vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function SmartHeal:OnLoad()
2  
3 -- register events
4 SmartHeal:RegisterEvent();
5  
6 end
7  
8 function SmartHeal:OnEvent(event,arg1,arg2)
9  
10 if (event == "PLAYER_LOGIN" and SmartHeal.isActive()) then
11  
12 SmartHeal:Init()
13 SmartHeal:InitClickMode()
14 SmartHeal:InitHotList()
15 SmartHeal:InitMiniMapButton()
16 SmartHeal:ErrorMsg(SH_SMARTHEAL_LOADED.." Version "..SMARTHEAL_CURRENT_VERSION,0.5,0.6,0.8);
17  
18 if (SmartHeal.InitializeSave) then
19 SmartHeal:setDefault();
20 end
21  
22 if (not SmartHeal:getConfig('enabled','minimapbutton')) then
23 MyMinimapButton:Disable('SmartHeal')
24 end
25  
26 SmartHeal.Loaded=1
27  
28 elseif event == "VARIABLES_LOADED" then
29  
30 local _, playerClass = UnitClass("player");
31 SmartHeal.playerClass=playerClass;
32  
33 if (not SMARTHEAL_HEALTABLE[playerClass]) then
34 SmartHeal.active=false;
35 SmartHeal:ErrorMsg(SH_IS_NOT_ACTIVE_CLASS)
36 SmartHeal:UnregisterEvent()
37  
38 else
39 SmartHeal.spellList=SMARTHEAL_HEALTABLE[playerClass];
40 SmartHeal.buffList=SMARTHEAL_BUFFTABLE[playerClass];
41 SmartHeal.active=1;
42 --SmartHeal:ErrorMsg(SmartHeal_Version)
43  
44 end
45  
46  
47 -- save to varaible
48 SmartHeal_Version=SMARTHEAL_VERSION
49  
50 elseif event=="PLAYER_ENTER_COMBAT" then
51 SmartHeal.Attacking=1
52 elseif event=="PLAYER_LEAVE_COMBAT" then
53 SmartHeal.Attacking=false
54 elseif event=="SPELLCAST_START" then
55  
56 SmartHeal.SpellIsCasting=1
57 SmartHeal.timer=arg2
58 SmartHeal.HealUnitId=SmartHeal.CacheUnitId
59  
60 -- Trigger excess healing alert
61 if(SmartHeal.spellList[arg1] and not SmartHeal.spellList[arg1].HoT and SmartHeal.HealUnitId and SmartHeal:getConfig("excesshealalert")) then
62 SmartHeal.DoExcessHealAlert=1
63 end
64  
65 --elseif event=="SPELLCAST_CHANNEL_UPDATE" then
66 -- SmartHeal.SpellIsChanneling=1
67 -- SmartHeal.timer=arg1
68  
69 elseif (event=="SPELLCAST_STOP" or event=="SPELLCAST_INTERRUPTED"
70 --or event=="SPELLCAST_CHANNEL_STOP"
71 )
72 then
73  
74 SmartHeal.SpellIsCasting=false
75 SmartHeal.SpellIsChanneling=false
76 SmartHeal.HealUnitId=nil
77  
78 if(SmartHeal.AttackingBeforeCast) then
79 SmartHeal.ResumeAttack=1
80 end
81  
82 --elseif event=="SPELLCAST_FAILED" then
83  
84 elseif event == "CHAT_MSG_SPELL_FRIENDLYPLAYER_BUFF" then
85  
86 if (SmartHeal:getConfig("alert") and UnitAffectingCombat("player")) then
87  
88 if (InspectFrame) then
89 if (not InspectFrame:IsShown()) then
90 SmartHeal:AlertHealer(arg1)
91 end
92 else
93 SmartHeal:AlertHealer(arg1)
94 end
95  
96 end
97 end
98  
99 end -- end of function
100  
101 function SmartHeal:RegisterEvent(event)
102  
103 if (event~=nil) then
104 this:RegisterEvent(event);
105 else
106 for i=1, table.getn(SmartHeal.Events) do
107 this:RegisterEvent(SmartHeal.Events[i]);
108 end
109 end
110 end
111  
112 function SmartHeal:UnregisterEvent(event)
113  
114 if (event~=nil) then
115 this:UnregisterEvent(event);
116 else
117 for i=1, table.getn(SmartHeal.Events) do
118 this:UnregisterEvent(SmartHeal.Events[i]);
119 end
120 end
121 end