vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 IMBA_SAPPHIRON_LIFEDRAIN_TIME = 22;
2 IMBA_SAPPHIRON_LIFEDRAIN_MSG = "is afflicted by Life Drain."
3  
4 IMBA_SAPPHIRON_ICEBOMB_TIME = 7;
5 IMBA_SAPPHIRON_ICEBOMB_MSG = "Sapphiron begins to cast Frost Breath."
6  
7  
8 IMBA_SAPPHIRON_LANDING_MSG = "Icebolt fades from"
9 IMBA_SAPPHIRON_GROUND_TIME_INIT = 35;
10 IMBA_SAPPHIRON_GROUND_TIME = 70;
11 IMBA_SAPPHIRON_FLIGHT_TIME = 30;
12  
13 function IMBA_Sapphiron_StartLifeDrainTimer()
14 IMBA_Sapphiron_TimerLifeDrain.timeLength=IMBA_SAPPHIRON_LIFEDRAIN_TIME;
15 IMBA_Sapphiron_TimerLifeDrain.timeEnd=GetTime()+IMBA_SAPPHIRON_LIFEDRAIN_TIME;
16 IMBA_Sapphiron_TimerLifeDrain.repeating=false;
17 IMBA_Sapphiron_TimerLifeDrain.active=true;
18 end
19  
20 function IMBA_Sapphiron_StartIceBombTimer()
21 IMBA_Sapphiron_TimerIceBomb.timeLength=IMBA_SAPPHIRON_ICEBOMB_TIME;
22 IMBA_Sapphiron_TimerIceBomb.timeEnd=GetTime()+IMBA_SAPPHIRON_ICEBOMB_TIME;
23 IMBA_Sapphiron_TimerIceBomb.repeating=false;
24 IMBA_Sapphiron_TimerIceBomb.active=true;
25 end
26  
27 function IMBA_Sapphiron_Null()
28 IMBA_RangeChecker_Active=false;
29 end
30  
31 function IMBA_Sapphiron_StartFlightTimer()
32 IMBA_RangeChecker_Active=true;
33 IMBA_Sapphiron_TimerFlight:SetBarText("Time in Air");
34 IMBA_Sapphiron_TimerFlight.timeLength=IMBA_SAPPHIRON_FLIGHT_TIME;
35 IMBA_Sapphiron_TimerFlight.timeEnd=GetTime()+IMBA_SAPPHIRON_FLIGHT_TIME;
36 IMBA_Sapphiron_TimerFlight.repeating=false;
37 IMBA_Sapphiron_TimerFlight.active=true;
38 IMBA_Sapphiron_TimerFlight.callback=IMBA_Sapphiron_Null;
39 end
40  
41 function IMBA_Sapphiron_StartGroundTimerInit()
42 IMBA_Sapphiron_TimerFlight:SetBarText("Time on Ground");
43 IMBA_Sapphiron_TimerFlight.timeLength=IMBA_SAPPHIRON_GROUND_TIME_INIT;
44 IMBA_Sapphiron_TimerFlight.timeEnd=GetTime()+IMBA_SAPPHIRON_GROUND_TIME_INIT;
45 IMBA_Sapphiron_TimerFlight.repeating=false;
46 IMBA_Sapphiron_TimerFlight.active=true;
47  
48 IMBA_Sapphiron_TimerFlight.callback=IMBA_Sapphiron_StartFlightTimer;
49 end
50  
51 function IMBA_Sapphiron_StartGroundTimer()
52 IMBA_Sapphiron_TimerFlight:SetBarText("Time on Ground");
53 IMBA_Sapphiron_TimerFlight.timeLength=IMBA_SAPPHIRON_GROUND_TIME;
54 IMBA_Sapphiron_TimerFlight.timeEnd=GetTime()+IMBA_SAPPHIRON_GROUND_TIME;
55 IMBA_Sapphiron_TimerFlight.repeating=false;
56 IMBA_Sapphiron_TimerFlight.active=true;
57 IMBA_Sapphiron_TimerFlight.oldcallback=IMBA_Sapphiron_TimerFlight.callback;
58 IMBA_Sapphiron_TimerFlight.callback=IMBA_Sapphiron_StartFlightTimer;
59 end
60  
61 function IMBA_Sapphiron_Start()
62 IMBA_Sapphiron_Blocks=1;
63 IMBA_Minimap_ClearBossMarkers();
64 IMBA_Sapphiron_StartGroundTimerInit();
65  
66 if IMBA_CheckVar("Sapphiron","ActivateRangeChecker") then
67 IMBA_RangeChecker:Show();
68 end
69 end
70  
71 function IMBA_Sapphiron_RegenActivator()
72 IMBA_Sapphiron_Start();
73 IMBA_Sapphiron:Show();
74 end
75  
76 function IMBA_Sapphiron_RegisterEvents()
77 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE");
78 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE");
79 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE");
80 this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
81 this:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE");
82 this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_OTHER");
83 this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF");
84 end
85  
86 function IMBA_Sapphiron_UnregisterEvents()
87 this:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE");
88 this:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE");
89 this:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE");
90 this:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
91 this:UnregisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE");
92 this:UnregisterEvent("CHAT_MSG_SPELL_AURA_GONE_OTHER");
93 this:UnregisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF");
94 end
95  
96 function IMBA_Sapphiron_CheckBombAnnounce()
97 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb==nil then
98 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb=false;
99 return false;
100 end
101 return IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb;
102 end
103  
104 function IMBA_Sapphiron_ToggleBombAnnounce()
105 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb==nil then
106 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb=true;
107 return;
108 end
109 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb then
110 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb=false
111 else
112 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb=true;
113 end
114 end
115  
116 function IMBA_Sapphiron_CheckLifeDrainAnnounce()
117 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain==nil then
118 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain=false;
119 return false;
120 end
121 return IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain;
122 end
123  
124 function IMBA_Sapphiron_ToggleLifeDrainAnnounce()
125 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain==nil then
126 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain=true;
127 return;
128 end
129 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain then
130 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain=false
131 else
132 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain=true;
133 end
134 end
135  
136 function IMBA_Sapphiron_CheckAnnounceBlocks()
137 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks==nil then
138 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks=false;
139 return false;
140 end
141 return IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks;
142 end
143  
144 function IMBA_Sapphiron_ToggleAnnounceBlocks()
145 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks==nil then
146 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks=true;
147 return;
148 end
149 if IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks then
150 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks=false
151 else
152 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks=true;
153 end
154 end
155  
156  
157 function IMBA_Sapphiron_OnLoad()
158 this:SetBackdropBorderColor(1, 1, 1, 1);
159 this:SetBackdropColor(0.0,0.0,0.0,0.6);
160  
161  
162 IMBA_Sapphiron_Title:SetText("Sapphiron Timers");
163  
164 IMBA_Sapphiron_TimerLifeDrain:SetBarText("Life Drain");
165 IMBA_Sapphiron_TimerIceBomb:SetBarText("Ice Bomb");
166 IMBA_Sapphiron_TimerFlight:SetBarText("Time on Ground");
167  
168 IMBA_Sapphiron_DrainLockout=0;
169 IMBA_Sapphiron_LandLockout=0;
170  
171 local playerClass, englishClass = UnitClass("player");
172  
173 if (englishClass=="DRUID") or (englishClass=="MAGE") then
174 IMBA_Sapphiron_Decurser=true;
175 else
176 IMBA_Sapphiron_Decurser=false;
177 end
178 IMBA_AddAddon("Sapphiron", "Timers for Life Drain, Ice Bomb, Flight Time, and marks Ice Blocks on the Minimap", IMBA_LOCATIONS_NAXX_LAIR, "IMBA_Sapphiron_RegenActivator", nil,nil,"IMBA_Sapphiron");
179 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb=false;
180 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain=false;
181 IMBA_SavedVariables.Mods["Sapphiron"].MarkBlocks=false;
182 IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks=false;
183 IMBA_AddOption("Sapphiron","Announce Bombs",IMBA_Sapphiron_ToggleBombAnnounce,IMBA_Sapphiron_CheckBombAnnounce)
184 IMBA_AddOption("Sapphiron","Announce Life Drains",IMBA_Sapphiron_ToggleLifeDrainAnnounce,IMBA_Sapphiron_CheckLifeDrainAnnounce)
185 IMBA_AddOption("Sapphiron","Announce Ice Blocks",IMBA_Sapphiron_ToggleAnnounceBlocks,IMBA_Sapphiron_CheckAnnounceBlocks)
186 IMBA_AddOption2("Sapphiron","ActivateRangeChecker","Activate Range Checker");
187 IMBA_Sapphiron_TimerFlight.oldcallback=IMBA_Sapphiron_TimerFlight.callback;
188 end
189  
190  
191 function IMBA_Sapphiron_OnEvent(event)
192 if ( event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" ) then
193 if string.find(arg1,IMBA_SAPPHIRON_ICEBOMB_MSG) then
194 IMBA_RangeChecker_Active=false;
195 IMBA_AddRaidAlert("** Ice Bomb Incoming! **",true,IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBomb);
196 IMBA_Sapphiron_StartIceBombTimer();
197 end
198 elseif ( event == "CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE" or event == "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE" or event == "CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE" ) then
199 if ( string.find(arg1,IMBA_SAPPHIRON_LIFEDRAIN_MSG) ) and ( IMBA_Sapphiron_DrainLockout < GetTime() ) then
200 IMBA_Sapphiron_DrainLockout=GetTime()+5;
201  
202 if IMBA_Sapphiron_Decurser then
203 IMBA_AddAlert("** Decurse Life Drains **");
204 end
205  
206 IMBA_AddRaidAlert("** Decurse Life Drains **",false,IMBA_SavedVariables.Mods["Sapphiron"].AnnounceLifeDrain);
207 IMBA_Sapphiron_StartLifeDrainTimer();
208 else
209 local iStart, iEnd, sPlayer, sType = string.find(arg1, "^([^%s]+) ([^%s]+) afflicted by Icebolt");
210 if ( sPlayer and sType ) then
211 IMBA_RangeChecker_Active=true;
212 if ( sPlayer == "You" and sType == "are" ) then
213 IMBA_Minimap_SetBossMarker();
214 IMBA_AddRaidAlert("** Ice Block "..IMBA_Sapphiron_Blocks.." ("..UnitName("player")..") **",true,IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks);
215 else
216 IMBA_AddRaidAlert("** Ice Block "..IMBA_Sapphiron_Blocks.." ("..sPlayer..") **",true,IMBA_SavedVariables.Mods["Sapphiron"].AnnounceBlocks);
217 end
218 IMBA_Sapphiron_Blocks=IMBA_Sapphiron_Blocks+1;
219 end
220 end
221 elseif ( event == "CHAT_MSG_SPELL_AURA_GONE_OTHER" or event == "CHAT_MSG_SPELL_AURA_GONE_SELF") then
222 if (string.find(arg1, IMBA_SAPPHIRON_LANDING_MSG) ) and ( IMBA_Sapphiron_LandLockout < GetTime() ) then
223 IMBA_RangeChecker_Active=false;
224 IMBA_Minimap_ClearBossMarkers();
225 IMBA_Sapphiron_Blocks=1;
226 IMBA_Sapphiron_LandLockout=GetTime()+5;
227 IMBA_Sapphiron_StartGroundTimer();
228 end
229 end
230 end