vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --AsmoMOD made by Asmodius, Arthas Server
2 --All rights reserved.
3  
4 -- Declare Needed Variables
5 local AsmoMOD_Color = "|c000566FF";
6 local AsmoMOD_ColorR = "|c00FF0000";
7 local ResetGroup = 0;
8 local Reseter;
9 local didWotf = 0;
10 local RipID = 0;
11 local RipAction = 0;
12 local opID = 0;
13 local opAction = 0;
14 local WotfID = 0;
15 local healID = 0;
16 local LightID = 0;
17 local touchID = 0;
18 local feignID = 0;
19 local trapID = 0;
20 local nsID = 1;
21 local inCombat = false;
22 local herbID = 0;
23 local mineID = 0;
24 local nshealme = 0;
25 local SaveMe = 0;
26 local herbmineme = 0;
27 local nslightning = 0;
28 local feigntrap = 0;
29 local justenabled = 0;
30  
31 -- Show the Option Menu
32 function AsmoMOD_showMenu()
33 PlaySound("igMainMenuOpen");
34 AsmoMODOptions:Show();
35 end
36  
37 -- Load Event
38 function AsmoMOD_OnLoad()
39  
40 this:RegisterEvent("PLAYER_ENTERING_WORLD")
41 this:RegisterEvent("PLAYER_DEAD");
42 this:RegisterEvent("UPDATE_BATTLEFIELD_STATUS");
43 this:RegisterEvent("MERCHANT_SHOW");
44 this:RegisterEvent("RESURRECT_REQUEST");
45 this:RegisterEvent("CONFIRM_SUMMON");
46 this:RegisterEvent("PARTY_INVITE_REQUEST");
47 this:RegisterEvent("PARTY_MEMBERS_CHANGED");
48 this:RegisterEvent("PLAYER_CONTROL_LOST");
49 this:RegisterEvent("PLAYER_CONTROL_GAINED");
50 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS");
51 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE");
52 this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF");
53 this:RegisterEvent("UNIT_HEALTH");
54 this:RegisterEvent("PLAYER_UNGHOST");
55 this:RegisterEvent("PLAYER_REGEN_ENABLED");
56 this:RegisterEvent("PLAYER_REGEN_DISABLED");
57 AsmoMOD_Chat("AsmoMOD v1.82 loaded.");
58  
59 if ( AsmoMOD_Save == nil ) then
60 AsmoMOD_Save = {};
61 AsmoMOD_Save.bgrelenabled = true;
62 AsmoMOD_Save.bgjoinenabled = true;
63 AsmoMOD_Save.repairenabled = true;
64 AsmoMOD_Save.rezenabled = true;
65 AsmoMOD_Save.summonenabled = true;
66 AsmoMOD_Save.groupenabled = true;
67 AsmoMOD_Save.trinketenabled = true;
68 AsmoMOD_Save.riposteenabled = false;
69 AsmoMOD_Save.nsenabled = false;
70 AsmoMOD_Save.lightenabled = false;
71 AsmoMOD_Save.executeenabled = false;
72 AsmoMOD_Save.overpowerenabled = false;
73 AsmoMOD_Save.conserveenabled = false;
74 AsmoMOD_Save.herbmineenabled = false;
75 AsmoMOD_Save.nspercent = 20;
76 AsmoMOD_Save.conservepercent = 80;
77 end
78  
79 SLASH_Asmo1 = "/Asmo";
80 SlashCmdList["Asmo"] = AsmoMOD_showMenu;
81  
82 SLASH_Asinvite1 = "/Asinvite";
83 SlashCmdList["Asinvite"] = function(msg)
84 Asmo_HandleInvite(msg);
85 end
86  
87 SLASH_nsheal1 = "/nsheal";
88 SlashCmdList["nsheal"] = AsmoMOD_nsheal;
89  
90 SLASH_nslight1 = "/nslight";
91 SlashCmdList["nslight"] = AsmoMOD_nslight;
92  
93 SLASH_feigntrap1 = "/feigntrap";
94 SlashCmdList["feigntrap"] = AsmoMOD_feigntrap;
95  
96 SLASH_timer1 = "/timer";
97 SlashCmdList["timer"] = ExecuteCheck;
98  
99 -- Add my options frame to the global UI panel list
100 UIPanelWindows["AsmoMODOptions"] = {area = "center", pushable = 0};
101 end
102  
103 -- Event Handler
104 function AsmoMOD_OnEvent(event)
105  
106 -- Load Base Variables and Auto-Cast find herbs/minerals
107 if(event == "PLAYER_ENTERING_WORLD") then
108 AsmoMOD_Load();
109 if(AsmoMOD_Save.herbmineenabled) then
110 herbmineme = 1;
111 end
112 end
113  
114 -- Determine if player is in combat
115 if (event == "PLAYER_REGEN_ENABLED") then
116 inCombat = false;
117 end
118 if (event == "PLAYER_REGEN_DISABLED") then
119 inCombat = true;
120 end
121  
122 -- Auto-release to the GY
123 if ( event == "PLAYER_DEAD" ) then
124 AsmoMOD_Release();
125 end
126  
127 -- Auto-join the BG when its your turn
128 if ( event == "UPDATE_BATTLEFIELD_STATUS" ) then
129 AsmoMOD_bgJoin();
130 end
131  
132 -- Auto-Repair when you see a merchant
133 if ( event == "MERCHANT_SHOW") then
134 AsmoMOD_RepairInventory();
135 AsmoMOD_RepairEquipment();
136 end
137  
138 -- Auto-Ressurect
139 if ( event == "RESURRECT_REQUEST" ) then
140 AsmoMOD_Resurrect();
141 end
142  
143 -- Auto-Summon
144 if ( event == "CONFIRM_SUMMON" ) then
145 AsmoMOD_Summon();
146 end
147  
148 -- Auto-Group
149 if (event == "PARTY_INVITE_REQUEST") then
150 AsmoMOD_Group();
151 end
152  
153 -- Reset-Group
154 if (event == "PARTY_MEMBERS_CHANGED") then
155 if(ResetGroup == 1) then
156 ResetGroup = 2;
157 return;
158 end
159 if(ResetGroup == 2) then
160 PromoteByName(Reseter);
161 LeaveParty();
162 ResetGroup = 0;
163 end
164 end
165  
166 -- Restore Control Fear
167 if (event == "PLAYER_CONTROL_GAINED") then
168 SaveMe = 0;
169 end
170  
171 -- Auto-Trinket Fear Detect
172 if (event == "PLAYER_CONTROL_LOST") then
173 if(not GetBattlefieldWinner()) then
174 SaveMe = 1;
175 end
176 end
177  
178 -- Wotf Succeed
179 if(event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS") then
180 if(arg1 == "You gain Will of the Forsaken.") then
181 didWotf = 0;
182 end
183 end
184  
185 -- Auto-Trinket Charm Detect
186 if(event == "CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE") then
187 if(arg1 == "You are afflicted by Seduction.") then
188 SaveMe = 1;
189 elseif(arg1 == "You are afflicted by Repentence.") then
190 SaveMe = 1;
191 elseif(arg1 == "You are afflicted by Reckless Charge.") then
192 SaveMe = 1;
193 elseif(arg1 == "You are afflicted by Intimidating Shout.") then
194 SaveMe = 1;
195 end
196 end
197  
198 -- Restore Control Charm
199 if(event == "CHAT_MSG_SPELL_AURA_GONE_SELF") then
200 if(arg1 == "Seduction fades from you.") then
201 SaveMe = 0;
202 elseif(arg1 == "Repentence fades from you.") then
203 SaveMe = 0;
204 elseif(arg1 == "Reckless Charge fades from you.") then
205 SaveMe = 0;
206 elseif(arg1 == "Intimidating Shout fades from you.") then
207 SaveMe = 0;
208 end
209 end
210  
211 -- Auto-NSheal
212 if((event == "UNIT_HEALTH") and AsmoMOD_Save.nsenabled) then
213 --Check to see if the player is below nspercent
214 local ppercent;
215 ppercent = (UnitHealth("player") / UnitHealthMax("player")) * 100;
216 if(ppercent <= AsmoMOD_Save.nspercent) then
217 nshealme = 1;
218 else
219 nshealme = 0;
220 end
221 end
222  
223 -- Auto-Herb/Mine
224 if((event == "PLAYER_UNGHOST") and AsmoMOD_Save.herbmineenabled) then
225 herbmineme = 1;
226 end
227 end
228  
229 -- Load Needed Variables
230 function AsmoMOD_Load()
231  
232 --If users switching between accounts, protect nill errors
233 if ( AsmoMOD_Save == nil ) then
234 AsmoMOD_Save = {};
235 AsmoMOD_Save.bgrelenabled = true;
236 AsmoMOD_Save.bgjoinenabled = true;
237 AsmoMOD_Save.repairenabled = true;
238 AsmoMOD_Save.rezenabled = true;
239 AsmoMOD_Save.summonenabled = true;
240 AsmoMOD_Save.groupenabled = true;
241 AsmoMOD_Save.trinketenabled = true;
242 AsmoMOD_Save.riposteenabled = false;
243 AsmoMOD_Save.overpowerenabled = false;
244 AsmoMOD_Save.nsenabled = false;
245 AsmoMOD_Save.lightenabled = false;
246 AsmoMOD_Save.executeenabled = false;
247 AsmoMOD_Save.conserveenabled = false;
248 AsmoMOD_Save.herbmineenabled = false;
249 AsmoMOD_Save.nspercent = 20;
250 AsmoMOD_Save.conservepercent = 80;
251 end
252  
253 -- Find all spell IDs
254 local a = 1
255 while true do
256 local spellName, spellRank = GetSpellName(a, BOOKTYPE_SPELL)
257 if not spellName then
258 do break end
259 end
260  
261 -- Find Riposte ID
262 if (spellName == "Riposte") then
263 texture = GetSpellTexture(a, BOOKTYPE_SPELL)
264 RipID = a
265 -- Find Action Bar Number for Riposte
266 local j;
267 for j=1,72, 1 do
268 if ( HasAction(j) ) then
269 local actiontexture = GetActionTexture(j);
270 if ( actiontexture == texture ) then
271 RipAction = j
272 do break end
273 end
274 end
275 end
276 end
277  
278 -- Find Overpower ID
279 if (spellName == "Overpower") then
280 texture = GetSpellTexture(a, BOOKTYPE_SPELL)
281 opID = a
282 -- Find Action Bar Number for Overpower
283 local j;
284 for j=1,108, 1 do
285 if ( HasAction(j) ) then
286 local actiontexture = GetActionTexture(j);
287 if ( actiontexture == texture ) then
288 opAction = j
289 do break end
290 end
291 end
292 end
293 end
294  
295 -- Find Will of the Forsaken
296 if (spellName == "Will of the Forsaken") then
297 WotfID = a
298 end
299  
300 -- Find Healing Wave ID
301 if (spellName == "Healing Wave") then
302 healID = a
303 end
304  
305 -- Find Chain Lightning ID
306 if (spellNamed == "Chain Lightning") then
307 LightID = a
308 end
309  
310 --Find Healing Touch
311 if (spellName == "Healing Touch") then
312 touchID = a
313 end
314  
315 -- Find NS for Shaman and Druid
316 if (spellName == "Nature's Swiftness") then
317 nsID = a
318 end
319  
320 -- Find Feign ID
321 if (spellName == "Feign Death") then
322 feignID = a
323 end
324  
325 -- Find Trap ID
326 if (spellName == "Freezing Trap") then
327 trapID = a
328 end
329  
330 -- Find Herb ID
331 if (spellName == "Find Herbs") then
332 herbID = a
333 end
334  
335 -- Find Minerals ID
336 if (spellName == "Find Minerals") then
337 mineID = a
338 end
339  
340 a = a + 1;
341 end
342  
343 -- Correct options frame to saved values
344 if(AsmoMOD_Save.bgrelenabled) then
345 bgrelenabled:SetChecked(1);
346 end
347 if(AsmoMOD_Save.bgjoinenabled) then
348 bgjoinenabled:SetChecked(1);
349 end
350 if(AsmoMOD_Save.rezenabled) then
351 RessEnabled:SetChecked(1);
352 end
353 if(AsmoMOD_Save.summonenabled) then
354 SummonEnabled:SetChecked(1);
355 end
356 if(AsmoMOD_Save.repairenabled) then
357 repairenabled:SetChecked(1);
358 end
359 if(AsmoMOD_Save.groupenabled) then
360 groupenabled:SetChecked(1);
361 end
362 if(AsmoMOD_Save.trinketenabled) then
363 trinketenabled:SetChecked(1);
364 end
365 if(AsmoMOD_Save.riposteenabled) then
366 riposteenabled:SetChecked(1);
367 end
368 if(AsmoMOD_Save.nsenabled) then
369 nshealenabled:SetChecked(1);
370 end
371 if(AsmoMOD_Save.executeenabled) then
372 executeenabled:SetChecked(1);
373 end
374 if(AsmoMOD_Save.conserveenabled) then
375 conserveenabled:SetChecked(1);
376 end
377 if(AsmoMOD_Save.herbmineenabled) then
378 herbmineenabled:SetChecked(1);
379 end
380 if(AsmoMOD_Save.overpowerenabled) then
381 openabled:SetChecked(1);
382 end
383 nshealpercentage:SetValue(AsmoMOD_Save.nspercent);
384 conservepercentage:SetValue(AsmoMOD_Save.conservepercent);
385 end
386  
387 -- Cast spells
388 function ExecuteCheck()
389  
390 -- Auto-PvP Trinket and WoTF
391 if ((AsmoMOD_Save.trinketenabled) and (UnitOnTaxi("player") ~= 1)) then
392  
393 -- Use WoTF if it is active
394 if (UnitRace("player") == "Undead") then
395 local duration;
396 if((SaveMe == 1) and (didWotf == 0)) then
397 duration = GetSpellCooldown(WotfID, 1);
398 if(duration == 0) then
399 CastSpell(WotfID, BOOKTYPE_SPELL);
400 didWotf = 1;
401 return;
402 end
403 end
404 end
405  
406 didWotf = 0;
407  
408 -- Use PvP Trinket if it is equipped and active
409 if(SaveMe == 1) then
410 myTrinket0 = GetInventoryItemLink("player", GetInventorySlotInfo("Trinket0Slot"))
411 myTrinket1 = GetInventoryItemLink("player", GetInventorySlotInfo("Trinket1Slot"))
412  
413 if (myTrinket0 == nil) then myTrinket0 = "empty" end
414 if (myTrinket1 == nil) then myTrinket1 = "empty" end
415  
416 if ((string.find(myTrinket0, "Insignia of the Horde") ~= nil) or (string.find(myTrinket0, "Insignia of the Alliance") ~= nil)) then
417 myTrinketUse = GetInventorySlotInfo("Trinket0Slot")
418 elseif ((string.find(myTrinket1, "Insignia of the Horde") ~= nil) or (string.find(myTrinket1, "Insignia of the Alliance") ~= nil)) then
419 myTrinketUse = GetInventorySlotInfo("Trinket1Slot")
420 else
421 myTrinketUse = nil
422 end
423 if(myTrinketUse ~= nil) then
424 UseInventoryItem(myTrinketUse);
425 end
426 end
427 end
428  
429 -- Auto-Riposte
430 if(AsmoMOD_Save.riposteenabled and (UnitClass("player") == "Rogue")) then
431 duration = GetSpellCooldown(RipID, 1);
432 if(IsUsableAction(RipAction)) then
433 if(duration == 0) then
434 CastSpellByName("Riposte");
435 end
436 end
437 end
438  
439 -- Auto-Overpower
440 if(AsmoMOD_Save.overpowerenabled and (UnitClass("player") == "Warrior")) then
441 duration = GetSpellCooldown(opID, 1);
442 if(IsUsableAction(opAction)) then
443 if(duration == 0) then
444 CastSpellByName("Overpower(Rank 4)");
445 end
446 end
447 end
448  
449 -- Auto-Execute
450 if((AsmoMOD_Save.executeenabled) and (UnitClass("player") == "Warrior")) then
451 --Check to see if the target is at 20% or less
452 local tpercent;
453 tpercent = (UnitHealth("target") / UnitHealthMax("target")) * 100;
454 if(tpercent <= 20) then
455 if(UnitMana("player") >= 15) then
456 CastSpellByName("Execute(Rank 5)");
457 end
458 end
459 end
460  
461 -- Auto-NSheal
462 if((nshealme >= 1) and (AsmoMOD_Save.nsenabled)) then
463 duration = GetSpellCooldown(nsID, 1);
464 if(duration == 0) then
465 CastSpellByName("Nature's Swiftness");
466 end
467 SpellStopCasting();
468 local i = 1;
469 local nsup = false;
470 while true do
471 buff = UnitBuff("player", i);
472 if not buff then
473 do break end;
474 end
475 if(string.find(buff, "Spell_Nature_RavenForm") ~= nil) then
476 nsup = true;
477 end
478 i = i + 1;
479 end
480 if(nsup == false) then
481 return;
482 end
483 if((UnitClass("player") == "Druid")) then
484 duration = GetSpellCooldown(touchID, 1);
485 if(duration == 0) then
486 nshealme = 2;
487 if(UnitIsEnemy("target", "player")) then
488 TargetUnit("player");
489 CastSpellByName("Healing Touch(Rank 10)");
490 TargetLastEnemy();
491 if (UnitIsDead("target") == 1) or ( UnitExists("target") ~= 1) then
492 TargetNearestEnemy()
493 end
494 else
495 TargetUnit("player");
496 CastSpellByName("Healing Touch(Rank 10)");
497 end
498 end
499 elseif((UnitClass("player") == "Shaman")) then
500 duration = GetSpellCooldown(healID, 1);
501 if(duration == 0) then
502 nshealme = 2;
503 if(UnitIsEnemy("target", "player")) then
504 TargetUnit("player");
505 CastSpellByName("Healing Wave(Rank 9)");
506 TargetLastEnemy();
507 if (UnitIsDead("target") == 1) or ( UnitExists("target") ~= 1) then
508 TargetNearestEnemy()
509 end
510 else
511 TargetUnit("player");
512 CastSpellByName("Healing Wave(Rank 9)");
513 end
514 end
515 end
516 end
517  
518 -- Mana Conserve
519 if(AsmoMOD_Save.conserveenabled and UnitIsFriend("target", "player")) then
520 local cpercent;
521 cpercent = (UnitHealth("target") / UnitHealthMax("target")) * 100;
522 if(cpercent >= AsmoMOD_Save.conservepercent) then
523 SpellStopCasting();
524 end
525 end
526  
527 -- Auto-Find herbs/minerals
528 if(AsmoMOD_Save.herbmineenabled and herbmineme == 1) then
529 local _, _, instanceID = GetBattlefieldStatus(1);
530 if ( instanceID == 0 ) and (not UnitOnTaxi("player")) and (not UnitIsDeadOrGhost("player")) and (not inCombat) then
531 if(herbID ~= 0) then
532 CastSpellByName("Find Herbs");
533 end
534 if(mineID ~= 0) then
535 CastSpellByName("Find Minerals");
536 end
537 herbmineme = 0;
538 end
539 end
540 end
541  
542 --Invite Handler
543 function Asmo_HandleInvite(msg)
544 local disabled = 0;
545 if ( msg ) then
546 msg = string.lower(msg);
547 end
548  
549 Reseter = msg;
550 InviteByName(msg);
551 ResetGroup = 1;
552 end
553  
554 -- Various Toggle Functions
555 function AsmoMOD_RezToggle()
556 if ( AsmoMOD_Save.rezenabled ) then
557 AsmoMOD_Save.rezenabled = false;
558 AsmoMOD_ChatR("Auto Ressurect has been disabled.");
559 else
560 AsmoMOD_Save.rezenabled = true;
561 AsmoMOD_Chat("Auto Ressurect has been enabled.");
562 end
563 end
564  
565 function AsmoMOD_SummonToggle()
566 if ( AsmoMOD_Save.summonenabled ) then
567 AsmoMOD_Save.summonenabled = false;
568 AsmoMOD_ChatR("Auto Summon has been disabled.");
569 else
570 AsmoMOD_Save.summonenabled = true;
571 AsmoMOD_Chat("Auto Summon has been enabled.");
572 end
573 end
574  
575 function AsmoMOD_bgreltoggle()
576 if ( AsmoMOD_Save.bgrelenabled ) then
577 AsmoMOD_Save.bgrelenabled = false;
578 AsmoMOD_ChatR("Auto BG Release has been disabled.");
579 else
580 AsmoMOD_Save.bgrelenabled = true;
581 AsmoMOD_Chat("Auto BG Release has been enabled.");
582 end
583 end
584  
585  
586 function AsmoMOD_bgjointoggle()
587 if ( AsmoMOD_Save.bgjoinenabled ) then
588 AsmoMOD_Save.bgjoinenabled = false;
589 AsmoMOD_ChatR("Auto BG Join has been disabled.");
590 else
591 AsmoMOD_Save.bgjoinenabled = true;
592 AsmoMOD_Chat("Auto BG Join has been enabled.");
593 end
594 end
595  
596 function AsmoMOD_repairtoggle()
597 if ( AsmoMOD_Save.repairenabled ) then
598 AsmoMOD_Save.repairenabled = false;
599 AsmoMOD_ChatR("Auto Repair has been disabled.");
600 else
601 AsmoMOD_Save.repairenabled = true;
602 AsmoMOD_Chat("Auto Repair has been enabled.");
603 end
604 end
605  
606 function AsmoMOD_grouptoggle()
607 if ( AsmoMOD_Save.groupenabled ) then
608 AsmoMOD_Save.groupenabled = false;
609 AsmoMOD_ChatR("Auto-accept invites has been disabled.");
610 else
611 AsmoMOD_Save.groupenabled = true;
612 AsmoMOD_Chat("Auto-accept invites has been enabled.");
613 end
614 end
615  
616 function AsmoMOD_trinkettoggle()
617 if ( AsmoMOD_Save.trinketenabled ) then
618 AsmoMOD_Save.trinketenabled = false;
619 AsmoMOD_ChatR("Auto-use of the PvP trinket has been disabled.");
620 else
621 AsmoMOD_Save.trinketenabled = true;
622 AsmoMOD_Chat("Auto-use of the PvP trinket has been enabled.");
623 end
624 end
625  
626 function AsmoMOD_ripostetoggle()
627 if ( AsmoMOD_Save.riposteenabled ) then
628 AsmoMOD_Save.riposteenabled = false;
629 AsmoMOD_ChatR("Auto-use of riposte has been disabled.");
630 else
631 AsmoMOD_Save.riposteenabled = true;
632 AsmoMOD_Chat("Auto-use of riposte has been enabled.");
633 AsmoMOD_Load();
634 end
635 end
636  
637 function AsmoMOD_executetoggle()
638 if ( AsmoMOD_Save.executeenabled ) then
639 AsmoMOD_Save.executeenabled = false;
640 AsmoMOD_ChatR("Auto-use of execute has been disabled.");
641 else
642 AsmoMOD_Save.executeenabled = true;
643 AsmoMOD_Chat("Auto-use of execute has been enabled.");
644 AsmoMOD_Load();
645 end
646 end
647  
648 function AsmoMOD_nshealtoggle()
649 if ( AsmoMOD_Save.nsenabled ) then
650 AsmoMOD_Save.nsenabled = false;
651 AsmoMOD_ChatR("Auto-use of nsheal has been disabled.");
652 else
653 AsmoMOD_Save.nsenabled = true;
654 AsmoMOD_Chat("Auto-use of nsheal has been enabled.");
655 AsmoMOD_Load();
656 end
657 end
658  
659 function AsmoMOD_conservetoggle()
660 if ( AsmoMOD_Save.conserveenabled ) then
661 AsmoMOD_Save.conserveenabled = false;
662 AsmoMOD_ChatR("Auto-cancelling of heals has been disabled.");
663 else
664 AsmoMOD_Save.conserveenabled = true;
665 AsmoMOD_Chat("Auto-cancelling of heals has been enabled.");
666 AsmoMOD_Load();
667 end
668 end
669  
670 function AsmoMOD_herbminetoggle()
671 if ( AsmoMOD_Save.herbmineenabled ) then
672 AsmoMOD_Save.herbmineenabled = false;
673 AsmoMOD_ChatR("Auto-casting of find herbs/minerals has been disabled.");
674 else
675 AsmoMOD_Save.herbmineenabled = true;
676 AsmoMOD_Chat("Auto-casting of find herbs/minerals has been enabled.");
677 AsmoMOD_Load();
678 end
679 end
680  
681 function AsmoMOD_overpowertoggle()
682 if ( AsmoMOD_Save.overpowerenabled ) then
683 AsmoMOD_Save.overpowerenabled = false;
684 AsmoMOD_ChatR("Auto-casting of overpower has been disabled.");
685 else
686 AsmoMOD_Save.overpowerenabled = true;
687 AsmoMOD_Chat("Auto-casting of overpower has been enabled.");
688 AsmoMOD_Load();
689 end
690 end
691  
692 -- Auto-Release Implimentation
693 function AsmoMOD_Release()
694 if( AsmoMOD_Save.bgrelenabled ) then
695 local _, _, instanceID = GetBattlefieldStatus(1);
696 if ( instanceID ~= 0 ) then
697 RepopMe();
698 end
699 return;
700 end
701 end
702  
703 -- Auto-Join BG Implimentation
704 function AsmoMOD_bgJoin()
705 if( AsmoMOD_Save.bgjoinenabled ) then
706 for i=1, MAX_BATTLEFIELD_QUEUES do
707 local status, _, _ = GetBattlefieldStatus(i);
708 if (status == "confirm") then
709 PlaySoundFile("Sound\\Doodad\\BellTollAlliance.wav");
710 AcceptBattlefieldPort(i, 1);
711 getglobal("StaticPopup1"):Hide();
712 end
713 end
714 end
715 end
716  
717 -- Auto-Ressurect Implimentation
718 function AsmoMOD_Resurrect()
719 if ( AsmoMOD_Save.rezenabled ) then
720 AcceptResurrect();
721 getglobal("StaticPopup1"):Hide();
722 else
723 AsmoMOD_ChatR("Auto Resurrect is set to off. Use the options menu to change this.");
724 end
725 end
726  
727 -- Auto-Repair Equipment Implimentation
728 function AsmoMOD_RepairEquipment()
729 if( (AsmoMOD_Save.repairenabled) and (CanMerchantRepair()) ) then
730 RepairAllItems();
731 end
732 end
733  
734 -- Auto-Repair Inventory Implimentation
735 function AsmoMOD_RepairInventory()
736 if( (AsmoMOD_Save.repairenabled) and (CanMerchantRepair()) ) then
737 local total = GetRepairAllCost();
738 total = total + AsmoMOD_GetInventoryCost();
739 total = total / 10000;
740 AsmoMOD_Chat("All items repaired. Total Cost: " .. total .. " gold.");
741  
742 ShowRepairCursor();
743 for bag = 0,4,1 do
744 for slot = 1, GetContainerNumSlots(bag) , 1 do
745 local hasCooldown, repairCost = GameTooltip:SetBagItem(bag,slot);
746 if (repairCost and repairCost > 0) then
747 UseContainerItem(bag,slot);
748 end
749 end
750 end
751 HideRepairCursor();
752 end
753 end
754  
755 -- Get Cost of Repairing Inventory
756 function AsmoMOD_GetInventoryCost()
757  
758 local AsmoMOD_InventoryCost = 0;
759  
760 for bag = 0,4,1 do
761 for slot = 1, GetContainerNumSlots(bag) , 1 do
762 local hasCooldown, repairCost = GameTooltip:SetBagItem(bag,slot);
763 if (repairCost) then
764 AsmoMOD_InventoryCost = AsmoMOD_InventoryCost + repairCost;
765 end
766 end
767 end
768  
769 return AsmoMOD_InventoryCost;
770 end
771  
772 -- Auto-Join Group Implimentation
773 function AsmoMOD_Group()
774 if( AsmoMOD_Save.groupenabled ) then
775 AcceptGroup();
776 AsmoMOD_HideWindow("PARTY_INVITE");
777 end
778 end
779  
780 -- Automatic Accept Summon Implimentation
781 function AsmoMOD_Summon()
782 if ( AsmoMOD_Save.summonenabled ) then
783 ConfirmSummon();
784 getglobal("StaticPopup1"):Hide();
785 else
786 AsmoMOD_ChatR("Auto Summon is set to off. Use the options menu to change this.");
787 end
788 end
789  
790 -- NS-Heal Start
791 function AsmoMOD_nsheal()
792 duration = GetSpellCooldown(nsID, 1);
793 if(duration == 0) then
794 CastSpellByName("Nature's Swiftness")
795 end
796 SpellStopCasting();
797 if((UnitClass("player") == "Druid")) then
798 duration = GetSpellCooldown(touchID, 1);
799 if(duration == 0) then
800 if(UnitIsEnemy("target", "player")) then
801 TargetUnit("player");
802 CastSpellByName("Healing Touch(Rank 10)");
803 TargetLastEnemy();
804 if (UnitIsDead("target") == 1) or ( UnitExists("target") ~= 1) then
805 TargetNearestEnemy()
806 end
807 elseif(UnitIsFriend("target", "player")) then
808 CastSpellByName("Healing Touch(Rank 10)");
809 else
810 TargetUnit("player");
811 CastSpellByName("Healing Touch(Rank 10)");
812 end
813 end
814 elseif((UnitClass("player") == "Shaman")) then
815 duration = GetSpellCooldown(healID, 1);
816 if(duration == 0) then
817 if(UnitIsEnemy("target", "player")) then
818 TargetUnit("player");
819 CastSpellByName("Healing Wave(Rank 9)");
820 TargetLastEnemy();
821 if (UnitIsDead("target") == 1) or ( UnitExists("target") ~= 1) then
822 TargetNearestEnemy()
823 end
824 elseif(UnitIsFriend("target", "player")) then
825 CastSpellByName("Healing Wave(Rank 9)");
826 else
827 TargetUnit("player");
828 CastSpellByName("Healing Wave(Rank 9)");
829 end
830 end
831 end
832 end
833  
834 -- NS Lightning Start
835 function AsmoMOD_nslight()
836 duration = GetSpellCooldown(nsID, 1);
837 if(duration == 0) then
838 CastSpellByName("Nature's Swiftness")
839 nslightning = 1;
840 end
841 SpellStopCasting();
842 duration = GetSpellCooldown(LightID, 1);
843 if(duration == 0) then
844 if(nslightning == 2) then
845 nslightning = 0;
846 return;
847 end
848 nslightning = 2;
849 if(UnitIsEnemy("target", "player")) then
850 CastSpellByName("Chain Lightning(Rank 4)");
851 else
852 TargetNearestEnemy();
853 CastSpellByName("Chain Lightning(Rank 4)");
854 end
855 end
856 end
857  
858 -- Feign-Trap Start
859 function AsmoMOD_feigntrap()
860 PetFollow();
861 duration = GetSpellCooldown(feignID, 1);
862 if(duration == 0) then
863 CastSpellByName("Feign Death")
864 feigntrap = 1;
865 end
866 SpellStopCasting();
867 duration = GetSpellCooldown(trapID, 1);
868 if(duration == 0) then
869 if(feigntrap == 2) then
870 feigntrap = 0;
871 return;
872 end
873 feigntrap = 2;
874 CastSpellByName("Freezing Trap(Rank 3)");
875 end
876 end
877  
878 -- Hide Popupbox Implimentation
879 function AsmoMOD_HideWindow(windowToHide)
880 local windowIndex
881 for windowIndex = 1, STATICPOPUP_NUMDIALOGS do
882 local currentFrame = getglobal("StaticPopup" .. windowIndex)
883 if currentFrame:IsVisible() and (currentFrame.which == windowToHide) then
884 currentFrame:Hide();
885 end
886 end
887 end
888  
889 -- Basic Text send function
890 function AsmoMOD_Chat(text)
891 DEFAULT_CHAT_FRAME:AddMessage(AsmoMOD_Color..text);
892 end
893  
894 function AsmoMOD_ChatR(text)
895 DEFAULT_CHAT_FRAME:AddMessage(AsmoMOD_ColorR..text);
896 end
897  
898 --Options Functions
899 function AsmoMOD_PercentageChanged()
900 AsmoMOD_Save.nspercent = this:GetValue();
901 nstext:SetText("NSHeal Percent: ".. AsmoMOD_Save.nspercent .. "%");
902 end
903  
904 function AsmoMOD_ConserveChanged()
905 AsmoMOD_Save.conservepercent = this:GetValue();
906 conservetext:SetText("Conserve Percent: ".. AsmoMOD_Save.conservepercent .. "%");
907 end