My favorites | Sign in
Project Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
          
Changes to /trunk/rBottomBarStyler/core.lua
r367 vs. r369   Edit
  Compare: vs.   Format:
Revision r369
Go to: 
/trunk/rBottomBarStyler/core.lua   r367 /trunk/rBottomBarStyler/core.lua   r369
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 rBottomBarStyler = rBottomBarStyler or {} 40 rBottomBarStyler = rBottomBarStyler or {}
41 local frame_to_scale 41 local frame_to_scale
42 local bar_to_show 42 local bar_to_show
43 local frame_to_drag 43 local frame_to_drag
44 local fog_smoother = 1.3
45 local orbtab = {
46 [1] = {r = 0.3, g = 0, b = 0, scale = 0.8, z = -12, x = 0.8, y = -1.7, anim = "SPELLS\\RedRadiationFog.m2"}, -- red
47 [2] = {r = 0, g = 0.3, b = 0.1, scale = 0.75, z = -12, x = 0, y = -1.1, anim = "SPELLS\\GreenRadiationFog.m2"}, -- green
48 [3] = {r = 0, g = 0.2, b = 0.3, scale = 0.75, z = -12, x = 1.2, y = -1, anim = "SPELLS\\BlueRadiationFog.m2"}, -- blue
49 [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
50 [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
51 }
44 52
45 ------------------------------------------------------ 53 ------------------------------------------------------
46 -- / SET UP DEFAULT VALUES / -- 54 -- / SET UP DEFAULT VALUES / --
47 ------------------------------------------------------ 55 ------------------------------------------------------
48 56
49 local function load_default() 57 local function load_default()
50 if(not rBottomBarStyler.scalevalue) then 58 if(not rBottomBarStyler.scalevalue) then
51 rBottomBarStyler.scalevalue = default_scale 59 rBottomBarStyler.scalevalue = default_scale
52 end 60 end
53 if(not rBottomBarStyler.artvalue) then 61 if(not rBottomBarStyler.artvalue) then
54 rBottomBarStyler.artvalue = default_art 62 rBottomBarStyler.artvalue = default_art
55 end 63 end
56 if(not rBottomBarStyler.barvalue) then 64 if(not rBottomBarStyler.barvalue) then
57 rBottomBarStyler.barvalue = default_bar 65 rBottomBarStyler.barvalue = default_bar
58 end 66 end
59 if(not rBottomBarStyler.movable) then 67 if(not rBottomBarStyler.movable) then
60 rBottomBarStyler.movable = default_movable 68 rBottomBarStyler.movable = default_movable
61 end 69 end
62 if(not rBottomBarStyler.locked) then 70 if(not rBottomBarStyler.locked) then
63 rBottomBarStyler.locked = default_locked 71 rBottomBarStyler.locked = default_locked
64 end 72 end
65 end 73 end
66 74
67 ------------------------------------------------------ 75 ------------------------------------------------------
68 -- / CHAT OUTPUT FUNC / -- 76 -- / CHAT OUTPUT FUNC / --
69 ------------------------------------------------------ 77 ------------------------------------------------------
70 78
71 local function am(text) 79 local function am(text)
72 DEFAULT_CHAT_FRAME:AddMessage(text) 80 DEFAULT_CHAT_FRAME:AddMessage(text)
73 end 81 end
74 82
75 ------------------------------------------------------ 83 ------------------------------------------------------
76 -- / SAVE POSXY FUNC / -- 84 -- / SAVE POSXY FUNC / --
77 ------------------------------------------------------ 85 ------------------------------------------------------
78 86
79 local function save_posxy() 87 local function save_posxy()
80 local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint() 88 local point, relativeTo, relativePoint, x, y = frame_to_scale:GetPoint()
81 rBottomBarStyler.point = point 89 rBottomBarStyler.point = point
82 rBottomBarStyler.posx = x 90 rBottomBarStyler.posx = x
83 rBottomBarStyler.posy = y 91 rBottomBarStyler.posy = y
84 end 92 end
85 93
86 ------------------------------------------------------ 94 ------------------------------------------------------
87 -- / MOVE ME FUNC / -- 95 -- / MOVE ME FUNC / --
88 ------------------------------------------------------ 96 ------------------------------------------------------
89 97
90 local function move_my_frame() 98 local function move_my_frame()
91 if frame_to_drag then 99 if frame_to_drag then
92 frame_to_drag:Hide() 100 frame_to_drag:Hide()
93 end 101 end
94 if rBottomBarStyler.movable == 1 then 102 if rBottomBarStyler.movable == 1 then
95 frame_to_scale:SetMovable(true) 103 frame_to_scale:SetMovable(true)
96 if rBottomBarStyler.locked == 0 then 104 if rBottomBarStyler.locked == 0 then
97 if frame_to_drag then 105 if frame_to_drag then
98 frame_to_drag:Show() 106 frame_to_drag:Show()
99 end 107 end
100 frame_to_scale:EnableMouse(true) 108 frame_to_scale:EnableMouse(true)
101 frame_to_scale:RegisterForDrag("LeftButton","RightButton") 109 frame_to_scale:RegisterForDrag("LeftButton","RightButton")
102 frame_to_scale:SetScript("OnDragStart", function(self) 110 frame_to_scale:SetScript("OnDragStart", function(self)
103 if IsShiftKeyDown() and IsAltKeyDown() then 111 if IsShiftKeyDown() and IsAltKeyDown() then
104 self:StartMoving() 112 self:StartMoving()
105 end 113 end
106 end) 114 end)
107 frame_to_scale:SetScript("OnDragStop", function(self) 115 frame_to_scale:SetScript("OnDragStop", function(self)
108 if IsShiftKeyDown() and IsAltKeyDown() then 116 if IsShiftKeyDown() and IsAltKeyDown() then
109 self:StopMovingOrSizing() 117 self:StopMovingOrSizing()
110 save_posxy() 118 save_posxy()
111 end 119 end
112 end) 120 end)
113 end 121 end
114 else 122 else
115 rBottomBarStyler.point = nil 123 rBottomBarStyler.point = nil
116 rBottomBarStyler.posx = nil 124 rBottomBarStyler.posx = nil
117 rBottomBarStyler.posy = nil 125 rBottomBarStyler.posy = nil
118 frame_to_scale:ClearAllPoints() 126 frame_to_scale:ClearAllPoints()
119 frame_to_scale:SetPoint("BOTTOM",0,0) 127 frame_to_scale:SetPoint("BOTTOM",0,0)
120 end 128 end
121 end 129 end
122 130
131 ------------------------------------------------------
132 -- / CREATE ME A ORB GLOW FUNC / --
133 ------------------------------------------------------
134
135 local function create_me_a_orb_glow(f,useorb,pos)
136 local glow = CreateFrame("PlayerModel", nil, f)
137 glow:SetFrameStrata("BACKGROUND")
138 glow:SetAllPoints(f)
139 glow:SetModel(orbtab[useorb].anim)
140 glow:SetModelScale(orbtab[useorb].scale)
141 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos)
142 glow:SetAlpha(1/fog_smoother)
143 glow:SetScript("OnShow",function()
144 glow:SetModel(orbtab[useorb].anim)
145 glow:SetModelScale(orbtab[useorb].scale)
146 glow:SetPosition(orbtab[useorb].z, orbtab[useorb].x, orbtab[useorb].y+pos)
147 end)
148 return glow
149 end
150
123 ------------------------------------------------------ 151 ------------------------------------------------------
124 -- / CREATE ME A FRAME FUNC / -- 152 -- / CREATE ME A FRAME FUNC / --
125 ------------------------------------------------------ 153 ------------------------------------------------------
126 154
127 local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag) 155 local function create_me_a_frame(fart,fname,fparent,fstrata,fwidth,fheight,fanchor,fxpos,fypos,fscale,fdrag)
156 -- PARENT, BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP
128 local f = CreateFrame(fart,fname,fparent) 157 local f = CreateFrame(fart,fname,fparent)
129 f:SetFrameStrata(fstrata) 158 f:SetFrameStrata(fstrata)
130 f:SetWidth(fwidth) 159 f:SetWidth(fwidth)
131 f:SetHeight(fheight) 160 f:SetHeight(fheight)
132 if fname == "rBBS_Holder" then 161 if fname == "rBBS_Holder" then
133 if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then 162 if rBottomBarStyler.point and rBottomBarStyler.posx and rBottomBarStyler.posy then
134 f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy) 163 f:SetPoint(rBottomBarStyler.point,rBottomBarStyler.posx,rBottomBarStyler.posy)
135 else 164 else
136 f:SetPoint(fanchor,fxpos,fypos) 165 f:SetPoint(fanchor,fxpos,fypos)
137 end 166 end
138 else 167 else
139 f:SetPoint(fanchor,fxpos,fypos) 168 f:SetPoint(fanchor,fxpos,fypos)
140 end 169 end
141 f:SetScale(fscale) 170 f:SetScale(fscale)
142 if fdrag == true then 171 if fdrag == true then
143 f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) 172 f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
144 end 173 end
145 return f 174 return f
146 end 175 end
147 176
148 ------------------------------------------------------ 177 ------------------------------------------------------
149 -- / CREATE ME A TEXTURE FUNC / -- 178 -- / CREATE ME A TEXTURE FUNC / --
150 ------------------------------------------------------ 179 ------------------------------------------------------
151 180
152 local function create_me_a_texture(fhooked,tstrata,tfile,tspecial) 181 local function create_me_a_texture(fhooked,tstrata,tfile,tspecial)
182 -- BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT
153 local t = fhooked:CreateTexture(nil,tstrata) 183 local t = fhooked:CreateTexture(nil,tstrata)
154 t:SetTexture(tfile) 184 t:SetTexture(tfile)
155 if tspecial == "fill" then 185 if tspecial == "fill" then
156 t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0) 186 t:SetPoint("BOTTOM",fhooked,"BOTTOM",0,0)
157 t:SetWidth(fhooked:GetWidth()) 187 t:SetWidth(fhooked:GetWidth())
158 t:SetHeight(fhooked:GetHeight()) 188 t:SetHeight(fhooked:GetHeight())
159 else 189 else
160 t:SetAllPoints(fhooked) 190 t:SetAllPoints(fhooked)
161 end 191 end
162 return t 192 return t
163 end 193 end
164 194
165 ------------------------------------------------------ 195 ------------------------------------------------------
166 -- / ORB HEALTH FUNC / -- 196 -- / ORB HEALTH FUNC / --
167 ------------------------------------------------------ 197 ------------------------------------------------------
168 198
169 local function orbhealth(orb1,orb1_fill) 199 local function orbhealth(orb1,orb1_fill,glow1,glow2)
170 orb1:SetScript("OnEvent", function(self, event, arg1, ...) 200 orb1:SetScript("OnEvent", function(self, event, arg1, ...)
171 if arg1 == "player" then 201 if arg1 == "player" then
172 local uh, uhm = UnitHealth("player"), UnitHealthMax("player") 202 local uh, uhm = UnitHealth("player"), UnitHealthMax("player")
173 orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth()) 203 orb1_fill:SetHeight((uh/uhm) * orb1_fill:GetWidth())
174 orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1) 204 orb1_fill:SetTexCoord(0,1, math.abs(uh/uhm - 1),1)
205 glow1:SetAlpha((uh / uhm)/fog_smoother)
206 glow2:SetAlpha((uh / uhm)/fog_smoother)
175 end 207 end
176 end) 208 end)
177 orb1:RegisterEvent("UNIT_HEALTH") 209 orb1:RegisterEvent("UNIT_HEALTH")
178 end 210 end
179 211
180 ------------------------------------------------------ 212 ------------------------------------------------------
181 -- / ORB MANA FUNC / -- 213 -- / ORB MANA FUNC / --
182 ------------------------------------------------------ 214 ------------------------------------------------------
183 215
184 local function orbmana(orb2,orb2_fill) 216 local function orbmana(orb2,orb2_fill,glow1,glow2)
185 orb2:SetScript("OnEvent", function(self, event, arg1, ...) 217 orb2:SetScript("OnEvent", function(self, event, arg1, ...)
186 if arg1 == "player" then 218 if arg1 == "player" then
187 local um, umm = UnitMana("player"), UnitManaMax("player") 219 local um, umm = UnitMana("player"), UnitManaMax("player")
188 orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth()) 220 orb2_fill:SetHeight((um/umm) * orb2_fill:GetWidth())
189 orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1) 221 orb2_fill:SetTexCoord(0,1, math.abs(um/umm - 1),1)
222 glow1:SetAlpha((um / umm)/fog_smoother)
223 glow2:SetAlpha((um / umm)/fog_smoother)
190 end 224 end
191 end) 225 end)
192 orb2:RegisterEvent("UNIT_MANA") 226 orb2:RegisterEvent("UNIT_MANA")
193 orb2:RegisterEvent("UNIT_RAGE") 227 orb2:RegisterEvent("UNIT_RAGE")
194 orb2:RegisterEvent("UNIT_ENERGY") 228 orb2:RegisterEvent("UNIT_ENERGY")
195 orb2:RegisterEvent("UNIT_FOCUS") 229 orb2:RegisterEvent("UNIT_FOCUS")
196 orb2:RegisterEvent("UNIT_RUNIC_POWER") 230 orb2:RegisterEvent("UNIT_RUNIC_POWER")
197 end 231 end
198 232
199 ------------------------------------------------------ 233 ------------------------------------------------------
200 -- / CREATE ORB FUNC / -- 234 -- / CREATE ORB FUNC / --
201 ------------------------------------------------------ 235 ------------------------------------------------------
202 236
203 local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,orbcolr,orbcolg,orbcolb) 237 local function create_orb(orbtype,orbsize,orbanchorframe,orbpoint,orbposx,orbposy,orbscale,orbfilltex,useorb)
204 --life orb 238 --life orb
205 local orb1 = create_me_a_frame("Frame",nil,orbanchorframe,"LOW",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale) 239 local orb1 = create_me_a_frame("Frame",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale)
206 local orb1_back = create_me_a_texture(orb1,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2") 240 local orb1_back = create_me_a_texture(orb1,"BORDER","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_back2")
207 local orb1_fill = create_me_a_texture(orb1,"LOW","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill") 241 local orb1_fill = create_me_a_texture(orb1,"ARTWORK","Interface\\AddOns\\rBottomBarStyler\\orbtex\\"..orbfilltex,"fill")
208 orb1_fill:SetVertexColor(orbcolr,orbcolg,orbcolb) 242 orb1_fill:SetVertexColor(orbtab[useorb].r,orbtab[useorb].g,orbtab[useorb].b)
209 local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"MEDIUM",orbsize,orbsize,"BOTTOM",0,0,1)
210 local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss")
211 if orbtype == "life" then 243 if orbtype == "life" then
212 orbhealth(orb1,orb1_fill) 244 local glow1 = create_me_a_orb_glow(orb1,useorb,0)
245 local glow2 = create_me_a_orb_glow(orb1,useorb,1)
246 orbhealth(orb1,orb1_fill,glow1,glow2)
213 else 247 else
214 orbmana(orb1,orb1_fill) 248 local glow1 = create_me_a_orb_glow(orb1,useorb,0)
249 local glow2 = create_me_a_orb_glow(orb1,useorb,1)
250 orbmana(orb1,orb1_fill,glow1,glow2)
215 end 251 end
252 local orb1_glossholder = create_me_a_frame("Frame",nil,orb1,"LOW",orbsize,orbsize,"BOTTOM",0,0,1)
253 local orb1_gloss = create_me_a_texture(orb1_glossholder,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\orbtex\\orb_gloss")
216 end 254 end
217 255
218 ------------------------------------------------------ 256 ------------------------------------------------------
219 -- / SET ME A SCALE / -- 257 -- / SET ME A SCALE / --
220 ------------------------------------------------------ 258 ------------------------------------------------------
221 259
222 local function set_me_a_scale() 260 local function set_me_a_scale()
223 frame_to_scale:SetScale(rBottomBarStyler.scalevalue) 261 frame_to_scale:SetScale(rBottomBarStyler.scalevalue)
224 end 262 end
225 263
226 ------------------------------------------------------ 264 ------------------------------------------------------
227 -- / SET ME A BAR / -- 265 -- / SET ME A BAR / --
228 ------------------------------------------------------ 266 ------------------------------------------------------
229 267
230 local function set_me_a_bar() 268 local function set_me_a_bar()
231 if rBottomBarStyler.artvalue == "roth" then 269 if rBottomBarStyler.artvalue == "roth" then
232 bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) 270 bar_to_show:SetTexture("Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue)
233 else 271 else
234 am("Does only work for roth layout") 272 am("Does only work for roth layout")
235 end 273 end
236 end 274 end
237 275
238 ------------------------------------------------------ 276 ------------------------------------------------------
239 -- / CREATE D1 STYLE / -- 277 -- / CREATE D1 STYLE / --
240 ------------------------------------------------------ 278 ------------------------------------------------------
241 local function create_d1_style(scale) 279 local function create_d1_style(scale)
242 --holder 280 --holder
243 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 281 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
244 frame_to_scale = holder 282 frame_to_scale = holder
245 --bar texture 283 --bar texture
246 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1) 284 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,256,"BOTTOM",0,0,1)
247 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar") 285 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\bar")
248 --orbs 286 --orbs
249 create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",0.8,0,0) 287 create_orb("life",160,holder,"BOTTOM",-290,120,1,"orb_filling4",1)
250 create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",0,0.3,0.8) 288 create_orb("mana",160,holder,"BOTTOM",285,120,1,"orb_filling4",3)
251 --left figure 289 --left figure
252 local lefty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",-320,35,0.9) 290 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-320,35,0.9)
253 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left") 291 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_left")
254 --right figure 292 --right figure
255 local righty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",320,35,0.9) 293 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",320,35,0.9)
256 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right") 294 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d1tex\\figure_right")
257 --dragframe 295 --dragframe
258 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 296 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
259 frame_to_drag = dragframe 297 frame_to_drag = dragframe
260 end 298 end
261 299
262 ------------------------------------------------------ 300 ------------------------------------------------------
263 -- / CREATE D2 STYLE / -- 301 -- / CREATE D2 STYLE / --
264 ------------------------------------------------------ 302 ------------------------------------------------------
265 local function create_d2_style(scale) 303 local function create_d2_style(scale)
266 --holder 304 --holder
267 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale,true) 305 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
268 frame_to_scale = holder 306 frame_to_scale = holder
269 --bar texture 307 --bar texture
270 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1) 308 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,44,1)
271 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar") 309 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\bar")
272 --border 310 --border
273 local border_left = create_me_a_frame("Frame",nil,holder,"LOW",1024,512,"BOTTOMRIGHT",0,0,1) 311 local border_left = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMRIGHT",0,0,1)
274 local border_left_tex = create_me_a_texture(border_left,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left") 312 local border_left_tex = create_me_a_texture(border_left,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_left")
275 local border_right = create_me_a_frame("Frame",nil,holder,"LOW",1024,512,"BOTTOMLEFT",0,0,1) 313 local border_right = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,512,"BOTTOMLEFT",0,0,1)
276 local border_right_tex = create_me_a_texture(border_right,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right") 314 local border_right_tex = create_me_a_texture(border_right,"BORDER","Interface\\AddOns\\rBottomBarStyler\\d2tex\\border_right")
277 --orbs 315 --orbs
278 create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",0.8,0,0) 316 create_orb("life",160,holder,"BOTTOM",-472,55,1,"orb_filling4",1)
279 create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",0,0.3,0.8) 317 create_orb("mana",160,holder,"BOTTOM",465,55,1,"orb_filling4",3)
280 --left figure 318 --left figure
281 local lefty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",-453,44,1) 319 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-453,44,1)
282 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left") 320 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_left")
283 --right figure 321 --right figure
284 local righty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",453,44,1) 322 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",453,44,1)
285 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right") 323 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d2tex\\figure_right")
286 --dragframe 324 --dragframe
287 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 325 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
288 frame_to_drag = dragframe 326 frame_to_drag = dragframe
289 end 327 end
290 328
291 ------------------------------------------------------ 329 ------------------------------------------------------
292 -- / CREATE D3 STYLE / -- 330 -- / CREATE D3 STYLE / --
293 ------------------------------------------------------ 331 ------------------------------------------------------
294 local function create_d3_style(scale) 332 local function create_d3_style(scale)
295 --holder 333 --holder
296 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 334 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
297 frame_to_scale = holder 335 frame_to_scale = holder
298 --bar texture 336 --bar texture
299 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1) 337 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",1024,128,"BOTTOM",0,0,1)
300 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar") 338 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\bar")
301 --orbs 339 --orbs
302 create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",0.8,0,0) 340 create_orb("life",200,holder,"BOTTOM",-471,-3,1,"orb_filling4",1)
303 create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",0,0.3,0.8) 341 create_orb("mana",200,holder,"BOTTOM",471,-3,1,"orb_filling4",3)
304 --left figure 342 --left figure
305 local lefty = create_me_a_frame("Frame",nil,holder,"HIGH",512,256,"BOTTOM",-455,0,1) 343 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",-455,0,1)
306 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left") 344 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_left")
307 --right figure 345 --right figure
308 local righty = create_me_a_frame("Frame",nil,holder,"HIGH",512,256,"BOTTOM",455,0,1) 346 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",512,256,"BOTTOM",455,0,1)
309 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right") 347 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\d3tex\\figure_right")
310 --dragframe 348 --dragframe
311 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 349 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
312 frame_to_drag = dragframe 350 frame_to_drag = dragframe
313 end 351 end
314 352
315 ------------------------------------------------------ 353 ------------------------------------------------------
316 -- / CREATE ROTH STYLE / -- 354 -- / CREATE ROTH STYLE / --
317 ------------------------------------------------------ 355 ------------------------------------------------------
318 local function create_roth_style(scale) 356 local function create_roth_style(scale)
319 --holder 357 --holder
320 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale) 358 local holder = create_me_a_frame("Frame","rBBS_Holder",UIParent,"BACKGROUND",100,100,"BOTTOM",0,0,scale)
321 frame_to_scale = holder 359 frame_to_scale = holder
322 --bar texture 360 --bar texture
323 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1) 361 local bar = create_me_a_frame("Frame",nil,holder,"BACKGROUND",512,256,"BOTTOM",0,0,1)
324 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue) 362 local bar_tex = create_me_a_texture(bar,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\"..rBottomBarStyler.barvalue)
325 bar_to_show = bar_tex 363 bar_to_show = bar_tex
364 --orbs
365 create_orb("life",120,holder,"BOTTOM",-250,-8,1,"orb_filling4",1)
366 create_orb("mana",120,holder,"BOTTOM",250,-8,1,"orb_filling4",3)
326 --bottom 367 --bottom
327 local bottom = create_me_a_frame("Frame",nil,holder,"HIGH",500,110,"BOTTOM",0,-10,1) 368 local bottom = create_me_a_frame("Frame",nil,holder,"MEDIUM",500,110,"BOTTOM",0,-10,1)
328 local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom") 369 local bottom_tex = create_me_a_texture(bottom,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\bottom")
329 --orbs
330 create_orb("life",120,holder,"BOTTOM",-250,-8,1,"orb_filling4",0.8,0,0)
331 create_orb("mana",120,holder,"BOTTOM",250,-8,1,"orb_filling4",0,0.3,0.8)
332 --left figure 370 --left figure
333 local lefty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",-510,0,0.6) 371 local lefty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",-510,0,0.6)
334 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left") 372 local lefty_tex = create_me_a_texture(lefty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_left")
335 --right figure 373 --right figure
336 local righty = create_me_a_frame("Frame",nil,holder,"HIGH",256,256,"BOTTOM",510,0,0.6) 374 local righty = create_me_a_frame("Frame",nil,holder,"MEDIUM",256,256,"BOTTOM",510,0,0.6)
337 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right") 375 local righty_tex = create_me_a_texture(righty,"BACKGROUND","Interface\\AddOns\\rBottomBarStyler\\rothtex\\figure_right")
338 --dragframe 376 --dragframe
339 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true) 377 local dragframe = create_me_a_frame("Frame",nil,holder,"TOOLTIP",100,100,"BOTTOM",0,0,scale,true)
340 frame_to_drag = dragframe 378 frame_to_drag = dragframe
341 end 379 end
342 380
343 ------------------------------------------------------ 381 ------------------------------------------------------
344 -- / LOAD STYLE FUNC / -- 382 -- / LOAD STYLE FUNC / --
345 ------------------------------------------------------ 383 ------------------------------------------------------
346 384
347 local function load_style(style,scale) 385 local function load_style(style,scale)
348 if style == "roth" then 386 if style == "roth" then
349 create_roth_style(scale) 387 create_roth_style(scale)
350 elseif style == "d1" then 388 elseif style == "d1" then
351 create_d1_style(scale) 389 create_d1_style(scale)
352 elseif style == "d2" then 390 elseif style == "d2" then
353 create_d2_style(scale) 391 create_d2_style(scale)
354 else 392 else
355 create_d3_style(scale) 393 create_d3_style(scale)
356 end 394 end
357 end 395 end
358 396
359 ------------------------------------------------------ 397 ------------------------------------------------------
360 -- / SLASH FUNC / -- 398 -- / SLASH FUNC / --
361 ------------------------------------------------------ 399 ------------------------------------------------------
362 400
363 local function SlashCmd(cmd) 401 local function SlashCmd(cmd)
364 --setscale 402 --setscale
365 if (cmd:match"setscale") then 403 if (cmd:match"setscale") then
366 local a,b = strfind(cmd, " "); 404 local a,b = strfind(cmd, " ");
367 if b then 405 if b then
368 local c = strsub(cmd, b+1) 406 local c = strsub(cmd, b+1)
369 if tonumber(c) then 407 if tonumber(c) then
370 am("Current scaling is set to: "..c) 408 am("Current scaling is set to: "..c)
371 rBottomBarStyler.scalevalue = tonumber(c) 409 rBottomBarStyler.scalevalue = tonumber(c)
372 set_me_a_scale() 410 set_me_a_scale()
373 else 411 else
374 am("No number value.") 412 am("No number value.")
375 end 413 end
376 else 414 else
377 am("No value found.") 415 am("No value found.")
378 end 416 end
379 --getscale 417 --getscale
380 elseif (cmd:match"getscale") then 418 elseif (cmd:match"getscale") then
381 am("Current scaling is set to: "..rBottomBarStyler.scalevalue) 419 am("Current scaling is set to: "..rBottomBarStyler.scalevalue)
382 --setart 420 --setart
383 elseif (cmd:match"setart") then 421 elseif (cmd:match"setart") then
384 local a,b = strfind(cmd, " "); 422 local a,b = strfind(cmd, " ");
385 if b then 423 if b then
386 local c = strsub(cmd, b+1) 424 local c = strsub(cmd, b+1)
387 if c == "d1" or c == "d2" or c == "d3" or c == "roth" then 425 if c == "d1" or c == "d2" or c == "d3" or c == "roth" then
388 am("You set the art to: "..c) 426 am("You set the art to: "..c)
389 rBottomBarStyler.artvalue = c 427 rBottomBarStyler.artvalue = c
390 am("You need to reoad the interface to see the changes.") 428 am("You need to reoad the interface to see the changes.")
391 am("Type in: \"/console reloadui\".") 429 am("Type in: \"/console reloadui\".")
392 else 430 else
393 am("Wrong value. (possible values: d1, d2, d3, roth)") 431 am("Wrong value. (possible values: d1, d2, d3, roth)")
394 end 432 end
395 else 433 else
396 am("No value found.") 434 am("No value found.")
397 end 435 end
398 --setbar 436 --setbar
399 elseif (cmd:match"setbar") then 437 elseif (cmd:match"setbar") then
400 local a,b = strfind(cmd, " "); 438 local a,b = strfind(cmd, " ");
401 if b then 439 if b then
402 local c = strsub(cmd, b+1) 440 local c = strsub(cmd, b+1)
403 if c == "bar1" or c == "bar2" or c == "bar3" then 441 if c == "bar1" or c == "bar2" or c == "bar3" then
404 am("You set the bar to: "..c) 442 am("You set the bar to: "..c)
405 rBottomBarStyler.barvalue = c 443 rBottomBarStyler.barvalue = c
406 set_me_a_bar() 444 set_me_a_bar()
407 else 445 else
408 am("Wrong value. (possible values: bar1, bar2, bar3)") 446 am("Wrong value. (possible values: bar1, bar2, bar3)")
409 end 447 end
410 else 448 else
411 am("No value found.") 449 am("No value found.")
412 end 450 end
413 --getart 451 --getart
414 elseif (cmd:match"getart") then 452 elseif (cmd:match"getart") then
415 am("Current art is set to: "..rBottomBarStyler.artvalue) 453 am("Current art is set to: "..rBottomBarStyler.artvalue)
416 --getmovable 454 --getmovable
417 elseif (cmd:match"getmovable") then 455 elseif (cmd:match"getmovable") then
418 am("Movable is set to: "..rBottomBarStyler.movable) 456 am("Movable is set to: "..rBottomBarStyler.movable)
419 --getlocked 457 --getlocked
420 elseif (cmd:match"getlocked") then 458 elseif (cmd:match"getlocked") then
421 am("Locked is set to: "..rBottomBarStyler.locked) 459 am("Locked is set to: "..rBottomBarStyler.locked)
422 --locked 460 --locked
423 elseif (cmd:match"locked") then 461 elseif (cmd:match"locked") then
424 local a,b = strfind(cmd, " "); 462 local a,b = strfind(cmd, " ");
425 if b then 463 if b then
426 local c = strsub(cmd, b+1) 464 local c = strsub(cmd, b+1)
427 if tonumber(c) then 465 if tonumber(c) then
428 am("Locked is set to: "..c) 466 am("Locked is set to: "..c)
429 rBottomBarStyler.locked = tonumber(c) 467 rBottomBarStyler.locked = tonumber(c)
430 move_my_frame() 468 move_my_frame()
431 else 469 else
432 am("No number value.") 470 am("No number value.")
433 end 471 end
434 else 472 else
435 am("No value found.") 473 am("No value found.")
436 end 474 end
437 --movable 475 --movable
438 elseif (cmd:match"movable") then 476 elseif (cmd:match"movable") then
439 local a,b = strfind(cmd, " "); 477 local a,b = strfind(cmd, " ");
440 if b then 478 if b then
441 local c = strsub(cmd, b+1) 479 local c = strsub(cmd, b+1)
442 if tonumber(c) then 480 if tonumber(c) then
443 am("Movable is set to: "..c) 481 am("Movable is set to: "..c)
444 rBottomBarStyler.movable = tonumber(c) 482 rBottomBarStyler.movable = tonumber(c)
445 move_my_frame() 483 move_my_frame()
446 else 484 else
447 am("No number value.") 485 am("No number value.")
448 end 486 end
449 else 487 else
450 am("No value found.") 488 am("No value found.")
451 end 489 end
452 else 490 else
453 am("rbbs commands...") 491 am("rbbs commands...")
454 am("\/rbbs getscale") 492 am("\/rbbs getscale")
455 am("\/rbbs getart") 493 am("\/rbbs getart")
456 am("\/rbbs getlocked") 494 am("\/rbbs getlocked")
457 am("\/rbbs getmovable") 495 am("\/rbbs getmovable")
458 am("\/rbbs setscale NUMBER") 496 am("\/rbbs setscale NUMBER")
459 am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)") 497 am("\/rbbs setart STRING (possible values: d1, d2, d3, roth)")
460 am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)") 498 am("\/rbbs setbar STRING (possible values: bar1, bar2, bar3 - only affects the roth layout)")
461 am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)") 499 am("\/rbbs locked NUMBER (value of 1 locks bars, 0 unlocks)")
462 am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)") 500 am("\/rbbs movable NUMBER (value of 1 makes bars movable if unlocked, value of 0 will reset position)")
463 end 501 end
464 end 502 end
465 503
466 ------------------------------------------------------ 504 ------------------------------------------------------
467 -- / LOAD THE SHIT / -- 505 -- / LOAD THE SHIT / --
468 ------------------------------------------------------ 506 ------------------------------------------------------
469 507
470 local a = CreateFrame"Frame" 508 local a = CreateFrame"Frame"
471 a:RegisterEvent("VARIABLES_LOADED") 509 a:RegisterEvent("VARIABLES_LOADED")
472 a:SetScript("OnEvent", function(self) 510 a:SetScript("OnEvent", function(self)
473 self:UnregisterEvent("VARIABLES_LOADED") 511 self:UnregisterEvent("VARIABLES_LOADED")
474 self:SetScript("OnEvent", nil) 512 self:SetScript("OnEvent", nil)
475 --default values 513 --default values
476 load_default() 514 load_default()
477 --load the styles 515 --load the styles
478 load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue) 516 load_style(rBottomBarStyler.artvalue,rBottomBarStyler.scalevalue)
479 move_my_frame() 517 move_my_frame()
480 --slash commands 518 --slash commands
481 SlashCmdList["whatever"] = SlashCmd; 519 SlashCmdList["whatever"] = SlashCmd;
482 SLASH_whatever1 = "/rbbs"; 520 SLASH_whatever1 = "/rbbs";
483 --am("rbbs loaded...") 521 --am("rbbs loaded...")
484 end) 522 end)
Hosted by Google Code