diff --git a/.pkgmeta b/.pkgmeta index 813034447f..9644f8c64f 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -19,7 +19,6 @@ externals: WeakAuras/Libs/LibCustomGlow-1.0: https://github.com/Stanzilla/LibCustomGlow WeakAuras/Libs/LibDBIcon-1.0: https://repos.curseforge.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0 WeakAuras/Libs/LibGetFrame-1.0: https://github.com/mrbuds/LibGetFrame - WeakAuras/Libs/LibClassicCasterino: https://github.com/rgd87/LibClassicCasterino WeakAuras/Libs/Archivist: url: https://github.com/emptyrivers/Archivist tag: v1.0.8 diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index 5cda24c5d8..8d87993ed3 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -437,9 +437,6 @@ do "LibSerialize", "LibUIDropDownMenu-4.0" } - if WeakAuras.IsClassicEra() then - tinsert(LibStubLibs, "LibClassicCasterino") - end if WeakAuras.IsRetail() then tinsert(LibStubLibs, "LibSpecialization") AddonCompartmentFrame:RegisterAddon({ diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 675b16546f..e3e455b578 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -86,83 +86,58 @@ function WeakAuras.UnitDetailedThreatSituation(unit1, unit2) end end -local LibClassicCasterino -if WeakAuras.IsClassicEra() then - LibClassicCasterino = LibStub("LibClassicCasterino") -end - -if WeakAuras.IsWrathOrRetail() then - WeakAuras.UnitCastingInfo = UnitCastingInfo -else - WeakAuras.UnitCastingInfo = function(unit) - if UnitIsUnit(unit, "player") then - return UnitCastingInfo("player") - else - return LibClassicCasterino:UnitCastingInfo(unit) - end - end -end +WeakAuras.UnitCastingInfo = UnitCastingInfo -if WeakAuras.IsWrathOrRetail() then - if WeakAuras.IsRetail() then - local cacheEmpowered = {} - WeakAuras.UnitChannelInfo = function(unit) - local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo(unit) - if name == nil and cacheEmpowered[unit] then - local holdAtMaxTime - holdAtMaxTime, name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = unpack(cacheEmpowered[unit]) - if endTime == nil - or holdAtMaxTime == nil - or endTime + holdAtMaxTime < GetTime() - then -- invalid or too old data - cacheEmpowered[unit] = nil - return nil - end - end - return name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages - end - local cacheEmpoweredFrame = CreateFrame("Frame") - cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_START") - cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_UPDATE") - cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_STOP") - cacheEmpoweredFrame:RegisterEvent("PLAYER_TARGET_CHANGED") - cacheEmpoweredFrame:RegisterEvent("PLAYER_SOFT_FRIEND_CHANGED") - cacheEmpoweredFrame:RegisterEvent("PLAYER_SOFT_ENEMY_CHANGED") - cacheEmpoweredFrame:RegisterEvent("PLAYER_FOCUS_CHANGED") - cacheEmpoweredFrame:SetScript("OnEvent", function(_, event, unit, ...) - if Private.player_target_events[event] then - unit = Private.player_target_events[event] - end - if event == "UNIT_SPELLCAST_EMPOWER_START" - or event == "UNIT_SPELLCAST_EMPOWER_UPDATE" - or ( - (Private.player_target_events[event]) - and (select(10, UnitChannelInfo(unit)) or 0) > 0 -- 10th arg of UnitChannelInfo is numStages for empowered spells - ) - then - cacheEmpowered[unit] = {GetUnitEmpowerHoldAtMaxTime(unit), UnitChannelInfo(unit)} - else +if WeakAuras.IsRetail() then + local cacheEmpowered = {} + WeakAuras.UnitChannelInfo = function(unit) + local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo(unit) + if name == nil and cacheEmpowered[unit] then + local holdAtMaxTime + holdAtMaxTime, name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = unpack(cacheEmpowered[unit]) + if endTime == nil + or holdAtMaxTime == nil + or endTime + holdAtMaxTime < GetTime() + then -- invalid or too old data cacheEmpowered[unit] = nil + return nil end - if unit == "player" and event == "UNIT_SPELLCAST_EMPOWER_START" or event == "UNIT_SPELLCAST_EMPOWER_STOP" then - local castLatencyFrame = Private.frames["Cast Latency Handler"] - if castLatencyFrame then - castLatencyFrame:GetScript("OnEvent")(nil, event, unit, ...) - end - end - WeakAuras.ScanUnitEvents(event.."_FAKE", unit, ...) - end) - else - WeakAuras.UnitChannelInfo = UnitChannelInfo + end + return name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages end -else - WeakAuras.UnitChannelInfo = function(unit) - if UnitIsUnit(unit, "player") then - return UnitChannelInfo("player") + local cacheEmpoweredFrame = CreateFrame("Frame") + cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_START") + cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_UPDATE") + cacheEmpoweredFrame:RegisterEvent("UNIT_SPELLCAST_EMPOWER_STOP") + cacheEmpoweredFrame:RegisterEvent("PLAYER_TARGET_CHANGED") + cacheEmpoweredFrame:RegisterEvent("PLAYER_SOFT_FRIEND_CHANGED") + cacheEmpoweredFrame:RegisterEvent("PLAYER_SOFT_ENEMY_CHANGED") + cacheEmpoweredFrame:RegisterEvent("PLAYER_FOCUS_CHANGED") + cacheEmpoweredFrame:SetScript("OnEvent", function(_, event, unit, ...) + if Private.player_target_events[event] then + unit = Private.player_target_events[event] + end + if event == "UNIT_SPELLCAST_EMPOWER_START" + or event == "UNIT_SPELLCAST_EMPOWER_UPDATE" + or ( + (Private.player_target_events[event]) + and (select(10, UnitChannelInfo(unit)) or 0) > 0 -- 10th arg of UnitChannelInfo is numStages for empowered spells + ) + then + cacheEmpowered[unit] = {GetUnitEmpowerHoldAtMaxTime(unit), UnitChannelInfo(unit)} else - return LibClassicCasterino:UnitChannelInfo(unit) + cacheEmpowered[unit] = nil end - end + if unit == "player" and event == "UNIT_SPELLCAST_EMPOWER_START" or event == "UNIT_SPELLCAST_EMPOWER_STOP" then + local castLatencyFrame = Private.frames["Cast Latency Handler"] + if castLatencyFrame then + castLatencyFrame:GetScript("OnEvent")(nil, event, unit, ...) + end + end + WeakAuras.ScanUnitEvents(event.."_FAKE", unit, ...) + end) +else + WeakAuras.UnitChannelInfo = UnitChannelInfo end local constants = { diff --git a/WeakAuras/WeakAuras.toc b/WeakAuras/WeakAuras.toc index 83667a44d1..3969acba6e 100644 --- a/WeakAuras/WeakAuras.toc +++ b/WeakAuras/WeakAuras.toc @@ -18,7 +18,7 @@ ## DefaultState: Enabled ## LoadOnDemand: 0 ## SavedVariables: WeakAurasSaved -## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibClassicCasterino, LibGetFrame-1.0, LibSpecialization, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core +## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibGetFrame-1.0, LibSpecialization, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core # External code + initialization embeds.xml diff --git a/WeakAuras/WeakAuras_Vanilla.toc b/WeakAuras/WeakAuras_Vanilla.toc index 3583c3ae49..40bc36bc94 100644 --- a/WeakAuras/WeakAuras_Vanilla.toc +++ b/WeakAuras/WeakAuras_Vanilla.toc @@ -17,14 +17,11 @@ ## DefaultState: Enabled ## LoadOnDemand: 0 ## SavedVariables: WeakAurasSaved -## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core +## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core # External code + initialization embeds.xml -# Client flavor specific libs -Libs\LibClassicCasterino\LibClassicCasterino.lua - Init.lua locales.xml ArchiveTypes\Repository.lua diff --git a/WeakAuras/WeakAuras_Wrath.toc b/WeakAuras/WeakAuras_Wrath.toc index 1f8b7de2a8..c0c47b9570 100644 --- a/WeakAuras/WeakAuras_Wrath.toc +++ b/WeakAuras/WeakAuras_Wrath.toc @@ -17,7 +17,7 @@ ## DefaultState: Enabled ## LoadOnDemand: 0 ## SavedVariables: WeakAurasSaved -## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core +## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-3.0, LibDBIcon-1.0, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, BigWigs, DBM-Core # External code + initialization embeds.xml