vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 FORMS_EN = {"Bear Form", "Cat Form", "Moonkin Form", "Travel Form", "Aquatic Form"}
2 PROWL_EN = "Prowl"
3 CHARG_EN = "Feral Charge"
4 TRACK_EN = "Track Humanoids"
5  
6 FORMS_FR = {"Forme d\226\128\153ours", "Forme de f\195\169lin", "Forme de s\195\169l\195\169nien", "Forme de voyage", "Forme aquatique"}
7 PROWL_FR = "R\195\180der"
8 CHARG_FR = "Charge farouche"
9 TRACK_FR = "Humanoide aufsp\195\188ren"
10  
11 FORMS_DE = {"B\195\164rengestalt", "Katzengestalt", "Moonkingestalt", "Reisegestalt", "Wassergestalt"}
12 PROWL_DE = "Schleichen"
13 CHARG_DE = "Wilde Attacke"
14 TRACK_DE = "Pistage des humano\195\175des"
15  
16 Human = "human"
17  
18 PROWL = "\Ability_Ambush"
19 TRACK = "\Ability_Tracking"
20  
21 Prowler_Forms = {}
22  
23 local maxspells
24 local prowl_id
25 local charg_id
26 local track_id
27 local prev_ab
28 local locked
29 local charg_toggle
30  
31 function SearchForm(form)
32 form = string.lower(form)
33 local bear = string.lower(Bear)
34 if (GetLocale() == 'frFR') then
35 if string.find(bear, form) then
36 form = bear
37 end
38 else
39 if string.find(form, bear) then
40 form = bear
41 end
42 end
43 return Prowler_Forms[form].pos
44 end
45  
46 function CurrentForm()
47 return Prowler_Forms["current"]
48 end
49  
50 local function ActiveForm()
51 local i = 1
52 while (i <= GetNumShapeshiftForms()) do
53 local _, name, active, castable = GetShapeshiftFormInfo(i)
54 if active then
55 return name
56 end
57 i = i + 1
58 end
59 return Human
60 end
61  
62 local function Init_Forms_Table()
63 for i = 1, getn(FORMS) do
64 local form = string.lower(FORMS[i])
65 Prowler_Forms[form] = {name = "", pos = 0}
66 end
67 end
68  
69 local function Create_Forms_Table()
70 local i = 1;
71 Prowler_Forms["current"] = string.lower(Human)
72 while (i <= GetNumShapeshiftForms()) do
73 local _, name1, active1 = GetShapeshiftFormInfo(i);
74 name1 = string.lower(name1)
75 local j = 0
76 if (GetLocale() == 'frFR') then
77 repeat
78 j = j + 1
79 form = string.lower(FORMS[j])
80 until (string.find(form,name1) or j >= getn(FORMS))
81 if (string.find(form,name1)) then
82 Prowler_Forms[form] = {name = form, pos = i}
83 if (active1) then
84 Prowler_Forms["current"] = form
85 end
86 end
87 else
88 repeat
89 j = j + 1
90 form = string.lower(FORMS[j])
91 until (string.find(name1,form) or j >= getn(FORMS))
92 if (string.find(name1,form)) then
93 Prowler_Forms[form] = {name = form, pos = i}
94 if (active1) then
95 Prowler_Forms["current"] = form
96 end
97 end
98 end
99 i = i + 1
100 end
101 end
102  
103 local function Update_Forms_Table()
104 form = string.lower(ActiveForm())
105 local bear = string.lower(Bear)
106 if (GetLocale() == 'frFR') then
107 if string.find(bear, form) then
108 form = bear
109 end
110 else
111 if string.find(form, bear) then
112 form = bear
113 end
114 end
115 Prowler_Forms["current"] = string.lower(form);
116 end
117  
118 local function FindProwl()
119 local i = 0
120 while GetPlayerBuffTexture(i) do
121 local icon = GetPlayerBuffTexture(i)
122 if (string.find(icon,PROWL) )then
123 return true
124 end
125 i = i + 1
126 if i > 50 then break end
127 end
128 return false
129 end
130  
131 local function FindTrackHumans()
132 local track = GetTrackingTexture()
133 if string.find(track,TRACK) then
134 return true
135 end
136 return false
137 end
138  
139 local function GetNumBuffs()
140 local i = 0
141 while GetPlayerBuffTexture(i) do
142 i = i + 1
143 end
144 return i
145 end
146  
147 local function MaxSpells()
148 local i = 1
149 local total_spells = 0
150 local num_tabs = GetNumSpellTabs()
151 while (i <= num_tabs) do
152 local _,_,_,numSpells = GetSpellTabInfo(i)
153 total_spells = total_spells + numSpells
154 i = i + 1;
155 end
156 return total_spells
157 end
158  
159 local function SearchBestSpell(msg)
160 local i = 0
161 local found = false
162 while (not found) do
163 i = i + 1
164 name = GetSpellName(i,'spell')
165 if (name == msg) then
166 found = true
167 end
168 if (i > maxspells) then
169 break
170 end
171 end
172 if (not found) then
173 return -1
174 end
175 local j = i
176 local best_spell = false
177 while (not best_spell) do
178 local name2,_ = GetSpellName(j+1,'spell')
179 if (msg == name2) then
180 j = j + 1
181 else
182 best_spell = true
183 end
184 end
185 return j
186 end
187  
188 local function Prowl_Print(msg)
189 if (not DEFAULT_CHAT_FRAME) then
190 return
191 end
192 DEFAULT_CHAT_FRAME:AddMessage(msg)
193 end
194  
195 function Prowler_OnLoad()
196 _,lclass = UnitClass("player")
197 if (lclass ~= "DRUID") then
198 return
199 end
200  
201 Prowl = PROWL_EN
202 Charg = CHARG_EN
203 Track = TRACK_EN
204 Bear = string.lower(FORMS_EN[1])
205 Cat = string.lower(FORMS_EN[2])
206 Moon = string.lower(FORMS_EN[3])
207 Travel = string.lower(FORMS_EN[4])
208 Aqua = string.lower(FORMS_EN[5])
209 FORMS = FORMS_EN
210 if (GetLocale() == 'frFR') then
211 Prowl = PROWL_FR
212 Charg = CHARG_FR
213 Track = TRACK_FR
214 Bear = string.lower(FORMS_FR[1])
215 Cat = string.lower(FORMS_FR[2])
216 Moon = string.lower(FORMS_FR[3])
217 Travel = string.lower(FORMS_FR[4])
218 Aqua = string.lower(FORMS_FR[5])
219 FORMS = FORMS_FR
220 elseif (GetLocale() == 'deDE') then
221 Prowl = PROWL_DE
222 Charg = CHARG_DE
223 Track = TRACK_DE
224 Bear = string.lower(FORMS_DE[1])
225 Cat = string.lower(FORMS_DE[2])
226 Moon = string.lower(FORMS_DE[3])
227 Travel = string.lower(FORMS_DE[4])
228 Aqua = string.lower(FORMS_DE[5])
229 FORMS = FORMS_DE
230 end
231  
232 BINDING_HEADER_Prowler = 'Prowler'
233 BINDING_NAME_Prowler_Aquatic = 'Aquatic Form'
234 BINDING_NAME_Prowler_Bear = 'Bear & Charge'
235 BINDING_NAME_Prowler_Prowl = 'Cat & Prowl'
236 BINDING_NAME_Prowler_Moon = 'Moonkin Form'
237 BINDING_NAME_Prowler_Human = 'Humanoid'
238 BINDING_NAME_Prowler_Travel = 'Travel Form'
239 BINDING_NAME_Prowler_Best = 'Best From'
240  
241 this:RegisterEvent("VARIABLES_LOADED");
242 this:RegisterEvent("PLAYER_AURAS_CHANGED");
243 this:RegisterEvent('SPELLS_CHANGED');
244  
245 SLASH_PROWLER1 = "/Prowler"
246 SlashCmdList["PROWLER"] = function(msg)
247 Prowler_Cmd(msg);
248 end
249  
250 maxspells = MaxSpells()
251 prowl_id = SearchBestSpell(Prowl);
252 charg_id = SearchBestSpell(Charg);
253 track_id = SearchBestSpell(Track);
254 Init_Forms_Table()
255 Create_Forms_Table()
256 Update_Forms_Table()
257  
258 tinsert(UISpecialFrames,"Prowler1");
259 end
260  
261 function Prowler_OnClick1(arg1)
262 if (Prowler1_CheckButton1:GetChecked()) then
263 toggle = true;
264 Prowler1_CheckButton1Text:SetText("Prowler Enabled")
265 Prowler1_CheckButton1Text:SetTextColor(0,1,0)
266 else
267 toggle = false;
268 Prowler1_CheckButton1Text:SetText("Prowler Disabled")
269 Prowler1_CheckButton1Text:SetTextColor(1,0,0)
270 end
271 end
272  
273 function Prowler_OnClick2(arg1)
274 local frame = getglobal("Prowler1")
275 if (Prowler1_CheckButton2:GetChecked()) then
276 frame.isLocked = 1;
277 locked = 1;
278 Prowler1_CheckButton2Text:SetText("Prowler Locked")
279 Prowler1_CheckButton2Text:SetTextColor(0,1,0)
280 else
281 frame.isLocked = 0;
282 locked = 0;
283 Prowler1_CheckButton2Text:SetText("Prowler Unlocked")
284 Prowler1_CheckButton2Text:SetTextColor(1,0,0)
285 end
286 end
287  
288 function Prowler_OnClick3(arg1)
289 if (Prowler1_CheckButton3:GetChecked()) then
290 prev = true
291 Prowler1_CheckButton3Text:SetText("Using Last AB")
292 Prowler1_CheckButton3Text:SetTextColor(0,1,0)
293 else
294 prev = false
295 Prowler1_CheckButton3Text:SetText("Using Main AB")
296 Prowler1_CheckButton3Text:SetTextColor(1,0,0)
297 end
298 end
299  
300 function Prowler_OnClick4(arg1)
301 if (Prowler1_CheckButton4:GetChecked()) then
302 MA_toggle = true
303 Prowler1_CheckButton4Text:SetText("MoveAnything! Fix on")
304 Prowler1_CheckButton4Text:SetTextColor(0,1,0)
305 else
306 MA_toggle = false
307 Prowler1_CheckButton4Text:SetText("MoveAnything! Fix off")
308 Prowler1_CheckButton4Text:SetTextColor(1,0,0)
309 end
310 end
311  
312 function Prowler_OnClick5(arg1)
313 if (Prowler1_CheckButton5:GetChecked()) then
314 charg_toggle = true
315 Prowler1_CheckButton5Text:SetText("Bear & Charge")
316 Prowler1_CheckButton5Text:SetTextColor(0,1,0)
317 else
318 charg_toggle = false
319 Prowler1_CheckButton5Text:SetText("Only Bear")
320 Prowler1_CheckButton5Text:SetTextColor(1,0,0)
321 end
322 end
323  
324 function Prowler_InitSlider1(slider,num)
325 sl = getglobal(slider)
326 if (sl:GetName() == "Prowler1_Slider1") then
327 sl.tooltipText = "Set the Main Actionbar";
328 elseif (sl:GetName() == "Prowler1_Slider2") then
329 sl.tooltipText = "Set the Prowl Actionbar";
330 end
331 getglobal(slider .. "Low"):SetText("1");
332 getglobal(slider .. "High"):SetText("7");
333 getglobal(sl:GetName()):SetValue(num);
334 getglobal(slider .. "Text"):SetText(sl:GetValue());
335 end
336  
337 function Prowler_InitSlider2(slider,num)
338 sl = getglobal(slider)
339 if (sl:GetName() == "Prowler1_Slider3") then
340 sl.tooltipText = "Set how the Cat Keybind will work";
341 end
342 getglobal(slider .. "Low"):SetText("");
343 getglobal(slider .. "High"):SetText("");
344 getglobal(sl:GetName()):SetValue(num);
345 if (cat_mode == 1) then
346 getglobal(sl:GetName().."Text"):SetText("Cat Only");
347 elseif (cat_mode == 2) then
348 getglobal(sl:GetName().."Text"):SetText("Prowl Only");
349 elseif (cat_mode == 3) then
350 getglobal(sl:GetName().."Text"):SetText("Prowl and Unprowl");
351 end
352 end
353 function Prowler_InitSlider3(slider,num)
354 sl = getglobal(slider)
355 if (sl:GetName() == "Prowler1_Slider4") then
356 sl.tooltipText = "Set when Track Humans will be activated (Need to be Prowling)";
357 end
358 getglobal(slider .. "Low"):SetText("");
359 getglobal(slider .. "High"):SetText("");
360 getglobal(sl:GetName()):SetValue(num);
361 if (track_mode == 1) then
362 getglobal(this:GetName().."Text"):SetText("Never Track");
363 elseif (track_mode == 2) then
364 getglobal(this:GetName().."Text"):SetText("Out of Combat");
365 elseif (track_mode == 3) then
366 getglobal(this:GetName().."Text"):SetText("Anytime");
367 end
368 end
369  
370 function Prowler_Prowl()
371 if CurrentForm() == string.lower(Cat) then
372 if (cat_mode == 2) then
373 if (GetSpellCooldown(prowl_id,1) == 0) then
374 if (not FindProwl()) then
375 CastSpell(prowl_id,1)
376 else
377 if (track_mode == 2) then
378 if (not FindTrackHumans()) and (not UnitAffectingCombat("player")) then
379 CastSpell(track_id,1)
380 end
381 elseif (track_mode == 3) then
382 if (not FindTrackHumans()) then
383 CastSpell(track_id,1)
384 end
385 end
386 end
387 end
388 elseif (cat_mode == 3) then
389 if (GetSpellCooldown(prowl_id,1) == 0) then
390 if (not FindProwl()) then
391 CastSpell(prowl_id,1)
392 else
393 if (track_mode == 2) and (not FindTrackHumans()) and (not UnitAffectingCombat("player")) then
394 CastSpell(track_id,1)
395 elseif (track_mode == 3) and (not FindTrackHumans()) then
396 CastSpell(track_id,1)
397 else
398 CastSpell(prowl_id,1)
399 end
400 end
401 end
402 end
403 else
404 Shapeshift(Cat)
405 end
406 end
407  
408 function Prowler_Bear()
409 if CurrentForm() == string.lower(Bear) then
410 if (charg_id ~= -1) then
411 if (GetSpellCooldown(charg_id,1) == 0) and (charg_toggle == true) then
412 CastSpell(charg_id,1)
413 end
414 end
415 else
416 Shapeshift(Bear)
417 end
418 end
419  
420 function Shapeshift(form)
421 local i = 1
422 local thing
423 form = string.lower(form)
424 local current = string.lower(CurrentForm())
425 if (UnitIsMounted("player")) then
426 Dismount()
427 else
428 if (not string.find(current,form)) then
429 if (CurrentForm() == Human) then
430 thing = SearchForm(form)
431 if (thing ~= 0) then
432 CastShapeshiftForm(thing)
433 else
434 Prowl_Print(form .. ' not found')
435 end
436 else
437 CastShapeshiftForm(SearchForm(CurrentForm()))
438 end
439 end
440 end
441 end
442  
443 function Prowler_BestForm()
444 if (MirrorTimer1:IsVisible()) then
445 if (CurrentForm() ~= Aqua) then
446 Shapeshift(Aqua)
447 end
448 else
449 if (CurrentForm() ~= Travel) then
450 Shapeshift(Travel)
451 end
452 end
453 end
454  
455 local function Shapeshifted()
456 local active = string.lower(ActiveForm())
457 local bear = string.lower(Bear)
458 local current = string.lower(CurrentForm())
459 if (GetLocale() == 'frFR') then
460 if string.find(bear, active) then
461 active = bear
462 end
463 else
464 if string.find(active, bear) then
465 active = bear
466 end
467 end
468  
469 if (active ~= current) then
470 return true
471 else
472 return false
473 end
474 end
475  
476 function Prowler_OnEvent(arg1)
477 if (event == 'VARIABLES_LOADED') then
478 if (not main_ab) then
479 main_ab = 1
480 end
481 if (not prowl_ab) then
482 prowl_ab = 2
483 end
484 if (not locked) then
485 locked = 1
486 end
487 if (not prev) then
488 prev = false;
489 end
490 if (not MA_toggle) then
491 MA_toggle = false
492 end
493 if (not charg_toggle) then
494 charg_toggle = true
495 end
496 if (not cat_mode) then
497 cat_mode = 3
498 end
499 if (not track_mode) then
500 track_mode = 1
501 end
502 prev_ab = main_ab
503 Prowler_InitSlider1("Prowler1_Slider1",main_ab);
504 Prowler_InitSlider1("Prowler1_Slider2",prowl_ab);
505 Prowler_InitSlider2("Prowler1_Slider3",cat_mode);
506 Prowler_InitSlider3("Prowler1_Slider4",track_mode);
507 if (locked == 1) then
508 Prowler1.isLocked = 1;
509 Prowler1_CheckButton2Text:SetText("Prowler Locked")
510 Prowler1_CheckButton2Text:SetTextColor(0,1,0)
511 else
512 Prowler1.isLocked = 0;
513 Prowler1_CheckButton2Text:SetText("Prowler Unlocked")
514 Prowler1_CheckButton2Text:SetTextColor(1,0,0)
515 end
516 if (prev == true) then
517 Prowler1_CheckButton3Text:SetText("Using Last AB")
518 Prowler1_CheckButton3Text:SetTextColor(0,1,0)
519 else
520 Prowler1_CheckButton3Text:SetText("Using Main AB")
521 Prowler1_CheckButton3Text:SetTextColor(1,0,0)
522 end
523 if (toggle == true) then
524 Prowler1_CheckButton1Text:SetText("Prowler Enabled")
525 Prowler1_CheckButton1Text:SetTextColor(0,1,0)
526 else
527 Prowler1_CheckButton1Text:SetText("Prowler Disabled")
528 Prowler1_CheckButton1Text:SetTextColor(1,0,0)
529 end
530 if (MA_toggle == true) then
531 Prowler1_CheckButton4Text:SetText("MoveAnything! Fix on")
532 Prowler1_CheckButton4Text:SetTextColor(0,1,0)
533 else
534 Prowler1_CheckButton4Text:SetText("MoveAnything! Fix off")
535 Prowler1_CheckButton4Text:SetTextColor(1,0,0)
536 end
537 if (charg_toggle == true) then
538 Prowler1_CheckButton5Text:SetText("Bear & Charge")
539 Prowler1_CheckButton5Text:SetTextColor(0,1,0)
540 else
541 Prowler1_CheckButton5Text:SetText("Bear Only")
542 Prowler1_CheckButton5Text:SetTextColor(1,0,0)
543 end
544  
545 Prowler1_CheckButton1:SetChecked(toggle);
546 Prowler1_CheckButton2:SetChecked(locked);
547 Prowler1_CheckButton3:SetChecked(prev);
548 Prowler1_CheckButton4:SetChecked(MA_toggle);
549 Prowler1_CheckButton5:SetChecked(charg_toggle);
550 Prowl_Print('Prowler Loaded. Main bar = ' .. main_ab .. ' Prowling bar = ' .. prowl_ab)
551 end
552 if (event == 'PLAYER_AURAS_CHANGED') then
553 num_buff_1 = GetNumBuffs()
554 if (num_buff_1 == num_buff_2) then
555 buffed = true
556 end
557 if (Shapeshifted() == true) then
558 Update_Forms_Table()
559 shifted = true
560 if (CurrentForm() == string.lower(Cat)) or (CurrentForm() == string.lower(Bear)) then
561 prev_ab = CURRENT_ACTIONBAR_PAGE
562 end
563 end
564 if (toggle == true) then
565 if (CurrentForm() == string.lower(Cat)) then
566 if (FindProwl()) then
567 if (CURRENT_ACTIONBAR_PAGE ~= prowl_ab) then
568 CURRENT_ACTIONBAR_PAGE = prowl_ab;
569 ChangeActionBarPage();
570 end
571 else
572 if (CURRENT_ACTIONBAR_PAGE ~= 1) then
573 CURRENT_ACTIONBAR_PAGE = 1;
574 ChangeActionBarPage();
575 end
576 end
577 elseif (CurrentForm() == Human) then
578 if (prev == true) then
579 if (CURRENT_ACTIONBAR_PAGE ~= prev_ab) and (shifted) then
580 CURRENT_ACTIONBAR_PAGE = prev_ab;
581 ChangeActionBarPage();
582 end
583 else
584 if (CURRENT_ACTIONBAR_PAGE ~= main_ab) and (shifted) then
585 CURRENT_ACTIONBAR_PAGE = main_ab;
586 ChangeActionBarPage();
587 end
588 end
589 if (MA_toggle == true) and buffed then
590 ChangeActionBarPage()
591 end
592 shifted = false
593 elseif (CurrentForm() == string.lower(Bear)) then
594 if (CURRENT_ACTIONBAR_PAGE ~= 1) then
595 CURRENT_ACTIONBAR_PAGE = 1;
596 ChangeActionBarPage();
597 end
598 end
599 end
600 num_buff_2 = GetNumBuffs()
601 buffed = false
602 end
603 if (event == 'SPELLS_CHANGED') then
604 maxspells = MaxSpells();
605 prowl_id = SearchBestSpell(Prowl);
606 charg_id = SearchBestSpell(Charg);
607 track_id = SearchBestSpell(Track);
608 Create_Forms_Table()
609 Update_Forms_Table()
610 end
611 end
612  
613 function Prowler_Cmd(msg)
614 local frame = getglobal("Prowler1")
615 if (frame) then
616 if( frame:IsVisible() ) then
617 frame:Hide();
618 else
619 frame:Show();
620 end
621 end
622 end