- separate TOC + Constants for BCC and Wrath
- cooldowns, auras, spec detection, trinket/racial tracking
This commit is contained in:
Sumsebrum
2022-07-29 07:41:55 +02:00
parent 2a12f35e58
commit a87455e7bd
12 changed files with 1783 additions and 228 deletions

View File

@ -483,12 +483,13 @@ function Auras:Test(unit)
if Gladdy.exceptionNames[spellid] then
spellName = Gladdy.exceptionNames[spellid]
end
local duration = math.random(2,10)
if (unit == "arena2") then
if (v.value.track == AURA_TYPE_BUFF) then
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, duration, GetTime() + duration)
end
else
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, duration, GetTime() + duration)
end
end
-- /run LibStub("Gladdy").modules["Auras"]:Test("arena1")

View File

@ -22,6 +22,7 @@ local Classicon = Gladdy:NewModule("Class Icon", 81, {
local classIconPath = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
local classIcons = {
["DRUID"] = classIconPath .. "inv_misc_monsterclaw_04",
["DEATHKNIGHT"] = select(3, GetSpellInfo(49023)), --Might of Mograine
["HUNTER"] = classIconPath .. "inv_weapon_bow_07",
["MAGE"] = classIconPath .. "inv_staff_13",
["PALADIN"] = classIconPath .. "inv_hammer_01",
@ -39,6 +40,11 @@ local specIcons = {
[L["Feral"]] = select(3, GetSpellInfo(27545)), -- Cat Form
[L["Restoration"]] = select(3, GetSpellInfo(5185)), -- Healing Touch
},
["DEATHKNIGHT"] = {
[L["Unholy"]] = select(3, GetSpellInfo(48265)), -- Unholy Presence
[L["Blood"]] = select(3, GetSpellInfo(48266)), -- Blood Presence
[L["Frost"]] = select(3, GetSpellInfo(48263)), -- Frost Presence
},
["HUNTER"] = {
[L["Beast Mastery"]] = select(3, GetSpellInfo(1515)), -- Tame Beast
[L["Marksmanship"]] = select(3, GetSpellInfo(42243)), -- Volley

View File

@ -32,6 +32,9 @@ function Racial:Initialize()
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("RACIAL_USED")
if Gladdy.expansion == "Wrath" then
self:RegisterMessage("TRINKET_USED")
end
end
end
@ -40,6 +43,9 @@ function Racial:UpdateFrameOnce()
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("RACIAL_USED")
if Gladdy.expansion == "Wrath" then
self:RegisterMessage("TRINKET_USED")
end
else
self:UnregisterAllMessages()
end
@ -207,6 +213,25 @@ function Racial:RACIAL_USED(unit, expirationTime, spellName)
Racial:Used(unit, startTime, Gladdy:Racials()[button.race].duration)
end
function Racial:TRINKET_USED(unit) -- Wrath only
local racial = self.frames[unit]
local button = Gladdy.buttons[unit]
if (not racial or not button or not button.race) then
return
end
if button.race == "Scourge" then
if racial.active and racial.timeLeft >= 45 then
-- do nothing
else
racial.active = false
self:Used(unit, GetTime(), 45)
end
elseif button.race == "Human" then
racial.active = false
self:Used(unit, GetTime(), 120)
end
end
function Racial:Used(unit, startTime, duration)
local racial = self.frames[unit]
if (not racial) then
@ -241,8 +266,8 @@ end
function Racial:Test(unit)
Racial:ENEMY_SPOTTED(unit)
if (unit == "arena1" or unit == "arena3") then
Racial:Used(unit, GetTime(), Gladdy:Racials()[Gladdy.buttons[unit].race].duration)
if (unit == "arena2" or unit == "arena3") then
Gladdy:SendMessage("RACIAL_USED", unit)
end
end

View File

@ -33,12 +33,18 @@ function Trinket:Initialize()
self.frames = {}
if Gladdy.db.trinketEnabled then
self:RegisterMessage("JOINED_ARENA")
if Gladdy.expansion == "Wrath" then
self:RegisterMessage("RACIAL_USED")
end
end
end
function Trinket:UpdateFrameOnce()
if Gladdy.db.trinketEnabled then
self:RegisterMessage("JOINED_ARENA")
if Gladdy.expansion == "Wrath" then
self:RegisterMessage("RACIAL_USED")
end
else
self:UnregisterAllMessages()
end
@ -228,6 +234,7 @@ function Trinket:ResetUnit(unit)
return
end
trinket.itemID = nil
trinket.timeLeft = nil
trinket.active = false
trinket.cooldown:Clear()
@ -239,13 +246,15 @@ function Trinket:Test(unit)
if (not trinket) then
return
end
if (unit == "arena2" or unit == "arena3") then
if (unit == "arena1" or unit == "arena2") then
self:Used(unit, GetTime() * 1000, 120000)
end
end
function Trinket:JOINED_ARENA()
self:RegisterEvent("ARENA_COOLDOWNS_UPDATE")
self:RegisterEvent("ARENA_CROWD_CONTROL_SPELL_UPDATE")
self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "arena1", "arena2", "arena3", "arena4", "arena5")
self:SetScript("OnEvent", function(self, event, ...)
if self[event] then
self[event](self, ...)
@ -253,19 +262,64 @@ function Trinket:JOINED_ARENA()
end)
end
function Trinket:ARENA_CROWD_CONTROL_SPELL_UPDATE(...)
local unitID, spellID, itemID = ...
Gladdy:Debug("INFO", "Trinket:ARENA_CROWD_CONTROL_SPELL_UPDATE", unitID, spellID, itemID)
if Gladdy.buttons[unitID] and Gladdy:GetPvpTrinkets()[itemID] then
Gladdy.buttons[unitID].trinket.itemID = itemID
if not Gladdy.db.trinketColored then
self.frames[unitID].texture:SetTexture(GetItemIcon(itemID))
end
end
end
function Trinket:UNIT_SPELLCAST_SUCCEEDED(...)
local unitID, castGUID, spellID = ...
if Gladdy.buttons[unitID] then
if spellID == 42292 or spellID == 59752 then
Gladdy:Debug("INFO", "Trinket:UNIT_SPELLCAST_SUCCEEDED", unitID, spellID)
self:Used(unitID, GetTime() * 1000,
Gladdy.buttons[unitID].trinket.itemID and Gladdy:GetPvpTrinkets()[Gladdy.buttons[unitID].trinket.itemID]
or 120000)
end
end
end
function Trinket:RACIAL_USED(unit) -- Wrath only
local trinket = self.frames[unit]
if (not trinket) then
return
end
if Gladdy.buttons[unit].race == "Scourge" then
if trinket.active and trinket.timeLeft >= 44 then
-- do nothing
else
trinket.active = false
self:Used(unit, GetTime() * 1000, 45000, true)
end
elseif Gladdy.buttons[unit].race == "Human" then
trinket.active = false
self:Used(unit, GetTime() * 1000, 120000)
end
end
function Trinket:ARENA_COOLDOWNS_UPDATE()
for i=1, Gladdy.curBracket do
local unit = "arena" .. i
local spellID, itemID, startTime, duration = C_PvP.GetArenaCrowdControlInfo(unit);
local unitID = "arena" .. i
local spellID, itemID, startTime, duration = C_PvP.GetArenaCrowdControlInfo(unitID)
Gladdy:Debug("INFO", "Trinket:ARENA_COOLDOWNS_UPDATE", spellID, itemID, startTime, duration)
if (spellID) then
if not Gladdy.db.trinketColored and Gladdy:GetPvpTrinkets()[itemID] then
self.frames[unitID].texture:SetTexture(GetItemIcon(itemID))
end
if (startTime ~= 0 and duration ~= 0) then
self:Used(unit, startTime, duration)
self:Used(unitID, startTime, duration)
end
end
end
end
function Trinket:Used(unit, startTime, duration)
function Trinket:Used(unit, startTime, duration, passive)
local trinket = self.frames[unit]
if (not trinket) then
return
@ -277,7 +331,9 @@ function Trinket:Used(unit, startTime, duration)
if Gladdy.db.trinketColored then
trinket:SetBackdropColor(Gladdy:SetColor(Gladdy.db.trinketColoredCd))
end
Gladdy:SendMessage("TRINKET_USED", unit)
if not passive then
Gladdy:SendMessage("TRINKET_USED", unit)
end
end
end