vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | CThunWarnerStatus_InCombat = 0; |
2 | CThunWarnerStatus_Alarm = 1; |
||
3 | CThunWarnerStatus_Timer = 1; |
||
4 | CThunWarnerStatus_PlaySound = 1; |
||
5 | CThunWarnerStatus_SoundPhase2 = 0; |
||
6 | CThunWarnerStatus_ShowList = 4; |
||
7 | CThunWarnerStatus_Fake = 0; |
||
8 | CThunWarnerStatus_RangeStatus = 0; |
||
9 | CThunWarnerStatus_CurrentTime = 0; |
||
10 | CThunWarnerStatus_LastTimeCheck = 0; |
||
11 | CThunWarnerStatus_LastTimeSound = 0; |
||
12 | CThunWarnerStatus_Scale = 2; |
||
13 | CThunWarnerStatus_Locked = 0; |
||
14 | CThunWarnerStatus_InStomach = 0; |
||
15 | CThunWarnerStatus_TempDisableSound = 0; |
||
16 | CThunWarnerStatus_Players = {}; |
||
17 | CThunWarnerStatus_PlayersStomach = {}; |
||
18 | CThunWarnerStatus_DigestiveAcidTexture = "Interface\\Icons\\Ability_Creature_Disease_02"; |
||
19 | CThunWarnerStatus_Emote = "%s is weakened!"; |
||
20 | CThunWarnerStatus_Dies = "Eye of C'Thun dies."; |
||
21 | CThunWarnerStatus_Victory = "C'Thun dies."; |
||
22 | CThunWarnerStatus_WasVisible = true; |
||
23 | CThunWarnerStatus_VersionCheck = {}; |
||
24 | CThunWarnerStatus_Offline = {}; |
||
25 | CThunWarnerStatus_CheckRunning = false; |
||
26 | CThunWarnerStatus_CheckProgress = 0; |
||
27 | CThunWarnerStatus_CheckTime = 3; |
||
28 | |||
29 | function CThunWarner_OnLoad() |
||
30 | this:RegisterEvent("VARIABLES_LOADED"); |
||
31 | this:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
32 | this:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
33 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
34 | this:RegisterEvent("CHAT_MSG_ADDON"); |
||
35 | this:RegisterEvent("CHAT_MSG_MONSTER_EMOTE"); |
||
36 | this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH"); |
||
37 | SLASH_CThunWarner1 = "/ctw"; |
||
38 | SlashCmdList["CThunWarner"] = CThunWarner_SlashHandler; |
||
39 | end |
||
40 | |||
41 | function CThunWarner_SlashHandler(arg1) |
||
42 | local _, _, command, args = string.find(arg1, "(%w+)%s?(.*)"); |
||
43 | if(command) then |
||
44 | command = strlower(command); |
||
45 | else |
||
46 | command = ""; |
||
47 | end |
||
48 | if(command == "sound") then |
||
49 | if(args == "on") then |
||
50 | CThunWarnerStatus_PlaySound = 1; |
||
51 | CThunWarner_Print("|cFFFF9955Sound:|r |cFFFFFF00On|r."); |
||
52 | elseif(args == "off") then |
||
53 | CThunWarnerStatus_PlaySound = 0; |
||
54 | CThunWarner_Print("|cFFFF9955Sound:|r |cFFFFFF00Off|r."); |
||
55 | end |
||
56 | elseif(command == "check") then |
||
57 | if(UnitInRaid("player")) then |
||
58 | CThunWarner_Check(); |
||
59 | else |
||
60 | CThunWarner_Print("You are not in a raid.") |
||
61 | end |
||
62 | elseif(command == "fake") then |
||
63 | if(CThunWarnerStatus_Fake == 0) then |
||
64 | if(not CThunWarnerFrame:IsVisible()) then |
||
65 | CThunWarnerStatus_WasVisible = false; |
||
66 | CThunWarnerFrame:Show(); |
||
67 | end |
||
68 | CThunWarnerStatus_Fake = 1; |
||
69 | CThunWarnerStatusBar_Timer(8); |
||
70 | if(CThunWarnerStatus_Alarm == 1) then |
||
71 | PlaySoundFile("Interface\\AddOns\\CThunWarner\\alarm.mp3"); |
||
72 | end |
||
73 | else |
||
74 | CThunWarnerStatusBar:Hide(); |
||
75 | CThunWarnerStatus_Fake = 0; |
||
76 | if(not CThunWarnerStatus_WasVisible) then |
||
77 | CThunWarner_Off(); |
||
78 | end |
||
79 | CThunWarnerStatus_WasVisible = true; |
||
80 | end |
||
81 | elseif(command == "alarm") then |
||
82 | if(args == "on") then |
||
83 | CThunWarnerStatus_Alarm = 1; |
||
84 | CThunWarner_Print("|cFFFF9955Alarm:|r |cFFFFFF00On|r."); |
||
85 | elseif(args == "off") then |
||
86 | CThunWarnerStatus_Alarm = 0; |
||
87 | CThunWarner_Print("|cFFFF9955Alarm:|r |cFFFFFF00Off|r."); |
||
88 | end |
||
89 | elseif(command == "timer") then |
||
90 | if(args == "on") then |
||
91 | CThunWarnerStatus_Timer = 1; |
||
92 | CThunWarner_Print("|cFFFF9955Timer:|r |cFFFFFF00On|r."); |
||
93 | elseif(args == "off") then |
||
94 | CThunWarnerStatus_Timer = 0; |
||
95 | CThunWarner_Print("|cFFFF9955Timer:|r |cFFFFFF00Off|r."); |
||
96 | end |
||
97 | elseif(command == "soundphase2") then |
||
98 | if(args == "on") then |
||
99 | CThunWarnerStatus_SoundPhase2 = 1; |
||
100 | CThunWarner_Print("|cFFFF9955Phase2 Sound:|r |cFFFFFF00On|r."); |
||
101 | elseif(args == "off") then |
||
102 | CThunWarnerStatus_SoundPhase2 = 0; |
||
103 | CThunWarner_Print("|cFFFF9955Phase2 Sound:|r |cFFFFFF00Off|r."); |
||
104 | end |
||
105 | elseif(command == "lock") then |
||
106 | CThunWarnerStatus_Locked = 1; |
||
107 | CThunWarner_Print("|cFFFF9955Position:|r |cFFFFFF00Locked|r."); |
||
108 | elseif(command == "unlock") then |
||
109 | CThunWarnerStatus_Locked = 0; |
||
110 | CThunWarner_Print("|cFFFF9955Position:|r |cFFFFFF00Unlocked|r."); |
||
111 | elseif(command == "reset") then |
||
112 | CThunWarnerStatus_Locked = 0; |
||
113 | CThunWarnerFrame:SetScale(2); |
||
114 | CThunWarnerStatus_Scale = 2; |
||
115 | CThunWarnerFrame:ClearAllPoints(); |
||
116 | CThunWarnerFrame:SetPoint("CENTER", "UIParent"); |
||
117 | CThunWarner_Print("|cFFFF9955Position:|r |cFFFFFF00Reset|r."); |
||
118 | elseif(command == "scale") then |
||
119 | if(tonumber(args)) then |
||
120 | local newscale = tonumber(args); |
||
121 | CThunWarnerStatus_Locked = 0; |
||
122 | CThunWarnerFrame:SetScale(newscale); |
||
123 | CThunWarnerStatus_Scale = newscale; |
||
124 | CThunWarnerFrame:ClearAllPoints(); |
||
125 | CThunWarnerFrame:SetPoint("CENTER", "UIParent"); |
||
126 | CThunWarner_Print("|cFFFF9955Scale:|r |cFFFFFF00"..newscale.."|r."); |
||
127 | end |
||
128 | elseif(command == "list") then |
||
129 | if(tonumber(args)) then |
||
130 | local newlines = tonumber(args); |
||
131 | CThunWarnerStatus_ShowList = newlines; |
||
132 | CThunWarner_Print("|cFFFF9955Player List:|r |cFFFFFF00"..newlines.."|r."); |
||
133 | end |
||
134 | elseif(command == "ooc") then |
||
135 | CThunWarnerStatus_InCombat = 0; |
||
136 | CThunWarnerStatus_TempDisableSound = 0; |
||
137 | CThunWarner_Print("|cFFFF9955Sound:|r |cFFFFFF00Reset|r."); |
||
138 | elseif(command == "help") then |
||
139 | CThunWarner_Print("Command List:"); |
||
140 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw on/off", 0.988, 0.819, 0.086); |
||
141 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw alarm on/off", 0.988, 0.819, 0.086); |
||
142 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw sound on/off", 0.988, 0.819, 0.086); |
||
143 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw timer on/off", 0.988, 0.819, 0.086); |
||
144 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw soundphase2 on/off", 0.988, 0.819, 0.086); |
||
145 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw list 0..40", 0.988, 0.819, 0.086); |
||
146 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw scale 1..9", 0.988, 0.819, 0.086); |
||
147 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw reset", 0.988, 0.819, 0.086); |
||
148 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw lock", 0.988, 0.819, 0.086); |
||
149 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw unlock", 0.988, 0.819, 0.086); |
||
150 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw ooc", 0.988, 0.819, 0.086); |
||
151 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw fake", 0.988, 0.819, 0.086); |
||
152 | DEFAULT_CHAT_FRAME:AddMessage(" /ctw check", 0.988, 0.819, 0.086); |
||
153 | CThunWarner_Print("Command List."); |
||
154 | elseif(command == "on") then |
||
155 | CThunWarnerFrame:Show(); |
||
156 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00On|r."); |
||
157 | elseif(command == "off") then |
||
158 | CThunWarner_Off(); |
||
159 | CThunWarnerStatus_Fake = 0; |
||
160 | CThunWarnerStatus_WasVisible = true; |
||
161 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00Off|r."); |
||
162 | elseif(command == "") then |
||
163 | if(CThunWarnerFrame:IsVisible()) then |
||
164 | CThunWarner_Off(); |
||
165 | CThunWarnerStatus_Fake = 0; |
||
166 | CThunWarnerStatus_WasVisible = true; |
||
167 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00Off|r."); |
||
168 | else |
||
169 | CThunWarnerFrame:Show(); |
||
170 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00On|r."); |
||
171 | end |
||
172 | else |
||
173 | CThunWarner_Print("Type /ctw help for a command list."); |
||
174 | end |
||
175 | end |
||
176 | |||
177 | function CThunWarner_OnEvent(event) |
||
178 | if(event == "PLAYER_REGEN_DISABLED" and GetZoneText() == "Ahn'Qiraj") then |
||
179 | if(CThunWarnerFrame:IsVisible()) then |
||
180 | CThunWarnerStatus_InCombat = 1; |
||
181 | end |
||
182 | elseif(event == "PLAYER_REGEN_ENABLED" and CThunWarnerStatus_InCombat == 1) then |
||
183 | CThunWarnerStatus_InCombat = 0; |
||
184 | CThunWarnerStatus_TempDisableSound = 0; |
||
185 | elseif(event == "PLAYER_ENTERING_WORLD") then |
||
186 | CThunWarnerStatus_InCombat = 0; |
||
187 | CThunWarnerStatus_TempDisableSound = 0; |
||
188 | elseif(event == "VARIABLES_LOADED") then |
||
189 | CThunWarnerFrame:SetScale(CThunWarnerStatus_Scale); |
||
190 | elseif(event == "CHAT_MSG_ADDON" and UnitInRaid("player")) then |
||
191 | if(arg1 == "CThunWarner" and arg3 == "RAID") then |
||
192 | CThunWarner_Reply(arg2, arg4); |
||
193 | end |
||
194 | elseif(event == "CHAT_MSG_MONSTER_EMOTE" and CThunWarnerFrame:IsVisible() and GetZoneText() == "Ahn'Qiraj") then |
||
195 | if(arg1 == CThunWarnerStatus_Emote) then |
||
196 | if(CThunWarnerStatus_Alarm == 1) then |
||
197 | PlaySoundFile("Interface\\AddOns\\CThunWarner\\alarm.mp3"); |
||
198 | end |
||
199 | if(CThunWarnerStatus_Timer == 1) then |
||
200 | CThunWarnerStatusBar_Timer(45); |
||
201 | end |
||
202 | end |
||
203 | elseif(event == "CHAT_MSG_COMBAT_HOSTILE_DEATH" and CThunWarnerFrame:IsVisible() and GetZoneText() == "Ahn'Qiraj") then |
||
204 | if(arg1 == CThunWarnerStatus_Dies) then |
||
205 | if(CThunWarnerStatus_SoundPhase2 == 0) then |
||
206 | CThunWarnerStatus_TempDisableSound = 1; |
||
207 | end |
||
208 | elseif(arg1 == CThunWarnerStatus_Victory) then |
||
209 | CThunWarner_Off(); |
||
210 | CThunWarnerStatus_InCombat = 0; |
||
211 | CThunWarnerStatus_TempDisableSound = 0; |
||
212 | CThunWarner_Print("|cFF5DFC0AVictory!|r |cFFFF9955C'Thun Warner:|r |cFFFFFF00Off|r."); |
||
213 | end |
||
214 | end |
||
215 | end |
||
216 | |||
217 | function CThunWarner_OnUpdate(arg1) |
||
218 | CThunWarnerStatus_CurrentTime = CThunWarnerStatus_CurrentTime + arg1; |
||
219 | if(CThunWarnerStatus_CurrentTime > (CThunWarnerStatus_LastTimeCheck+0.1)) then |
||
220 | local unitid; |
||
221 | CThunWarnerStatus_Players = {}; |
||
222 | CThunWarnerStatus_PlayersStomach = {}; |
||
223 | CThunWarnerStatus_InStomach = 0; |
||
224 | for i = 1, GetNumRaidMembers(), 1 do |
||
225 | unitid = "raid"..i; |
||
226 | if(not UnitIsDeadOrGhost(unitid)) then |
||
227 | if(not UnitIsUnit(unitid, "player")) then |
||
228 | if(CheckInteractDistance(unitid, 3)) then |
||
229 | tinsert(CThunWarnerStatus_Players, (UnitName(unitid))); |
||
230 | end |
||
231 | end |
||
232 | for a=1,16 do |
||
233 | local t,c = UnitDebuff(unitid,a); |
||
234 | if(t == nil) then break; end; |
||
235 | if(t == CThunWarnerStatus_DigestiveAcidTexture) then |
||
236 | if(UnitIsUnit(unitid, "player")) then |
||
237 | CThunWarnerStatus_InStomach = 1; |
||
238 | end |
||
239 | tinsert(CThunWarnerStatus_PlayersStomach, unitid); |
||
240 | break; |
||
241 | end |
||
242 | end |
||
243 | end |
||
244 | end |
||
245 | if(getn(CThunWarnerStatus_Players) > 0) then |
||
246 | CThunWarnerStatus_RangeStatus = 1; |
||
247 | CThunWarnerStatusTexture:SetVertexColor(1,0,0); |
||
248 | if(CThunWarnerStatus_InCombat == 1 and CThunWarnerStatus_PlaySound == 1 and CThunWarnerStatus_TempDisableSound == 0 and CThunWarnerStatus_InStomach == 0) then |
||
249 | if(CThunWarnerStatus_CurrentTime > (CThunWarnerStatus_LastTimeSound+1)) then |
||
250 | PlaySoundFile("Interface\\AddOns\\CThunWarner\\beep.mp3"); |
||
251 | CThunWarnerStatus_LastTimeSound = CThunWarnerStatus_CurrentTime; |
||
252 | end |
||
253 | end |
||
254 | else |
||
255 | CThunWarnerStatus_RangeStatus = 0; |
||
256 | CThunWarnerStatusTexture:SetVertexColor(0,1,0); |
||
257 | end |
||
258 | CThunWarner_UpdateList(); |
||
259 | CThunWarner_UpdateStomachList(); |
||
260 | CThunWarnerStatus_LastTimeCheck = CThunWarnerStatus_CurrentTime; |
||
261 | end |
||
262 | if(CThunWarnerStatus_CheckRunning) then |
||
263 | CThunWarnerStatus_CheckProgress = CThunWarnerStatus_CheckProgress + arg1; |
||
264 | if(CThunWarnerStatus_CheckProgress > CThunWarnerStatus_CheckTime) then |
||
265 | CThunWarnerStatus_CheckRunning = false; |
||
266 | local foundcount = 0; |
||
267 | local notfoundcount = 0; |
||
268 | local notfound = "Not Found: "; |
||
269 | for i=1,MAX_RAID_MEMBERS do |
||
270 | local raidname = (UnitName("raid"..i)); |
||
271 | if(CThunWarnerStatus_VersionCheck[raidname] == false) then |
||
272 | notfoundcount = notfoundcount + 1; |
||
273 | notfound = notfound.."|Hplayer:"..raidname.."|h["..raidname.."]|h, "; |
||
274 | elseif(CThunWarnerStatus_VersionCheck[raidname] == true and raidname ~= UnitName("player")) then |
||
275 | foundcount = foundcount + 1; |
||
276 | end |
||
277 | end |
||
278 | CThunWarner_Print("|cFFFF5333"..notfound.."("..notfoundcount.." Total)|r"); |
||
279 | CThunWarner_Print("|cFF5DFC0AFound: ("..foundcount.." Total)|r"); |
||
280 | end |
||
281 | end |
||
282 | end |
||
283 | |||
284 | function CThunWarnerStatusBar_Timer(time) |
||
285 | CThunWarnerStatusBar.startTime = GetTime(); |
||
286 | CThunWarnerStatusBar.endTime = CThunWarnerStatusBar.startTime + time; |
||
287 | CThunWarnerStatusBar:SetMinMaxValues(CThunWarnerStatusBar.startTime, CThunWarnerStatusBar.endTime); |
||
288 | CThunWarnerStatusBar:SetValue(CThunWarnerStatusBar.startTime); |
||
289 | CThunWarnerStatusBar:Show(); |
||
290 | end |
||
291 | |||
292 | function CThunWarnerStatusBar_OnUpdate() |
||
293 | local time = GetTime(); |
||
294 | if(time > this.endTime) then |
||
295 | time = this.endTime |
||
296 | end |
||
297 | if(time == this.endTime) then |
||
298 | if(CThunWarnerStatus_Fake == 1) then |
||
299 | CThunWarnerStatus_Fake = 0; |
||
300 | if(not CThunWarnerStatus_WasVisible) then |
||
301 | CThunWarner_Off(); |
||
302 | CThunWarnerStatus_WasVisible = true; |
||
303 | end |
||
304 | end |
||
305 | this:Hide(); |
||
306 | return; |
||
307 | end |
||
308 | this:SetValue(this.startTime + (this.endTime - time)); |
||
309 | getglobal(this:GetName().."Text"):SetText(format("%.2f", this.endTime - time)); |
||
310 | end |
||
311 | |||
312 | function CThunWarner_UpdateList() |
||
313 | CThunWarnerTooltip:SetOwner(CThunWarnerFrame, "ANCHOR_BOTTOMRIGHT"); |
||
314 | CThunWarnerTooltip:SetFrameStrata("MEDIUM"); |
||
315 | if(CThunWarnerStatus_RangeStatus == 0 or CThunWarnerStatus_ShowList == 0) then |
||
316 | CThunWarnerTooltip:Hide(); |
||
317 | if(CThunWarnerStatus_Fake == 1) then |
||
318 | CThunWarnerTooltip:SetOwner(CThunWarnerFrame, "ANCHOR_BOTTOMRIGHT"); |
||
319 | CThunWarnerTooltip:SetFrameStrata("MEDIUM"); |
||
320 | CThunWarnerTooltip:ClearLines(); |
||
321 | CThunWarnerTooltip:AddLine("Linking:",0.890,0.811,0.341,0); |
||
322 | CThunWarnerTooltip:AddLine("- Farming",1,0.498,0,0); |
||
323 | CThunWarnerTooltip:AddLine("- Stranglekelp",0.666,0.666,1,0); |
||
324 | CThunWarnerTooltip:AddLine("- Liferoot",0.666,0.666,1,0); |
||
325 | CThunWarnerTooltip:AddLine("- Forever",1,0.498,0,0); |
||
326 | CThunWarnerTooltip:Show(); |
||
327 | end |
||
328 | else |
||
329 | CThunWarnerTooltip:ClearLines(); |
||
330 | CThunWarnerTooltip:AddLine("Linking:",0.890,0.811,0.341,0); |
||
331 | local index = 1; |
||
332 | for key, player in CThunWarnerStatus_Players do |
||
333 | for i=1,MAX_RAID_MEMBERS do |
||
334 | local partyid = "raid"..i; |
||
335 | if((player == (UnitName(partyid))) and UnitExists(partyid) and UnitInParty(partyid)) then |
||
336 | CThunWarnerTooltip:AddLine("- "..player,0.666,0.666,1,0); |
||
337 | else |
||
338 | if((player == (UnitName(partyid))) and UnitExists(partyid) and not UnitInParty(partyid)) then |
||
339 | CThunWarnerTooltip:AddLine("- "..player,1,0.498,0,0); |
||
340 | end |
||
341 | end |
||
342 | end |
||
343 | if(index >= CThunWarnerStatus_ShowList) then |
||
344 | break; |
||
345 | end |
||
346 | index = index + 1; |
||
347 | end |
||
348 | CThunWarnerTooltip:Show(); |
||
349 | end |
||
350 | end |
||
351 | |||
352 | function CThunWarner_UpdateStomachList() |
||
353 | CThunWarnerStomachTooltip:SetOwner(CThunWarnerFrame, "ANCHOR_RIGHT"); |
||
354 | CThunWarnerStomachTooltip:SetFrameStrata("MEDIUM"); |
||
355 | if(getn(CThunWarnerStatus_PlayersStomach) == 0 or CThunWarnerStatus_ShowList == 0 or CThunWarnerStatus_InStomach == 1) then |
||
356 | CThunWarnerStomachTooltip:Hide(); |
||
357 | if(CThunWarnerStatus_Fake == 1) then |
||
358 | CThunWarnerStomachTooltip:SetOwner(CThunWarnerFrame, "ANCHOR_RIGHT"); |
||
359 | CThunWarnerStomachTooltip:SetFrameStrata("MEDIUM"); |
||
360 | CThunWarnerStomachTooltip:ClearLines(); |
||
361 | CThunWarnerStomachTooltip:AddLine("Stomach:",0.635,0.737,0.074,0); |
||
362 | CThunWarnerStomachTooltip:AddLine("- Pepcid",0.666,0.666,1,0); |
||
363 | CThunWarnerStomachTooltip:AddLine("- Reflux",1,0.498,0,0); |
||
364 | CThunWarnerStomachTooltip:Show(); |
||
365 | end |
||
366 | else |
||
367 | CThunWarnerStomachTooltip:ClearLines(); |
||
368 | CThunWarnerStomachTooltip:AddLine("Stomach:",0.635,0.737,0.074,0); |
||
369 | for key, unit in CThunWarnerStatus_PlayersStomach do |
||
370 | if(UnitExists(unit)) then |
||
371 | if(UnitInParty(unit)) then |
||
372 | CThunWarnerStomachTooltip:AddLine("- "..(UnitName(unit)),0.666,0.666,1,0); |
||
373 | else |
||
374 | CThunWarnerStomachTooltip:AddLine("- "..(UnitName(unit)),1,0.498,0,0); |
||
375 | end |
||
376 | end |
||
377 | end |
||
378 | CThunWarnerStomachTooltip:Show(); |
||
379 | end |
||
380 | end |
||
381 | |||
382 | function CThunWarner_Check() |
||
383 | if(UnitInRaid("player")) then |
||
384 | if(CThunWarnerFrame:IsVisible() and not CThunWarnerStatus_CheckRunning) then |
||
385 | CThunWarner_Print("|cFF5DFC0AReady Check!|r"); |
||
386 | elseif(not CThunWarnerFrame:IsVisible()) then |
||
387 | CThunWarnerFrame:Show(); |
||
388 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00On|r. |cFF5DFC0AReady Check!|r"); |
||
389 | end |
||
390 | if(not CThunWarnerStatus_CheckRunning) then |
||
391 | CThunWarnerStatus_VersionCheck = {}; |
||
392 | CThunWarnerStatus_Offline = {}; |
||
393 | for i=1,MAX_RAID_MEMBERS do |
||
394 | local raidname = (UnitName("raid"..i)); |
||
395 | local isonline = UnitIsConnected("raid"..i); |
||
396 | if(raidname and isonline ~= nil) then |
||
397 | CThunWarnerStatus_VersionCheck[raidname] = false; |
||
398 | else |
||
399 | if(raidname and isonline == nil) then |
||
400 | CThunWarnerStatus_Offline[raidname] = true; |
||
401 | end |
||
402 | end |
||
403 | end |
||
404 | SendAddonMessage("CThunWarner", "Check", "RAID"); |
||
405 | CThunWarnerStatus_CheckRunning = true; |
||
406 | CThunWarnerStatus_CheckProgress = 0; |
||
407 | CThunWarner_Reply("Ready", (UnitName("player"))); |
||
408 | CThunWarner_Offline(); |
||
409 | end |
||
410 | end |
||
411 | end |
||
412 | |||
413 | function CThunWarner_Offline() |
||
414 | local offlinecount = 0; |
||
415 | local isoffline = "Offline: "; |
||
416 | for i=1,MAX_RAID_MEMBERS do |
||
417 | local raidname = (UnitName("raid"..i)); |
||
418 | if(CThunWarnerStatus_Offline[raidname] == true) then |
||
419 | offlinecount = offlinecount + 1; |
||
420 | isoffline = isoffline.."|Hplayer:"..raidname.."|h["..raidname.."]|h, "; |
||
421 | end |
||
422 | end |
||
423 | CThunWarner_Print("|cFFC6C3B5"..isoffline.."("..offlinecount.." Total)|r"); |
||
424 | end |
||
425 | |||
426 | function CThunWarner_Reply(msg, sender) |
||
427 | if(msg == "Check" and sender ~= UnitName("player")) then |
||
428 | SendAddonMessage("CThunWarner", "Ready", "RAID"); |
||
429 | if(not CThunWarnerFrame:IsVisible() and GetZoneText() == "Ahn'Qiraj") then |
||
430 | local name, rank; |
||
431 | for i = 1, GetNumRaidMembers(), 1 do |
||
432 | name, rank = GetRaidRosterInfo(i); |
||
433 | if(name == sender) then |
||
434 | if(rank and rank > 0) then |
||
435 | CThunWarnerFrame:Show(); |
||
436 | CThunWarner_Print("|cFFFF9955C'Thun Warner:|r |cFFFFFF00On|r. |cFF5DFC0AReady Check!|r |cFFFF9955|Hplayer:"..sender.."|h["..sender.."]|h|r"); |
||
437 | break; |
||
438 | end |
||
439 | break; |
||
440 | end |
||
441 | end |
||
442 | end |
||
443 | elseif(CThunWarnerStatus_CheckRunning and msg == "Ready" and sender) then |
||
444 | CThunWarnerStatus_VersionCheck[sender] = true; |
||
445 | end |
||
446 | end |
||
447 | |||
448 | function CThunWarner_Off() |
||
449 | CThunWarnerFrame:Hide(); |
||
450 | CThunWarnerTooltip:Hide(); |
||
451 | CThunWarnerStomachTooltip:Hide(); |
||
452 | CThunWarnerStatusBar:Hide(); |
||
453 | end |
||
454 | |||
455 | function CThunWarner_Print(msg) |
||
456 | DEFAULT_CHAT_FRAME:AddMessage("<C'Thun Warner> "..msg, 0.988, 0.819, 0.086); |
||
457 | end |