From 8c37da2d389dda65fa841b8943eb1182c4e045a4 Mon Sep 17 00:00:00 2001 From: Torsten Brendgen Date: Tue, 21 Apr 2026 18:26:12 +0200 Subject: [PATCH] Adding Events for Hail Mary Bridge Addon --- HailMaryGuildTools.lua | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/HailMaryGuildTools.lua b/HailMaryGuildTools.lua index 282141d..3e0e2d7 100644 --- a/HailMaryGuildTools.lua +++ b/HailMaryGuildTools.lua @@ -3064,6 +3064,74 @@ function HMGT:StoreRemotePlayerInfo(playerName, class, specIndex, talentHash, kn ) end +function HMGT:RegisterExternalAddonSource(sourceName) + local source = tostring(sourceName or "") + if source == "" then + return false + end + self.externalAddonSources = self.externalAddonSources or {} + self.externalAddonSources[source] = true + return true +end + +function HMGT:ApplyExternalKnownSpell(sourceName, playerName, spellId, class, cooldown) + local source = tostring(sourceName or "External") + local normalizedName = self:NormalizePlayerName(playerName) + local sid = tonumber(spellId) + if not normalizedName or normalizedName == "" or not sid or sid <= 0 then + return false + end + if not self:IsPlayerInCurrentGroup(normalizedName) then + return false + end + + self:RegisterExternalAddonSource(source) + local previous = self.playerData[normalizedName] or {} + local knownSpells = previous.knownSpells + if type(knownSpells) ~= "table" then + knownSpells = {} + end + knownSpells[sid] = true + + self.playerData[normalizedName] = { + class = class or previous.class, + specIndex = previous.specIndex, + talentHash = previous.talentHash, + talents = previous.talents or {}, + knownSpells = knownSpells, + externalSource = source, + } + + if tonumber(cooldown) and tonumber(cooldown) > 0 and HMGT_SpellData then + local spellEntry = HMGT_SpellData.InterruptLookup and HMGT_SpellData.InterruptLookup[sid] + or HMGT_SpellData.CooldownLookup and HMGT_SpellData.CooldownLookup[sid] + if spellEntry then + spellEntry._hmgtExternalBaseCd = tonumber(cooldown) + end + end + + self:TriggerTrackerUpdate("trackers") + return true +end + +function HMGT:ApplyExternalCooldown(sourceName, playerName, spellId, cooldown) + local source = tostring(sourceName or "External") + local normalizedName = self:NormalizePlayerName(playerName) + local sid = tonumber(spellId) + local cd = tonumber(cooldown) + if not normalizedName or normalizedName == "" or not sid or sid <= 0 or not cd or cd <= 0 then + return false + end + if not self:IsPlayerInCurrentGroup(normalizedName) then + return false + end + + self:RegisterExternalAddonSource(source) + self:ApplyExternalKnownSpell(source, normalizedName, sid, nil, cd) + self:HandleRemoteSpellCast(normalizedName, sid, GetServerTime(), nil, nil, nil, cd) + return true +end + function HMGT:ClearRemoteSpellState(playerName, spellId) local normalizedName = self:NormalizePlayerName(playerName) local sid = tonumber(spellId)