My favorites | Sign in
Project Logo
          
Changes to /trunk/rBottomBarStyler/core.lua
r370 vs. r371   Edit
  Compare: vs.   Format:
Revision r371
Go to: 
/trunk/rBottomBarStyler/core.lua   r370 /trunk/rBottomBarStyler/core.lua   r371
1 1
2 --[[---------------------------------------------------------------------------- 2 --[[----------------------------------------------------------------------------
3 Copyright (c) 2009, Erik Raetz 3 Copyright (c) 2009, Erik Raetz
4 All rights reserved. 4 All rights reserved.
5 5
6 Redistribution and use in source and binary forms, with or without 6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met: 7 modification, are permitted provided that the following conditions are met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright notice, 11 * Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation 12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution. 13 and/or other materials provided with the distribution.
14 * Neither the name of rBottomBarStyler nor the names of its contributors may be used 14 * Neither the name of rBottomBarStyler nor the names of its contributors may be used
15 to endorse or promote products derived from this software without specific 15 to endorse or promote products derived from this software without specific
16 prior written permission. 16 prior written permission.
17 17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE. 28 POSSIBILITY OF SUCH DAMAGE.
29 ------------------------------------------------------------------------------]] 29 ------------------------------------------------------------------------------]]
30 30
31 ------------------------------------------------------ 31 ------------------------------------------------------
32 -- / VARIABLES / -- 32 -- / VARIABLES / --
33 ------------------------------------------------------ 33 ------------------------------------------------------
34 34
35 local default_scale = 0.6 35 local default_scale = 0.6
36 local default_art = "d3" 36 local default_art = "d3"
37 local default_bar = "bar2" 37 local default_bar = "bar2"
38 local default_movable = 1 38 local default_movable = 1
39 local default_locked = 1 39 local default_locked = 1
40 local default_healthorb = 2
41 local default_manaorb = 3
42 local default_automana = 1
43
40 local default_font = NAMEPLATE_FONT 44 local default_font = NAMEPLATE_FONT
41 rBottomBarStyler = rBottomBarStyler or {} 45 rBottomBarStyler = rBottomBarStyler or {}
42 local frame_to_scale 46 local frame_to_scale
43 local bar_to_show 47 local bar_to_show
48 local hglow1, hglow2, mglow1, mglow2, hfill, mfill
44 local frame_to_drag 49 local frame_to_drag
45 local fog_smoother = 1.3 50 local fog_smoother = 1.3
51 local text_display = 1
52 local save_dudustance
53
46 local orbtab = { 54 local orbtab = {
47 [1] = {r = 0.3, g = 0, b = 0, scale = 0.8, z = -12, x = 0.8, y = -1.7, anim = "SPELLS\\RedRadiationFog.m2"}, -- red 55 [1] = {r = 0.3, g = 0, b = 0, scale = 0.8, z = -12, x = 0.8, y = -1.7, anim = "SPELLS\\RedRadiationFog.m2"}, -- red
48 [2] = {r = 0, g = 0.3, b = 0.1, scale = 0.75, z = -12, x = 0, y = -1.1, anim = "SPELLS\\GreenRadiationFog.m2"}, -- green 56 [2] = {r = 0, g = 0.3, b = 0.1, scale = 0.75, z = -12, x = 0, y = -1.1, anim = "SPELLS\\GreenRadiationFog.m2"}, -- green
49 [3] = {r = 0, g = 0.2, b = 0.3, scale = 0.75, z = -12, x = 1.2, y = -1, anim = "SPELLS\\BlueRadiationFog.m2"}, -- blue 57 [3] = {r = 0, g = 0.2, b = 0.3, scale = 0.75, z = -12, x = 1.2, y = -1, anim = "SPELLS\\BlueRadiationFog.m2"}, -- blue
50 [4] = {r = 0.4, g = 0.3, b = 0, scale = 0.75, z = -12, x = -0.3, y = -1.2, anim = "SPELLS\\OrangeRadiationFog.m2"}, -- yellow 58 [4] = {r = 0.4, g = 0.3, b = 0, scale = 0.75, z = -12, x = -0.3, y = -1.2, anim = "SPELLS\\OrangeRadiationFog.m2"}, -- yellow
51 [5] = {r = 0, g = 0.7, b = 0.7, scale = 0.9, z = -12, x = -0.5, y = -0.8, anim = "SPELLS\\WhiteRadiationFog.m2"}, -- runic 59 [5] = {r = 0, g = 0.7, b = 0.7, scale = 0.9, z = -12, x = -0.5, y = -0.8, anim = "SPELLS\\WhiteRadiationFog.m2"}, -- runic
52 } 60 }
61
62 UnitPopupMenus["SELF"] = { "PVP_FLAG", "LOOT_METHOD", "LOOT_THRESHOLD", "OPT_OUT_LOOT_TITLE", "LOOT_PROMOTE", "DUNGEON_DIFFICULTY", "RESET_INSTANCES", "RAID_TARGET_ICON", "LEAVE", "CANCEL" }
63
64 ------------------------------------------------------
65 -- / CHAT OUTPUT FUNC / --
66 ------------------------------------------------------
67
68 local function am(text)
69 DEFAULT_CHAT_FRAME:AddMessage(text)
70 end
71
72 ------------------------------------------------------
73 -- / SET AUTO MANA / --
74 ------------------------------------------------------
75
76 local function set_automana()
77 if rBottomBarStyler.automana == 1 then
78 local st = GetShapeshiftForm()
79 local _, pt = UnitClass("player")
80 if pt == "WARRIOR" then
81 rBottomBarStyler.manaorb = 1
82 elseif pt == "DEATHKNIGHT" then
83 rBottomBarStyler.manaorb = 5
84 elseif pt == "ROGUE" then
85 rBottomBarStyler.manaorb = 4
86 elseif pt == "DRUID" and st == 3 then
87 rBottomBarStyler.manaorb = 4
88 elseif pt == "DRUID" and st == 1 then
89 rBottomBarStyler.manaorb = 1
90 else
91 rBottomBarStyler.manaorb = 3
92 end
93 end
94 end
53 95
54 ------------------------------------------------------ 96 ------------------------------------------------------
55 -- / SET UP DEFAULT VALUES / -- 97 -- / SET UP DEFAULT VALUES / --
56 ------------------------------------------------------ 98 ------------------------------------------------------
57 99
58 local function load_default() 100 local function load_default()
59 if(not rBottomBarStyler.scalevalue) then 101 if(not rBottomBarStyler.scalevalue) then
60 rBottomBarStyler.scalevalue = default_scale 102 rBottomBarStyler.scalevalue = default_scale
61 end 103 end
62 if(not rBottomBarStyler.artvalue) then 104 if(not rBottomBarStyler.artvalue) then
63 rBottomBarStyler.artvalue = default_art 105 rBottomBarStyler.artvalue = default_art
64 end 106 end
65 if(not rBottomBarStyler.barvalue) then 107 if(not rBottomBarStyler.barvalue) then
66 rBottomBarStyler.barvalue = default_bar 108 rBottomBarStyler.barvalue = default_bar
67 end 109 end
68 if(not rBottomBarStyler.movable) then 110 if(not rBottomBarStyler.movable) then
69 rBottomBarStyler.movable = default_movable 111 rBottomBarStyler.movable = default_movable
70 end 112 end
71 if(not rBottomBarStyler.locked) then 113 if(not rBottomBarStyler.locked) then
72 rBottomBarStyler.locked = default_locked 114 rBottomBarStyler.locked = default_locked
73 end 115 end
74 end 116 if(not rBottomBarStyler.healthorb) then
75 117 rBottomBarStyler.healthorb = default_healthorb
76 ------------------------------------------------------ 118 end
77 -- / CHAT OUTPUT FUNC / -- 119 if(not rBottomBarStyler.manaorb) then
78 ------------------------------------------------------ 120 rBottomBarStyler.manaorb = default_manaorb
79 121 end
80 local function am(text) 122 if(not rBottomBarStyler.automana) then
81 DEFAULT_CHAT_FRAME:AddMessage(text) 123 rBottomBarStyler.automana = default_automana
124 end
125
126 set_automana()
127
128 save_dudustance = GetShapeshiftForm()
129
82 end 130 end
83 131
84 ------------------------------------------------------ 132 ------------------------------------------------------
85 -- / SAVE POSXY FUNC / -- 133 -- / SAVE POSXY FUNC / --
86 ------------------------------------------------------ 134 ------------------------------------------------------
87 135
88 local function save_posxy() 136 local function save_posxy()
89 local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint() 137 local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint()
90 rBottomBarStyler.point = point 138 rBottomBarStyler.point = point
91 rBottomBarStyler.posx = x 139 rBottomBarStyler.posx = x
92 rBottomBarStyler.posy = y 140 rBottomBarStyler.posy = y
93 end 141 end
94 142
95 ------------------------------------------------------ 143 ------------------------------------------------------
96 -- / MOVE ME FUNC / -- 144 -- / MOVE ME FUNC / --
97 ------------------------------------------------------ 145 ------------------------------------------------------
98 146
99 local function move_my_frame() 147 local function move_my_frame()
100 if frame_to_drag then 148 if frame_to_drag then
101 frame_to_drag:Hide() 149 frame_to_drag:Hide()
102 end 150 end
103 if rBottomBarStyler.movable == 1 then 151 if rBottomBarStyler.movable == 1 then
104 frame_to_scale:SetMovable(true) 152 frame_to_scale:SetMovable(true)
105 if rBottomBarStyler.locked == 0 then 153 if rBottomBarStyler.locked == 0 then
106 if frame_to_drag then 154 if frame_to_drag then
107 frame_to_drag:Show() 155 frame_to_drag:Show()
108 end 156 end
109 frame_to_scale:EnableMouse(true) 157 frame_to_scale:EnableMouse(true)
110 frame_to_scale:RegisterForDrag("LeftButton","RightButton") 158 frame_to_scale:RegisterForDrag("LeftButton","RightButton")
111 frame_to_scale:SetScript("OnDragStart", function(self) 159 frame_to_scale:SetScript("OnDragStart", function(self)
112 if IsShiftKeyDown() and IsAltKeyDown() then 160 if IsShiftKeyDown() and IsAltKeyDown() then
113 self:StartMoving() 161 self:StartMoving()
114 end 162 end
115 end) 163 end)
116 frame_to_scale:SetScript("OnDragStop", function(self) 164 frame_to_scale:SetScript("OnDragStop", function(self)
117 if IsShiftKeyDown() and IsAltKeyDown() then 165 if IsShiftKeyDown() and IsAltKeyDown() then
118 self:StopMovingOrSizing() 166 self:StopMovingOrSizing()
119 save_posxy() 167 save_posxy()
120 end 168 end
121 end) 169 end)
122 end 170 end
123 else 171 else
124 rBottomBarStyler.point = nil 172 rBottomBarStyler.point = nil
125 rBottomBarStyler.posx = nil 173 rBottomBarStyler.posx = nil
126 rBottomBarStyler.posy = nil 174 rBottomBarStyler.posy = nil
127 frame_to_scale:ClearAllPoints() 175 frame_to_scale:ClearAllPoints()
128 frame_to_scale:SetPoint("BOTTOM",0,0) 176 frame_to_scale:SetPoint("BOTTOM",0,0)
129 end 177 end
130 end 178 end
131 179
180 ------------------------------------------------------
181 -- / SET ME GLOWS / --
182 ------------------------------------------------------
183
184 local function set_the_hglows()
185 hfill:SetVertexColor(orbtab[rBottomBarStyler.healthorb].r,orbtab[rBottomBarStyler.healthorb].g,orbtab[rBottomBarStyler.healthorb].b)
186 hglow1:SetModel(orbtab[rBottomBarStyler.healthorb].anim)
187 hglow1:SetModelScale(orbtab[rBottomBarStyler.healthorb].scale)
188 hglow1:SetPosition(orbtab[rBottomBarStyler.healthorb].z, orbtab[rBottomBarStyler.healthorb].x, orbtab[rBottomBarStyler.healthorb].y)
189 hglow2:SetModel(orbtab[rBottomBarStyler.healthorb].anim)
190 hglow2:SetModelScale(orbtab[rBottomBarStyler.healthorb].scale)
191 hglow2:SetPosition(orbtab[rBottomBarStyler.healthorb].z, orbtab[rBottomBarStyler.healthorb].x, orbtab[rBottomBarStyler.healthorb].y+1)
192 end
193
194 local function set_the_mglows()
195 mfill:SetVertexColor(orbtab[rBottomBarStyler.manaorb].r,orbtab[rBottomBarStyler.manaorb].g,orbtab[rBottomBarStyler.manaorb].b)
196 mglow1:SetModel(orbtab[rBottomBarStyler.manaorb].anim)
197 mglow1:SetModelScale(orbtab[rBottomBarStyler.manaorb].scale)
198 mglow1:SetPosition(orbtab[rBottomBarStyler.manaorb].z, orbtab[rBottomBarStyler.manaorb].x, orbtab[rBottomBarStyler.manaorb].y)
199 mglow2:SetModel(orbtab[rBottomBarStyler.manaorb].anim)
200 mglow2:SetModelScale(orbtab[rBottomBarStyler.manaorb].scale)
201 mglow2:SetPosition(orbtab[rBottomBarStyler.manaorb].z, orbtab[rBottomBarStyler.manaorb].x, orbtab[rBottomBarStyler.manaorb].y+1)
202 end
203
204 local function set_the_shapeshift_mglows()
205 local st = GetShapeshiftForm()
206 if st ~= save_dudustance then
207 mfill:SetVertexColor(orbtab[rBottomBarStyler.manaorb].r,orbtab[rBottomBarStyler.manaorb].g,orbtab[rBottomBarStyler.manaorb].b)
208 mglow1:SetModel(orbtab[rBottomBarStyler.manaorb].anim)
209 mglow1:SetModelScale(orbtab[rBottomBarStyler.manaorb].scale)
210 mglow1:SetPosition(orbtab[rBottomBarStyler.manaorb].z, orbtab[rBottomBarStyler.manaorb].x, orbtab[rBottomBarStyler.manaorb].y)
211 mglow2:SetModel(orbtab[rBottomBarStyler.manaorb].anim)
212 mglow2:SetModelScale(orbtab[rBottomBarStyler.manaorb].scale)
213 mglow2:SetPosition(orbtab[rBottomBarStyler.manaorb].z, orbtab[rBottomBarStyler.manaorb].x, orbtab[rBottomBarStyler.manaorb].y+1)
214 save_dudustance = st
215 end
216 end
217
132 ------------------------------------------------------ 218 ------------------------------------------------------
133 -- / CREATE ME A ORB GLOW FUNC / -- 219 -- / CREATE ME A ORB GLOW FUNC / --
134 ------------------------------------------------------ 220 ------------------------------------------------------
135 221
136 local function create_me_a_orb_glow(f,useorb,pos) 222 local function create_me_a_orb_glow(f,useorb,pos)
137 local glow = CreateFrame("PlayerModel", nil, f) 223 local glow = CreateFrame("PlayerModel", nil, f)
138 glow:SetFrameStrata("BACKGROUND") 224 glow:SetFrameStrata("BACKGROUND")
139 glow:SetAllPoints(f) 225 glow:SetAllPoints(f)
226 glow:SetModel(orbtab[useorb].anim)
227 glow:SetModelScale(orbtab[useorb].scale)
228 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos)
229 glow:SetAlpha(1/fog_smoother)
230 glow:SetScript("OnShow",function()
140 glow:SetModel(orbtab[useorb].anim) 231 glow:SetModel(orbtab[useorb].anim)
141 glow:SetModelScale(orbtab[useorb].scale) 232 glow:SetModelScale(orbtab[useorb].scale)
142 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos) 233 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos)
143 glow:SetAlpha(1/fog_smoother) 234 end)
144 glow:SetScript("OnShow",function() 235 return glow
145 glow:SetModel(orbtab[useorb].anim) 236 end
146 glow:SetModelScale(orbtab[useorb].scale)
147 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos)
148 end)
149 return glow
150 end
151 237
152 ------------------------------------------------------ 238 ------------------------------------------------------
153 -- / CREATE ME A FRAME FUNC / -- 239 -- / CREATE ME A FRAME FUNC / --
154 ------------------------------------------------------ 240 ------------------------------------------------------
155 241
156 local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag,finherit) 242 local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag,finherit)
157 -- PARENT, BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP 243 -- PARENT, BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP
158 local f = CreateFrame(fart,fname,fparent,finherit) 244 local f = CreateFrame(fart,fname,fparent,finherit)
159 f:SetFrameStrata(fstrata) 245 f:SetFrameStrata(fstrata)
160 f:SetWidth(fwidth) 246 f:SetWidth(fwidth)
161 f:SetHeight(fheight) 247 f:SetHeight(fheight)
162 if fname == "rBBS_Holder" then 248 if fname == "rBBS_Holder" then
163 if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then 249 if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then
164 f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy) 250 f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy)
165 else 251 else
166 f:SetPoint(fanchor,fxpos,fypos) 252 f:SetPoint(fanchor,fxpos,fypos)
167 end 253 end
168 else 254 else
169 f:SetPoint(fanchor,fxpos,fypos) 255 f:SetPoint(fanchor,fxpos,fypos)
170 end 256 end
171 f:SetScale(fscale) 257 f:SetScale(fscale)
172 if fdrag == true then 258 if fdrag == true then
173 f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) 259 f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
174 end 260 end
175 return f 261 return f
176 end 262 end
177 263
178 ------------------------------------------------------ 264 ------------------------------------------------------
179 -- / CREATE ME A TEXTURE FUNC / -- 265 -- / CREATE ME A TEXTURE FUNC / --
180 ------------------------------------------------------ 266 ------------------------------------------------------
181 267
182 local function create_me_a_texture(fhooked,tstrata,tfile,tspecial) 268 local function create_me_a_texture(fhooked,tstrata,tfile,tspecial)
183 -- BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT 269 -- BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT
184 local t = fhooked:CreateTexture(nil,tstrata) 270 local t = fhooked:CreateTexture(nil,tstrata)
185 t:SetTexture(tfile) 271 t:SetTexture(tfile)
186 if tspecial == "fill" then 272 if tspecial == "fill" then
187 t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0) 273 t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0)
188 t:SetWidth(fhooked:GetWidth()) 274 t:SetWidth(fhooked:GetWidth())
189 t:SetHeight(fhooked:GetHeight()) 275 t:SetHeight(fhooked:GetHeight())
190 else 276 else
191 t:SetAllPoints(fhooked) 277 t:SetAllPoints(fhooked)
192 end 278 end
193 return t 279 return t
194 end 280 end
195 281
196 ------------------------------------------------------ 282 ------------------------------------------------------
197 -- / DO FORMAT / -- 283 -- / DO FORMAT / --
198 ------------------------------------------------------ 284 ------------------------------------------------------
199 285
200 local function do_format(v) 286 local function do_format(v)
201 local string = "" 287 local string = ""
202 if v > 1000000 then 288 if v > 1000000 then
203 string = (floor((v/1000000)*10)/10).."m" 289 string = (floor((v/1000000)*10)/10).."m"
204 elseif v > 1000 then 290 elseif v > 1000 then
205 string = (floor((v/1000)*10)/10).."k" 291 string = (floor((v/1000)*10)/10).."k"
206 else 292 else
207 string = v 293 string = v
208 end 294 end
209 return string 295 return string
210 end 296 end
211 297
212 ------------------------------------------------------ 298 ------------------------------------------------------
213 -- / ORB HEALTH FUNC / -- 299 -- / ORB HEALTH FUNC / --
214 ------------------------------------------------------ 300 ------------------------------------------------------
215 301
216 local function orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) 302 local function orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2)
217 orb1:SetScript("OnEvent", function(self, event, arg1, ...) 303 orb1:SetScript("OnEvent", function(self, event, arg1, ...)
218 if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then 304 if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then
219 local uh, uhm = UnitHealth("player"), UnitHealthMax("player") 305 local uh, uhm = UnitHealth("player"), UnitHealthMax("player")
220 local perc = floor(uh/uhm*100) 306 local perc = floor(uh/uhm*100)
221 local nuh = do_format(uh) 307 local nuh = do_format(uh)
222 local nuhm = do_format(uhm) 308 local nuhm = do_format(uhm)
223 orbtext1:SetText(perc) 309 orbtext1:SetText(perc)
224 orbtext2:SetText(nuh.."/"..nuhm) 310 if text_display == 1 then
311 orbtext2:SetText(nuh)
312 else
313 orbtext2:SetText(nuh.."/"..nuhm)
314 end
225 orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth()) 315 orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth())
226 orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1) 316 orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1)
227 glow1:SetAlpha((uh / uhm)/fog_smoother) 317 glow1:SetAlpha((uh / uhm)/fog_smoother)
228 glow2:SetAlpha((uh / uhm)/fog_smoother) 318 glow2:SetAlpha((uh / uhm)/fog_smoother)
229 orbtext1:SetText(perc)
230 orbtext2:SetText(nuh.."/"..nuhm)
231 end 319 end
232 end) 320 end)
233 orb1:RegisterEvent("UNIT_HEALTH") 321 orb1:RegisterEvent("UNIT_HEALTH")
234 orb1:RegisterEvent("PLAYER_ENTERING_WORLD") 322 orb1:RegisterEvent("PLAYER_ENTERING_WORLD")
235 end 323 end
236 324
237 ------------------------------------------------------ 325 ------------------------------------------------------
238 -- / ORB MANA FUNC / -- 326 -- / ORB MANA FUNC / --
239 ------------------------------------------------------ 327 ------------------------------------------------------
240 328
241 local function orbmana(orb2,orb2_fill,glow1,glow2,orbtext1,orbtext2) 329 local function orbmana(orb2,orb2_fill,glow1,glow2,orbtext1,orbtext2)
242 orb2:SetScript("OnEvent", function(self, event, arg1, ...) 330 orb2:SetScript("OnEvent", function(self, event, arg1, ...)
243 if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then 331 if arg1 == "player" or event == "PLAYER_ENTERING_WORLD" then
244 local um, umm = UnitMana("player"), UnitManaMax("player") 332 local um, umm = UnitMana("player"), UnitManaMax("player")
245 local perc = floor(um/umm*100) 333 local perc = floor(um/umm*100)
246 local nuh = do_format(um) 334 local nuh = do_format(um)
247 local nuhm = do_format(umm) 335 local nuhm = do_format(umm)
248 orbtext1:SetText(perc) 336 local _, class = UnitClass("player")
249 orbtext2:SetText(nuh.."/"..nuhm) 337 local shape = GetShapeshiftForm()
338 if text_display == 1 then
339 if class == "WARRIOR" or (class == "DRUID" and shape == 3) or (class == "DRUID" and shape == 1) or class == "DEATHKNIGHT" or class == "ROGUE" then
340 orbtext1:SetText(nuh)
341 orbtext2:SetText(perc)
342 else
343 orbtext1:SetText(perc)
344 orbtext2:SetText(nuh)
345 end
346 else
347 orbtext1:SetText(perc)
348 orbtext2:SetText(nuh.."/"..nuhm)
349 end
250 orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth()) 350 orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth())
251 orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1) 351 orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1)
252 glow1:SetAlpha((um / umm)/fog_smoother) 352 glow1:SetAlpha((um / umm)/fog_smoother)
253 glow2:SetAlpha((um / umm)/fog_smoother) 353 glow2:SetAlpha((um / umm)/fog_smoother)
254 end 354 end
255 end) 355 end)
256 orb2:RegisterEvent("UNIT_MANA") 356 orb2:RegisterEvent("UNIT_MANA")
257 orb2:RegisterEvent("UNIT_RAGE") 357 orb2:RegisterEvent("UNIT_RAGE")
258 orb2:RegisterEvent("UNIT_ENERGY") 358 orb2:RegisterEvent("UNIT_ENERGY")
259 orb2:RegisterEvent("UNIT_FOCUS") 359 orb2:RegisterEvent("UNIT_FOCUS")
260 orb2:RegisterEvent("UNIT_RUNIC_POWER") 360 orb2:RegisterEvent("UNIT_RUNIC_POWER")
261 orb2:RegisterEvent("PLAYER_ENTERING_WORLD") 361 orb2:RegisterEvent("PLAYER_ENTERING_WORLD")
262 end 362 end
263 363
264 ------------------------------------------------------ 364 ------------------------------------------------------
265 -- / SET ME A FONT / -- 365 -- / SET ME A FONT / --
266 ------------------------------------------------------ 366 ------------------------------------------------------
267 367
268 local function set_me_a_font(f, font, size, style) 368 local function set_me_a_font(f, font, size, style)
269 local fs = f:CreateFontString(nil, "OVERLAY") 369 local fs = f:CreateFontString(nil, "OVERLAY")
270 fs:SetFont(font, size, style) 370 fs:SetFont(font, size, style)
271 fs:SetShadowColor(0,0,0,1) 371 fs:SetShadowColor(0,0,0,1)
272 return fs 372 return fs
273 end 373 end
274 374
275 ------------------------------------------------------ 375 ------------------------------------------------------
276 -- / CREATE ORB FUNC / -- 376 -- / CREATE ORB FUNC / --
277 ------------------------------------------------------ 377 ------------------------------------------------------
278 378
279 local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,useorb) 379 local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,useorb)
380 --create the player frame
280 local orb1 = create_me_a_frame("Button",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale,nil,"SecureUnitButtonTemplate") 381 local orb1 = create_me_a_frame("Button",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale,nil,"SecureUnitButtonTemplate")
281 orb1:RegisterForClicks("AnyUp") 382 orb1:RegisterForClicks("AnyUp")
282 orb1:SetAttribute("unit", "player") 383 orb1:SetAttribute("unit", "player")
283 orb1:SetAttribute("*type1", "target") 384 orb1:SetAttribute("*type1", "target")
284 local showmenu = function() 385 local showmenu = function()
285 ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor", 0, 0) 386 ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor", 0, 0)
286 end 387 end
287 orb1.showmenu = showmenu 388 orb1.showmenu = showmenu
288 orb1.unit = "player" 389 orb1.unit = "player"
289 orb1:SetAttribute("*type2", "showmenu") 390 orb1:SetAttribute("*type2", "showmenu")
290 orb1:SetScript("OnEnter", UnitFrame_OnEnter) 391 orb1:SetScript("OnEnter", UnitFrame_OnEnter)
291 orb1:SetScript("OnLeave", UnitFrame_OnLeave) 392 orb1:SetScript("OnLeave", UnitFrame_OnLeave)
292 393
293 local orb1_back = create_me_a_texture(orb1,"BORDER","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2") 394 local orb1_back = create_me_a_texture(orb1,"BORDER","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2")
294 local orb1_fill = create_me_a_texture(orb1,"ARTWORK","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill") 395 local orb1_fill = create_me_a_texture(orb1,"ARTWORK","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill")
295 orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b) 396 --glows
296 local glow1, glow2 397 local glow1, glow2
297 if orbtype == "life" then 398 if orbtype == "life" then
399 orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b)
400 hfill = orb1_fill
298 glow1 = create_me_a_orb_glow(orb1,useorb,0) 401 glow1 = create_me_a_orb_glow(orb1,useorb,0)
299 glow2 = create_me_a_orb_glow(orb1,useorb,1) 402 glow2 = create_me_a_orb_glow(orb1,useorb,1)
403 hglow1 = glow1
404 hglow2 = glow2
300 else 405 else
406 orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b)
407 mfill = orb1_fill
301 glow1 = create_me_a_orb_glow(orb1,useorb,0) 408 glow1 = create_me_a_orb_glow(orb1,useorb,0)
302 glow2 = create_me_a_orb_glow(orb1,useorb,1) 409 glow2 = create_me_a_orb_glow(orb1,useorb,1)
410 mglow1 = glow1
411 mglow2 = glow2
303 end 412 end
304 local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"LOW",orbsize,orbsize,"BOTTOM",0,0,1) 413 local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"LOW",orbsize,orbsize,"BOTTOM",0,0,1)
305 local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss") 414 local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss")
306 local orbtext1 = set_me_a_font(orb1_glossholder, default_font, orbsize/5, "THINOUTLINE") 415 local orbtext1 = set_me_a_font(orb1_glossholder, default_font, orbsize/5, "THINOUTLINE")
307 orbtext1:SetPoint("CENTER", 0, (orbsize/12)) 416 orbtext1:SetPoint("CENTER", 0, (orbsize/12))
308 orbtext1:SetTextColor(1,1,1) 417 orbtext1:SetTextColor(1,1,1)
309 local orbtext2 = set_me_a_font(orb1_glossholder, default_font, orbsize/8.5, "THINOUTLINE") 418 local orbtext2 = set_me_a_font(orb1_glossholder, default_font, orbsize/8.5, "THINOUTLINE")
310 orbtext2:SetPoint("CENTER", 0, -(orbsize/12)) 419 orbtext2:SetPoint("CENTER", 0, -(orbsize/12))
311 orbtext2:SetTextColor(0.6,0.6,0.6) 420 orbtext2:SetTextColor(0.6,0.6,0.6)
312 if orbtype == "life" then 421 if orbtype == "life" then
313 orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) 422 orbhealth(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2)
314 else 423 else
315 orbmana(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2) 424 orbmana(orb1,orb1_fill,glow1,glow2,orbtext1,orbtext2)
425 --druid mana color on stance
426 local _, pt = UnitClass("player")
427 if pt == "DRUID" then
428 orb1_glossholder:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
429 orb1_glossholder:SetScript("OnEvent", function(self,event)
430 if event == "UPDATE_SHAPESHIFT_FORM" then
431 set_automana()
432 set_the_shapeshift_mglows()
433 end
434 end)
435 end
316 end 436 end
317 end 437 end
318 438
319 ------------------------------------------------------ 439 ------------------------------------------------------
320 -- / SET ME A SCALE / -- 440 -- / SET ME A SCALE / --
321 ------------------------------------------------------ 441 ------------------------------------------------------
322 442
323 local function set_me_a_scale() 443 local function set_me_a_scale()
324 frame_to_scale:SetScale(rBottomBarStyler.scalevalue) 444 frame_to_scale:SetScale(rBottomBarStyler.scalevalue)
325 end 445 end
326 446
327 ------------------------------------------------------ 447 ------------------------------------------------------
328 -- / SET ME A BAR / -- 448 -- / SET ME A BAR / --
329 ------------------------------------------------------ 449 ------------------------------------------------------
330 450
331 local function set_me_a_bar() 451 local function set_me_a_bar()
332 if rBottomBarStyler.artvalue == "roth" then 452 if rBottomBarStyler.artvalue == "roth" then
333 bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) 453 bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue)
334 else 454 else
335 am("Does only work for roth layout") 455 am("Does only work for roth layout")
336 end 456 end
337 end 457 end
338 458
339 ------------------------------------------------------ 459 ------------------------------------------------------
340 -- / CREATE D1 STYLE / -- 460 -- / CREATE D1 STYLE / --
341 ------------------------------------------------------ 461 ------------------------------------------------------
342 local function create_d1_style(scale) 462 local function create_d1_style(scale)
343 --holder 463 --holder
344 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 464 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
345 frame_to_scale = holder 465 frame_to_scale = holder
346 --bar texture 466 --bar texture
347 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1) 467 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1)
348 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar") 468 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar")
349 --orbs 469 --orbs
350 create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",1) 470 create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",rBottomBarStyler.healthorb)
351 create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",3) 471 create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",rBottomBarStyler.manaorb)
352 --left figure 472 --left figure
353 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-320,35,0.9) 473 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-320,35,0.9)
354 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left") 474 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left")
355 --right figure 475 --right figure
356 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",320,35,0.9) 476 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",320,35,0.9)
357 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right") 477 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right")
358 --dragframe 478 --dragframe
359 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 479 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
360 frame_to_drag = dragframe 480 frame_to_drag = dragframe
361 end 481 end
362 482
363 ------------------------------------------------------ 483 ------------------------------------------------------
364 -- / CREATE D2 STYLE / -- 484 -- / CREATE D2 STYLE / --
365 ------------------------------------------------------ 485 ------------------------------------------------------
366 local function create_d2_style(scale) 486 local function create_d2_style(scale)
367 --holder 487 --holder
368 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 488 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
369 frame_to_scale = holder 489 frame_to_scale = holder
370 --bar texture 490 --bar texture
371 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1) 491 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1)
372 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar") 492 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar")
373 --border 493 --border
374 local border_left = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMRIGHT",0,0,1) 494 local border_left = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMRIGHT",0,0,1)
375 local border_left_tex = create_me_a_texture(border_left,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left") 495 local border_left_tex = create_me_a_texture(border_left,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left")
376 local border_right = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMLEFT",0,0,1) 496 local border_right = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMLEFT",0,0,1)
377 local border_right_tex = create_me_a_texture(border_right,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right") 497 local border_right_tex = create_me_a_texture(border_right,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right")
378 --orbs 498 --orbs
379 create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",1) 499 create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",rBottomBarStyler.healthorb)
380 create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",3) 500 create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",rBottomBarStyler.manaorb)
381 --left figure 501 --left figure
382 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-453,44,1) 502 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-453,44,1)
383 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left") 503 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left")
384 --right figure 504 --right figure
385 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",453,44,1) 505 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",453,44,1)
386 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right") 506 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right")
387 --dragframe 507 --dragframe
388 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 508 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
389 frame_to_drag = dragframe 509 frame_to_drag = dragframe
390 end 510 end
391 511
392 ------------------------------------------------------ 512 ------------------------------------------------------
393 -- / CREATE D3 STYLE / -- 513 -- / CREATE D3 STYLE / --
394 ------------------------------------------------------ 514 ------------------------------------------------------
395 local function create_d3_style(scale) 515 local function create_d3_style(scale)
396 --holder 516 --holder
397 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 517 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
398 frame_to_scale = holder 518 frame_to_scale = holder
399 --bar texture 519 --bar texture
400 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1) 520 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1)
401 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar") 521 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar")
402 --orbs 522 --orbs
403 create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",1) 523 create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",rBottomBarStyler.healthorb)
404 create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",3) 524 create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",rBottomBarStyler.manaorb)
405 --left figure 525 --left figure
406 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",-455,0,1) 526 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",-470,0,1)
407 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left") 527 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left")
408 --right figure 528 --right figure
409 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",455,0,1) 529 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",470,0,1)
410 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right") 530 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right")
411 --dragframe 531 --dragframe
412 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 532 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
413 frame_to_drag = dragframe 533 frame_to_drag = dragframe
414 end 534 end
415 535
416 ------------------------------------------------------ 536 ------------------------------------------------------
417 -- / CREATE ROTH STYLE / -- 537 -- / CREATE ROTH STYLE / --
418 ------------------------------------------------------ 538 ------------------------------------------------------
419 local function create_roth_style(scale) 539 local function create_roth_style(scale)
420 --holder 540 --holder
421 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 541 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
422 frame_to_scale = holder 542 frame_to_scale = holder
423 --bar texture 543 --bar texture
424 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1) 544 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1)
425 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) 545 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue)
426 bar_to_show = bar_tex 546 bar_to_show = bar_tex
427 --orbs 547 --orbs
428 create_orb("life",120,holder,"BOTTOM",-250,-8,1,"orb_filling4",1) 548 create_orb("life",140,holder,"BOTTOM",-255,-8,1,"orb_filling4",rBottomBarStyler.healthorb)
429 create_orb("mana",120,holder,"BOTTOM",250,-8,1,"orb_filling4",3) 549 create_orb("mana",140,holder,"BOTTOM",250,-8,1,"orb_filling4",rBottomBarStyler.manaorb)
430 --bottom 550 --bottom
431 local bottom = create_me_a_frame("Frame",nil,holder,"MEDIUM",500,110,"BOTTOM",0,-10,1) 551 local bottom = create_me_a_frame("Frame",nil,holder,"MEDIUM",510,110,"BOTTOM",0,-10,1)
432 local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom") 552 local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom")
433 --left figure 553 --left figure
434 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-510,0,0.6) 554 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-530,0,0.6)
435 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left") 555 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left")
436 --right figure 556 --right figure
437 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",510,0,0.6) 557 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",520,0,0.6)
438 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right") 558 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right")
439 --dragframe 559 --dragframe
440 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 560 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
441 frame_to_drag = dragframe 561 frame_to_drag = dragframe
442 end 562 end
443 563
444 ------------------------------------------------------ 564 ------------------------------------------------------
445 -- / LOAD STYLE FUNC / -- 565 -- / LOAD STYLE FUNC / --
446 ------------------------------------------------------ 566 ------------------------------------------------------
447 567
448 local function load_style(style,scale) 568 local function load_style(style,scale)
449 if style == "roth" then 569 if style == "roth" then
450 create_roth_style(scale) 570 create_roth_style(scale)
451 elseif style == "d1" then 571 elseif style == "d1" then
452 create_d1_style(scale) 572 create_d1_style(scale)
453 elseif style == "d2" then 573 elseif style == "d2" then
454 create_d2_style(scale) 574 create_d2_style(scale)
455 else 575 else
456 create_d3_style(scale) 576 create_d3_style(scale)
457 end 577 end
458 end 578 end
459 579
460 ------------------------------------------------------ 580 ------------------------------------------------------
461 -- / SLASH FUNC / -- 581 -- / SLASH FUNC / --
462 ------------------------------------------------------ 582 ------------------------------------------------------
463 583
464 local function SlashCmd(cmd) 584 local function SlashCmd(cmd)
465 --setscale 585 --setscale
466 if (cmd:match"setscale") then 586 if (cmd:match"setscale") then
467 local a,b = strfind(cmd, " "); 587 local a,b = strfind(cmd, " ");
468 if b then 588 if b then
469 local c = strsub(cmd, b+1) 589 local c = strsub(cmd, b+1)
470 if tonumber(c) then 590 if tonumber(c) then
471 am("Current scaling is set to: "..c) 591 am("Current scaling is set to: "..c)
472 rBottomBarStyler.scalevalue = tonumber(c) 592 rBottomBarStyler.scalevalue = tonumber(c)
473 set_me_a_scale() 593 set_me_a_scale()
474 else 594 else
475 am("No number value.") 595 am("No number value.")
476 end 596 end
477 else 597 else
478 am("No value found.") 598 am("No value found.")
479 end 599 end
480 --getscale 600 --getscale
481 elseif (cmd:match"getscale") then 601 elseif (cmd:match"getscale") then
482 am("Current scaling is set to: "..rBottomBarStyler.scalevalue) 602 am("Current scaling is set to: "..rBottomBarStyler.scalevalue)
483 --setart 603 --setart
484 elseif (cmd:match"setart") then 604 elseif (cmd:match"setart") then
485 local a,b = strfind(cmd, " "); 605 local a,b = strfind(cmd, " ");
486 if b then 606 if b then
487 local c = strsub(cmd, b+1) 607 local c = strsub(cmd, b+1)
488 if c == "d1" or c == "d2" or c == "d3" or c == "roth" then 608 if c == "d1" or c == "d2" or c == "d3" or c == "roth" then
489 am("You set the art to: "..c) 609 am("You set the art to: "..c)
490 rBottomBarStyler.artvalue = c 610 rBottomBarStyler.artvalue = c
491 am("You need to reoad the interface to see the changes.") 611 am("You need to reoad the interface to see the changes.")
492 am("Type in: \"/console reloadui\".") 612 am("Type in: \"/console reloadui\".")
493 else 613 else
494 am("Wrong value. (possible values: d1, d2, d3, roth)") 614 am("Wrong value. (possible values: d1, d2, d3, roth)")
495 end 615 end
496 else 616 else
497 am("No value found.") 617 am("No value found.")
498 end 618 end
499 --setbar 619 --setbar
500 elseif (cmd:match"setbar") then 620 elseif (cmd:match"setbar") then
501 local a,b = strfind(cmd, " "); 621 local a,b = strfind(cmd, " ");
502 if b then 622 if b then
503 local c = strsub(cmd, b+1) 623 local c = strsub(cmd, b+1)
504 if c == "bar1" or c == "bar2" or c == "bar3" then 624 if c == "bar1" or c == "bar2" or c == "bar3" then
505 am("You set the bar to: "..c) 625 am("You set the bar to: "..c)
506 rBottomBarStyler.barvalue = c 626 rBottomBarStyler.barvalue = c
507 set_me_a_bar() 627 set_me_a_bar()
508 else 628 else
509 am("Wrong value. (possible values: bar1, bar2, bar3)") 629 am("Wrong value. (possible values: bar1, bar2, bar3)")
510 end 630 end
511 else 631 else
512 am("No value found.") 632 am("No value found.")
513 end 633 end
514 --getart 634 --getart
515 elseif (cmd:match"getart") then 635 elseif (cmd:match"getart") then
516 am("Current art is set to: "..rBottomBarStyler.artvalue) 636 am("Current art is set to: "..rBottomBarStyler.artvalue)
517 --getmovable 637 --getmovable
518 elseif (cmd:match"getmovable") then 638 elseif (cmd:match"getmovable") then
519 am("Movable is set to: "..rBottomBarStyler.movable) 639 am("Movable is set to: "..rBottomBarStyler.movable)
520 --getlocked 640 --getlocked
521 elseif (cmd:match"getlocked") then 641 elseif (cmd:match"getlocked") then
522 am("Locked is set to: "..rBottomBarStyler.locked) 642 am("Locked is set to: "..rBottomBarStyler.locked)
523 --locked 643 --locked
524 elseif (cmd:match"locked") then 644 elseif (cmd:match"locked") then
525 local a,b = strfind(cmd, " "); 645 local a,b = strfind(cmd, " ");
526 if b then 646 if b then
527 local c = strsub(cmd, b+1) 647 local c = strsub(cmd, b+1)
528 if tonumber(c) then 648 if tonumber(c) then
529 am("Locked is set to: "..c) 649 am("Locked is set to: "..c)
530 rBottomBarStyler.locked = tonumber(c) 650 rBottomBarStyler.locked = tonumber(c)
531 move_my_frame() 651 move_my_frame()
532 else 652 else
533 am("No number value.") 653 am("No number value.")
534 end 654 end
535 else 655 else
536 am("No value found.") 656 am("No value found.")
537 end 657 end
538 --movable 658 --movable
539 elseif (cmd:match"movable") then 659 elseif (cmd:match"movable") then
540 local a,b = strfind(cmd, " "); 660 local a,b = strfind(cmd, " ");
541 if b then 661 if b then
542 local c = strsub(cmd, b+1) 662 local c = strsub(cmd, b+1)
543 if tonumber(c) then 663 if tonumber(c) then
544 am("Movable is set to: "..c) 664 am("Movable is set to: "..c)
545 rBottomBarStyler.movable = tonumber(c) 665 rBottomBarStyler.movable = tonumber(c)
546 move_my_frame() 666 move_my_frame()
547 else 667 else
548 am("No number value.") 668 am("No number value.")
549 end 669 end
670 else
671 am("No value found.")
672 end
673 --healthorb
674 elseif (cmd:match"sethealthorb") then
675 local a,b = strfind(cmd, " ");
676 if b then
677 local c = strsub(cmd, b+1)
678 if tonumber(c) and tonumber(c) > 0 and tonumber(c) < 6 then
679 am("Healthorb is set to: "..c)
680 rBottomBarStyler.healthorb = tonumber(c)
681 set_the_hglows()
682 else
683 am("No number value.")
684 end
685 else
686 am("No value found.")
687 end
688 --manaorb
689 elseif (cmd:match"setmanaorb") then
690 local a,b = strfind(cmd, " ");
691 if b then
692 local c = strsub(cmd, b+1)
693 if tonumber(c) and tonumber(c) > 0 and tonumber(c) < 6 then
694 am("Manaorb is set to: "..c)
695 if rBottomBarStyler.automana == 1 then
696 am("Automana is active. Not possible, deactivate automana first.")
697 else
698 rBottomBarStyler.manaorb = tonumber(c)
699 set_the_mglows()
700 end
701 else
702 am("No number value.")
703 end
704 else
705 am("No value found.")
706 end
707 --automana
708 elseif (cmd:match"setautomana") then
709 local a,b = strfind(cmd, " ");
710 if b then
711 local c = strsub(cmd, b+1)
712 if tonumber(c) then
713 am("Automana is set to: "..c)
714 rBottomBarStyler.automana = tonumber(c)
715 set_automana()
716 set_the_mglows()
717 else
718 am("No number value.")
719 end
550 else 720 else
551 am("No value found.") 721 am("No value found.")
552 end 722 end
553 else 723 else
554 am("rbbs commands...") 724 am("rbbs commands...")
555 am("\/rbbs getscale") 725 am("\/rbbs getscale")
556 am("\/rbbs getart") 726 am("\/rbbs getart")
557 am("\/rbbs getlocked") 727 am("\/rbbs getlocked")
558 am("\/rbbs getmovable") 728 am("\/rbbs getmovable")
559 am("\/rbbs setscale NUMBER") 729 am("\/rbbs setscale NUMBER")
560 am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)") 730 am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)")
561 am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)") 731 am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)")
562 am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)") 732 am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)")
563 am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)") 733 am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)")
734
735 am("\/rbbs sethealthorb NUMBER (values 1 (red), 2 (green), 3 (blue), 4 (yellow), 5(runic) to set your healthcolor)")
736 am("\/rbbs setmanaorb NUMBER (values 1 (red), 2 (green), 3 (blue), 4 (yellow), 5(runic) to set your manacolor)")
737 am("\/rbbs setautomana NUMBER (values 0 or 1, this will override the manaorb setting and automatically detect your manacolor on class/stance)")
738
564 end 739 end
565 end 740 end
566 741
567 ------------------------------------------------------ 742 ------------------------------------------------------
568 -- / LOAD THE SHIT / -- 743 -- / LOAD THE SHIT / --
569 ------------------------------------------------------ 744 ------------------------------------------------------
570 745
571 local a = CreateFrame"Frame" 746 local a = CreateFrame"Frame"
572 a:RegisterEvent("VARIABLES_LOADED") 747 a:RegisterEvent("VARIABLES_LOADED")
573 a:SetScript("OnEvent", function(self) 748 a:SetScript("OnEvent", function(self)
574 self:UnregisterEvent("VARIABLES_LOADED") 749 self:UnregisterEvent("VARIABLES_LOADED")
575 self:SetScript("OnEvent", nil) 750 self:SetScript("OnEvent", nil)
576 --default values 751 --default values
577 load_default() 752 load_default()
578 --load the styles 753 --load the styles
579 load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue) 754 load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue)
580 move_my_frame() 755 move_my_frame()
581 --slash commands 756 --slash commands
582 SlashCmdList["whatever"] = SlashCmd; 757 SlashCmdList["whatever"] = SlashCmd;
583 SLASH_whatever1 = "/rbbs"; 758 SLASH_whatever1 = "/rbbs";
584 --am("rbbs loaded...") 759 --am("rbbs loaded...")
585 end) 760 end)
Hosted by Google Code