Version 2.1.0-Beta #9

Open
Torsten wants to merge 8 commits from dev into main
Showing only changes of commit 8c37da2d38 - Show all commits

View File

@@ -3064,6 +3064,74 @@ function HMGT:StoreRemotePlayerInfo(playerName, class, specIndex, talentHash, kn
) )
end 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) function HMGT:ClearRemoteSpellState(playerName, spellId)
local normalizedName = self:NormalizePlayerName(playerName) local normalizedName = self:NormalizePlayerName(playerName)
local sid = tonumber(spellId) local sid = tonumber(spellId)