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

@ -23,6 +23,19 @@ if not UnitCastingInfo then
UnitChannelInfo = ChannelInfo UnitChannelInfo = ChannelInfo
end 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 -- Fulzamoth 2019-09-27 : Use LibClassicCasterino if it's there so we can use TargetCast
-- module in Classic WoW -- module in Classic WoW
if IceHUD.WowClassic then if IceHUD.WowClassic then
@ -701,11 +714,11 @@ function IceCastBar.prototype:SpellCastSucceeded(event, unit, castGuid, spellId)
return return
end end
local spell = GetSpellInfo(spellId) local spell = GetSpellName(spellId)
-- show after normal successfull cast -- show after normal successfull cast
if (self.action == IceCastBar.Actions.Cast) then 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 return
end end
@ -723,7 +736,7 @@ function IceCastBar.prototype:SpellCastSucceeded(event, unit, castGuid, spellId)
return return
end end
self:StartBar(IceCastBar.Actions.Success, spell.. self:GetShortRank(rank), spellId) self:StartBar(IceCastBar.Actions.Success, spell, spellId)
end end

View File

@ -19,6 +19,11 @@ end
local DogTag = LibStub("LibDogTag-3.0", true) 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 = IceCore_CreateClass()
IceCore.Side = { Left = "LEFT", Right = "RIGHT" } IceCore.Side = { Left = "LEFT", Right = "RIGHT" }
@ -367,13 +372,13 @@ end
function IceCore.prototype:RedirectRemovedModules() function IceCore.prototype:RedirectRemovedModules()
local _, class = UnitClass("player") 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 if self.settings.modules["SunderCount"].enabled or self.settings.modules["SunderCount"].enabled == nil then
local bFound = false local bFound = false
for k,v in pairs(self.elements) do for k,v in pairs(self.elements) do
if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName 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 bFound = true
break break
end end
@ -396,7 +401,7 @@ function IceCore.prototype:RedirectRemovedModules()
newCounter.moduleSettings.maxCount = 3 newCounter.moduleSettings.maxCount = 3
newCounter.moduleSettings.auraTarget = "target" newCounter.moduleSettings.auraTarget = "target"
newCounter.moduleSettings.auraType = "debuff" newCounter.moduleSettings.auraType = "debuff"
newCounter.moduleSettings.auraName = GetSpellInfo(SUNDER_SPELL_ID) newCounter.moduleSettings.auraName = GetSpellName(SUNDER_SPELL_ID)
newCounter:Enable() newCounter:Enable()
end end
end end
@ -404,12 +409,12 @@ function IceCore.prototype:RedirectRemovedModules()
self.settings.modules["SunderCount"] = nil self.settings.modules["SunderCount"] = nil
end 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 if self.settings.modules["LacerateCount"].enabled or self.settings.modules["LacerateCount"].enabled == nil then
local bFound = false local bFound = false
for k,v in pairs(self.elements) do for k,v in pairs(self.elements) do
if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName 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 bFound = true
break break
end end
@ -433,7 +438,7 @@ function IceCore.prototype:RedirectRemovedModules()
newCounter.moduleSettings.maxCount = 3 newCounter.moduleSettings.maxCount = 3
newCounter.moduleSettings.auraTarget = "target" newCounter.moduleSettings.auraTarget = "target"
newCounter.moduleSettings.auraType = "debuff" newCounter.moduleSettings.auraType = "debuff"
newCounter.moduleSettings.auraName = GetSpellInfo(LACERATE_SPELL_ID) newCounter.moduleSettings.auraName = GetSpellName(LACERATE_SPELL_ID)
newCounter:Enable() newCounter:Enable()
end end
end end
@ -441,12 +446,12 @@ function IceCore.prototype:RedirectRemovedModules()
self.settings.modules["LacerateCount"] = nil self.settings.modules["LacerateCount"] = nil
end 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 if self.settings.modules["MaelstromCount"].enabled or self.settings.modules["MaelstromCount"].enabled == nil then
local bFound = false local bFound = false
for k,v in pairs(self.elements) do for k,v in pairs(self.elements) do
if v.moduleSettings.customBarType == "Counter" and v.moduleSettings.auraName 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 bFound = true
break break
end end
@ -466,7 +471,7 @@ function IceCore.prototype:RedirectRemovedModules()
newCounter.moduleSettings.countMode = self.settings.modules["MaelstromCount"].maelstromMode or newCounter.moduleSettings.countMode 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.countGap = self.settings.modules["MaelstromCount"].maelstromGap or newCounter.moduleSettings.countGap
newCounter.moduleSettings.gradient = self.settings.modules["MaelstromCount"].gradient or newCounter.moduleSettings.gradient 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() newCounter:Enable()
end end
end end

View File

@ -11,6 +11,20 @@ local icon = LibStub("LibDBIcon-1.0", true)
local pendingModuleLoads = {} local pendingModuleLoads = {}
local bReadyToRegisterModules = false 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.CurrTagVersion = 3
IceHUD.debugging = false IceHUD.debugging = false
@ -39,6 +53,11 @@ else
end end
end end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
-- compatibility/feature flags -- compatibility/feature flags
IceHUD.CanShowTargetCasting = not IceHUD.WowClassic or LibClassicCasterino or (IceHUD.WowClassic and IceHUD.WowVer >= 11500) IceHUD.CanShowTargetCasting = not IceHUD.WowClassic or LibClassicCasterino or (IceHUD.WowClassic and IceHUD.WowVer >= 11500)
IceHUD.GetPlayerAuraBySpellID = _G["C_UnitAuras"] and C_UnitAuras.GetPlayerAuraBySpellID 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.SupportsHealPrediction = IceHUD.WowVer >= 40000 or IceHUD.WowClassicWrath
IceHUD.UnitGroupRolesReturnsRoleString = IceHUD.WowVer >= 40000 or IceHUD.WowClassicWrath IceHUD.UnitGroupRolesReturnsRoleString = IceHUD.WowVer >= 40000 or IceHUD.WowClassicWrath
IceHUD.ShellGameSpellID = 271571 IceHUD.ShellGameSpellID = 271571
IceHUD.HasShellGame = GetSpellInfo(IceHUD.ShellGameSpellID) IceHUD.HasShellGame = GetSpellName(IceHUD.ShellGameSpellID)
IceHUD.CatalogingSpellIDs = {366290, 372817, 385025, 385635, 386070, 386504, 400043, 403115} IceHUD.CatalogingSpellIDs = {366290, 372817, 385025, 385635, 386070, 386504, 400043, 403115}
IceHUD.HasCataloging = GetSpellInfo(366290) IceHUD.HasCataloging = GetSpellName(366290)
IceHUD.UnitPowerEvent = "UNIT_POWER_UPDATE" IceHUD.UnitPowerEvent = "UNIT_POWER_UPDATE"
@ -418,7 +437,12 @@ blizOptionsPanel.button:SetWidth(240)
blizOptionsPanel.button:SetHeight(30) blizOptionsPanel.button:SetHeight(30)
blizOptionsPanel.button:SetScript("OnClick", function(self) HideUIPanel(InterfaceOptionsFrame) HideUIPanel(GameMenuFrame) IceHUD:OpenConfig() end) blizOptionsPanel.button:SetScript("OnClick", function(self) HideUIPanel(InterfaceOptionsFrame) HideUIPanel(GameMenuFrame) IceHUD:OpenConfig() end)
blizOptionsPanel.button:SetPoint('TOPLEFT', blizOptionsPanel, 'TOPLEFT', 20, -20) 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() function IceHUD:OpenConfig()
if not ConfigDialog then return end if not ConfigDialog then return end
@ -515,9 +539,9 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
local i = 1 local i = 1
local name, _, texture, applications local name, _, texture, applications
if IceHUD.SpellFunctionsReturnRank then 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 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
while name do while name do
if (not matchByName and string.match(texture:upper(), ability:upper())) 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 i = i + 1
if IceHUD.SpellFunctionsReturnRank then 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 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
end end
@ -547,9 +571,9 @@ do
local i = 1 local i = 1
local name, _, texture, applications, _, _, _, _, _, _, auraID local name, _, texture, applications, _, _, _, _, _, _, auraID
if IceHUD.SpellFunctionsReturnRank then if IceHUD.SpellFunctionsReturnRank then
name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) name, _, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter)
else else
name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) name, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter)
end end
while name do while name do
for i=1, #spellIDs do for i=1, #spellIDs do
@ -561,9 +585,9 @@ do
i = i + 1 i = i + 1
if IceHUD.SpellFunctionsReturnRank then if IceHUD.SpellFunctionsReturnRank then
name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) name, _, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter)
else else
name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) name, texture, applications, _, _, _, _, _, _, auraID = IceHUD.UnitAura(unit, i, filter)
end end
end end

View File

@ -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 = { barSettings = {
type = 'group', type = 'group',
name = L["Bar Settings"], 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 IceHUD_Options.options = options
function IceHUD_Options:GenerateModuleOptions(firstLoad) function IceHUD_Options:GenerateModuleOptions(firstLoad)

View File

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

View File

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

View File

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

View File

@ -17,6 +17,29 @@ local COOLDOWN_TYPE_ITEM = 2
local localizedInventorySlotNames = {} 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.cooldownDuration = 0
IceCustomCDBar.prototype.cooldownEndTime = 0 IceCustomCDBar.prototype.cooldownEndTime = 0
IceCustomCDBar.prototype.coolingDown = false 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 not self.moduleSettings.cooldownType or self.moduleSettings.cooldownType == COOLDOWN_TYPE_SPELL then
if tonumber(fromValue) ~= nil then if tonumber(fromValue) ~= nil then
local spellName = GetSpellInfo(tonumber(fromValue)) local spellName = GetSpellName(tonumber(fromValue))
if spellName then if spellName then
v = spellName v = spellName
end end
@ -278,7 +301,7 @@ function IceCustomCDBar.prototype:GetOptions()
set = function(info, v) set = function(info, v)
local orig = v local orig = v
if tonumber(v) ~= nil then if tonumber(v) ~= nil then
v = GetSpellInfo(tonumber(v)) v = GetSpellName(tonumber(v))
end end
if v == nil then if v == nil then
v = orig v = orig

View File

@ -7,6 +7,14 @@ local AuraIconWidth = 20
local AuraIconHeight = 20 local AuraIconHeight = 20
local DefaultAuraIcon = "Interface\\Icons\\Spell_Frost_Frost" 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() function IceCustomCounterBar.prototype:init()
IceCustomCounterBar.super.prototype.init(self, "CustomCounterBar") IceCustomCounterBar.super.prototype.init(self, "CustomCounterBar")

View File

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

View File

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

View File

@ -26,6 +26,11 @@ if Enum and Enum.PowerType then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end end
local GetSpellName = GetSpellInfo
if C_Spell and C_Spell.GetSpellName then
GetSpellName = C_Spell.GetSpellName
end
-- Constructor -- -- Constructor --
function RollTheBones.prototype:init() function RollTheBones.prototype:init()
RollTheBones.super.prototype.init(self, "RollTheBones", "player") 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 -- 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. -- when SnD is known, but this is.
local function HasSpell(id) local function HasSpell(id)
local spell = GetSpellInfo(id) local spell = GetSpellName(id)
return spell == GetSpellInfo(spell) return spell == GetSpellName(spell)
end end
local function ShouldHide() local function ShouldHide()

View File

@ -294,13 +294,6 @@ local function SNDGetComboPoints(unit)
end end
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() local function ShouldHide()
if IceHUD.WowVer >= 90000 or IceHUD.WowClassicBC or IceHUD.WowClassicWrath then if IceHUD.WowVer >= 90000 or IceHUD.WowClassicBC or IceHUD.WowClassicWrath then
return false return false

View File

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

View File

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

View File

@ -1420,11 +1420,11 @@ function IceTargetInfo.prototype:UpdateBuffType(aura)
---- end change by Fulzamoth ---- end change by Fulzamoth
if IceHUD.SpellFunctionsReturnRank then 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 else
---- Fulzamoth - 2019-09-04 : support for cooldowns on target buffs/debuffs (classic) ---- 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 -- 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 if duration == 0 and LibClassicDurations then
-- 2. if no duration defined for the (de)buff, look up the spell in LibClassicDurations -- 2. if no duration defined for the (de)buff, look up the spell in LibClassicDurations
local classicDuration, classicExpirationTime = LibClassicDurations:GetAuraDurationByUnit(self.unit, spellID, caster) local classicDuration, classicExpirationTime = LibClassicDurations:GetAuraDurationByUnit(self.unit, spellID, caster)

View File

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

View File

@ -124,6 +124,7 @@ function TargetOfTarget.prototype:GetOptions()
order = 34 order = 34
} }
if AceGUIWidgetLSMlists then
opts["texture"] = { opts["texture"] = {
type = 'select', type = 'select',
dialogControl = "LSM30_Statusbar", dialogControl = "LSM30_Statusbar",
@ -142,6 +143,7 @@ function TargetOfTarget.prototype:GetOptions()
values = AceGUIWidgetLSMlists.statusbar, values = AceGUIWidgetLSMlists.statusbar,
order = 35 order = 35
} }
end
opts["sizeToGap"] = { opts["sizeToGap"] = {
type = 'toggle', type = 'toggle',

View File

@ -30,6 +30,11 @@ if not UnitGroupRolesAssigned then
end end
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_RAID_MEMBERS = 40
local MAX_NUM_PARTY_MEMBERS = 5 local MAX_NUM_PARTY_MEMBERS = 5

View File

@ -3,6 +3,11 @@ local Vengeance = IceCore_CreateClass(IceUnitBar)
local VENGEANCE_SPELL_ID = 93098 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.current = nil
Vengeance.prototype.max = nil Vengeance.prototype.max = nil
@ -50,19 +55,26 @@ end
-- scan the tooltip and extract the vengeance value -- scan the tooltip and extract the vengeance value
do do
-- making these local as they're not used anywhere else -- 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) function Vengeance.prototype:UpdateCurrent(event, unit)
if (unit and (unit ~= self.unit)) then if (unit and (unit ~= self.unit)) then
return return
end end
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
local _, idx = IceHUD:GetBuffCount(self.unit, spellName, true, true) local _, idx = IceHUD:GetBuffCount(self.unit, spellName, true, true)
if idx then if idx then
self.current = select(17, UnitAura(self.unit, idx)) self.current = select(17, IceHUD.UnitAura(self.unit, idx))
else else
self.current = 0 self.current = 0
end end
end
self:Update() self:Update()
end end