vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | Range Color: Change the icon color when out of range, no mana, etc; |
||
4 | also it shows the hotkeys for the extra Blizzard Bars. |
||
5 | |||
6 | Made by: Edswor |
||
7 | |||
8 | Commands: /rangecolor or /rc |
||
9 | |||
10 | ]] |
||
11 | |||
12 | -------------------------------------------------------------------------------------------------- |
||
13 | -- Other variables |
||
14 | -------------------------------------------------------------------------------------------------- |
||
15 | |||
16 | local Old_ActionButton_OnUpdate; |
||
17 | local Old_ActionButton_UpdateUsable |
||
18 | local Old_ActionButton_UpdateHotkeys |
||
19 | local Old_FlexBarButton_OnUpdate; |
||
20 | local Old_FlexBarButton_UpdateUsable; |
||
21 | local Old_Gypsy_ActionButtonOnUpdate; |
||
22 | local Old_Gypsy_ActionButtonUpdateUsable; |
||
23 | |||
24 | -------------------------------------------------------------------------------------------------- |
||
25 | -- OnLoad, Initialize |
||
26 | -------------------------------------------------------------------------------------------------- |
||
27 | |||
28 | function RangeColor_OnLoad() |
||
29 | |||
30 | this:RegisterEvent("VARIABLES_LOADED"); |
||
31 | this:RegisterEvent("UPDATE_BINDINGS"); |
||
32 | this:RegisterEvent("ADDON_LOADED"); |
||
33 | |||
34 | SLASH_RANGECOLOR1 = "/rangecolor"; |
||
35 | SLASH_RANGECOLOR2 = "/rc"; |
||
36 | SlashCmdList["RANGECOLOR"] = RangeColor_ShowOptions; |
||
37 | |||
38 | --Hook the ActionButton_OnUpdate function |
||
39 | Old_ActionButton_OnUpdate = ActionButton_OnUpdate; |
||
40 | ActionButton_OnUpdate = RangeColor_ActionButton_OnUpdate; |
||
41 | |||
42 | --Hook the ActionButton_UpdateUsable function |
||
43 | Old_ActionButton_UpdateUsable = ActionButton_UpdateUsable; |
||
44 | ActionButton_UpdateUsable = RangeColor_ActionButton_UpdateUsable; |
||
45 | |||
46 | --Hook the ActionButton_UpdateUsable function |
||
47 | Old_ActionButton_UpdateHotkeys = ActionButton_UpdateHotkeys; |
||
48 | ActionButton_UpdateHotkeys = RangeColor_ActionButton_UpdateHotkeys; |
||
49 | |||
50 | --FlexBarButton_OnUpdate |
||
51 | |||
52 | --Hook the FlexBarButton_OnUpdate and FlexBarButton_UpdateUsable function |
||
53 | if (type(FlexBarButton_OnUpdate) == 'function') then |
||
54 | Old_FlexBarButton_OnUpdate = FlexBarButton_OnUpdate; |
||
55 | FlexBarButton_OnUpdate = RangeColor_FlexBarButton_OnUpdate; |
||
56 | end |
||
57 | if (type(FlexBarButton_UpdateUsable) == 'function') then |
||
58 | Old_FlexBarButton_UpdateUsable = FlexBarButton_UpdateUsable; |
||
59 | FlexBarButton_UpdateUsable = RangeColor_FlexBarButton_UpdateUsable; |
||
60 | end |
||
61 | |||
62 | --Hook the Gypsy_ActionButtonOnUpdate and Gypsy_ActionButtonOnUpdate function |
||
63 | if (type(Gypsy_ActionButtonOnUpdate) == 'function') then |
||
64 | Old_Gypsy_ActionButtonOnUpdate = Gypsy_ActionButtonOnUpdate; |
||
65 | Gypsy_ActionButtonOnUpdate = RangeColor_Gypsy_ActionButtonOnUpdate; |
||
66 | end |
||
67 | if (type(Gypsy_ActionButtonUpdateUsable) == 'function') then |
||
68 | Old_Gypsy_ActionButtonUpdateUsable = Gypsy_ActionButtonUpdateUsable; |
||
69 | Gypsy_ActionButtonUpdateUsable = RangeColor_Gypsy_ActionButtonUpdateUsable; |
||
70 | end |
||
71 | |||
72 | end |
||
73 | |||
74 | function RangeColor_Initialize() |
||
75 | RangeColor_Save2 = { |
||
76 | ["Version"] = RANGECOLOR_VERSION, |
||
77 | ["Mode"] = 3, |
||
78 | ["Filter"] = 1, |
||
79 | ["Dash"] = 1, |
||
80 | ["Colors"] = { |
||
81 | [1] = {r = 1.0, g = 0.0, b = 0.0}, |
||
82 | [2] = {r = 1.0, g = 0.0, b = 0.0}, |
||
83 | [3] = {r = 1.0, g = 0.0, b = 0.0}, |
||
84 | [4] = {r = 0.3, g = 0.3, b = 1.0}, |
||
85 | [5] = {r = 0.3, g = 0.3, b = 1.0}, |
||
86 | [6] = {r = 0.3, g = 0.3, b = 1.0}, |
||
87 | [7] = {r = 0.4, g = 0.4, b = 0.4}, |
||
88 | [8] = {r = 0.4, g = 0.4, b = 0.4}, |
||
89 | [9] = {r = 0.6, g = 0.6, b = 0.6}, |
||
90 | [10] = {r = 1.0, g = 1.0, b = 1.0}, |
||
91 | [11] = {r = 1.0, g = 1.0, b = 1.0}, |
||
92 | [12] = {r = 0.6, g = 0.6, b = 0.6} |
||
93 | } |
||
94 | }; |
||
95 | |||
96 | end |
||
97 | |||
98 | -------------------------------------------------------------------------------------------------- |
||
99 | -- ShowOptions, HideOptions, Toggle |
||
100 | -------------------------------------------------------------------------------------------------- |
||
101 | |||
102 | function RangeColor_ShowOptions() |
||
103 | ShowUIPanel(RangeColorOptionsFrame); |
||
104 | end |
||
105 | |||
106 | function RangeColor_HideOptions() |
||
107 | HideUIPanel(RangeColorOptionsFrame); |
||
108 | end |
||
109 | |||
110 | function RangeColor_Toggle() |
||
111 | if(RangeColorOptionsFrame:IsVisible()) then |
||
112 | HideUIPanel(RangeColorOptionsFrame); |
||
113 | else |
||
114 | ShowUIPanel(RangeColorOptionsFrame); |
||
115 | end |
||
116 | end |
||
117 | |||
118 | function RangeColor_ResetOptions() |
||
119 | RangeColor_Initialize(); |
||
120 | RangeColor_HideOptions(); |
||
121 | end |
||
122 | |||
123 | -------------------------------------------------------------------------------------------------- |
||
124 | -- OnEvent, OnUpdate, UpdateUsable |
||
125 | -------------------------------------------------------------------------------------------------- |
||
126 | |||
127 | function RangeColor_OnEvent() |
||
128 | if( event == "VARIABLES_LOADED" ) then |
||
129 | if ( RangeColor_Save2 == nil ) then |
||
130 | RangeColor_Initialize(); |
||
131 | elseif( RangeColor_Save2["Version"] == nil or RangeColor_Save2["Version"] ~= RANGECOLOR_VERSION) then |
||
132 | RangeColor_Initialize(); |
||
133 | end |
||
134 | if( DEFAULT_CHAT_FRAME ) then |
||
135 | DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00Range Color|r, made by: |cffff3300Edswor|r, Version: |cffffff00"..RANGECOLOR_VERSION.."|r, loaded."); |
||
136 | end |
||
137 | return; |
||
138 | elseif( event == "ADDON_LOADED") then |
||
139 | if(myAddOnsFrame_Register) then |
||
140 | RangeColorDetails = { |
||
141 | name = "RangeColor", |
||
142 | version = RANGECOLOR_VERSION, |
||
143 | releaseDate = RANGECOLOR_RELEASE, |
||
144 | author = "Edswor", |
||
145 | email = "edsowr@hotmail.com", |
||
146 | website = "http://edswor.iespana.es", |
||
147 | category = MYADDONS_CATEGORY_BARS, |
||
148 | optionsframe = "RangeColorOptionsFrame" |
||
149 | }; |
||
150 | myAddOnsFrame_Register(RangeColorDetails, RangeColorHelp); |
||
151 | end |
||
152 | return; |
||
153 | elseif( event == "UPDATE_BINDINGS" ) then |
||
154 | RangeColor_UpdateHotkeys(); |
||
155 | return; |
||
156 | end |
||
157 | end |
||
158 | |||
159 | function RangeColor_ActionButton_OnUpdate(elapsed) |
||
160 | |||
161 | --This calls the old OnUpdate function |
||
162 | Old_ActionButton_OnUpdate(elapsed); |
||
163 | |||
164 | --This is to change the color if is out of range |
||
165 | --Blizzard only change the color of the hotkey of the icon |
||
166 | RangeColor_ActionButton(elapsed); |
||
167 | |||
168 | end |
||
169 | |||
170 | function RangeColor_ActionButton_UpdateUsable() |
||
171 | |||
172 | --This calls the old UpdateUsable function |
||
173 | --I dont make this calls, because I have rewritten all the Blizzard code |
||
174 | --Uncomment to use it if needed with other addon |
||
175 | --Old_ActionButton_UpdateUsable(); |
||
176 | |||
177 | RangeColor_ActionButton(0); |
||
178 | |||
179 | end |
||
180 | |||
181 | function RangeColor_ActionButton(elapsed) |
||
182 | |||
183 | local icon = getglobal(this:GetName().."Icon"); |
||
184 | local normalTexture = getglobal(this:GetName().."NormalTexture"); |
||
185 | local isUsable, notEnoughMana = IsUsableAction(ActionButton_GetPagedID(this)); |
||
186 | local hotkey = getglobal(this:GetName().."HotKey"); |
||
187 | |||
188 | if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then |
||
189 | hotkey:SetVertexColor(0.6, 0.6, 0.6); |
||
190 | if ( this.rangeTimer ) then |
||
191 | if ( this.rangeTimer <= elapsed ) then |
||
192 | if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then |
||
193 | icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); |
||
194 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][2].r, RangeColor_Save2["Colors"][2].g, RangeColor_Save2["Colors"][2].b); |
||
195 | else |
||
196 | if ( isUsable ) then |
||
197 | icon:SetVertexColor(RangeColor_Save2["Colors"][10].r, RangeColor_Save2["Colors"][10].g, RangeColor_Save2["Colors"][10].b); |
||
198 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][11].r, RangeColor_Save2["Colors"][11].g, RangeColor_Save2["Colors"][11].b); |
||
199 | elseif ( notEnoughMana ) then |
||
200 | icon:SetVertexColor(RangeColor_Save2["Colors"][4].r, RangeColor_Save2["Colors"][4].g, RangeColor_Save2["Colors"][4].b); |
||
201 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][5].r, RangeColor_Save2["Colors"][5].g, RangeColor_Save2["Colors"][5].b); |
||
202 | else |
||
203 | icon:SetVertexColor(RangeColor_Save2["Colors"][7].r, RangeColor_Save2["Colors"][7].g, RangeColor_Save2["Colors"][7].b); |
||
204 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); |
||
205 | end |
||
206 | end |
||
207 | end |
||
208 | end |
||
209 | else |
||
210 | if ( this.rangeTimer ) then |
||
211 | if ( this.rangeTimer <= elapsed ) then |
||
212 | if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then |
||
213 | icon:SetVertexColor(1.0, 1.0, 1.0); |
||
214 | normalTexture:SetVertexColor(1.0, 1.0, 1.0); |
||
215 | end |
||
216 | end |
||
217 | end |
||
218 | if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then |
||
219 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][3].r, RangeColor_Save2["Colors"][3].g, RangeColor_Save2["Colors"][3].b); |
||
220 | else |
||
221 | if ( isUsable ) then |
||
222 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][12].r, RangeColor_Save2["Colors"][12].g, RangeColor_Save2["Colors"][12].b); |
||
223 | elseif ( notEnoughMana ) then |
||
224 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][6].r, RangeColor_Save2["Colors"][6].g, RangeColor_Save2["Colors"][6].b); |
||
225 | else |
||
226 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][9].r, RangeColor_Save2["Colors"][9].g, RangeColor_Save2["Colors"][9].b); |
||
227 | end |
||
228 | end |
||
229 | end |
||
230 | end |
||
231 | |||
232 | -------------------------------------------------------------------------------------------------- |
||
233 | -- ActionButton_UpdateHotkeys, UpdateHotkeys, UpdateHotkeysBar, TransformText |
||
234 | -------------------------------------------------------------------------------------------------- |
||
235 | |||
236 | --Overwrittes the Blizzard one to be able to use our filter for the text |
||
237 | function RangeColor_ActionButton_UpdateHotkeys(actionButtonType) |
||
238 | if ( not actionButtonType ) then |
||
239 | actionButtonType = "ACTIONBUTTON"; |
||
240 | end |
||
241 | local hotkey = getglobal(this:GetName().."HotKey"); |
||
242 | local action = actionButtonType..this:GetID(); |
||
243 | local text = GetBindingText(GetBindingKey(action), "KEY_"); |
||
244 | if ( string.len(text)==0 ) then |
||
245 | hotkey:Hide(); |
||
246 | else |
||
247 | hotkey:SetText(RangeColor_TransformText(text)); |
||
248 | hotkey:Show(); |
||
249 | end |
||
250 | end |
||
251 | |||
252 | function RangeColor_UpdateHotkeys() |
||
253 | RangeColor_UpdateHotkeysBar("MultiBarBottomLeft", 1); |
||
254 | RangeColor_UpdateHotkeysBar("MultiBarBottomRight", 2); |
||
255 | RangeColor_UpdateHotkeysBar("MultiBarRight", 3); |
||
256 | RangeColor_UpdateHotkeysBar("MultiBarLeft", 4); |
||
257 | end |
||
258 | |||
259 | --Change the text of hotkeys of this multibar |
||
260 | function RangeColor_UpdateHotkeysBar(bar, id) |
||
261 | local hotkey, action, text; |
||
262 | for i = 1, 12 do |
||
263 | hotkey = getglobal(bar.."Button"..i.."HotKey"); |
||
264 | action = "MULTIACTIONBAR"..id.."BUTTON"..i; |
||
265 | text = GetBindingText(GetBindingKey(action),"KEY_"); |
||
266 | if ( string.len(text)==0 ) then |
||
267 | hotkey:Hide(); |
||
268 | else |
||
269 | hotkey:SetText(RangeColor_TransformText(text)); |
||
270 | hotkey:Show(); |
||
271 | end |
||
272 | end |
||
273 | end |
||
274 | |||
275 | function RangeColor_TransformText(text) |
||
276 | |||
277 | --The fisrt time that WoW loads, it calls this function before any addon loads, |
||
278 | --so I have put a default option if the addon is not loaded. |
||
279 | --If you want to change to your options, make a change in the key binding menu |
||
280 | --so this function is called again |
||
281 | |||
282 | if (RangeColor_Save2 ~= nil) then |
||
283 | if( RangeColor_Get("Filter")==1 ) then |
||
284 | text = string.gsub(text, "CTRL", "C"); |
||
285 | text = string.gsub(text, "ALT", "A"); |
||
286 | text = string.gsub(text, "SHIFT", "S"); |
||
287 | if( RangeColor_Get("Dash")==1 ) then |
||
288 | text = string.gsub(text, "-", ""); |
||
289 | end |
||
290 | end |
||
291 | else |
||
292 | text = string.gsub(text, "CTRL", "C"); |
||
293 | text = string.gsub(text, "ALT", "A"); |
||
294 | text = string.gsub(text, "SHIFT", "S"); |
||
295 | text = string.gsub(text, "-", ""); |
||
296 | end |
||
297 | |||
298 | return text; |
||
299 | end |
||
300 | |||
301 | -------------------------------------------------------------------------------------------------- |
||
302 | -- Set, Get, GetColor, SetColor |
||
303 | -------------------------------------------------------------------------------------------------- |
||
304 | |||
305 | function RangeColor_Get(option) |
||
306 | if (RangeColor_Save2[option] ~= nil) then |
||
307 | return RangeColor_Save2[option]; |
||
308 | end |
||
309 | end |
||
310 | |||
311 | function RangeColor_Set(option, val) |
||
312 | if (RangeColor_Save2 ~= nil) then |
||
313 | if ( option ) then |
||
314 | RangeColor_Save2[option] = val; |
||
315 | end |
||
316 | end |
||
317 | end |
||
318 | |||
319 | function RangeColor_GetColor(key) |
||
320 | local color = {r = 1.0, g = 1.0, b = 1.0}; |
||
321 | |||
322 | if (RangeColor_Save2["Colors"][key] ~= nil) then |
||
323 | color.r = RangeColor_Save2["Colors"][key].r; |
||
324 | color.g = RangeColor_Save2["Colors"][key].g; |
||
325 | color.b = RangeColor_Save2["Colors"][key].b; |
||
326 | return color; |
||
327 | end |
||
328 | end |
||
329 | |||
330 | function RangeColor_SetColor(key, r, g, b) |
||
331 | if (RangeColor_Save2["Colors"][key] ~= nil) then |
||
332 | RangeColor_Save2["Colors"][key].r = r; |
||
333 | RangeColor_Save2["Colors"][key].g = g; |
||
334 | RangeColor_Save2["Colors"][key].b = b; |
||
335 | end |
||
336 | end |
||
337 | |||
338 | -------------------------------------------------------------------------------------------------- |
||
339 | -- Flexbar |
||
340 | -------------------------------------------------------------------------------------------------- |
||
341 | -- OnUpdate, UpdateUsable |
||
342 | -------------------------------------------------------------------------------------------------- |
||
343 | |||
344 | function RangeColor_FlexBarButton_OnUpdate(elapsed, button) |
||
345 | |||
346 | --This calls the old OnUpdate function |
||
347 | Old_FlexBarButton_OnUpdate(elapsed, button); |
||
348 | |||
349 | --This is to change the color if is out of range |
||
350 | RangeColor_FlexBarButton_UpdateUsable(button); |
||
351 | |||
352 | end |
||
353 | |||
354 | function RangeColor_FlexBarButton_UpdateUsable(button) |
||
355 | |||
356 | --This calls the old UpdateUsable function |
||
357 | Old_FlexBarButton_UpdateUsable(button); |
||
358 | |||
359 | local icon = getglobal(button:GetName().."Icon"); |
||
360 | local normalTexture = getglobal(button:GetName().."NormalTexture"); |
||
361 | local isUsable, notEnoughMana = IsUsableAction(FlexBarButton_GetID(button)); |
||
362 | local hotkey = getglobal(button:GetName().."HotKey"); |
||
363 | |||
364 | if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then |
||
365 | hotkey:SetVertexColor(0.6, 0.6, 0.6); |
||
366 | if ( button.rangeTimer ) then |
||
367 | if ( button.rangeTimer < 0 ) then |
||
368 | if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then |
||
369 | icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); |
||
370 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][2].r, RangeColor_Save2["Colors"][2].g, RangeColor_Save2["Colors"][2].b); |
||
371 | else |
||
372 | if ( isUsable ) then |
||
373 | icon:SetVertexColor(RangeColor_Save2["Colors"][10].r, RangeColor_Save2["Colors"][10].g, RangeColor_Save2["Colors"][10].b); |
||
374 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][11].r, RangeColor_Save2["Colors"][11].g, RangeColor_Save2["Colors"][11].b); |
||
375 | elseif ( notEnoughMana ) then |
||
376 | icon:SetVertexColor(RangeColor_Save2["Colors"][4].r, RangeColor_Save2["Colors"][4].g, RangeColor_Save2["Colors"][4].b); |
||
377 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][5].r, RangeColor_Save2["Colors"][5].g, RangeColor_Save2["Colors"][5].b); |
||
378 | else |
||
379 | icon:SetVertexColor(RangeColor_Save2["Colors"][7].r, RangeColor_Save2["Colors"][7].g, RangeColor_Save2["Colors"][7].b); |
||
380 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); |
||
381 | end |
||
382 | end |
||
383 | end |
||
384 | end |
||
385 | else |
||
386 | if ( button.rangeTimer ) then |
||
387 | if ( button.rangeTimer < 0 ) then |
||
388 | if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then |
||
389 | icon:SetVertexColor(1.0, 1.0, 1.0); |
||
390 | normalTexture:SetVertexColor(1.0, 1.0, 1.0); |
||
391 | end |
||
392 | end |
||
393 | end |
||
394 | if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then |
||
395 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][3].r, RangeColor_Save2["Colors"][3].g, RangeColor_Save2["Colors"][3].b); |
||
396 | else |
||
397 | if ( isUsable ) then |
||
398 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][12].r, RangeColor_Save2["Colors"][12].g, RangeColor_Save2["Colors"][12].b); |
||
399 | elseif ( notEnoughMana ) then |
||
400 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][6].r, RangeColor_Save2["Colors"][6].g, RangeColor_Save2["Colors"][6].b); |
||
401 | else |
||
402 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][9].r, RangeColor_Save2["Colors"][9].g, RangeColor_Save2["Colors"][9].b); |
||
403 | end |
||
404 | end |
||
405 | end |
||
406 | end |
||
407 | |||
408 | |||
409 | -------------------------------------------------------------------------------------------------- |
||
410 | -- Other Action Bars |
||
411 | -------------------------------------------------------------------------------------------------- |
||
412 | |||
413 | |||
414 | -------------------------------------------------------------------------------------------------- |
||
415 | -- Gypsy |
||
416 | -------------------------------------------------------------------------------------------------- |
||
417 | -- OnUpdate, UpdateUsable |
||
418 | -------------------------------------------------------------------------------------------------- |
||
419 | |||
420 | function RangeColor_Gypsy_ActionButtonOnUpdate(elapsed) |
||
421 | |||
422 | --This calls the old OnUpdate function |
||
423 | Old_Gypsy_ActionButtonOnUpdate(elapsed); |
||
424 | |||
425 | --This is to change the color if is out of range |
||
426 | RangeColor_Gypsy_ActionButtonUpdateUsable(); |
||
427 | |||
428 | end |
||
429 | |||
430 | function RangeColor_Gypsy_ActionButtonUpdateUsable() |
||
431 | |||
432 | --This calls the old UpdateUsable function |
||
433 | --I dont make this calls, because I have rewritten all the code |
||
434 | --Uncomment to use it if needed with other addon or some errors occurs |
||
435 | --Old_Gypsy_ActionButtonUpdateUsable(); |
||
436 | |||
437 | local icon = getglobal(this:GetName().."Icon"); |
||
438 | local normalTexture = getglobal(this:GetName().."NormalTexture"); |
||
439 | local isUsable, notEnoughMana = IsUsableAction(Gypsy_ActionButtonGetPagedID(this)); |
||
440 | local hotkey = getglobal(this:GetName().."HotKey"); |
||
441 | |||
442 | if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then |
||
443 | hotkey:SetVertexColor(0.6, 0.6, 0.6); |
||
444 | if ( this.rangeTimer ) then |
||
445 | if ( this.rangeTimer < 0 ) then |
||
446 | if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then |
||
447 | icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); |
||
448 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][2].r, RangeColor_Save2["Colors"][2].g, RangeColor_Save2["Colors"][2].b); |
||
449 | else |
||
450 | if ( isUsable ) then |
||
451 | icon:SetVertexColor(RangeColor_Save2["Colors"][10].r, RangeColor_Save2["Colors"][10].g, RangeColor_Save2["Colors"][10].b); |
||
452 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][11].r, RangeColor_Save2["Colors"][11].g, RangeColor_Save2["Colors"][11].b); |
||
453 | elseif ( notEnoughMana ) then |
||
454 | icon:SetVertexColor(RangeColor_Save2["Colors"][4].r, RangeColor_Save2["Colors"][4].g, RangeColor_Save2["Colors"][4].b); |
||
455 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][5].r, RangeColor_Save2["Colors"][5].g, RangeColor_Save2["Colors"][5].b); |
||
456 | else |
||
457 | icon:SetVertexColor(RangeColor_Save2["Colors"][7].r, RangeColor_Save2["Colors"][7].g, RangeColor_Save2["Colors"][7].b); |
||
458 | normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); |
||
459 | end |
||
460 | end |
||
461 | end |
||
462 | end |
||
463 | else |
||
464 | if ( this.rangeTimer ) then |
||
465 | if ( this.rangeTimer < 0 ) then |
||
466 | if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then |
||
467 | icon:SetVertexColor(1.0, 1.0, 1.0); |
||
468 | normalTexture:SetVertexColor(1.0, 1.0, 1.0); |
||
469 | end |
||
470 | end |
||
471 | end |
||
472 | if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then |
||
473 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][3].r, RangeColor_Save2["Colors"][3].g, RangeColor_Save2["Colors"][3].b); |
||
474 | else |
||
475 | if ( isUsable ) then |
||
476 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][12].r, RangeColor_Save2["Colors"][12].g, RangeColor_Save2["Colors"][12].b); |
||
477 | elseif ( notEnoughMana ) then |
||
478 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][6].r, RangeColor_Save2["Colors"][6].g, RangeColor_Save2["Colors"][6].b); |
||
479 | else |
||
480 | hotkey:SetVertexColor(RangeColor_Save2["Colors"][9].r, RangeColor_Save2["Colors"][9].g, RangeColor_Save2["Colors"][9].b); |
||
481 | end |
||
482 | end |
||
483 | end |
||
484 | end |
||
485 |