initial commit v.2.1.0

This commit is contained in:
Torsten Brendgen
2026-04-24 23:43:55 +02:00
parent 258cadeba5
commit f1d2a761e4
17 changed files with 3252 additions and 3891 deletions

View File

@@ -0,0 +1,65 @@
local ADDON_NAME = "HailMaryGuildTools"
local HMGT = LibStub("AceAddon-3.0"):GetAddon(ADDON_NAME)
if not HMGT then return end
HMGT.TrackerPlayerState = HMGT.TrackerPlayerState or {}
local internals = HMGT.TrackerInternals or {}
local IsSpellKnownLocally = internals.IsSpellKnownLocally
function HMGT:CollectOwnAvailableTrackerSpells(classToken, specIndex)
local class = classToken or select(2, UnitClass("player"))
local spec = tonumber(specIndex) or tonumber(GetSpecialization())
if not class or not spec or spec <= 0 then
return {}
end
if not HMGT_SpellData or type(HMGT_SpellData.GetSpellsForSpec) ~= "function" then
return {}
end
local knownSpells = {}
for _, datasetName in ipairs({ "Interrupts", "RaidCooldowns", "GroupCooldowns" }) do
local dataset = HMGT_SpellData[datasetName]
if type(dataset) == "table" then
local spells = HMGT_SpellData.GetSpellsForSpec(class, spec, dataset)
for _, entry in ipairs(spells) do
local sid = tonumber(entry.spellId)
if sid and sid > 0 and IsSpellKnownLocally and IsSpellKnownLocally(sid) then
knownSpells[sid] = true
end
end
end
end
local ownName = self:NormalizePlayerName(UnitName("player"))
local ownCDs = ownName and self:GetPlayerCooldownMap(ownName, false)
if ownCDs then
for sid in pairs(ownCDs) do
sid = tonumber(sid)
if sid and sid > 0 then
knownSpells[sid] = true
end
end
end
return knownSpells
end
function HMGT:IsTrackedSpellKnownForPlayer(playerName, spellId)
local sid = tonumber(spellId)
if not sid or sid <= 0 then
return false
end
local normalizedName = self:NormalizePlayerName(playerName)
local ownName = self:NormalizePlayerName(UnitName("player"))
local pData = normalizedName and self.playerData[normalizedName]
if pData and type(pData.knownSpells) == "table" and pData.knownSpells[sid] == true then
return true
end
if normalizedName and ownName and normalizedName == ownName and IsSpellKnownLocally then
return IsSpellKnownLocally(sid)
end
return false
end