Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smallpatches #4765

Merged
merged 7 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +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/LibClassicDurations: https://github.com/rgd87/LibClassicDurations
WeakAuras/Libs/LibClassicCasterino: https://github.com/rgd87/LibClassicCasterino
WeakAuras/Libs/LibClassicSpellActionCount-1.0: https://github.com/Ennea/LibClassicSpellActionCount-1.0
WeakAuras/Libs/Archivist:
url: https://github.com/emptyrivers/Archivist
tag: v1.0.8
Expand Down
23 changes: 0 additions & 23 deletions WeakAuras/AuraEnvironment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ local AddonName, Private = ...
local WeakAuras = WeakAuras
local L = WeakAuras.L

local LCD
if WeakAuras.IsClassicEra() then
LCD = LibStub("LibClassicDurations")
LCD:RegisterFrame("WeakAuras")
end

local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub:GetLibrary("LibDeflate")

Expand All @@ -29,23 +23,6 @@ local WA_GetUnitAura = function(unit, spell, filter)
end
end

if WeakAuras.IsClassicEra() then
local WA_GetUnitAuraBase = WA_GetUnitAura
WA_GetUnitAura = function(unit, spell, filter)
local name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId,
canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = WA_GetUnitAuraBase(unit, spell, filter)
if spellId then
local durationNew, expirationTimeNew = LCD:GetAuraDurationByUnit(unit, spellId, source, name)
if duration == 0 and durationNew then
duration = durationNew
expirationTime = expirationTimeNew
end
end
return name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId,
canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod
end
end

local WA_GetUnitBuff = function(unit, spell, filter)
filter = filter and filter.."|HELPFUL" or "HELPFUL"
return WA_GetUnitAura(unit, spell, filter)
Expand Down
21 changes: 4 additions & 17 deletions WeakAuras/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ local tinsert, wipe = table.insert, wipe
local pairs, next, type = pairs, next, type
local UnitAura = UnitAura

local LCD
if WeakAuras.IsClassicEra() then
LCD = LibStub("LibClassicDurations")
LCD:Register("WeakAuras")
UnitAura = LCD.UnitAuraWithBuffs
end

local newAPI = WeakAuras.IsRetail()

local WeakAuras = WeakAuras
Expand Down Expand Up @@ -2350,19 +2343,13 @@ Buff2Frame:RegisterEvent("UNIT_FLAGS")
Buff2Frame:RegisterEvent("PLAYER_FLAGS_CHANGED")
Buff2Frame:RegisterEvent("UNIT_PET")
Buff2Frame:RegisterEvent("RAID_TARGET_UPDATE")
if not WeakAuras.IsClassicEra() then
Buff2Frame:RegisterEvent("PLAYER_SOFT_ENEMY_CHANGED")
Buff2Frame:RegisterEvent("PLAYER_SOFT_FRIEND_CHANGED")
if WeakAuras.IsWrathOrRetail() then
Buff2Frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
if WeakAuras.IsWrathOrRetail() then
Buff2Frame:RegisterEvent("PLAYER_SOFT_ENEMY_CHANGED")
Buff2Frame:RegisterEvent("PLAYER_SOFT_FRIEND_CHANGED")
Buff2Frame:RegisterEvent("ARENA_OPPONENT_UPDATE")
end
Buff2Frame:RegisterEvent("ARENA_OPPONENT_UPDATE")
Buff2Frame:RegisterEvent("UNIT_ENTERED_VEHICLE")
Buff2Frame:RegisterEvent("UNIT_EXITED_VEHICLE")
else
LCD.RegisterCallback("WeakAuras", "UNIT_BUFF", function(event, unit)
EventHandler(Buff2Frame, "UNIT_AURA", unit)
end)
end
Buff2Frame:RegisterEvent("PLAYER_TARGET_CHANGED")
Buff2Frame:RegisterEvent("ENCOUNTER_START")
Expand Down
11 changes: 1 addition & 10 deletions WeakAuras/GenericTrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ local aceEvents = WeakAurasAceEvents
local WeakAuras = WeakAuras;
local L = WeakAuras.L;
local GenericTrigger = {};
local LCSA
if WeakAuras.IsClassicEra() then
LCSA = LibStub("LibClassicSpellActionCount-1.0")
end

local event_prototypes = Private.event_prototypes;

Expand Down Expand Up @@ -2727,12 +2723,7 @@ do
end
end

local count
if WeakAuras.IsClassicEra() then
count = LCSA:GetSpellReagentCount(id)
else
count = GetSpellCount(id)
end
local count = GetSpellCount(id)

return charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune,
startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges,
Expand Down
10 changes: 0 additions & 10 deletions WeakAuras/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,6 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad
--- @field SerializeEx fun(self: LibSerialize,options: table, input: any)
--- @field Deserialize fun(self: LibSerialize, input: string): table

--- @class LibClassicDurations
--- @field RegisterFrame fun(self: LibClassicDurations, frame: string)
--- @field Register fun(self: LibClassicDurations, frame: string)
--- @field GetAuraDurationByUnit fun(self: LibClassicDurations, unit: string, spellId: number, source: string?, name: string?)

--- @class LibDeflate
--- @field CompressDeflate fun(self: LibDeflate, input: string, options: table): string
--- @field EncodeForPrint fun(self: LibDeflate, input: string): string)
Expand Down Expand Up @@ -442,11 +437,6 @@ do
"LibSerialize",
"LibUIDropDownMenu-4.0"
}
if WeakAuras.IsClassicEra() then
tinsert(LibStubLibs, "LibClassicSpellActionCount-1.0")
tinsert(LibStubLibs, "LibClassicCasterino")
tinsert(LibStubLibs, "LibClassicDurations")
end
if WeakAuras.IsRetail() then
tinsert(LibStubLibs, "LibSpecialization")
AddonCompartmentFrame:RegisterAddon({
Expand Down
129 changes: 47 additions & 82 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -4408,7 +4383,6 @@ Private.event_prototypes = {
enable = function(trigger)
return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL")
end,
test = WeakAuras.IsClassicEra() and "GetSpellInfo(%q) == extraSpellName" or nil,
type = "spell",
showExactOption = false,
store = true,
Expand Down Expand Up @@ -4613,7 +4587,7 @@ Private.event_prototypes = {
{
hidden = true,
name = "icon",
init = "(WeakAuras.IsClassicEra() and spellName and select(3, GetSpellInfo(spellName))) or (spellId and select(3, GetSpellInfo(spellId))) or 'Interface\\\\Icons\\\\INV_Misc_QuestionMark'",
init = "(spellId and select(3, GetSpellInfo(spellId))) or 'Interface\\\\Icons\\\\INV_Misc_QuestionMark'",
store = true,
test = "true"
},
Expand Down Expand Up @@ -8365,15 +8339,6 @@ Private.event_prototypes = {
AddUnitEventForEvents(result, unit, "UNIT_SPELLCAST_EMPOWER_UPDATE_FAKE")
AddUnitEventForEvents(result, unit, "UNIT_SPELLCAST_EMPOWER_STOP_FAKE")
end
if WeakAuras.IsClassicEra() and unit ~= "player" then
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_START", WeakAuras.ScanUnitEvents)
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_DELAYED", WeakAuras.ScanUnitEvents) -- only for player
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_STOP", WeakAuras.ScanUnitEvents)
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_CHANNEL_START", WeakAuras.ScanUnitEvents)
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_CHANNEL_UPDATE", WeakAuras.ScanUnitEvents) -- only for player
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_CHANNEL_STOP", WeakAuras.ScanUnitEvents)
LibClassicCasterino.RegisterCallback("WeakAuras", "UNIT_SPELLCAST_INTERRUPTED", WeakAuras.ScanUnitEvents)
end
AddUnitEventForEvents(result, unit, "UNIT_TARGET")
return result
end,
Expand Down
57 changes: 24 additions & 33 deletions WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,11 @@ Private.group_hybrid_sort_types = {
descending = L["Descending"]
}

if WeakAuras.IsClassicEra() then
Private.time_format_types = {
[0] = L["WeakAuras Built-In (63:42 | 3:07 | 10 | 2.4)"],
[1] = L["Blizzard (2h | 3m | 10s | 2.4)"],
}
else
Private.time_format_types = {
[0] = L["WeakAuras Built-In (63:42 | 3:07 | 10 | 2.4)"],
[1] = L["Old Blizzard (2h | 3m | 10s | 2.4)"],
[2] = L["Modern Blizzard (1h 3m | 3m 7s | 10s | 2.4)"],
}
end
Private.time_format_types = {
[0] = L["WeakAuras Built-In (63:42 | 3:07 | 10 | 2.4)"],
[1] = L["Old Blizzard (2h | 3m | 10s | 2.4)"],
[2] = L["Modern Blizzard (1h 3m | 3m 7s | 10s | 2.4)"],
}

Private.time_precision_types = {
[1] = "12.3",
Expand Down Expand Up @@ -135,30 +128,28 @@ Private.unit_realm_name_types = {
}

local timeFormatter = {}
if WeakAuras.IsRetail() then
Mixin(timeFormatter, SecondsFormatterMixin)
timeFormatter:Init(0, SecondsFormatter.Abbreviation.OneLetter)

-- The default time formatter adds a space between the value and the unit
-- While there is a API to strip it, that API does not work on all locales, e.g. german
-- Thus, copy the interval descriptions, strip the whitespace from them
-- and hack the timeFormatter to use our interval descriptions
local timeFormatIntervalDescriptionFixed = {}
timeFormatIntervalDescriptionFixed = CopyTable(SecondsFormatter.IntervalDescription)
for i, interval in ipairs(timeFormatIntervalDescriptionFixed) do
interval.formatString = CopyTable(SecondsFormatter.IntervalDescription[i].formatString)
for j, formatString in ipairs(interval.formatString) do
interval.formatString[j] = formatString:gsub(" ", "")
end
Mixin(timeFormatter, SecondsFormatterMixin)
timeFormatter:Init(0, SecondsFormatter.Abbreviation.OneLetter)

-- The default time formatter adds a space between the value and the unit
-- While there is a API to strip it, that API does not work on all locales, e.g. german
-- Thus, copy the interval descriptions, strip the whitespace from them
-- and hack the timeFormatter to use our interval descriptions
local timeFormatIntervalDescriptionFixed = {}
timeFormatIntervalDescriptionFixed = CopyTable(SecondsFormatter.IntervalDescription)
for i, interval in ipairs(timeFormatIntervalDescriptionFixed) do
interval.formatString = CopyTable(SecondsFormatter.IntervalDescription[i].formatString)
for j, formatString in ipairs(interval.formatString) do
interval.formatString[j] = formatString:gsub(" ", "")
end
end

timeFormatter.GetIntervalDescription = function(self, interval)
return timeFormatIntervalDescriptionFixed[interval]
end
timeFormatter.GetIntervalDescription = function(self, interval)
return timeFormatIntervalDescriptionFixed[interval]
end

timeFormatter.GetMaxInterval = function(self)
return #timeFormatIntervalDescriptionFixed
end
timeFormatter.GetMaxInterval = function(self)
return #timeFormatIntervalDescriptionFixed
end

local simpleFormatters = {
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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, LibClassicDurations, 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
Expand Down
7 changes: 1 addition & 6 deletions WeakAuras/WeakAuras_Vanilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +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, LibClassicDurations, 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\LibClassicDurations\LibClassicDurations.xml
Libs\LibClassicCasterino\LibClassicCasterino.lua
Libs\LibClassicSpellActionCount-1.0\LibClassicSpellActionCount-1.0.lua

Init.lua
locales.xml
ArchiveTypes\Repository.lua
Expand Down
Loading