vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --GB_Old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent; |
2 | --function UIErrorsFrame_OnEvent(event, message) |
||
3 | -- GB_Old_UIErrorsFrame_OnEvent(event, message); |
||
4 | -- if (GB_ISCASTING or GB_INSTANTCASTING) then |
||
5 | --SpellStopTargeting(); |
||
6 | -- end |
||
7 | --end |
||
8 | |||
9 | function GB_CheckForInvalidSpells() |
||
10 | local idtype, name, rank; |
||
11 | for index in GB_UNITS_ARRAY do |
||
12 | for i=1, 20 do |
||
13 | idtype = GB_Settings[GB_INDEX][index].Button[i].idType; |
||
14 | name = GB_Settings[GB_INDEX][index].Button[i].name; |
||
15 | rank = GB_Settings[GB_INDEX][index].Button[i].rank; |
||
16 | if (idtype == "spell") then |
||
17 | if (not GB_SPELLS[name][rank]) then |
||
18 | GB_Settings[GB_INDEX][index].Button[i] = GB_Get_DefaultButtonSettings(); |
||
19 | GB_ActionButton_Initialize(index, i); |
||
20 | end |
||
21 | end |
||
22 | end |
||
23 | end |
||
24 | end |
||
25 | |||
26 | function GB_DisableGB() |
||
27 | if (GB_Settings[GB_INDEX].Disable) then |
||
28 | GB_Settings[GB_INDEX] = {}; |
||
29 | GB_Settings[GB_INDEX].Disable = true; |
||
30 | GB_INITIALIZED = false; |
||
31 | for _,box in GB_CLICKBOXES do |
||
32 | getglobal(box):Hide(); |
||
33 | getglobal(box.."_Texture"):Hide(); |
||
34 | end |
||
35 | for i=1,4 do |
||
36 | local partyBar = getglobal(GB_Get_UnitBar("party"..i)); |
||
37 | local petBar = getglobal(GB_Get_UnitBar("partypet"..i)); |
||
38 | partyBar.noshow = true; |
||
39 | petBar.noshow = true; |
||
40 | partyBar:Hide(); |
||
41 | petBar:Hide(); |
||
42 | end |
||
43 | for i=1,40 do |
||
44 | local raidbar = getglobal(GB_Get_UnitBar("raid"..i)); |
||
45 | raidbar.noshow = true; |
||
46 | raidbar:Hide(); |
||
47 | end |
||
48 | GB_LowestHealthBar:Hide(); |
||
49 | GB_HostileTargetBar:Hide(); |
||
50 | GB_FriendlyTargetBar:Hide(); |
||
51 | GB_PlayerBar:Hide(); |
||
52 | else |
||
53 | GB_Settings[GB_INDEX] = {}; |
||
54 | GB_Settings[GB_INDEX].Undisable = true; |
||
55 | GB_Feedback("Reloading the UI."); |
||
56 | GB_MacroBox:SetText("/console reloadui"); |
||
57 | ChatEdit_SendText(GB_MacroBox); |
||
58 | end |
||
59 | end |
||
60 | |||
61 | function GB_Initialize() |
||
62 | if (GB_INITIALIZED) then return; end |
||
63 | |||
64 | for i=2,30 do |
||
65 | local left = getglobal("GBAuraTooltipTextLeft"..i) |
||
66 | for i,v in left do |
||
67 | if (type(v) == "function") then |
||
68 | left[i] = function() end |
||
69 | end |
||
70 | end |
||
71 | local left = getglobal("GBAuraTooltipTextRight"..i) |
||
72 | for i,v in left do |
||
73 | if (type(v) == "function") then |
||
74 | left[i] = function() end |
||
75 | end |
||
76 | end |
||
77 | end |
||
78 | for i,v in GBAuraTooltipTextLeft1 do |
||
79 | if (type(v) == "function" and i ~= "GetText" and i ~= "SetText" and i ~= "Hide" and i ~= "Show") then |
||
80 | GBAuraTooltipTextLeft1[i] = function() end |
||
81 | end |
||
82 | end |
||
83 | for i,v in GBAuraTooltipTextRight1 do |
||
84 | if (type(v) == "function" and i ~= "GetText" and i ~= "SetText" and i ~= "Hide" and i ~= "Show") then |
||
85 | GBAuraTooltipTextRight1[i] = function() end |
||
86 | end |
||
87 | end |
||
88 | |||
89 | GB_INDEX = UnitName("player").."::"..GetCVar("realmName"); |
||
90 | _,GB_PLAYER_CLASS = UnitClass("player") |
||
91 | |||
92 | GBTooltip:SetOwner(WorldFrame, "ANCHOR_NONE"); |
||
93 | GBAuraTooltip:SetOwner(WorldFrame, "ANCHOR_NONE"); |
||
94 | |||
95 | if (GB_Settings and GB_Settings[GB_INDEX]) then |
||
96 | if (GB_Settings[GB_INDEX].Disable) then |
||
97 | GB_Settings[GB_INDEX] = {}; |
||
98 | GB_Settings[GB_INDEX].Disable = true; |
||
99 | GB_MiscOptions_DisableGB:SetChecked(1); |
||
100 | GroupButtonsFrame:UnregisterEvent("BAG_UPDATE"); |
||
101 | for _,box in GB_CLICKBOXES do |
||
102 | getglobal(box):Hide(); |
||
103 | getglobal(box.."_Texture"):Hide(); |
||
104 | end |
||
105 | for i=1,4 do |
||
106 | local partyBar = getglobal(GB_Get_UnitBar("party"..i)); |
||
107 | local petBar = getglobal(GB_Get_UnitBar("partypet"..i)); |
||
108 | partyBar.noshow = true; |
||
109 | petBar.noshow = true; |
||
110 | partyBar:Hide(); |
||
111 | petBar:Hide(); |
||
112 | end |
||
113 | for i=1,40 do |
||
114 | local raidbar = getglobal(GB_Get_UnitBar("raid"..i)); |
||
115 | raidbar.noshow = true; |
||
116 | raidbar:Hide(); |
||
117 | end |
||
118 | GB_LowestHealthBar:Hide(); |
||
119 | GB_HostileTargetBar:Hide(); |
||
120 | GB_FriendlyTargetBar:Hide(); |
||
121 | GB_PlayerBar:Hide(); |
||
122 | return; |
||
123 | end |
||
124 | end |
||
125 | |||
126 | GB_Hook_Functions(); |
||
127 | |||
128 | if (GetLocale() == "deDE") then |
||
129 | if (UnitClass("player") == GB_TEXT.Shaman) then |
||
130 | GB_CURES.CurePoison.text = "Vergiftung heilen"; |
||
131 | end |
||
132 | end |
||
133 | |||
134 | GB_RaidMemberSelect1:ClearAllPoints(); |
||
135 | GB_RaidMemberSelect1:SetPoint("TOPLEFT", "GB_RaidMemberSelect", "TOPLEFT", 10, -35); |
||
136 | GB_RaidMemberSelect1_Label:SetText("Raid Member 1"); |
||
137 | local prm; |
||
138 | for i=2,20 do |
||
139 | prm = "GB_RaidMemberSelect"..(i - 1); |
||
140 | getglobal("GB_RaidMemberSelect"..i):ClearAllPoints(); |
||
141 | getglobal("GB_RaidMemberSelect"..i):SetPoint("TOPLEFT", prm, "BOTTOMLEFT", 0, 0); |
||
142 | end |
||
143 | GB_RaidMemberSelect21:ClearAllPoints(); |
||
144 | GB_RaidMemberSelect21:SetPoint("TOPLEFT", "GB_RaidMemberSelect", "TOPLEFT", 270, -35); |
||
145 | GB_RaidMemberSelect21_Label:SetText("Raid Member 21"); |
||
146 | for i=22,40 do |
||
147 | prm = "GB_RaidMemberSelect"..(i - 1); |
||
148 | getglobal("GB_RaidMemberSelect"..i):ClearAllPoints(); |
||
149 | getglobal("GB_RaidMemberSelect"..i):SetPoint("TOPLEFT", prm, "BOTTOMLEFT", 0, 0); |
||
150 | end |
||
151 | |||
152 | if (not GB_Settings) then |
||
153 | GB_Settings = {}; |
||
154 | end |
||
155 | |||
156 | if (not GB_Settings[GB_INDEX]) then |
||
157 | GB_Initialize_DefaultSettings(); |
||
158 | elseif (GB_Settings[GB_INDEX].Undisable) then |
||
159 | GB_Initialize_DefaultSettings(); |
||
160 | end |
||
161 | |||
162 | GB_Initialize_NewSettings(); |
||
163 | GB_INITIALIZED = true; |
||
164 | |||
165 | if (DUF_TargetOfTargetFrame) then |
||
166 | GB_Settings[GB_INDEX].hideClickboxes = true; |
||
167 | end |
||
168 | |||
169 | GB_Update_FrameLocations(); |
||
170 | GB_UnitFrames_Initialize(); |
||
171 | GB_Update_Spells(); |
||
172 | GB_Update_InventoryItems(); |
||
173 | GB_Update_ContainerItems(1); |
||
174 | GB_Update_Macros(); |
||
175 | GB_CheckForInvalidSpells(); |
||
176 | GB_Spellbook_Initialize(); |
||
177 | GB_Initialize_BarOptions("player"); |
||
178 | GB_Initialize_Labels(); |
||
179 | GB_Initialize_Toggles(); |
||
180 | GB_Initialize_AllBars(); |
||
181 | GB_Initialize_Menus(); |
||
182 | GB_Initialize_AnnounceOptions(); |
||
183 | GB_Initialize_ThresholdsOptions(); |
||
184 | GB_Initialize_MiscOptions(); |
||
185 | GB_Update_Bindings(); |
||
186 | GB_Update_RaidMemberSelect(); |
||
187 | GB_Bars_Raise(); |
||
188 | |||
189 | if (not GB_Get("partypet", "hide")) then |
||
190 | if (UnitName("pet")) then |
||
191 | GB_PetBar0:Show(); |
||
192 | end |
||
193 | end |
||
194 | for i=1, GetNumPartyMembers() do |
||
195 | getglobal("GB_PartyBar"..i).noshow = false; |
||
196 | GB_LowestHealthBar.noshow = false; |
||
197 | if (not GB_Get("party", "hide")) then |
||
198 | getglobal("GB_PartyBar"..i):Show(); |
||
199 | if (not GB_Get("partypet", "hide")) then |
||
200 | if (UnitName("partypet"..i)) then |
||
201 | getglobal("GB_PetBar"..i).noshow = false; |
||
202 | getglobal("GB_PetBar"..i):Show(); |
||
203 | end |
||
204 | end |
||
205 | end |
||
206 | if (not GB_Get("lowesthealth", "hide")) then |
||
207 | GB_LowestHealthBar:Show(); |
||
208 | end |
||
209 | end |
||
210 | |||
211 | if (not GB_Settings[GB_INDEX].Disable) then |
||
212 | GB_Initialize_AllBars(); |
||
213 | end |
||
214 | |||
215 | if (not GB_Settings[GB_INDEX].Disable) then |
||
216 | for _,box in GB_CLICKBOXES do |
||
217 | getglobal(box):Hide(); |
||
218 | getglobal(box.."_Texture"):Hide(); |
||
219 | end |
||
220 | if (not GB_Get("hideClickboxes")) then |
||
221 | GB_PlayerClickbox:Show(); |
||
222 | if (UnitName("target")) then |
||
223 | GB_TargetClickbox:Show(); |
||
224 | end |
||
225 | if (UnitName("pet")) then |
||
226 | GB_Pet0Clickbox:Show(); |
||
227 | end |
||
228 | for i=1,GetNumPartyMembers() do |
||
229 | getglobal("GB_Party"..i.."Clickbox"):Show(); |
||
230 | if (UnitName("partypet"..i)) then |
||
231 | getglobal("GB_Pet"..i.."Clickbox"):Show(); |
||
232 | end |
||
233 | end |
||
234 | end |
||
235 | end |
||
236 | end |
||
237 | |||
238 | function GB_Initialize_NewSettings() |
||
239 | if (not GB_Settings[GB_INDEX].HealingBonus) then |
||
240 | GB_Settings[GB_INDEX].HealingBonus = 0; |
||
241 | end |
||
242 | |||
243 | if (not GB_Settings[GB_INDEX].Initialized["4.11"]) then |
||
244 | GB_Settings[GB_INDEX].disablePartyRange = true; |
||
245 | end |
||
246 | |||
247 | if (not GB_Settings[GB_INDEX].Initialized["4.3"]) then |
||
248 | for bar in GB_UNITS_ARRAY do |
||
249 | if (GB_Settings[GB_INDEX][bar]) then |
||
250 | GB_Settings[GB_INDEX][bar].oldLeftClick = "l"; |
||
251 | GB_Settings[GB_INDEX][bar].oldRightClick = "r"; |
||
252 | for i = 1, GB_UNITS_ARRAY[bar].buttons do |
||
253 | if (GB_Settings[GB_INDEX][bar].Button[i].preventOverhealing) then |
||
254 | GB_Settings[GB_INDEX][bar].Button[i].cancelHeal = true; |
||
255 | else |
||
256 | GB_Settings[GB_INDEX][bar].Button[i].cancelHeal = false; |
||
257 | end |
||
258 | end |
||
259 | end |
||
260 | end |
||
261 | end |
||
262 | |||
263 | if (not GB_Settings[GB_INDEX].Initialized["4.5"]) then |
||
264 | GB_Settings[GB_INDEX].frameLocs = {}; |
||
265 | GB_Settings[GB_INDEX].partypet = { |
||
266 | Button = {}, |
||
267 | alpha = 1, |
||
268 | buttonSize = 30, |
||
269 | hide = false, |
||
270 | rows = 1, |
||
271 | collapse = false, |
||
272 | spacing = 0, |
||
273 | attach = false, |
||
274 | attachPoint = "TOPLEFT", |
||
275 | attachTo = "BOTTOMLEFT", |
||
276 | xoffset = 0, |
||
277 | yoffset = 0, |
||
278 | mouseover = false, |
||
279 | clickCast = {}, |
||
280 | Clickbox = { x1=0, x2=0, y1=0, y2=0 }, |
||
281 | oldLeftClick = "l", |
||
282 | oldRightClick = "r" |
||
283 | }; |
||
284 | GB_Settings[GB_INDEX].raid = { |
||
285 | Button = {}, |
||
286 | alpha = 1, |
||
287 | buttonSize = 30, |
||
288 | hide = false, |
||
289 | rows = 1, |
||
290 | collapse = false, |
||
291 | spacing = 0, |
||
292 | attach = false, |
||
293 | attachPoint = "TOPLEFT", |
||
294 | attachTo = "BOTTOMLEFT", |
||
295 | xoffset = 0, |
||
296 | yoffset = 0, |
||
297 | mouseover = false, |
||
298 | clickCast = {}, |
||
299 | Clickbox = { x1=0, x2=0, y1=0, y2=0 }, |
||
300 | oldLeftClick = "l", |
||
301 | oldRightClick = "r" |
||
302 | }; |
||
303 | for i=1, 20 do |
||
304 | GB_Settings[GB_INDEX].partypet.Button[i] = GB_Get_DefaultButtonSettings(); |
||
305 | GB_Settings[GB_INDEX].raid.Button[i] = GB_Get_DefaultButtonSettings(); |
||
306 | GB_Settings[GB_INDEX].party.Button[i].OOCoption = "hide"; |
||
307 | GB_Settings[GB_INDEX].friendlytarget.Button[i].OOCoption = "hide"; |
||
308 | GB_Settings[GB_INDEX].hostiletarget.Button[i].OOCoption = "hide"; |
||
309 | GB_Settings[GB_INDEX].player.Button[i].OOCoption = "hide"; |
||
310 | GB_Settings[GB_INDEX].lowesthealth.Button[i].OOCoption = "hide"; |
||
311 | end |
||
312 | end |
||
313 | |||
314 | if (not GB_Settings[GB_INDEX].Initialized["4.6"]) then |
||
315 | GB_Settings[GB_INDEX].OOMcolor = {r=.2, g=.2, b=1}; |
||
316 | GB_Settings[GB_INDEX].OORcolor = {r=1, g=.2, b=.2}; |
||
317 | GB_Settings[GB_INDEX].greycolor = {r=.4, g=.4, b=.4}; |
||
318 | end |
||
319 | |||
320 | if (not GB_Settings[GB_INDEX].Initialized["4.7"]) then |
||
321 | GB_Settings[GB_INDEX].announcements[4] = ""; |
||
322 | GB_Settings[GB_INDEX].announcements[5] = ""; |
||
323 | GB_Settings[GB_INDEX].pet = {}; |
||
324 | GB_Copy_Table(GB_Settings[GB_INDEX].partypet, GB_Settings[GB_INDEX].pet); |
||
325 | end |
||
326 | |||
327 | if (not GB_Settings[GB_INDEX].Initialized["4.95"]) then |
||
328 | GB_Settings[GB_INDEX].modifybyUIscale = true; |
||
329 | GB_Settings[GB_INDEX].announceChannel = ""; |
||
330 | end |
||
331 | |||
332 | if (not GB_Settings[GB_INDEX].announceChannel) then |
||
333 | GB_Settings[GB_INDEX].announceChannel = ""; |
||
334 | end |
||
335 | |||
336 | GB_Settings[GB_INDEX].Initialized["4.95"] = true; |
||
337 | GB_Settings[GB_INDEX].Initialized["4.7"] = true; |
||
338 | GB_Settings[GB_INDEX].Initialized["4.6"] = true; |
||
339 | GB_Settings[GB_INDEX].Initialized["4.5"] = true; |
||
340 | GB_Settings[GB_INDEX].Initialized["4.3"] = true; |
||
341 | GB_Settings[GB_INDEX].Initialized["4.11"] = true; |
||
342 | end |
||
343 | |||
344 | function GB_Initialize_AnchorsMenu() |
||
345 | local width = 0; |
||
346 | for i=1,9 do |
||
347 | local optiontext = getglobal("GB_Menu_Anchors_Option"..i.."_Text"); |
||
348 | optiontext:SetText(GB_ANCHOR_POINTS[i].text); |
||
349 | getglobal("GB_Menu_Anchors_Option"..i).value = GB_ANCHOR_POINTS[i].value; |
||
350 | if (optiontext:GetWidth() > width) then |
||
351 | width = optiontext:GetWidth(); |
||
352 | end |
||
353 | end |
||
354 | for i=1,9 do |
||
355 | getglobal("GB_Menu_Anchors_Option"..i):SetWidth(width); |
||
356 | end |
||
357 | GB_Menu_Anchors:SetWidth(width + 20); |
||
358 | end |
||
359 | |||
360 | function GB_Initialize_AnnounceNumMenu() |
||
361 | for i=1,5 do |
||
362 | getglobal("GB_Menu_Announce_Option"..i.."_Text"):SetText(i); |
||
363 | getglobal("GB_Menu_Announce_Option"..i):SetWidth(20); |
||
364 | end |
||
365 | GB_Menu_Announce:SetWidth(30); |
||
366 | end |
||
367 | |||
368 | function GB_Initialize_AnnounceOptions() |
||
369 | GB_AnnounceOptions_Text1:SetText(GB_Settings[GB_INDEX].announcements[1]); |
||
370 | GB_AnnounceOptions_Text2:SetText(GB_Settings[GB_INDEX].announcements[2]); |
||
371 | GB_AnnounceOptions_Text3:SetText(GB_Settings[GB_INDEX].announcements[3]); |
||
372 | GB_AnnounceOptions_Text4:SetText(GB_Settings[GB_INDEX].announcements[4]); |
||
373 | GB_AnnounceOptions_Text5:SetText(GB_Settings[GB_INDEX].announcements[5]); |
||
374 | GB_AnnounceOptions_FailedText:SetText(GB_Get("failedText")); |
||
375 | GB_AnnounceOptions_InterruptedText:SetText(GB_Get("interruptedText")); |
||
376 | if (not GB_Settings[GB_INDEX].announceChannel) then |
||
377 | GB_Settings[GB_INDEX].announceChannel = ""; |
||
378 | end |
||
379 | GB_AnnounceOptions_AnnounceChannel:SetText(GB_Get("announceChannel")); |
||
380 | if (GB_Get("announceInterrupted")) then |
||
381 | GB_AnnounceOptions_AnnounceInterrupts:SetChecked(1); |
||
382 | end |
||
383 | if (GB_Get("sendToChannel")) then |
||
384 | GB_AnnounceOptions_SendToChannel:SetChecked(1); |
||
385 | end |
||
386 | if (GB_Get("announceFailed")) then |
||
387 | GB_AnnounceOptions_AnnounceFailures:SetChecked(1); |
||
388 | end |
||
389 | if (GB_Get("doNotUseSay")) then |
||
390 | GB_AnnounceOptions_DoNotUseSay:SetChecked(1); |
||
391 | end |
||
392 | if (GB_Get("doNotUseParty")) then |
||
393 | GB_AnnounceOptions_DoNotUseParty:SetChecked(1); |
||
394 | end |
||
395 | if (GB_Get("doNotUseRaid")) then |
||
396 | GB_AnnounceOptions_DoNotUseRaid:SetChecked(1); |
||
397 | end |
||
398 | if (GB_Get("doNotAnnounceSolo")) then |
||
399 | GB_AnnounceOptions_DoNotAnnounceSolo:SetChecked(1); |
||
400 | end |
||
401 | if (GB_Get("announceDisabled")) then |
||
402 | GB_AnnounceOptions_TurnOffAllAnnouncements:SetChecked(1); |
||
403 | end |
||
404 | end |
||
405 | |||
406 | function GB_Initialize_ClickboxMenu() |
||
407 | local width = 0; |
||
408 | for i, v in GB_CLICKBOX_MENU do |
||
409 | local option = getglobal("GB_Menu_Clickboxes_Option"..i); |
||
410 | option.index = v.value; |
||
411 | getglobal(option:GetName().."_Text"):SetText(v.text); |
||
412 | local textwidth = getglobal(option:GetName().."_Text"):GetWidth(); |
||
413 | if (textwidth > width) then |
||
414 | width = textwidth; |
||
415 | end |
||
416 | end |
||
417 | for i=1,5 do |
||
418 | getglobal("GB_Menu_Clickboxes_Option"..i):SetWidth(width); |
||
419 | end |
||
420 | GB_Menu_Clickboxes:SetWidth(width + 20); |
||
421 | end |
||
422 | |||
423 | function GB_Initialize_ContextMenu() |
||
424 | local width = 0; |
||
425 | for i, value in GB_CONTEXTS do |
||
426 | local option = getglobal("GB_Menu_Contexts_Option"..i); |
||
427 | option.index = value.index; |
||
428 | getglobal(option:GetName().."_Text"):SetText(value.text); |
||
429 | local textwidth = getglobal(option:GetName().."_Text"):GetWidth(); |
||
430 | if (textwidth > width) then |
||
431 | width = textwidth; |
||
432 | end |
||
433 | end |
||
434 | for i=1,15 do |
||
435 | getglobal("GB_Menu_Contexts_Option"..i):SetWidth(width); |
||
436 | end |
||
437 | GB_Menu_Contexts:SetWidth(width + 20); |
||
438 | end |
||
439 | |||
440 | function GB_Initialize_CopyBarMenu() |
||
441 | local width = 0; |
||
442 | for i,v in GB_COPYBAR_MENU do |
||
443 | getglobal("GB_Menu_CopyBar_Option"..i).value = v.value; |
||
444 | local option = getglobal("GB_Menu_CopyBar_Option"..i.."_Text"); |
||
445 | option:SetText(v.text); |
||
446 | if (option:GetWidth() > width) then |
||
447 | width = option:GetWidth(); |
||
448 | end |
||
449 | end |
||
450 | for i=1,5 do |
||
451 | getglobal("GB_Menu_CopyBar_Option"..i):SetWidth(width); |
||
452 | end |
||
453 | GB_Menu_CopyBar:SetWidth(width + 20); |
||
454 | end |
||
455 | |||
456 | function GB_Initialize_DefaultSettings() |
||
457 | GB_Settings[GB_INDEX] = { |
||
458 | Initialized = { ["4.0"] = true }, |
||
459 | barsLocked = true, |
||
460 | buttonsLocked = true, |
||
461 | showLabels = false, |
||
462 | showEmpty = false, |
||
463 | hideAllBlessings = false, |
||
464 | hideClickboxes = false, |
||
465 | hideBaseBindings = false, |
||
466 | hideDynamicBindings = false, |
||
467 | healthThresholds = {0,0,0,0}, |
||
468 | manaThreshold = 0, |
||
469 | aeThreshold = 0, |
||
470 | numPastAEThreshold = 3, |
||
471 | POthreshold = 0, |
||
472 | cancelHealThreshold = 0, |
||
473 | announcements = { GB_DEFAULT_ANNOUNCE_TEXT, "", "" }, |
||
474 | announceFailed = true, |
||
475 | announceInterrupted = true, |
||
476 | failedText = GB_TEXT.DefaultFailedText, |
||
477 | interruptedText = GB_TEXT.DefaultInterruptedText, |
||
478 | doNotUseSay = true, |
||
479 | doNotUseParty = false, |
||
480 | doNotUseRaid = false, |
||
481 | disableTooltip = false, |
||
482 | dontAttack = false, |
||
483 | dontTargetPet = false, |
||
484 | disableGBSpam = false, |
||
485 | disableCantDoYetSpam = false, |
||
486 | disableActionInProgressSpam = false, |
||
487 | disableOutOfRangeSpam = false, |
||
488 | announceDisabled = false, |
||
489 | Undisable = nil |
||
490 | }; |
||
491 | for unit in GB_UNITS_ARRAY do |
||
492 | GB_Settings[GB_INDEX][unit] = { |
||
493 | Button = {}, |
||
494 | alpha = 1, |
||
495 | buttonSize = 30, |
||
496 | hide = false, |
||
497 | rows = 1, |
||
498 | collapse = false, |
||
499 | spacing = 0, |
||
500 | attach = false, |
||
501 | attachPoint = "TOPLEFT", |
||
502 | attachTo = "BOTTOMLEFT", |
||
503 | xoffset = 0, |
||
504 | yoffset = 0, |
||
505 | mouseover = false, |
||
506 | clickCast = {}, |
||
507 | Clickbox = { x1=0, x2=0, y1=0, y2=0 } |
||
508 | }; |
||
509 | for i=1, 20 do |
||
510 | GB_Settings[GB_INDEX][unit].Button[i] = GB_Get_DefaultButtonSettings(); |
||
511 | end |
||
512 | end |
||
513 | end |
||
514 | |||
515 | function GB_Initialize_FormsMenu() |
||
516 | local numForms = GetNumShapeshiftForms(); |
||
517 | getglobal("GB_Menu_Forms_Option0_Text"):SetText(GB_TEXT.NoForm); |
||
518 | local width = getglobal("GB_Menu_Forms_Option0_Text"):GetWidth(); |
||
519 | for i=1, 10 do |
||
520 | local option = getglobal("GB_Menu_Forms_Option"..i.."_Text"); |
||
521 | if (i > numForms) then |
||
522 | getglobal("GB_Menu_Forms_Option"..i):Hide(); |
||
523 | else |
||
524 | local _, name = GetShapeshiftFormInfo(i); |
||
525 | option:SetText(name); |
||
526 | if (option:GetWidth() > width) then |
||
527 | width = option:GetWidth() |
||
528 | end |
||
529 | end |
||
530 | end |
||
531 | for i=0, 10 do |
||
532 | getglobal("GB_Menu_Forms_Option"..i):SetWidth(width); |
||
533 | end |
||
534 | getglobal("GB_Menu_Forms_Option99"):SetWidth(width); |
||
535 | if (width == 0) then |
||
536 | width = 50; |
||
537 | numForms = 1; |
||
538 | end |
||
539 | GB_Menu_Forms:SetWidth(width + 20); |
||
540 | GB_Menu_Forms:SetHeight((numForms + 2) * 15 + 20); |
||
541 | end |
||
542 | |||
543 | function GB_Initialize_Labels() |
||
544 | local label, labeltext, text, name; |
||
545 | for unit, value in GB_UNITS_ARRAY do |
||
546 | for index in value.frames do |
||
547 | label = getglobal(value.frames[index].."_Label"); |
||
548 | labeltext = getglobal(value.frames[index].."_Label_Text"); |
||
549 | text = value.labels[index]; |
||
550 | if (unit == "raid") then |
||
551 | name = UnitName("raid"..index); |
||
552 | if (name) then |
||
553 | text = name; |
||
554 | end |
||
555 | end |
||
556 | labeltext:SetText(text); |
||
557 | label:SetWidth(labeltext:GetWidth() + 10); |
||
558 | end |
||
559 | end |
||
560 | end |
||
561 | |||
562 | function GB_Initialize_Menus() |
||
563 | GB_Initialize_AnchorsMenu(); |
||
564 | GB_Initialize_AnnounceNumMenu(); |
||
565 | GB_Initialize_ClickboxMenu(); |
||
566 | GB_Initialize_ContextMenu(); |
||
567 | GB_Initialize_CopyBarMenu(); |
||
568 | GB_Initialize_FormsMenu(); |
||
569 | GB_Initialize_NumPartyMenu(); |
||
570 | GB_Initialize_OutOfContextMenu(); |
||
571 | end |
||
572 | |||
573 | function GB_Initialize_MiscOptions() |
||
574 | if (GB_Get("dontAttack")) then |
||
575 | GB_MiscOptions_DoNotAttack:SetChecked(1); |
||
576 | end |
||
577 | if (GB_Get("dontTargetPet")) then |
||
578 | GB_MiscOptions_DoNotTargetPet:SetChecked(1); |
||
579 | end |
||
580 | if (GB_Get("disableTooltip")) then |
||
581 | GB_MiscOptions_DisableTooltip:SetChecked(1); |
||
582 | end |
||
583 | if (GB_Get("disableGBSpam")) then |
||
584 | GB_MiscOptions_DisableGroupButtonsSpam:SetChecked(1); |
||
585 | end |
||
586 | if (GB_Get("disableCantDoYetSpam")) then |
||
587 | GB_MiscOptions_DisableCantDoYetSpam:SetChecked(1); |
||
588 | end |
||
589 | if (GB_Get("disableActionInProgressSpam")) then |
||
590 | GB_MiscOptions_DisableActionInProgressSpam:SetChecked(1); |
||
591 | end |
||
592 | if (GB_Get("disableOutOfRangeSpam")) then |
||
593 | GB_MiscOptions_DisableOutOfRangeSpam:SetChecked(1); |
||
594 | end |
||
595 | if (GB_Get("hideBaseBindings")) then |
||
596 | GB_MiscOptions_HideBaseKeybindings:SetChecked(1); |
||
597 | end |
||
598 | if (GB_Get("hideDynamicBindings")) then |
||
599 | GB_MiscOptions_HideDynamicKeybindings:SetChecked(1); |
||
600 | end |
||
601 | if (GB_Get("disablePartyRange")) then |
||
602 | GB_MiscOptions_DisablePartyRange:SetChecked(1); |
||
603 | end |
||
604 | if (GB_Get("includePets")) then |
||
605 | GB_MiscOptions_IncludePets:SetChecked(1); |
||
606 | end |
||
607 | if (GB_Get("includeRaid")) then |
||
608 | GB_MiscOptions_IncludeRaid:SetChecked(1); |
||
609 | end |
||
610 | if (GB_Get("showCooldown")) then |
||
611 | GB_MiscOptions_ShowCooldown:SetChecked(1); |
||
612 | end |
||
613 | if (GB_Get("applyPOonCtrl")) then |
||
614 | GB_MiscOptions_ApplyPOonCtrl:SetChecked(1); |
||
615 | end |
||
616 | if (GB_Get("hideInRaid")) then |
||
617 | GB_MiscOptions_HideInRaid:SetChecked(1); |
||
618 | end |
||
619 | if (GB_Get("changeTarget")) then |
||
620 | GB_MiscOptions_ChangeTarget:SetChecked(1); |
||
621 | end |
||
622 | if (GB_Get("modifybyUIscale")) then |
||
623 | GB_MiscOptions_ModifyByUIScale:SetChecked(1); |
||
624 | end |
||
625 | if (GB_Get("autoleaveform")) then |
||
626 | GB_MiscOptions_AutoCancelForm:SetChecked(1); |
||
627 | end |
||
628 | if (GB_Get("limitlhrange")) then |
||
629 | GB_MiscOptions_LimitLHRange:SetChecked(1); |
||
630 | end |
||
631 | if (GB_Get("limitaerange")) then |
||
632 | GB_MiscOptions_LimitARange:SetChecked(1); |
||
633 | end |
||
634 | GB_MiscOptions_OORColor:SetBackdropColor(GB_Settings[GB_INDEX].OORcolor.r, GB_Settings[GB_INDEX].OORcolor.g, GB_Settings[GB_INDEX].OORcolor.b); |
||
635 | GB_MiscOptions_OOMColor:SetBackdropColor(GB_Settings[GB_INDEX].OOMcolor.r, GB_Settings[GB_INDEX].OOMcolor.g, GB_Settings[GB_INDEX].OOMcolor.b); |
||
636 | GB_MiscOptions_GreyColor:SetBackdropColor(GB_Settings[GB_INDEX].greycolor.r, GB_Settings[GB_INDEX].greycolor.g, GB_Settings[GB_INDEX].greycolor.b); |
||
637 | GB_MiscOptions_HealingBonus:SetText(GB_Settings[GB_INDEX].HealingBonus); |
||
638 | end |
||
639 | |||
640 | function GB_Initialize_NumPartyMenu() |
||
641 | for i=1,5 do |
||
642 | getglobal("GB_Menu_NumParty_Option"..i.."_Text"):SetText(i); |
||
643 | getglobal("GB_Menu_NumParty_Option"..i):SetWidth(30); |
||
644 | end |
||
645 | GB_Menu_NumParty:SetWidth(30); |
||
646 | end |
||
647 | |||
648 | function GB_Initialize_OutOfContextMenu() |
||
649 | local width = 0; |
||
650 | for i=1,3 do |
||
651 | local optiontext = getglobal("GB_Menu_OutOfContext_Option"..i.."_Text"); |
||
652 | optiontext:SetText(GB_OOC_MENU[i].text); |
||
653 | getglobal("GB_Menu_OutOfContext_Option"..i).value = GB_OOC_MENU[i].value; |
||
654 | if (optiontext:GetWidth() > width) then |
||
655 | width = optiontext:GetWidth(); |
||
656 | end |
||
657 | end |
||
658 | for i=1,3 do |
||
659 | getglobal("GB_Menu_OutOfContext_Option"..i):SetWidth(width); |
||
660 | end |
||
661 | GB_Menu_OutOfContext:SetWidth(width + 20); |
||
662 | end |
||
663 | |||
664 | function GB_Initialize_ThresholdsOptions() |
||
665 | GB_ThresholdsOptions_HealthThreshold1:SetText(GB_Settings[GB_INDEX].healthThresholds[1]); |
||
666 | GB_ThresholdsOptions_HealthThreshold2:SetText(GB_Settings[GB_INDEX].healthThresholds[2]); |
||
667 | GB_ThresholdsOptions_HealthThreshold3:SetText(GB_Settings[GB_INDEX].healthThresholds[3]); |
||
668 | GB_ThresholdsOptions_HealthThreshold4:SetText(GB_Settings[GB_INDEX].healthThresholds[4]); |
||
669 | GB_ThresholdsOptions_ManaThreshold:SetText(GB_Get("manaThreshold")); |
||
670 | GB_ThresholdsOptions_AreaHealThreshold:SetText(GB_Get("aeThreshold")); |
||
671 | GB_ThresholdsOptions_NumPartyToCheck_Setting:SetText(GB_Get("numPastAEThreshold")); |
||
672 | GB_ThresholdsOptions_CancelHealThreshold:SetText(GB_Get("cancelHealThreshold")); |
||
673 | end |
||
674 | |||
675 | function GB_Initialize_Toggles() |
||
676 | if (not GB_Get("barsLocked")) then |
||
677 | GB_LockBars_Button:SetText(GB_TEXT.LockBars); |
||
678 | end |
||
679 | if (not GB_Get("buttonsLocked")) then |
||
680 | GB_LockButtons_Button:SetText(GB_TEXT.LockButtons); |
||
681 | end |
||
682 | if (GB_Get("showEmpty")) then |
||
683 | GB_ShowEmpty_Button:SetText(GB_TEXT.HideEmpty); |
||
684 | end |
||
685 | if (GB_Get("showLabels")) then |
||
686 | GB_Labels_Show(); |
||
687 | GB_ShowLabels_Button:SetText(GB_TEXT.HideLabels); |
||
688 | end |
||
689 | if (GB_Get("hideClickboxes")) then |
||
690 | GB_Set("hideClickboxes", false); |
||
691 | GB_Toggle_Clickboxes(); |
||
692 | end |
||
693 | end |
||
694 | |||
695 | function GB_Parse_Tooltip(filter) |
||
696 | local value; |
||
697 | for i = 1, 30 do |
||
698 | local textleft = getglobal("GBTooltipTextLeft"..i):GetText(); |
||
699 | local textright = getglobal("GBTooltipTextRight"..i):GetText(); |
||
700 | local text; |
||
701 | if (textleft and textright) then |
||
702 | text = textleft.." "..textright |
||
703 | elseif (textleft) then |
||
704 | text = textleft |
||
705 | elseif (textright) then |
||
706 | text = textright |
||
707 | end |
||
708 | if (text) then |
||
709 | _,_,value = string.find(text, filter); |
||
710 | end |
||
711 | if (value) then break; end |
||
712 | end |
||
713 | return value; |
||
714 | end |
||
715 | |||
716 | function GB_RegisterWithMyAddons() |
||
717 | if (myAddOnsFrame) then |
||
718 | myAddOnsList.GroupButtons = { |
||
719 | name = "Group Buttons", |
||
720 | description = "Adds hotbars connected to different targets", |
||
721 | version = GB_VERSION, |
||
722 | category = MYADDONS_CATEGORY_BARS, |
||
723 | frame = "GroupButtonsFrame", |
||
724 | optionsframe = "GB_Options"}; |
||
725 | end |
||
726 | end |
||
727 | |||
728 | function GB_Update_ContainerItems(counttoggle) |
||
729 | if (not GB_INITIALIZED) then return; end |
||
730 | GB_ITEMS = {}; |
||
731 | for bag = 0, 4 do |
||
732 | local bagslots = GetContainerNumSlots(bag); |
||
733 | if (bagslots) then |
||
734 | for slot = 1, bagslots do |
||
735 | local itemName = GB_Get_ItemName(bag, slot); |
||
736 | if (itemName) then |
||
737 | GB_ITEMS[itemName] = { bag = bag, slot = slot}; |
||
738 | end |
||
739 | end |
||
740 | end |
||
741 | end |
||
742 | if (not counttoggle) then |
||
743 | for bar in GB_UNITS_ARRAY do |
||
744 | for button = 1, 20 do |
||
745 | local idType = GB_Settings[GB_INDEX][bar].Button[button].idType; |
||
746 | local name = GB_Settings[GB_INDEX][bar].Button[button].name; |
||
747 | if (idType == "inv" and (not GB_INVENTORY[name])) then |
||
748 | if (GB_ITEMS[name]) then |
||
749 | GB_Settings[GB_INDEX][bar].Button[button].idType = "item"; |
||
750 | else |
||
751 | GB_Settings[GB_INDEX][bar].Button[button] = GB_Get_DefaultButtonSettings(); |
||
752 | end |
||
753 | elseif (idType == "item" and (not GB_ITEMS[name])) then |
||
754 | if (GB_INVENTORY[name]) then |
||
755 | GB_Settings[GB_INDEX][bar].Button[button].idType = "inv"; |
||
756 | else |
||
757 | GB_Settings[GB_INDEX][bar].Button[button] = GB_Get_DefaultButtonSettings(); |
||
758 | end |
||
759 | end |
||
760 | if (idType == "item" or idType == "inv") then |
||
761 | GB_ActionButton_SetCount(bar, button); |
||
762 | end |
||
763 | end |
||
764 | end |
||
765 | end |
||
766 | end |
||
767 | |||
768 | function GB_Update_FrameLocations() |
||
769 | for frame, offset in GB_Settings[GB_INDEX].frameLocs do |
||
770 | getglobal(frame):ClearAllPoints(); |
||
771 | getglobal(frame):SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", offset.x, offset.y); |
||
772 | end |
||
773 | end |
||
774 | |||
775 | function GB_Update_InventoryItems() |
||
776 | if (not GB_INITIALIZED) then return; end |
||
777 | GB_INVENTORY = {}; |
||
778 | local slots = { "HeadSlot", "NeckSlot", "ShoulderSlot", "BackSlot", "ChestSlot", "ShirtSlot", "TabardSlot", "WristSlot", "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "Finger0Slot", "Finger1Slot", "Trinket0Slot", "Trinket1Slot", "MainHandSlot", "SecondaryHandSlot", "RangedSlot", "AmmoSlot" }; |
||
779 | for _,slot in slots do |
||
780 | local slotId, texture = GetInventorySlotInfo(slot); |
||
781 | local name = GB_Get_ItemName(slotId); |
||
782 | if (name) then |
||
783 | local count = GetInventoryItemCount("player", slotId); |
||
784 | GB_INVENTORY[name] = { slot = slot, id = slotId, texture = texture, count = count }; |
||
785 | end |
||
786 | end |
||
787 | end |
||
788 | |||
789 | function GB_Update_Macros() |
||
790 | GB_MACROS = {}; |
||
791 | local base, character = GetNumMacros(); |
||
792 | for i=1, base do |
||
793 | local name, texture, body = GetMacroInfo(i); |
||
794 | if (name) then |
||
795 | GB_MACROS[name] = { id=i, texture = texture, body = body }; |
||
796 | end |
||
797 | end |
||
798 | for i=19, 18 + character do |
||
799 | local name, texture, body = GetMacroInfo(i); |
||
800 | if (name) then |
||
801 | GB_MACROS[name] = { id=i, texture = texture, body = body }; |
||
802 | end |
||
803 | end |
||
804 | end |
||
805 | |||
806 | function GB_Update_RaidMemberSelect() |
||
807 | local unit, rms, name, class, level, fileName, color; |
||
808 | for i=1,40 do |
||
809 | unit = "raid"..i; |
||
810 | rms = "GB_RaidMemberSelect"..i; |
||
811 | if (UnitExists(unit) and UnitName(unit)) then |
||
812 | getglobal(rms):Show(); |
||
813 | name = UnitName(unit); |
||
814 | _, _, _, level, class, fileName = GetRaidRosterInfo(i); |
||
815 | color = RAID_CLASS_COLORS[fileName]; |
||
816 | if (color) then |
||
817 | getglobal(rms.."_Label"):SetTextColor(color.r, color.g, color.b); |
||
818 | end |
||
819 | if (not level) then level = ""; end |
||
820 | if (not class) then class = ""; end |
||
821 | getglobal(rms.."_Label"):SetText(name.." ("..level.." "..class..")"); |
||
822 | if (GB_RAID_MEMBERS[name]) then |
||
823 | getglobal(rms):SetChecked(1); |
||
824 | else |
||
825 | getglobal(rms):SetChecked(0); |
||
826 | end |
||
827 | else |
||
828 | getglobal(rms):Hide(); |
||
829 | end |
||
830 | end |
||
831 | GB_RAID_MEMBERS = {nil}; |
||
832 | for i=1,GetNumRaidMembers() do |
||
833 | rms = getglobal("GB_RaidMemberSelect"..i); |
||
834 | if (rms:GetChecked()) then |
||
835 | if (UnitName("raid"..i)) then |
||
836 | GB_RAID_MEMBERS[UnitName("raid"..i)] = true; |
||
837 | else |
||
838 | rms:SetChecked(0); |
||
839 | end |
||
840 | end |
||
841 | end |
||
842 | end |
||
843 | |||
844 | function GB_Update_Spells(forceupdate) |
||
845 | if (not GB_INITIALIZED) then return; end |
||
846 | local spellID = 1; |
||
847 | while true do |
||
848 | local spellName, spellRank = GetSpellName(spellID, BOOKTYPE_SPELL); |
||
849 | if not spellName then |
||
850 | do break end |
||
851 | end |
||
852 | |||
853 | local skipspell; |
||
854 | if (not GB_SPELLS[spellName]) then |
||
855 | GB_SPELLS[spellName] = {}; |
||
856 | elseif (GB_SPELLS[spellName][spellRank]) then |
||
857 | GB_SPELLS[spellName][spellRank].id = spellID; |
||
858 | skipspell = 1; |
||
859 | end |
||
860 | if (forceupdate or (not skipspell)) then |
||
861 | local spellMana, spellRage, spellEnergy, spellType, spellMin, spellMax, spellCastingTime, spellAvg, spellDuration, otamt; |
||
862 | |||
863 | GBTooltip:SetSpell(spellID, SpellBookFrame.bookType); |
||
864 | local textleft, textright, text; |
||
865 | for i = 1, 30 do |
||
866 | if (getglobal("GBTooltipTextLeft"..i):IsShown()) then |
||
867 | textleft = getglobal("GBTooltipTextLeft"..i):GetText(); |
||
868 | else |
||
869 | textleft = nil; |
||
870 | end |
||
871 | if (getglobal("GBTooltipTextRight"..i):IsShown()) then |
||
872 | textright = getglobal("GBTooltipTextRight"..i):GetText(); |
||
873 | else |
||
874 | textright = nil; |
||
875 | end |
||
876 | if (textleft and textright) then |
||
877 | text = textleft.." "..textright |
||
878 | elseif (textleft) then |
||
879 | text = textleft |
||
880 | elseif (textright) then |
||
881 | text = textright |
||
882 | end |
||
883 | if (text) then |
||
884 | if (not spellMana) then |
||
885 | _,_,spellMana = string.find(text, GB_FILTERS.Mana); |
||
886 | end |
||
887 | if (not spellRage) then |
||
888 | _,_,spellRage = string.find(text, GB_FILTERS.Rage); |
||
889 | end |
||
890 | if (not spellEnergy) then |
||
891 | _,_,spellEnergy = string.find(text, GB_FILTERS.Energy); |
||
892 | end |
||
893 | if (not spellMin) then |
||
894 | _,_,spellMin,spellMax = string.find(text, GB_FILTERS.To); |
||
895 | if (spellMin and spellMax) then |
||
896 | string.gsub(spellMin, ',', '.'); |
||
897 | string.gsub(spellMax, ',', '.'); |
||
898 | spellMin = tonumber(spellMin); |
||
899 | spellMax = tonumber(spellMax); |
||
900 | end |
||
901 | end |
||
902 | if (string.find(string.upper(text), GB_FILTERS.Heal)) then |
||
903 | if (string.find(text, GB_FILTERS.HealOverTime)) then |
||
904 | _,_,otamt,spellDuration = string.find(text, GB_FILTERS.HealOverTime); |
||
905 | if (otamt) then string.gsub(otamt, ',', '.'); end |
||
906 | otamt = tonumber(otamt); |
||
907 | if (otamt) then |
||
908 | spellType = "HoT"; |
||
909 | if (not spellMax) then |
||
910 | spellMin, spellMax = otamt, otamt; |
||
911 | elseif (spellType ~= "HoT") then |
||
912 | spellType = "heal"; |
||
913 | end |
||
914 | end |
||
915 | elseif (string.find(text, GB_FILTERS.DruidHealOverTime)) then |
||
916 | _,_,otamt,spellDuration = string.find(text, GB_FILTERS.DruidHealOverTime); |
||
917 | if (otamt) then string.gsub(otamt, ',', '.'); end |
||
918 | otamt = tonumber(otamt); |
||
919 | if (otamt) then |
||
920 | spellType = "HoT"; |
||
921 | if (not spellMax) then |
||
922 | spellMin, spellMax = otamt, otamt; |
||
923 | elseif (spellType ~= "HoT") then |
||
924 | spellType = "heal"; |
||
925 | end |
||
926 | end |
||
927 | elseif (spellType ~= "HoT") then |
||
928 | spellType = "heal"; |
||
929 | end |
||
930 | elseif (string.find(text, GB_FILTERS.Damage) or string.find(string.upper(text), GB_FILTERS.Damage)) then |
||
931 | if (string.find(text, GB_FILTERS.DamageOverTime)) then |
||
932 | _,_,otamt,spellDuration = string.find(text, GB_FILTERS.DamageOverTime); |
||
933 | if (otamt) then string.gsub(otamt, ',', '.'); end |
||
934 | otamt = tonumber(otamt); |
||
935 | if (otamt) then |
||
936 | spellType = "DoT"; |
||
937 | if (not spellMax) then |
||
938 | spellMin, spellMax = otamt, otamt; |
||
939 | elseif (spellType ~= "DoT") then |
||
940 | spellType = "damage"; |
||
941 | end |
||
942 | end |
||
943 | elseif (spellType ~= "DoT") then |
||
944 | spellType = "damage"; |
||
945 | end |
||
946 | end |
||
947 | if (not spellCastingTime) then |
||
948 | _,_,spellCastingTime = string.find(text, GB_FILTERS.CastingTime); |
||
949 | end |
||
950 | end |
||
951 | end |
||
952 | |||
953 | if (not spellMana) then |
||
954 | if (spellRage) then |
||
955 | spellMana = spellRage; |
||
956 | elseif (spellEnergy) then |
||
957 | spellMana = spellEnergy; |
||
958 | end |
||
959 | end |
||
960 | if (not spellMana) then |
||
961 | spellMana = 0; |
||
962 | else |
||
963 | spellMana = tonumber(spellMana); |
||
964 | end |
||
965 | if (not spellCastingTime) then |
||
966 | spellCastingTime = 0; |
||
967 | else |
||
968 | string.gsub(spellCastingTime, ',', '.'); |
||
969 | spellCastingTime = tonumber(spellCastingTime); |
||
970 | if (not spellCastingTime) then |
||
971 | spellCastingTime = 0; |
||
972 | end |
||
973 | end |
||
974 | spellMin = tonumber(spellMin); |
||
975 | if (not spellMin) then |
||
976 | spellMin = 0; |
||
977 | end |
||
978 | spellMax = tonumber(spellMax); |
||
979 | if (not spellMax) then |
||
980 | spellMax = 0; |
||
981 | end |
||
982 | if (spellType == "heal" or spellType == "HoT") then |
||
983 | local ct = spellCastingTime; |
||
984 | if (ct == 0) then |
||
985 | ct = 3.5; |
||
986 | end |
||
987 | local bonus = (spellCastingTime / 3.5) * GB_Settings[GB_INDEX].HealingBonus; |
||
988 | spellMin = spellMin + bonus; |
||
989 | spellMax = spellMax + bonus; |
||
990 | end |
||
991 | spellAvg = (spellMin + spellMax) / 2; |
||
992 | if (not spellDuration) then |
||
993 | spellDuration = 0; |
||
994 | end |
||
995 | |||
996 | for _,v in GB_CURES do |
||
997 | if (v.text == spellName) then |
||
998 | spellType = "cure"; |
||
999 | break; |
||
1000 | end |
||
1001 | end |
||
1002 | if (spellType ~= "cure" and spellType ~= "HoT") then |
||
1003 | for _,v in GB_MINLVL_SPELLS do |
||
1004 | if (v == spellName) then |
||
1005 | spellType="buff"; |
||
1006 | break; |
||
1007 | end |
||
1008 | end |
||
1009 | end |
||
1010 | |||
1011 | GB_SPELLS[spellName][spellRank] = { |
||
1012 | id = spellID, |
||
1013 | mana = spellMana, |
||
1014 | type = spellType, |
||
1015 | min = spellMin, |
||
1016 | max = spellMax, |
||
1017 | avg = spellAvg, |
||
1018 | castingTime = spellCastingTime, |
||
1019 | duration = spellDuration |
||
1020 | }; |
||
1021 | end |
||
1022 | |||
1023 | spellID = spellID + 1; |
||
1024 | end |
||
1025 | |||
1026 | GB_SPELLS_COUNT = spellID - 1; |
||
1027 | GB_Update_SpellRanges(); |
||
1028 | |||
1029 | for bar, value in GB_UNITS_ARRAY do |
||
1030 | for button = 1, 20 do |
||
1031 | if (GB_Settings[GB_INDEX][bar].Button[button].idType == "spell") then |
||
1032 | if (not GB_SPELLS[GB_Settings[GB_INDEX][bar].Button[button].name]) then |
||
1033 | GB_Settings[GB_INDEX][bar].Button[button] = GB_Get_DefaultButtonSettings(); |
||
1034 | GB_ActionButton_Initialize(bar, button); |
||
1035 | end |
||
1036 | end |
||
1037 | end |
||
1038 | end |
||
1039 | end |
||
1040 | |||
1041 | function GB_Update_SpellRanges(forceupdate) |
||
1042 | local match; |
||
1043 | for spellname, ranks in GB_SPELLS do |
||
1044 | for spellrank,spell in ranks do |
||
1045 | if (forceupdate or (not GB_SPELLS[spellname][spellrank].range)) then |
||
1046 | local texture = GetSpellTexture(spell.id, "BOOKTYPE_SPELL"); |
||
1047 | GBTooltip:ClearLines(); |
||
1048 | GBTooltip:SetSpell(spell.id, SpellBookFrame.bookType); |
||
1049 | local range = GB_Parse_Tooltip(GB_FILTERS.Range); |
||
1050 | GB_SPELLS[spellname][spellrank].rangeinyds = range; |
||
1051 | for i=120, 1, -1 do |
||
1052 | local abtexture = GetActionTexture(i); |
||
1053 | if (abtexture == texture) then |
||
1054 | match = i; |
||
1055 | break; |
||
1056 | end |
||
1057 | GBTooltip:ClearLines(); |
||
1058 | GBTooltip:SetAction(i); |
||
1059 | local abrange = GB_Parse_Tooltip(GB_FILTERS.Range); |
||
1060 | if (abrange == range) then |
||
1061 | match = i; |
||
1062 | end |
||
1063 | end |
||
1064 | GB_SPELLS[spellname][spellrank].range = match; |
||
1065 | end |
||
1066 | end |
||
1067 | end |
||
1068 | end |
||
1069 |