-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZHunterAIAntiDaze.lua
executable file
·54 lines (51 loc) · 1.98 KB
/
ZHunterAIAntiDaze.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ZHunterMod_Saved["ZHunterAIAntiDaze"] = nil
ZHunterAIAntiDaze_Tooltip = CreateFrame("GameTooltip", "ZHunterAIAntiDaze_Tooltip", nil, "GameTooltipTemplate")
ZHunterAIAntiDaze = CreateFrame("Frame", "ZHunterAIAntiDaze")
ZHunterAIAntiDaze:RegisterEvent("VARIABLES_LOADED")
ZHunterAIAntiDaze:SetScript("OnEvent", function()
if event == "VARIABLES_LOADED" then
if ZHunterMod_Saved["ZHunterAIAntiDaze"] then
ZHunterAIAntiDaze:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE")
ZHunterAIAntiDaze:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE")
end
else
local _, _, player = string.find(arg1 or "", ZHUNTER_AFFLICTED_DAZED)
if player then
local group = {}
group[ZHUNTER_YOU] = 1
for i=1, GetNumPartyMembers() do
group[UnitName("party"..i)] = 1
end
if group[player] then
local text
local i = 0
local buff = GetPlayerBuff(i, "HELPFUL")
while buff >= 0 do
ZHunterAIAntiDaze_Tooltip:SetOwner(this, "ANCHOR_NONE")
ZHunterAIAntiDaze_Tooltip:SetPlayerBuff(i)
text = ZHunterAIAntiDaze_TooltipTextLeft1:GetText()
if (text == ZHUNTER_ASPECT_CHEETAH and player == ZHUNTER_YOU) or text == ZHUNTER_ASPECT_PACK then
CancelPlayerBuff(buff)
return
end
i = i + 1
buff = GetPlayerBuff(i, "HELPFUL")
end
end
end
end
end)
SLASH_ZHunterAIAntiDaze1 = "/zantidaze"
SlashCmdList["ZHunterAIAntiDaze"] = function(msg)
if ZHunterMod_Saved["ZHunterAIAntiDaze"] then
ZHunterMod_Saved["ZHunterAIAntiDaze"] = nil
DEFAULT_CHAT_FRAME:AddMessage("Anti Daze Disabled.", 0, 1, 1)
ZHunterAIAntiDaze:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE")
ZHunterAIAntiDaze:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE")
else
ZHunterMod_Saved["ZHunterAIAntiDaze"] = 1
DEFAULT_CHAT_FRAME:AddMessage("Anti Daze Enabled.", 0, 1, 1)
ZHunterAIAntiDaze:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE")
ZHunterAIAntiDaze:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE")
end
end