Basic TWW compatibility

This commit is contained in:
Parnic
2024-06-22 18:07:42 -05:00
parent b0f7c776db
commit 6c2e759f45
20 changed files with 261 additions and 109 deletions

View File

@ -8,6 +8,11 @@ if not CastingBarFrame then
CastingBarFrame = PlayerCastingBarFrame
end
local IsSpellInRange = IsSpellInRange
if not IsSpellInRange and C_Spell then
IsSpellInRange = C_Spell.IsSpellInRange
end
CastBar.prototype.spellCastSent = nil
-- Constructor --

View File

@ -3,8 +3,13 @@ local ComboPoints = IceCore_CreateClass(IceElement)
local IceHUD = _G.IceHUD
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
local AnticipationSpellId = 114015
local AnticipationExists = GetSpellInfo(AnticipationSpellId) and IceHUD.WowVer < 70000
local AnticipationExists = GetSpellName(AnticipationSpellId) and IceHUD.WowVer < 70000
ComboPoints.prototype.comboSize = 20
@ -522,7 +527,7 @@ function ComboPoints.prototype:UpdateComboPoints(...)
end
if AnticipationExists then
_, _, _, anticipate = UnitAura("player", GetSpellInfo(AnticipationSpellId))
_, _, _, anticipate = IceHUD.UnitAura("player", GetSpellName(AnticipationSpellId))
else
anticipate = 0
end
@ -593,9 +598,9 @@ do
if UnitIsUnit(unit, "player") then
local _, _, _, newAntStacks
if IceHUD.SpellFunctionsReturnRank then
_, _, _, newAntStacks = UnitAura("player", GetSpellInfo(AnticipationSpellId))
_, _, _, newAntStacks = IceHUD.UnitAura("player", GetSpellName(AnticipationSpellId))
else
_, _, newAntStacks = UnitAura("player", GetSpellInfo(AnticipationSpellId))
_, _, newAntStacks = IceHUD.UnitAura("player", GetSpellName(AnticipationSpellId))
end
if newAntStacks ~= antStacks then
antStacks = newAntStacks

View File

@ -12,6 +12,19 @@ local AuraIconWidth = 20
local AuraIconHeight = 20
local displayModes = {NORMAL = L["When present"], ALWAYS = L["Always"], WHEN_TARGETING = L["Always, when targeting"], MISSING = L["When missing"]}
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
local GetSpellInfo = GetSpellInfo
if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
GetSpellInfo = function(id)
local info = C_Spell.GetSpellInfo
return info.name, nil, info.iconID
end
end
IceCustomBar.prototype.auraDuration = -1
IceCustomBar.prototype.auraEndTime = -1
IceCustomBar.prototype.bIsAura = false
@ -686,9 +699,9 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
local buffFilter = (isBuff and "HELPFUL" or "HARMFUL") .. (self.moduleSettings.trackOnlyMine and "|PLAYER" or "")
local buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId
if IceHUD.SpellFunctionsReturnRank then
buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, buffFilter)
else
buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, buffFilter)
end
local isMine = unitCaster == "player"
local mySpellId = tonumber(self.moduleSettings.buffToTrack)
@ -716,9 +729,9 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
i = i + 1;
if IceHUD.SpellFunctionsReturnRank then
buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, buffFilter)
else
buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, buffFilter)
end
isMine = unitCaster == "player"
end
@ -773,7 +786,7 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
self:GetAuraDuration(self.unit, self.moduleSettings.buffToTrack)
else
self.auraDuration, remaining, self.auraBuffCount, auraIcon, endTime =
self:GetAuraDuration(self.unit, GetSpellInfo(self.moduleSettings.buffToTrack))
self:GetAuraDuration(self.unit, GetSpellName(self.moduleSettings.buffToTrack))
end
if endTime == 0 then

View File

@ -17,6 +17,29 @@ local COOLDOWN_TYPE_ITEM = 2
local localizedInventorySlotNames = {}
local IsSpellInRange = IsSpellInRange
if not IsSpellInRange and C_Spell then
IsSpellInRange = C_Spell.IsSpellInRange
end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
local GetSpellInfo = GetSpellInfo
if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
GetSpellInfo = function(id)
local info = C_Spell.GetSpellInfo
return info.name, nil, info.iconID
end
end
local GetItemInfo = GetItemInfo
if not GetItemInfo and C_Item then
GetItemInfo = C_Item.GetItemInfo
end
IceCustomCDBar.prototype.cooldownDuration = 0
IceCustomCDBar.prototype.cooldownEndTime = 0
IceCustomCDBar.prototype.coolingDown = false
@ -161,7 +184,7 @@ function IceCustomCDBar.prototype:GetDisplayText(fromValue)
if not self.moduleSettings.cooldownType or self.moduleSettings.cooldownType == COOLDOWN_TYPE_SPELL then
if tonumber(fromValue) ~= nil then
local spellName = GetSpellInfo(tonumber(fromValue))
local spellName = GetSpellName(tonumber(fromValue))
if spellName then
v = spellName
end
@ -278,7 +301,7 @@ function IceCustomCDBar.prototype:GetOptions()
set = function(info, v)
local orig = v
if tonumber(v) ~= nil then
v = GetSpellInfo(tonumber(v))
v = GetSpellName(tonumber(v))
end
if v == nil then
v = orig

View File

@ -7,6 +7,14 @@ local AuraIconWidth = 20
local AuraIconHeight = 20
local DefaultAuraIcon = "Interface\\Icons\\Spell_Frost_Frost"
local GetSpellInfo = GetSpellInfo
if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
GetSpellInfo = function(id)
local info = C_Spell.GetSpellInfo
return info.name, nil, info.iconID
end
end
function IceCustomCounterBar.prototype:init()
IceCustomCounterBar.super.prototype.init(self, "CustomCounterBar")

View File

@ -1,6 +1,19 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
local GlobalCoolDown = IceCore_CreateClass(IceBarElement)
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
local GetSpellInfo = GetSpellInfo
if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
GetSpellInfo = function(id)
local info = C_Spell.GetSpellInfo
return info.name, nil, info.iconID, info.castTime
end
end
-- Constructor --
function GlobalCoolDown.prototype:init()
GlobalCoolDown.super.prototype.init(self, "GlobalCoolDown")
@ -267,7 +280,7 @@ function GlobalCoolDown.prototype:CreateLagBar()
end
function GlobalCoolDown.prototype:GetSpellId()
if GetSpellInfo(61304) then
if GetSpellName(61304) then
return 61304
else
local defaultSpells
@ -286,13 +299,13 @@ function GlobalCoolDown.prototype:GetSpellId()
MONK=100780, -- jab
}
if not GetSpellInfo(defaultSpells["PALADIN"]) then
if not GetSpellName(defaultSpells["PALADIN"]) then
defaultSpells["PALADIN"] = 635
end
if not GetSpellInfo(defaultSpells["MAGE"]) then
if not GetSpellName(defaultSpells["MAGE"]) then
defaultSpells["MAGE"] = 133
end
if not GetSpellInfo(defaultSpells["WARRIOR"]) then
if not GetSpellName(defaultSpells["WARRIOR"]) then
defaultSpells["WARRIOR"] = 6673
end

View File

@ -4,6 +4,11 @@ local Resolve = IceCore_CreateClass(IceUnitBar)
local RESOLVE_SPELL_ID = 158300
local RESOLVE_MAX = 240
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
Resolve.prototype.current = nil
Resolve.prototype.max = RESOLVE_MAX
@ -49,14 +54,19 @@ end
-- scan the tooltip and extract the Resolve value
do
local spellName = GetSpellInfo(RESOLVE_SPELL_ID)
local spellName = GetSpellName(RESOLVE_SPELL_ID)
function Resolve.prototype:UpdateCurrent(event, unit)
if (unit and (unit ~= self.unit)) then
return
end
self.current = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, UnitAura(self.unit, spellName)) or 0
if UnitAura then
self.current = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, UnitAura(self.unit, spellName)) or 0
else
local auraInfo = C_UnitAuras.GetAuraDataBySpellName(self.unit, spellName)
self.current = auraInfo and auraInfo.timeMod or 0
end
self:Update()
end
@ -80,6 +90,6 @@ end
-- Load for tanks only
local _, unitClass = UnitClass("player")
if (unitClass == "DEATHKNIGHT" or unitClass == "DRUID" or unitClass == "PALADIN" or unitClass == "WARRIOR" or unitClass == "MONK")
and GetSpellInfo(RESOLVE_SPELL_ID) then
and GetSpellName(RESOLVE_SPELL_ID) then
IceHUD.Resolve = Resolve:new()
end

View File

@ -26,6 +26,11 @@ if Enum and Enum.PowerType then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
-- Constructor --
function RollTheBones.prototype:init()
RollTheBones.super.prototype.init(self, "RollTheBones", "player")
@ -288,8 +293,8 @@ end
-- use this to figure out if Roll the Bones is available or not. neither IsSpellKnown nor IsPlayerSpell are correct for it
-- when SnD is known, but this is.
local function HasSpell(id)
local spell = GetSpellInfo(id)
return spell == GetSpellInfo(spell)
local spell = GetSpellName(id)
return spell == GetSpellName(spell)
end
local function ShouldHide()

View File

@ -294,13 +294,6 @@ local function SNDGetComboPoints(unit)
end
end
-- use this to figure out if Roll the Bones is available or not. neither IsSpellKnown nor IsPlayerSpell are correct for it
-- when SnD is known, but this is.
local function HasSpell(id)
local spell = GetSpellInfo(id)
return spell == GetSpellInfo(spell)
end
local function ShouldHide()
if IceHUD.WowVer >= 90000 or IceHUD.WowClassicBC or IceHUD.WowClassicWrath then
return false

View File

@ -23,6 +23,11 @@ if STAGGER_STATES then
STAGGER_RED_TRANSITION = STAGGER_STATES.RED.threshold
end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
StaggerBar.prototype.StaggerDuration = 0
StaggerBar.prototype.StaggerEndTime = 0
@ -119,9 +124,9 @@ function StaggerBar.prototype:Enable(core)
StaggerBar.super.prototype.Enable(self, core)
playerName = UnitName(self.unit)
staggerNames[1] = GetSpellInfo(LightID)
staggerNames[2] = GetSpellInfo(ModerateID)
staggerNames[3] = GetSpellInfo(HeavyID)
staggerNames[1] = GetSpellName(LightID)
staggerNames[2] = GetSpellName(ModerateID)
staggerNames[3] = GetSpellName(HeavyID)
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
@ -196,8 +201,8 @@ function StaggerBar.prototype:GetDebuffInfo()
if debuffID == LightID or debuffID == ModerateID or debuffID == HeavyID then
local spellName = UnitDebuff(self.unit, i)
duration = select(IceHUD.SpellFunctionsReturnRank and 6 or 5, UnitAura(self.unit, spellName, "", "HARMFUL"))
amount = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, UnitAura(self.unit, spellName, "", "HARMFUL"))
duration = select(IceHUD.SpellFunctionsReturnRank and 6 or 5, IceHUD.UnitAura(self.unit, spellName, "", "HARMFUL"))
amount = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, IceHUD.UnitAura(self.unit, spellName, "", "HARMFUL"))
staggerLevel = (debuffID == LightID) and 1 or (debuffID == ModerateID) and 2 or 3
break

View File

@ -12,6 +12,11 @@ if GetNumGroupMembers then
GetNumRaidMembers = GetNumGroupMembers
end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
-- list of spell ID's for each CC type so we can avoid localization issues
local StunCCList = {
-- kidney shot
@ -259,7 +264,7 @@ function TargetCC.prototype:PopulateSpellList(debuffListVar, ccList, ccName)
local spellName
for i=1,#ccList do
spellName = GetSpellInfo(ccList[i])
spellName = GetSpellName(ccList[i])
if spellName and spellName ~= "" then
debuffListVar[spellName] = ccName
@ -349,9 +354,9 @@ function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames)
local i = 1
local debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId
if IceHUD.SpellFunctionsReturnRank then
debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL")
debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, "HARMFUL")
else
debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL")
debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, "HARMFUL")
end
local isMine = unitCaster == "player"
local result = {nil, nil, nil}
@ -373,9 +378,9 @@ function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames)
i = i + 1;
if IceHUD.SpellFunctionsReturnRank then
debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL")
debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, "HARMFUL")
else
debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL")
debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = IceHUD.UnitAura(unitName, i, "HARMFUL")
end
isMine = unitCaster == "player"
end

View File

@ -1420,11 +1420,11 @@ function IceTargetInfo.prototype:UpdateBuffType(aura)
---- end change by Fulzamoth
if IceHUD.SpellFunctionsReturnRank then
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or ""))
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = IceHUD.UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or ""))
else
---- Fulzamoth - 2019-09-04 : support for cooldowns on target buffs/debuffs (classic)
-- 1. in addition to other info, get the spellID for for the (de)buff
name, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, _, spellID = UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or ""))
name, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, _, spellID = IceHUD.UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or ""))
if duration == 0 and LibClassicDurations then
-- 2. if no duration defined for the (de)buff, look up the spell in LibClassicDurations
local classicDuration, classicExpirationTime = LibClassicDurations:GetAuraDurationByUnit(self.unit, spellID, caster)

View File

@ -12,6 +12,11 @@ if GetNumGroupMembers then
GetNumRaidMembers = GetNumGroupMembers
end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
-- list of spell ID's for each CC type so we can avoid localization issues
local InvulnList= {
-- Anti-Magic Shell
@ -76,7 +81,7 @@ function TargetInvuln.prototype:PopulateSpellList(buffListVar, ccList, ccName)
local spellName
for i=1,#ccList do
spellName = GetSpellInfo(ccList[i])
spellName = GetSpellName(ccList[i])
if spellName and spellName ~= "" then
buffListVar[spellName] = ccName
@ -148,9 +153,9 @@ function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames)
local i = 1
local buff, rank, texture, count, buffType, duration, endTime, unitCaster
if IceHUD.SpellFunctionsReturnRank then
buff, rank, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL")
buff, rank, texture, count, buffType, duration, endTime, unitCaster = IceHUD.UnitAura(unitName, i, "HELPFUL")
else
buff, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL")
buff, texture, count, buffType, duration, endTime, unitCaster = IceHUD.UnitAura(unitName, i, "HELPFUL")
end
local isMine = unitCaster == "player"
local result = {nil, nil, nil}
@ -179,9 +184,9 @@ function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames)
i = i + 1;
if IceHUD.SpellFunctionsReturnRank then
buff, rank, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL")
buff, rank, texture, count, buffType, duration, endTime, unitCaster = IceHUD.UnitAura(unitName, i, "HELPFUL")
else
buff, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL")
buff, texture, count, buffType, duration, endTime, unitCaster = IceHUD.UnitAura(unitName, i, "HELPFUL")
end
isMine = unitCaster == "player"
end

View File

@ -124,24 +124,26 @@ function TargetOfTarget.prototype:GetOptions()
order = 34
}
opts["texture"] = {
type = 'select',
dialogControl = "LSM30_Statusbar",
name = L["Texture"],
desc = L["ToT frame texture"],
get = function(info)
return self.moduleSettings.texture
end,
set = function(info, v)
self.moduleSettings.texture = v
self:Redraw()
end,
disabled = function()
return not self.moduleSettings.enabled
end,
values = AceGUIWidgetLSMlists.statusbar,
order = 35
}
if AceGUIWidgetLSMlists then
opts["texture"] = {
type = 'select',
dialogControl = "LSM30_Statusbar",
name = L["Texture"],
desc = L["ToT frame texture"],
get = function(info)
return self.moduleSettings.texture
end,
set = function(info, v)
self.moduleSettings.texture = v
self:Redraw()
end,
disabled = function()
return not self.moduleSettings.enabled
end,
values = AceGUIWidgetLSMlists.statusbar,
order = 35
}
end
opts["sizeToGap"] = {
type = 'toggle',

View File

@ -30,6 +30,11 @@ if not UnitGroupRolesAssigned then
end
end
local GetItemInfo = GetItemInfo
if not GetItemInfo and C_Item then
GetItemInfo = C_Item.GetItemInfo
end
local MAX_NUM_RAID_MEMBERS = 40
local MAX_NUM_PARTY_MEMBERS = 5

View File

@ -3,6 +3,11 @@ local Vengeance = IceCore_CreateClass(IceUnitBar)
local VENGEANCE_SPELL_ID = 93098
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
Vengeance.prototype.current = nil
Vengeance.prototype.max = nil
@ -50,18 +55,25 @@ end
-- scan the tooltip and extract the vengeance value
do
-- making these local as they're not used anywhere else
local spellName = GetSpellInfo(VENGEANCE_SPELL_ID)
local spellName = GetSpellName(VENGEANCE_SPELL_ID)
function Vengeance.prototype:UpdateCurrent(event, unit)
if (unit and (unit ~= self.unit)) then
return
end
local _, idx = IceHUD:GetBuffCount(self.unit, spellName, true, true)
if idx then
self.current = select(17, UnitAura(self.unit, idx))
if C_UnitAuras and C_UnitAuras.GetAuraDataBySpellName then
local data = C_UnitAuras.GetAuraDataBySpellName(self.unit, spellName)
if data and data.points and #data.points > 0 then
self.current = (data and data.points and #data.points > 0) and data.points[1] or 0
end
else
self.current = 0
local _, idx = IceHUD:GetBuffCount(self.unit, spellName, true, true)
if idx then
self.current = select(17, IceHUD.UnitAura(self.unit, idx))
else
self.current = 0
end
end
self:Update()