Skip to content

Commit

Permalink
refactor: prepare for additional TWW api breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Jun 20, 2024
1 parent 038ca6a commit 305fa8a
Show file tree
Hide file tree
Showing 37 changed files with 235 additions and 153 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## v10.2.7
* Initial support for WoW 11.0
* Fix GetTalentTabInfo call for SOD Phase 4

## v10.2.6
Expand Down
14 changes: 8 additions & 6 deletions Components/Core/Common/SwingTimerMonitor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ local strsub, pairs
local UnitGUID, GetNetStats, GetInventorySlotInfo, IsDualWielding, UnitAttackSpeed
= UnitGUID, GetNetStats, GetInventorySlotInfo, IsDualWielding, UnitAttackSpeed

local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName
local strlowerCache = TMW.strlowerCache

-- Module creation
Expand All @@ -58,15 +60,15 @@ end)

local swingSpells =
not TMW.isRetail and {
[strlowerCache[GetSpellInfo(78)]] = 1, -- Heroic Strike
[strlowerCache[GetSpellInfo(845)]] = 1, -- Cleave
[strlowerCache[GetSpellInfo(6807)]] = 1, -- Maul
[strlowerCache[GetSpellInfo(2973)]] = 1, -- Raptor Strike
[strlowerCache[GetSpellName(78)]] = 1, -- Heroic Strike
[strlowerCache[GetSpellName(845)]] = 1, -- Cleave
[strlowerCache[GetSpellName(6807)]] = 1, -- Maul
[strlowerCache[GetSpellName(2973)]] = 1, -- Raptor Strike
}
or {}

if GetSpellInfo(56815) then
swingSpells[strlowerCache[GetSpellInfo(56815)]] = 1 -- Rune Strike
if GetSpellName(56815) then
swingSpells[strlowerCache[GetSpellName(56815)]] = 1 -- Rune Strike
end

-- ---------------------------------
Expand Down
4 changes: 3 additions & 1 deletion Components/Core/Conditions/Categories/PlayerAttributes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ local strlowerCache = TMW.strlowerCache

local _, pclass = UnitClass("Player")

local GetSpellName = TMW.GetSpellName
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture

local IsInInstance, GetInstanceDifficulty, GetNumShapeshiftForms, GetShapeshiftFormInfo =
IsInInstance, GetInstanceDifficulty, GetNumShapeshiftForms, GetShapeshiftFormInfo
local GetPetActionInfo = GetPetActionInfo
Expand Down Expand Up @@ -193,7 +195,7 @@ ConditionCategory:RegisterCondition(6, "STANCE", {
return strlowerCache[NONE]
else
local icons, active, catable, spellID = GetShapeshiftFormInfo(i)
return spellID and strlowerCache[GetSpellInfo(spellID)] or ""
return spellID and strlowerCache[GetSpellName(spellID)] or ""
end
end
},
Expand Down
84 changes: 43 additions & 41 deletions Components/Core/Conditions/Categories/PlayerAttributes_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ local print = TMW.print

local SUG = TMW.SUG
local strlowerCache = TMW.strlowerCache
local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName

local GetNumTrackingTypes = GetNumTrackingTypes or C_Minimap.GetNumTrackingTypes
local GetTrackingInfo = GetTrackingInfo or C_Minimap.GetTrackingInfo
Expand All @@ -34,70 +36,70 @@ Module.helpText = L["SUG_TOOLTIPTITLE_GENERIC"]

Module.stances = (TMW.isWrath or TMW.isCata) and {
WARRIOR = {
[2457] = GetSpellInfo(2457), -- Battle Stance
[71] = GetSpellInfo(71), -- Defensive Stance
[2458] = GetSpellInfo(2458), -- Berserker Stance
[2457] = GetSpellName(2457), -- Battle Stance
[71] = GetSpellName(71), -- Defensive Stance
[2458] = GetSpellName(2458), -- Berserker Stance
},
DRUID = {
[5487] = GetSpellInfo(5487), -- Bear Form
[9634] = GetSpellInfo(9634), -- Dire Bear Form
[768] = GetSpellInfo(768), -- Cat Form
[783] = GetSpellInfo(783), -- Travel Form
[1066] = GetSpellInfo(1066), -- Aquatic Form
[24858] = GetSpellInfo(24858), -- Moonkin Form
[33891] = GetSpellInfo(33891), -- Tree of Life
[33943] = GetSpellInfo(33943), -- Flight Form
[40120] = GetSpellInfo(40120), -- Swift Flight Form
[5487] = GetSpellName(5487), -- Bear Form
[9634] = GetSpellName(9634), -- Dire Bear Form
[768] = GetSpellName(768), -- Cat Form
[783] = GetSpellName(783), -- Travel Form
[1066] = GetSpellName(1066), -- Aquatic Form
[24858] = GetSpellName(24858), -- Moonkin Form
[33891] = GetSpellName(33891), -- Tree of Life
[33943] = GetSpellName(33943), -- Flight Form
[40120] = GetSpellName(40120), -- Swift Flight Form
},
PRIEST = {
[15473] = GetSpellInfo(15473), -- Shadowform
[15473] = GetSpellName(15473), -- Shadowform
},
ROGUE = {
[1784] = GetSpellInfo(1784), -- Stealth
[1784] = GetSpellName(1784), -- Stealth
},
PALADIN = {
[19746] = GetSpellInfo(19746), -- Concentration Aura
[32223] = GetSpellInfo(32223), -- Crusader Aura
[465] = GetSpellInfo(465), -- Devotion Aura
[19900] = GetSpellInfo(19891), -- Fire Resistance Aura
[19898] = GetSpellInfo(19891), -- Frost Resistance Aura
[19896] = GetSpellInfo(19891), -- Shadow Resistance Aura
[7294] = GetSpellInfo(7294), -- Retribution Aura
[19746] = GetSpellName(19746), -- Concentration Aura
[32223] = GetSpellName(32223), -- Crusader Aura
[465] = GetSpellName(465), -- Devotion Aura
[19900] = GetSpellName(19891), -- Fire Resistance Aura
[19898] = GetSpellName(19891), -- Frost Resistance Aura
[19896] = GetSpellName(19891), -- Shadow Resistance Aura
[7294] = GetSpellName(7294), -- Retribution Aura
},
DEATHKNIGHT = {
[48266] = GetSpellInfo(48266), -- Blood
[48263] = GetSpellInfo(48263), -- Frost
[48265] = GetSpellInfo(48265), -- Unholy
[48266] = GetSpellName(48266), -- Blood
[48263] = GetSpellName(48263), -- Frost
[48265] = GetSpellName(48265), -- Unholy
},
} or TMW.isClassic and {
WARRIOR = {
[2457] = GetSpellInfo(2457), -- Battle Stance
[71] = GetSpellInfo(71), -- Defensive Stance
[2458] = GetSpellInfo(2458), -- Berserker Stance
[2457] = GetSpellName(2457), -- Battle Stance
[71] = GetSpellName(71), -- Defensive Stance
[2458] = GetSpellName(2458), -- Berserker Stance
},
DRUID = {
[5487] = GetSpellInfo(5487), -- Bear Form
[768] = GetSpellInfo(768), -- Cat Form
[783] = GetSpellInfo(783), -- Travel Form
[24858] = GetSpellInfo(24858), -- Moonkin Form
[5487] = GetSpellName(5487), -- Bear Form
[768] = GetSpellName(768), -- Cat Form
[783] = GetSpellName(783), -- Travel Form
[24858] = GetSpellName(24858), -- Moonkin Form
},
PRIEST = {
[15473] = GetSpellInfo(15473), -- Shadowform
[15473] = GetSpellName(15473), -- Shadowform
},
ROGUE = {
[1784] = GetSpellInfo(1784), -- Stealth
[1784] = GetSpellName(1784), -- Stealth
},
} or {
DRUID = {
[5487] = GetSpellInfo(5487), -- Bear Form
[768] = GetSpellInfo(768), -- Cat Form
[783] = GetSpellInfo(783), -- Travel Form
[24858] = GetSpellInfo(24858), -- Moonkin Form
[33891] = GetSpellInfo(33891), -- Incarnation: Tree of Life
[171745] = GetSpellInfo(171745), -- Claws of Shirvallah
[5487] = GetSpellName(5487), -- Bear Form
[768] = GetSpellName(768), -- Cat Form
[783] = GetSpellName(783), -- Travel Form
[24858] = GetSpellName(24858), -- Moonkin Form
[33891] = GetSpellName(33891), -- Incarnation: Tree of Life
[171745] = GetSpellName(171745), -- Claws of Shirvallah
},
ROGUE = {
[1784] = GetSpellInfo(1784), -- Stealth
[1784] = GetSpellName(1784), -- Stealth
},
}
function Module:Table_Get()
Expand Down Expand Up @@ -188,7 +190,7 @@ else
19883, -- Track Humanoids
19884, -- Track Undead
} do
local name = GetSpellInfo(id)
local name = GetSpellName(id)
TrackingCache[id] = strlower(name)
end

Expand Down
12 changes: 7 additions & 5 deletions Components/Core/Conditions/Categories/Spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ local bit_band = bit.band

local COMBATLOG_OBJECT_TYPE_PLAYER = COMBATLOG_OBJECT_TYPE_PLAYER

local GetSpellCooldown = TMW.GetSpellCooldown
Env.GetSpellCooldown = GetSpellCooldown
local GetSpellCooldown = GetSpellCooldown
local GetSpellName = TMW.GetSpellName
local GetSpellInfo = TMW.GetSpellInfo

local GetItemCooldown = GetItemCooldown or (C_Container and C_Container.GetItemCooldown)

Expand Down Expand Up @@ -277,7 +279,7 @@ ConditionCategory:RegisterCondition(2.8, "LASTCAST", {
module:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED",
function(_, unit, _, spellID)
if unit == "player" and ussSpells[spellID] and not blacklist[spellID] then
Env.LastPlayerCastName = strlower(GetSpellInfo(spellID))
Env.LastPlayerCastName = strlower(GetSpellName(spellID))
Env.LastPlayerCastID = spellID
TMW:Fire("TMW_CNDT_LASTCAST_UPDATED")
end
Expand Down Expand Up @@ -326,11 +328,11 @@ ConditionCategory:RegisterCondition(2.95, "SPELL_LEARNED", {
icon = 237558,
tcoords = CNDT.COMMON.standardtcoords,
Env = {
GetSpellInfo = GetSpellInfo,
GetSpellName = TMW.GetSpellName
},
-- In Classic SoD, IsPlayerSpell doesn't work for rune abilities (always returns false).
-- However, GetSpellInfo with a name input only returns the player's spells.
funcstr = [[BOOLCHECK( GetSpellInfo(c.Spells.FirstString) )]],
funcstr = [[BOOLCHECK( GetSpellName(c.Spells.FirstString) )]],
events = function(ConditionObject, c)
return
ConditionObject:GenerateNormalEventString("SPELLS_CHANGED")
Expand Down Expand Up @@ -436,7 +438,7 @@ ConditionCategory:RegisterCondition(3.5, "OVERLAYED", {
module = CNDT:NewModule("OVERLAYED", "AceEvent-3.0")

local function handleEvent(event, arg1)
Env.OverlayedNameMap[strlowerCache[GetSpellInfo(arg1)]] = arg1
Env.OverlayedNameMap[strlowerCache[GetSpellName(arg1)]] = arg1
end

module:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW", handleEvent)
Expand Down
4 changes: 3 additions & 1 deletion Components/Core/Conditions/Categories/Spells_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ local L = TMW.L
local print = TMW.print

local SUG = TMW.SUG
local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName

local Module_spell = SUG:GetModule("spell")
local Module = SUG:NewModule("spellWithGCD", Module_spell)
Expand All @@ -34,7 +36,7 @@ function Module:Entry_AddToList_2(f, id)
if id == "GCD" then
local spellID = TMW.GCDSpell

local name = GetSpellInfo(spellID)
local name = GetSpellName(spellID)

f.Name:SetText(L["GCD"])
f.ID:SetText(nil)
Expand Down
10 changes: 6 additions & 4 deletions Components/Core/Conditions/Categories/Talents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ local _, pclass = UnitClass("Player")

local wipe =
wipe
local GetTalentInfo, GetNumTalents, GetGlyphLink, GetSpellInfo =
GetTalentInfo, GetNumTalents, GetGlyphLink, GetSpellInfo
local GetTalentInfo, GetNumTalents, GetGlyphLink =
GetTalentInfo, GetNumTalents, GetGlyphLink
local GetSpecializationInfo, GetNumClasses =
GetSpecializationInfo, GetNumClasses
local GetNumBattlefieldScores, RequestBattlefieldScoreData, GetBattlefieldScore, GetNumArenaOpponents, GetArenaOpponentSpec =
GetNumBattlefieldScores, RequestBattlefieldScoreData, GetBattlefieldScore, GetNumArenaOpponents, GetArenaOpponentSpec
local UnitAura, IsInJailersTower, C_SpecializationInfo, GetPvpTalentInfoByID =
UnitAura, IsInJailersTower, C_SpecializationInfo, GetPvpTalentInfoByID

local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName
local GetClassInfo = TMW.GetClassInfo
local GetMaxClassID = TMW.GetMaxClassID

Expand Down Expand Up @@ -690,7 +692,7 @@ if GetGlyphSocketInfo then
if spellID then
GlyphLookup[spellID] = 1

local name = GetSpellInfo(spellID)
local name = GetSpellName(spellID)
name = strlowerCache[name]
GlyphLookup[name] = 1
end
Expand All @@ -702,7 +704,7 @@ if GetGlyphSocketInfo then
if spellID then
GlyphLookup[spellID] = 1

local name = GetSpellInfo(spellID)
local name = GetSpellName(spellID)
name = strlowerCache[name]
GlyphLookup[name] = 1
end
Expand Down
1 change: 1 addition & 0 deletions Components/Core/Conditions/Categories/Talents_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local print = TMW.print

local SUG = TMW.SUG
local strlowerCache = TMW.strlowerCache
local GetSpellInfo = TMW.GetSpellInfo

local _, pclass = UnitClass("Player")

Expand Down
2 changes: 1 addition & 1 deletion Components/Core/Conditions/Conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TMW:RegisterUpgrade(60026, {

for _, stanceData in ipairs(self.stances) do
if stanceData.class == pclass then
local stanceName = GetSpellInfo(stanceData.id)
local stanceName = TMW.GetSpellInfo(stanceData.id)
tinsert(self.CSN, stanceName)
end
end
Expand Down
2 changes: 2 additions & 0 deletions Components/Core/IconDataProcessors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ local print = TMW.print

local format = format
local isNumber = TMW.isNumber

local GetSpellInfo = TMW.GetSpellInfo
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or GetSpellLink


Expand Down
16 changes: 8 additions & 8 deletions Components/Core/IconType.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ local TMW = TMW
local L = TMW.L
local print = TMW.print

local GetSpellInfo
= GetSpellInfo

local pairs, ipairs, setmetatable, rawget, date, tinsert, type
= pairs, ipairs, setmetatable, rawget, date, tinsert, type

local GetSpellBookItemInfo = TMW.GetSpellBookItemInfo
= pairs, ipairs, setmetatable, rawget, date, tinsert, type

local GetSpellBookItemInfo = TMW.GetSpellBookItemInfo
local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or GetSpellLink
local GetSpellTexture = TMW.GetSpellTexture
local tContains = TMW.tContains
Expand Down Expand Up @@ -121,7 +121,7 @@ function IconType:FormatSpellForOutput(icon, data, doInsertLink)
if doInsertLink then
name = GetSpellLink(data)
else
name = GetSpellInfo(data)
name = GetSpellName(data)
end
if name then
return name
Expand Down Expand Up @@ -215,14 +215,14 @@ function IconType:DragReceived(icon, t, data, subType, param4)
if data == 0 and type(param4) == "number" then
-- I don't remember the purpose of this anymore.
-- It handles some special sort of spell, though, and is required.
input = GetSpellInfo(param4)
input = GetSpellName(param4)
else
local spellData = GetSpellBookItemInfo(data, subType)
if not spellData or spellData.typeName ~= "SPELL" then
return
end

local baseSpellName = GetSpellInfo(spellData.actionId)
local baseSpellName = GetSpellName(spellData.actionId)

input = baseSpellName or spellData.name
end
Expand Down
4 changes: 3 additions & 1 deletion Components/Core/Spells/ClassSpellCache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ local print = TMW.print
local pairs, type, ipairs, bit, select =
pairs, type, ipairs, bit, select

local GetSpellInfo = TMW.GetSpellInfo
local GetSpellName = TMW.GetSpellName
local GetClassInfo = TMW.GetClassInfo
local GetMaxClassID = TMW.GetMaxClassID

Expand Down Expand Up @@ -144,7 +146,7 @@ function ClassSpellCache:GetNameCache()
local c = {}
NameCache[class] = c
for spellID, value in pairs(spells) do
local name = GetSpellInfo(spellID)
local name = GetSpellName(spellID)
if name then
c[name:lower()] = true
end
Expand Down
Loading

0 comments on commit 305fa8a

Please sign in to comment.