Add Spell ID support for aura tracking (#31)

This commit is contained in:
rekkrap
2022-11-06 07:34:01 -07:00
committed by GitHub
parent b467af21c0
commit 3a5e58bf34
5 changed files with 33 additions and 6 deletions

View File

@ -36,6 +36,7 @@ else
end end
-- compatibility/feature flags -- compatibility/feature flags
IceHUD.GetPlayerAuraBySpellID = _G["C_UnitAuras"] and C_UnitAuras.GetPlayerAuraBySpellID
IceHUD.SpellFunctionsReturnRank = IceHUD.WowMain and IceHUD.WowVer < 80000 IceHUD.SpellFunctionsReturnRank = IceHUD.WowMain and IceHUD.WowVer < 80000
IceHUD.EventExistsPlayerPetChanged = IceHUD.WowMain and IceHUD.WowVer < 80000 IceHUD.EventExistsPlayerPetChanged = IceHUD.WowMain and IceHUD.WowVer < 80000
IceHUD.EventExistsPetBarChanged = IceHUD.WowMain and IceHUD.WowVer < 80000 IceHUD.EventExistsPetBarChanged = IceHUD.WowMain and IceHUD.WowVer < 80000
@ -494,6 +495,16 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
return 0 return 0
end end
-- Support for Spell IDs
if (IceHUD.GetPlayerAuraBySpellID and tonumber(ability) ~= nil) then
local aura = C_UnitAuras.GetPlayerAuraBySpellID(ability)
if aura ~= nil then
return aura.applications
else
return 0
end
end
local i = 1 local i = 1
local name, _, texture, applications local name, _, texture, applications
if IceHUD.SpellFunctionsReturnRank then if IceHUD.SpellFunctionsReturnRank then

View File

@ -52,7 +52,13 @@ function IceStackCounter_GetOptions(frame, opts)
opts["auraName"] = { opts["auraName"] = {
type = 'input', type = 'input',
name = L["Aura to track"], name = L["Aura to track"],
desc = L["Which buff/debuff this counter will be tracking. \n\nRemember to press ENTER after filling out this box with the name you want or it will not save."], desc = function()
if IceHUD.GetPlayerAuraBySpellID then
return L["Which buff/debuff this counter will be tracking. Can use the name or spell id. \n\nRemember to press ENTER after filling out this box with the name you want or it will not save."]
else
return L["Which buff/debuff this counter will be tracking. \n\nRemember to press ENTER after filling out this box with the name you want or it will not save."]
end
end,
get = function() get = function()
return frame.moduleSettings.auraName return frame.moduleSettings.auraName
end, end,

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.14.3:
- Add Spell ID support for aura tracking.
v1.14.2: v1.14.2:
- Fix CC and Invuln modules not showing immediately when they should. - Fix CC and Invuln modules not showing immediately when they should.

View File

@ -329,16 +329,18 @@ function IceCustomBar.prototype:GetOptions()
opts["buffToTrack"] = { opts["buffToTrack"] = {
type = 'input', type = 'input',
name = L["Aura to track"], name = L["Aura to track"],
desc = L["Which buff/debuff this bar will be tracking.\n\nRemember to press ENTER after filling out this box with the name you want or it will not save."], desc = function()
if IceHUD.GetPlayerAuraBySpellID then
return L["Which buff/debuff this bar will be tracking. Can use the name or spell id. \n\nRemember to press ENTER after filling out this box with the name you want or it will not save."]
else
return L["Which buff/debuff this bar will be tracking.\n\nRemember to press ENTER after filling out this box with the name you want or it will not save."]
end
end,
get = function() get = function()
return self.moduleSettings.buffToTrack return self.moduleSettings.buffToTrack
end, end,
set = function(info, v) set = function(info, v)
local orig = v local orig = v
--Parnic: we now allow spell IDs to be used directly
--if tonumber(v) ~= nil then
-- v = GetSpellInfo(tonumber(v))
--end
if v == nil then if v == nil then
v = orig v = orig
end end

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.14.3:
- Add Spell ID support for aura tracking.
v1.14.2: v1.14.2:
- Fix CC and Invuln modules not showing immediately when they should. - Fix CC and Invuln modules not showing immediately when they should.