2022-01-27 01:30:28 +01:00
|
|
|
local select, string_gsub, tostring, pairs, ipairs = select, string.gsub, tostring, pairs, ipairs
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
|
|
|
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
|
|
|
|
local AURA_TYPE_BUFF = AURA_TYPE_BUFF
|
|
|
|
|
2022-01-11 00:05:31 +01:00
|
|
|
local UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit, UnitExists = UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit, UnitExists
|
2021-05-17 16:49:54 +02:00
|
|
|
local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo
|
|
|
|
local GetSpellInfo = GetSpellInfo
|
|
|
|
local FindAuraByName = AuraUtil.FindAuraByName
|
2022-01-11 00:05:31 +01:00
|
|
|
local GetTime = GetTime
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
local Gladdy = LibStub("Gladdy")
|
2022-01-27 01:30:28 +01:00
|
|
|
local L = Gladdy.L
|
2021-05-17 16:49:54 +02:00
|
|
|
local Cooldowns = Gladdy.modules["Cooldowns"]
|
|
|
|
local Diminishings = Gladdy.modules["Diminishings"]
|
|
|
|
|
2022-03-03 23:40:00 +01:00
|
|
|
local EventListener = Gladdy:NewModule("EventListener", 101, {
|
2021-05-17 16:49:54 +02:00
|
|
|
test = true,
|
|
|
|
})
|
|
|
|
|
|
|
|
function EventListener:Initialize()
|
|
|
|
self:RegisterMessage("JOINED_ARENA")
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener.OnEvent(self, event, ...)
|
|
|
|
EventListener[event](self, ...)
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:JOINED_ARENA()
|
|
|
|
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
|
|
|
self:RegisterEvent("ARENA_OPPONENT_UPDATE")
|
|
|
|
self:RegisterEvent("UNIT_AURA")
|
|
|
|
self:RegisterEvent("UNIT_SPELLCAST_START")
|
|
|
|
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
|
|
|
|
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
|
|
|
|
self:SetScript("OnEvent", EventListener.OnEvent)
|
2022-01-10 23:59:33 +01:00
|
|
|
|
|
|
|
-- in case arena has started already we check for units
|
|
|
|
for i=1,Gladdy.curBracket do
|
|
|
|
if UnitExists("arena" .. i) then
|
|
|
|
Gladdy:SpotEnemy("arena" .. i, true)
|
|
|
|
end
|
|
|
|
if UnitExists("arenapet" .. i) then
|
|
|
|
Gladdy:SendMessage("PET_SPOTTED", "arenapet" .. i)
|
|
|
|
end
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:Reset()
|
|
|
|
self:UnregisterAllEvents()
|
|
|
|
self:SetScript("OnEvent", nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
function Gladdy:SpotEnemy(unit, auraScan)
|
|
|
|
local button = self.buttons[unit]
|
2021-08-19 18:57:27 +02:00
|
|
|
if not unit or not button then
|
|
|
|
return
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
button.stealthed = false
|
2022-03-27 18:50:02 +02:00
|
|
|
if UnitExists(unit) then
|
|
|
|
button.raceLoc = UnitRace(unit)
|
|
|
|
button.race = select(2, UnitRace(unit))
|
|
|
|
button.classLoc = select(1, UnitClass(unit))
|
|
|
|
button.class = select(2, UnitClass(unit))
|
|
|
|
button.name = UnitName(unit)
|
|
|
|
Gladdy.guids[UnitGUID(unit)] = unit
|
|
|
|
end
|
2021-08-19 18:57:27 +02:00
|
|
|
if button.class and button.race then
|
|
|
|
Gladdy:SendMessage("ENEMY_SPOTTED", unit)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
if auraScan and not button.spec then
|
|
|
|
for n = 1, 30 do
|
2022-01-11 00:05:31 +01:00
|
|
|
local spellName,_,_,_,_,expirationTime,unitCaster = UnitAura(unit, n, "HELPFUL")
|
2021-05-17 16:49:54 +02:00
|
|
|
if ( not spellName ) then
|
|
|
|
break
|
|
|
|
end
|
2022-03-26 18:22:21 +01:00
|
|
|
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
|
|
|
|
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
|
|
|
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
|
|
|
|
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
|
|
|
end
|
|
|
|
end
|
2022-02-12 02:08:51 +01:00
|
|
|
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that detect used CDs (like Fear Ward)
|
2022-01-11 00:05:31 +01:00
|
|
|
for arenaUnit,v in pairs(self.buttons) do
|
|
|
|
if (UnitIsUnit(arenaUnit, unitCaster)) then
|
2022-03-03 23:40:00 +01:00
|
|
|
Cooldowns:CooldownUsed(arenaUnit, v.class, Gladdy.cooldownBuffs[spellName].spellId, Gladdy.cooldownBuffs[spellName].cd(expirationTime - GetTime()))
|
2022-01-12 16:18:34 +01:00
|
|
|
-- /run LibStub("Gladdy").modules["Cooldowns"]:CooldownUsed("arena5", "PRIEST", 6346, 10)
|
2022-01-11 00:05:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-03-03 23:40:00 +01:00
|
|
|
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
|
|
|
|
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
|
2022-01-14 03:06:02 +01:00
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
|
|
|
-- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool
|
2021-06-20 02:30:28 +02:00
|
|
|
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool = CombatLogGetCurrentEventInfo()
|
2022-01-12 16:18:11 +01:00
|
|
|
local srcUnit = Gladdy.guids[sourceGUID] -- can be a PET
|
|
|
|
local destUnit = Gladdy.guids[destGUID] -- can be a PET
|
|
|
|
if (Gladdy.db.shadowsightTimerEnabled and eventType == "SPELL_AURA_APPLIED" and spellID == 34709) then
|
|
|
|
Gladdy.modules["Shadowsight Timer"]:AURA_GAIN(nil, nil, 34709)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
if destUnit then
|
|
|
|
-- diminish tracker
|
2022-01-12 16:15:53 +01:00
|
|
|
if Gladdy.buttons[destUnit] and (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then
|
2021-05-17 16:49:54 +02:00
|
|
|
Diminishings:AuraFade(destUnit, spellID)
|
|
|
|
end
|
|
|
|
-- death detection
|
2022-01-12 16:15:53 +01:00
|
|
|
if (Gladdy.buttons[destUnit] and eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
|
2022-07-29 15:06:39 +02:00
|
|
|
if not Gladdy:isFeignDeath(destUnit) then
|
|
|
|
Gladdy:SendMessage("UNIT_DEATH", destUnit)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
-- spec detection
|
2022-01-12 16:15:53 +01:00
|
|
|
if Gladdy.buttons[destUnit] and (not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race) then
|
2021-05-17 16:49:54 +02:00
|
|
|
Gladdy:SpotEnemy(destUnit, true)
|
|
|
|
end
|
2021-06-20 02:30:28 +02:00
|
|
|
--interrupt detection
|
2022-01-12 16:15:53 +01:00
|
|
|
if Gladdy.buttons[destUnit] and eventType == "SPELL_INTERRUPT" then
|
2021-06-20 02:30:28 +02:00
|
|
|
Gladdy:SendMessage("SPELL_INTERRUPT", destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
if srcUnit then
|
2022-01-11 00:03:36 +01:00
|
|
|
srcUnit = string_gsub(srcUnit, "pet", "")
|
|
|
|
if (not UnitExists(srcUnit)) then
|
|
|
|
return
|
|
|
|
end
|
2022-03-26 18:22:21 +01:00
|
|
|
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
|
|
|
|
Gladdy:SpotEnemy(srcUnit, true)
|
|
|
|
end
|
|
|
|
if not Gladdy.buttons[srcUnit].spec then
|
|
|
|
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
|
|
|
end
|
2022-07-29 07:44:40 +02:00
|
|
|
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED" or eventType == "SPELL_MISSED") then
|
2021-06-20 02:30:03 +02:00
|
|
|
local unitRace = Gladdy.buttons[srcUnit].race
|
2022-07-29 07:44:40 +02:00
|
|
|
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
2021-06-20 02:30:03 +02:00
|
|
|
-- cooldown tracker
|
|
|
|
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
|
|
|
|
local unitClass
|
|
|
|
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
|
2022-03-27 18:50:02 +02:00
|
|
|
if spellID == 16188 or spellID == 17116 then -- Nature's Swiftness (same name for druid and shaman)
|
|
|
|
spellId = spellID
|
|
|
|
end
|
2021-06-20 02:30:03 +02:00
|
|
|
if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
|
|
|
|
if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
|
|
|
|
unitClass = Gladdy.buttons[srcUnit].class
|
|
|
|
else
|
|
|
|
unitClass = Gladdy.buttons[srcUnit].race
|
|
|
|
end
|
2022-03-27 18:50:02 +02:00
|
|
|
if spellID ~= 16188 and spellID ~= 17116 then -- Nature's Swiftness CD starts when buff fades
|
|
|
|
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
|
|
|
|
end
|
2021-05-18 16:41:25 +02:00
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
2021-05-18 16:41:25 +02:00
|
|
|
|
2021-06-20 02:30:03 +02:00
|
|
|
if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then
|
|
|
|
Gladdy:SendMessage("RACIAL_USED", srcUnit)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
2022-03-27 20:49:02 +02:00
|
|
|
if (eventType == "SPELL_AURA_REMOVED" and (spellID == 16188 or spellID == 17116) and Gladdy.buttons[srcUnit].class) then
|
2022-03-27 18:50:02 +02:00
|
|
|
Cooldowns:CooldownUsed(srcUnit, Gladdy.buttons[srcUnit].class, spellID)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
|
|
|
|
--[[ updateReason: seen, unseen, destroyed, cleared ]]
|
|
|
|
|
|
|
|
local button = Gladdy.buttons[unit]
|
|
|
|
local pet = Gladdy.modules["Pets"].frames[unit]
|
|
|
|
if button or pet then
|
|
|
|
if updateReason == "seen" then
|
|
|
|
-- ENEMY_SPOTTED
|
2021-06-15 09:06:50 +02:00
|
|
|
if button then
|
|
|
|
Gladdy:SendMessage("ENEMY_STEALTH", unit, false)
|
2021-08-19 18:57:27 +02:00
|
|
|
if not button.class or not button.race then
|
2021-06-15 09:06:50 +02:00
|
|
|
Gladdy:SpotEnemy(unit, true)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
if pet then
|
|
|
|
Gladdy:SendMessage("PET_SPOTTED", unit)
|
|
|
|
end
|
|
|
|
elseif updateReason == "unseen" then
|
|
|
|
-- STEALTH
|
|
|
|
if button then
|
2021-06-15 09:06:50 +02:00
|
|
|
Gladdy:SendMessage("ENEMY_STEALTH", unit, true)
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
if pet then
|
|
|
|
Gladdy:SendMessage("PET_STEALTH", unit)
|
|
|
|
end
|
|
|
|
elseif updateReason == "destroyed" then
|
|
|
|
-- LEAVE
|
|
|
|
if button then
|
|
|
|
Gladdy:SendMessage("UNIT_DESTROYED", unit)
|
|
|
|
end
|
|
|
|
if pet then
|
|
|
|
Gladdy:SendMessage("PET_DESTROYED", unit)
|
|
|
|
end
|
|
|
|
elseif updateReason == "cleared" then
|
|
|
|
--Gladdy:Print("ARENA_OPPONENT_UPDATE", updateReason, unit)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-29 15:13:19 +02:00
|
|
|
Gladdy.exceptionNames = { -- TODO MOVE ME TO CLASSBUFFS LIB
|
2021-05-17 16:49:54 +02:00
|
|
|
[31117] = GetSpellInfo(30405) .. " Silence", -- Unstable Affliction Silence
|
|
|
|
[43523] = GetSpellInfo(30405) .. " Silence",
|
|
|
|
[24131] = select(1, GetSpellInfo(19386)) .. " Dot", -- Wyvern Sting Dot
|
|
|
|
[24134] = select(1, GetSpellInfo(19386)) .. " Dot",
|
|
|
|
[24135] = select(1, GetSpellInfo(19386)) .. " Dot",
|
|
|
|
[27069] = select(1, GetSpellInfo(19386)) .. " Dot",
|
|
|
|
[19975] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)), -- Entangling Roots Nature's Grasp
|
|
|
|
[19974] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
[19973] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
[19972] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
[19971] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
[19971] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
[27010] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
|
|
|
}
|
|
|
|
|
2022-01-11 00:05:31 +01:00
|
|
|
Gladdy.cooldownBuffs = {
|
2022-03-03 23:40:00 +01:00
|
|
|
[GetSpellInfo(6346)] = { cd = function(expTime) -- 180s uptime == cd
|
|
|
|
return expTime
|
|
|
|
end, spellId = 6346 }, -- Fear Ward
|
|
|
|
[GetSpellInfo(11305)] = { cd = function(expTime) -- 15s uptime
|
2022-03-27 20:49:02 +02:00
|
|
|
return 300 - (15 - expTime)
|
2022-03-03 23:40:00 +01:00
|
|
|
end, spellId = 11305 }, -- Sprint
|
2022-03-27 20:49:02 +02:00
|
|
|
[36554] = { cd = function(expTime) -- 3s uptime
|
2022-03-03 23:40:00 +01:00
|
|
|
return 30 - (3 - expTime)
|
2022-03-27 20:49:02 +02:00
|
|
|
end, spellId = 36554 }, -- Shadowstep speed buff
|
|
|
|
[36563] = { cd = function(expTime) -- 10s uptime
|
|
|
|
return 30 - (10 - expTime)
|
|
|
|
end, spellId = 36554 }, -- Shadowstep dmg buff
|
2022-03-03 23:40:00 +01:00
|
|
|
[GetSpellInfo(26889)] = { cd = function(expTime) -- 3s uptime
|
|
|
|
return 180 - (10 - expTime)
|
|
|
|
end, spellId = 26889 }, -- Vanish
|
2022-01-14 03:06:02 +01:00
|
|
|
racials = {
|
2022-03-03 23:40:00 +01:00
|
|
|
[GetSpellInfo(20600)] = { cd = function(expTime) -- 20s uptime
|
|
|
|
return GetTime() - (20 - expTime)
|
|
|
|
end, spellId = 20600 }, -- Perception
|
2022-01-14 03:06:02 +01:00
|
|
|
}
|
2022-01-11 00:05:31 +01:00
|
|
|
}
|
|
|
|
|
2021-05-17 16:49:54 +02:00
|
|
|
function EventListener:UNIT_AURA(unit)
|
|
|
|
local button = Gladdy.buttons[unit]
|
|
|
|
if not button then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
for i = 1, 2 do
|
2021-08-19 18:57:27 +02:00
|
|
|
if not Gladdy.buttons[unit].class or not Gladdy.buttons[unit].race then
|
2021-05-17 16:49:54 +02:00
|
|
|
Gladdy:SpotEnemy(unit, false)
|
|
|
|
end
|
|
|
|
local filter = (i == 1 and "HELPFUL" or "HARMFUL")
|
|
|
|
local auraType = i == 1 and AURA_TYPE_BUFF or AURA_TYPE_DEBUFF
|
|
|
|
Gladdy:SendMessage("AURA_FADE", unit, auraType)
|
|
|
|
for n = 1, 30 do
|
|
|
|
local spellName, texture, count, debuffType, duration, expirationTime, unitCaster, _, shouldConsolidate, spellID = UnitAura(unit, n, filter)
|
|
|
|
if ( not spellID ) then
|
|
|
|
Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1)
|
|
|
|
break
|
|
|
|
end
|
2022-03-26 18:22:21 +01:00
|
|
|
if not button.spec and Gladdy.specBuffs[spellName] and unitCaster then
|
|
|
|
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
|
|
|
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
|
|
|
|
self:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
|
|
|
end
|
|
|
|
end
|
2022-03-27 20:49:02 +02:00
|
|
|
if (Gladdy.cooldownBuffs[spellName] or Gladdy.cooldownBuffs[spellID]) and unitCaster then -- Check for auras that hint used CDs (like Fear Ward)
|
|
|
|
local cooldownBuff = Gladdy.cooldownBuffs[spellID] or Gladdy.cooldownBuffs[spellName]
|
2022-01-11 00:05:31 +01:00
|
|
|
for arenaUnit,v in pairs(Gladdy.buttons) do
|
|
|
|
if (UnitIsUnit(arenaUnit, unitCaster)) then
|
2022-03-27 20:49:02 +02:00
|
|
|
Cooldowns:CooldownUsed(arenaUnit, v.class, cooldownBuff.spellId, cooldownBuff.cd(expirationTime - GetTime()))
|
2022-01-11 00:05:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-03-03 23:40:00 +01:00
|
|
|
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
|
|
|
|
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
|
2022-01-14 03:06:02 +01:00
|
|
|
end
|
2021-07-29 15:13:19 +02:00
|
|
|
if Gladdy.exceptionNames[spellID] then
|
|
|
|
spellName = Gladdy.exceptionNames[spellID]
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
Gladdy:SendMessage("AURA_GAIN", unit, auraType, spellID, spellName, texture, duration, expirationTime, count, debuffType, i)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:UNIT_SPELLCAST_START(unit)
|
|
|
|
if Gladdy.buttons[unit] then
|
|
|
|
local spellName = UnitCastingInfo(unit)
|
|
|
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
2022-01-27 01:30:28 +01:00
|
|
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:UNIT_SPELLCAST_CHANNEL_START(unit)
|
|
|
|
if Gladdy.buttons[unit] then
|
|
|
|
local spellName = UnitChannelInfo(unit)
|
|
|
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
2022-01-27 01:30:28 +01:00
|
|
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:UNIT_SPELLCAST_SUCCEEDED(unit)
|
|
|
|
if Gladdy.buttons[unit] then
|
|
|
|
local spellName = UnitCastingInfo(unit)
|
|
|
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
2022-01-27 01:30:28 +01:00
|
|
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:DetectSpec(unit, spec)
|
|
|
|
local button = Gladdy.buttons[unit]
|
|
|
|
if (not button or not spec or button.spec) then
|
|
|
|
return
|
|
|
|
end
|
2022-07-29 07:44:40 +02:00
|
|
|
if button.class == "PALADIN" and Gladdy:contains(spec, {L["Holy"], L["Retribution"], L["Protection"]})
|
|
|
|
or button.class == "SHAMAN" and not Gladdy:contains(spec, {L["Restoration"], L["Enhancement"], L["Elemental"]})
|
|
|
|
or button.class == "ROGUE" and not Gladdy:contains(spec, {L["Subtlety"], L["Assassination"], L["Combat"]})
|
|
|
|
or button.class == "WARLOCK" and not Gladdy:contains(spec, {L["Demonology"], L["Destruction"], L["Affliction"]})
|
|
|
|
or button.class == "PRIEST" and not Gladdy:contains(spec, {L["Shadow"], L["Discipline"], L["Holy"]})
|
|
|
|
or button.class == "MAGE" and not Gladdy:contains(spec, {L["Frost"], L["Fire"], L["Arcane"]})
|
|
|
|
or button.class == "DRUID" and not Gladdy:contains(spec, {L["Restoration"], L["Feral"], L["Balance"]})
|
|
|
|
or button.class == "HUNTER" and not Gladdy:contains(spec, {L["Beast Mastery"], L["Marksmanship"], L["Survival"]})
|
|
|
|
or button.class == "WARRIOR" and not Gladdy:contains(spec, {L["Arms"], L["Protection"], L["Fury"]})
|
|
|
|
or button.class == "DEATHKNIGHT" and not Gladdy:contains(spec, {L["Unholy"], L["Blood"], L["Frost"]}) then
|
2022-01-27 01:30:28 +01:00
|
|
|
return
|
|
|
|
end
|
|
|
|
if not button.spec then
|
|
|
|
button.spec = spec
|
|
|
|
Gladdy:SendMessage("UNIT_SPEC", unit, spec)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function EventListener:Test(unit)
|
|
|
|
local button = Gladdy.buttons[unit]
|
2022-03-27 18:50:02 +02:00
|
|
|
if (button and Gladdy.testData[unit].testSpec) then
|
2022-01-27 01:30:28 +01:00
|
|
|
button.spec = nil
|
2022-03-27 18:50:02 +02:00
|
|
|
Gladdy:SpotEnemy(unit, false)
|
2022-01-27 01:30:28 +01:00
|
|
|
self:DetectSpec(unit, button.testSpec)
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|