diff --git a/IceCastBar.lua b/IceCastBar.lua index c9e6e6e..2601d6a 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -23,6 +23,19 @@ if not UnitCastingInfo then UnitChannelInfo = ChannelInfo 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 + -- Fulzamoth 2019-09-27 : Use LibClassicCasterino if it's there so we can use TargetCast -- module in Classic WoW if IceHUD.WowClassic then @@ -701,11 +714,11 @@ function IceCastBar.prototype:SpellCastSucceeded(event, unit, castGuid, spellId) return end - local spell = GetSpellInfo(spellId) + local spell = GetSpellName(spellId) -- show after normal successfull cast if (self.action == IceCastBar.Actions.Cast) then - self:StartBar(IceCastBar.Actions.Success, spell.. self:GetShortRank(rank), spellId) + self:StartBar(IceCastBar.Actions.Success, spell, spellId) return end @@ -723,7 +736,7 @@ function IceCastBar.prototype:SpellCastSucceeded(event, unit, castGuid, spellId) return end - self:StartBar(IceCastBar.Actions.Success, spell.. self:GetShortRank(rank), spellId) + self:StartBar(IceCastBar.Actions.Success, spell, spellId) end diff --git a/IceCore.lua b/IceCore.lua index e20a9f0..d560b51 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -19,6 +19,11 @@ end local DogTag = LibStub("LibDogTag-3.0", true) +local GetSpellName = GetSpellInfo +if C_Spell and C_Spell.GetSpellName then + GetSpellName = C_Spell.GetSpellName +end + IceCore = IceCore_CreateClass() IceCore.Side = { Left = "LEFT", Right = "RIGHT" } @@ -367,13 +372,13 @@ end function IceCore.prototype:RedirectRemovedModules() local _, class = UnitClass("player") - if class == "WARRIOR" and self.settings.modules["SunderCount"] and GetSpellInfo(SUNDER_SPELL_ID) and IceHUD.WowVer < 60000 then + if class == "WARRIOR" and self.settings.modules["SunderCount"] and GetSpellName(SUNDER_SPELL_ID) and IceHUD.WowVer < 60000 then if self.settings.modules["SunderCount"].enabled or self.settings.modules["SunderCount"].enabled == nil then local bFound = false for k,v in pairs(self.elements) do if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName - and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellInfo(SUNDER_SPELL_ID)) then + and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellName(SUNDER_SPELL_ID)) then bFound = true break end @@ -396,7 +401,7 @@ function IceCore.prototype:RedirectRemovedModules() newCounter.moduleSettings.maxCount = 3 newCounter.moduleSettings.auraTarget = "target" newCounter.moduleSettings.auraType = "debuff" - newCounter.moduleSettings.auraName = GetSpellInfo(SUNDER_SPELL_ID) + newCounter.moduleSettings.auraName = GetSpellName(SUNDER_SPELL_ID) newCounter:Enable() end end @@ -404,12 +409,12 @@ function IceCore.prototype:RedirectRemovedModules() self.settings.modules["SunderCount"] = nil end - if class == "DRUID" and self.settings.modules["LacerateCount"] and GetSpellInfo(LACERATE_SPELL_ID) then + if class == "DRUID" and self.settings.modules["LacerateCount"] and GetSpellName(LACERATE_SPELL_ID) then if self.settings.modules["LacerateCount"].enabled or self.settings.modules["LacerateCount"].enabled == nil then local bFound = false for k,v in pairs(self.elements) do if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName - and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellInfo(LACERATE_SPELL_ID)) then + and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellName(LACERATE_SPELL_ID)) then bFound = true break end @@ -433,7 +438,7 @@ function IceCore.prototype:RedirectRemovedModules() newCounter.moduleSettings.maxCount = 3 newCounter.moduleSettings.auraTarget = "target" newCounter.moduleSettings.auraType = "debuff" - newCounter.moduleSettings.auraName = GetSpellInfo(LACERATE_SPELL_ID) + newCounter.moduleSettings.auraName = GetSpellName(LACERATE_SPELL_ID) newCounter:Enable() end end @@ -441,12 +446,12 @@ function IceCore.prototype:RedirectRemovedModules() self.settings.modules["LacerateCount"] = nil end - if class == "SHAMAN" and self.settings.modules["MaelstromCount"] and GetSpellInfo(MAELSTROM_SPELL_ID) then + if class == "SHAMAN" and self.settings.modules["MaelstromCount"] and GetSpellName(MAELSTROM_SPELL_ID) then if self.settings.modules["MaelstromCount"].enabled or self.settings.modules["MaelstromCount"].enabled == nil then local bFound = false for k,v in pairs(self.elements) do if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName - and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellInfo(MAELSTROM_SPELL_ID)) then + and string.upper(v.moduleSettings.auraName) == string.upper(GetSpellName(MAELSTROM_SPELL_ID)) then bFound = true break end @@ -466,7 +471,7 @@ function IceCore.prototype:RedirectRemovedModules() newCounter.moduleSettings.countMode = self.settings.modules["MaelstromCount"].maelstromMode or newCounter.moduleSettings.countMode newCounter.moduleSettings.countGap = self.settings.modules["MaelstromCount"].maelstromGap or newCounter.moduleSettings.countGap newCounter.moduleSettings.gradient = self.settings.modules["MaelstromCount"].gradient or newCounter.moduleSettings.gradient - newCounter.moduleSettings.auraName = GetSpellInfo(MAELSTROM_SPELL_ID) + newCounter.moduleSettings.auraName = GetSpellName(MAELSTROM_SPELL_ID) newCounter:Enable() end end diff --git a/IceHUD.lua b/IceHUD.lua index cab3ed5..bbd2f9f 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -11,6 +11,20 @@ local icon = LibStub("LibDBIcon-1.0", true) local pendingModuleLoads = {} local bReadyToRegisterModules = false +local LoadAddOn = C_AddOns and C_AddOns.LoadAddOn or LoadAddOn + +IceHUD.UnitAura = UnitAura +if not IceHUD.UnitAura then + IceHUD.UnitAura = function(unitToken, index, filter) + local auraData = C_UnitAuras.GetAuraDataByIndex(unitToken, index, filter) + if not auraData then + return nil + end + + return AuraUtil.UnpackAuraData(auraData) + end +end + IceHUD.CurrTagVersion = 3 IceHUD.debugging = false @@ -39,6 +53,11 @@ else end end +local GetSpellName = GetSpellInfo +if C_Spell and C_Spell.GetSpellName then + GetSpellName = C_Spell.GetSpellName +end + -- compatibility/feature flags IceHUD.CanShowTargetCasting = not IceHUD.WowClassic or LibClassicCasterino or (IceHUD.WowClassic and IceHUD.WowVer >= 11500) IceHUD.GetPlayerAuraBySpellID = _G["C_UnitAuras"] and C_UnitAuras.GetPlayerAuraBySpellID @@ -64,9 +83,9 @@ IceHUD.DeathKnightUnholyFrostRunesSwapped = IceHUD.WowVer < 70300 and not IceHUD IceHUD.SupportsHealPrediction = IceHUD.WowVer >= 40000 or IceHUD.WowClassicWrath IceHUD.UnitGroupRolesReturnsRoleString = IceHUD.WowVer >= 40000 or IceHUD.WowClassicWrath IceHUD.ShellGameSpellID = 271571 -IceHUD.HasShellGame = GetSpellInfo(IceHUD.ShellGameSpellID) +IceHUD.HasShellGame = GetSpellName(IceHUD.ShellGameSpellID) IceHUD.CatalogingSpellIDs = {366290, 372817, 385025, 385635, 386070, 386504, 400043, 403115} -IceHUD.HasCataloging = GetSpellInfo(366290) +IceHUD.HasCataloging = GetSpellName(366290) IceHUD.UnitPowerEvent = "UNIT_POWER_UPDATE" @@ -418,7 +437,12 @@ blizOptionsPanel.button:SetWidth(240) blizOptionsPanel.button:SetHeight(30) blizOptionsPanel.button:SetScript("OnClick", function(self) HideUIPanel(InterfaceOptionsFrame) HideUIPanel(GameMenuFrame) IceHUD:OpenConfig() end) blizOptionsPanel.button:SetPoint('TOPLEFT', blizOptionsPanel, 'TOPLEFT', 20, -20) -InterfaceOptions_AddCategory(blizOptionsPanel) +if InterfaceOptions_AddCategory then + InterfaceOptions_AddCategory(blizOptionsPanel) +elseif Settings then + local category = Settings.RegisterCanvasLayoutCategory(blizOptionsPanel, "IceHUD") + Settings.RegisterAddOnCategory(category) +end function IceHUD:OpenConfig() if not ConfigDialog then return end @@ -515,9 +539,9 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) local i = 1 local name, _, texture, applications if IceHUD.SpellFunctionsReturnRank then - name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) + name, _, texture, applications = IceHUD.UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else - name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) + name, texture, applications = IceHUD.UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) end while name do if (not matchByName and string.match(texture:upper(), ability:upper())) @@ -527,9 +551,9 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) i = i + 1 if IceHUD.SpellFunctionsReturnRank then - name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) + name, _, texture, applications = IceHUD.UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else - name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) + name, texture, applications = IceHUD.UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) end end @@ -547,9 +571,9 @@ do local i = 1 local name, _, texture, applications, _, _, _, _, _, _, auraID if IceHUD.SpellFunctionsReturnRank then - name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) + name, _, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter) else - name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) + name, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter) end while name do for i=1, #spellIDs do @@ -561,9 +585,9 @@ do i = i + 1 if IceHUD.SpellFunctionsReturnRank then - name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) + name, _, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter) else - name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) + name, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter) end end diff --git a/IceHUD_Options/Options.lua b/IceHUD_Options/Options.lua index de430a3..3fc4712 100644 --- a/IceHUD_Options/Options.lua +++ b/IceHUD_Options/Options.lua @@ -464,25 +464,6 @@ The Classic game client doesn't provide this information to addons because it wa }, - textSettings = { - type = 'select', - dialogControl = "LSM30_Font", - name = L["Font"], - desc = L["IceHUD Font"], - order = 19, - get = function(info) - return IceHUD.IceCore:GetFontFamily() - end, - set = function(info, value) - IceHUD.IceCore:SetFontFamily(value) - end, - disabled = function() - return not IceHUD.IceCore:IsEnabled() - end, - values = AceGUIWidgetLSMlists.font, - order = 94.75, - }, - barSettings = { type = 'group', name = L["Bar Settings"], @@ -780,6 +761,26 @@ The Classic game client doesn't provide this information to addons because it wa } } +if AceGUIWidgetLSMlists then + options.args.textSettings = { + type = 'select', + dialogControl = "LSM30_Font", + name = L["Font"], + desc = L["IceHUD Font"], + get = function(info) + return IceHUD.IceCore:GetFontFamily() + end, + set = function(info, value) + IceHUD.IceCore:SetFontFamily(value) + end, + disabled = function() + return not IceHUD.IceCore:IsEnabled() + end, + values = AceGUIWidgetLSMlists.font, + order = 94.75, + } +end + IceHUD_Options.options = options function IceHUD_Options:GenerateModuleOptions(firstLoad) diff --git a/modules/CastBar.lua b/modules/CastBar.lua index 26ba9c4..582945b 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -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 -- diff --git a/modules/ComboPoints.lua b/modules/ComboPoints.lua index 1c2eb6b..62aef01 100644 --- a/modules/ComboPoints.lua +++ b/modules/ComboPoints.lua @@ -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 diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 68f9c34..35f0979 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -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 diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 3766852..91bc05b 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -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 diff --git a/modules/CustomCounterBar.lua b/modules/CustomCounterBar.lua index d1f2076..6b6d6f4 100644 --- a/modules/CustomCounterBar.lua +++ b/modules/CustomCounterBar.lua @@ -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") diff --git a/modules/GlobalCoolDown.lua b/modules/GlobalCoolDown.lua index cb6d6eb..d62ecce 100644 --- a/modules/GlobalCoolDown.lua +++ b/modules/GlobalCoolDown.lua @@ -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 diff --git a/modules/Resolve.lua b/modules/Resolve.lua index b78df5a..afb6dba 100644 --- a/modules/Resolve.lua +++ b/modules/Resolve.lua @@ -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 diff --git a/modules/RollTheBones.lua b/modules/RollTheBones.lua index 8f2c230..441b14d 100644 --- a/modules/RollTheBones.lua +++ b/modules/RollTheBones.lua @@ -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() diff --git a/modules/SliceAndDice.lua b/modules/SliceAndDice.lua index b81d298..3888b5e 100644 --- a/modules/SliceAndDice.lua +++ b/modules/SliceAndDice.lua @@ -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 diff --git a/modules/Stagger.lua b/modules/Stagger.lua index 439dbe3..13faff0 100644 --- a/modules/Stagger.lua +++ b/modules/Stagger.lua @@ -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 diff --git a/modules/TargetCC.lua b/modules/TargetCC.lua index 3d3bc7b..f66aa6a 100644 --- a/modules/TargetCC.lua +++ b/modules/TargetCC.lua @@ -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 diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index 5be995b..44de9f1 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -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) diff --git a/modules/TargetInvuln.lua b/modules/TargetInvuln.lua index 9317934..4b1699f 100644 --- a/modules/TargetInvuln.lua +++ b/modules/TargetInvuln.lua @@ -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 diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 0692745..b338de0 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -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', diff --git a/modules/Threat.lua b/modules/Threat.lua index 5571cfb..86ec8f5 100644 --- a/modules/Threat.lua +++ b/modules/Threat.lua @@ -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 diff --git a/modules/Vengeance.lua b/modules/Vengeance.lua index a318596..ef87d53 100644 --- a/modules/Vengeance.lua +++ b/modules/Vengeance.lua @@ -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()