Refactor AgentTracker and related modules to improve agent management and logging

This commit is contained in:
2025-05-18 11:16:13 +02:00
parent eab562b36d
commit e3eefadb75
7 changed files with 166 additions and 144 deletions

View File

@@ -35,29 +35,25 @@ function shared.Inviter.Init()
if Heimdall_Data.config.inviter.agentsAssist then
if Heimdall_Data.config.inviter.debug then
local agentCount = 0
for _ in pairs(Heimdall_Data.config.agents) do
agentCount = agentCount + 1
end
print(string.format("[%s] Processing %d agents for assistant promotion", ModuleName, agentCount))
print(string.format("[%s] Processing agents for assistant promotion", ModuleName))
end
for name, _ in pairs(Heimdall_Data.config.agents) do
if UnitInParty(name) and not UnitIsGroupLeader(name) and not UnitIsRaidOfficer(name) then
shared.AgentTracker.ForEach(function(agent)
if UnitInParty(agent) and not UnitIsGroupLeader(agent) and not UnitIsRaidOfficer(agent) then
if Heimdall_Data.config.inviter.debug then
print(string.format("[%s] Promoting agent to assistant: %s", ModuleName, name))
print(string.format("[%s] Promoting agent to assistant: %s", ModuleName, agent))
end
PromoteToAssistant(name, true)
PromoteToAssistant(agent, true)
elseif Heimdall_Data.config.inviter.debug then
if not UnitInParty(name) then
print(string.format("[%s] Agent not in party: %s", ModuleName, name))
elseif UnitIsGroupLeader(name) then
print(string.format("[%s] Agent is already leader: %s", ModuleName, name))
elseif UnitIsRaidOfficer(name) then
print(string.format("[%s] Agent is already assistant: %s", ModuleName, name))
if not UnitInParty(agent) then
print(string.format("[%s] Agent not in party: %s", ModuleName, agent))
elseif UnitIsGroupLeader(agent) then
print(string.format("[%s] Agent is already leader: %s", ModuleName, agent))
elseif UnitIsRaidOfficer(agent) then
print(string.format("[%s] Agent is already assistant: %s", ModuleName, agent))
end
end
end
end)
end
if Heimdall_Data.config.inviter.debug then