Allow level-55 Death Knights within race-based faction limits

This commit is contained in:
Codex
2026-09-22 16:20:47 -04:00
parent 77f6b56c2f
commit 360f164905
4 changed files with 34 additions and 14 deletions
+10 -6
View File
@@ -1,5 +1,5 @@
-- Persistent hardcore retirement. The native random-bot manager fills vacancies
-- from its factory-created, unused level-1 reserve; identities are never reset.
-- from its factory-created, unused starting-level reserve; identities are never reset.
-- Install only after deploy/playable/install-lifecycle.py has seeded the registry.
local residents = {}
local ready = false
@@ -21,6 +21,10 @@ local function sqltext(value)
return "CONVERT(UNHEX('"..(string.gsub(value,".",function(c) return string.format("%02X",string.byte(c)) end)).."') USING utf8mb4)"
end
local function startingLevel(player)
return player:GetClass()==6 and 55 or 1
end
local function enroll(player)
local guid=player:GetGUIDLow()
if unmanaged[guid] then return nil end
@@ -33,7 +37,7 @@ local function enroll(player)
if not owned then unmanaged[guid]=true;return nil end
local character=CharDBQuery("SELECT totaltime FROM characters WHERE guid="..guid.." AND account="..account)
if not character then return nil end
local state=(player:GetLevel()==1 and character:GetUInt32(0)<=60) and "reserve" or "blocked"
local state=(player:GetLevel()==startingLevel(player) and character:GetUInt32(0)<=60) and "reserve" or "blocked"
local row={name=name,account=account,protected=false,state=state,race=player:GetRace()}
residents[guid]=row
AuthDBExecute("INSERT IGNORE INTO azerothai_lifecycle(guid,name,account_id,protected,state,race) VALUES ("..
@@ -130,17 +134,17 @@ local function enforce()
if player:IsDead() then
recordDeath(player)
elseif row.state=="reserve" then
if (arrivals[guid] or player:GetLevel())~=1 then
if (arrivals[guid] or player:GetLevel())~=startingLevel(player) then
row.state="blocked"
AuthDBExecute("UPDATE azerothai_lifecycle SET state='blocked' WHERE guid="..guid.." AND state='reserve'")
PrintError("[AzerothAI] Replacement did not start at level 1: "..row.name)
PrintError("[AzerothAI] Replacement did not start at its class starting level: "..row.name)
elseif faction(row) and counts[faction(row)]<TARGET_PER_FACTION then
counts[faction(row)]=counts[faction(row)]+1
row.state="active"
online[guid]=true
AuthDBExecute("UPDATE azerothai_lifecycle SET state='active',entry_level=1,activated_at=COALESCE(activated_at,NOW()) WHERE guid="..guid.." AND state='reserve'")
AuthDBExecute("UPDATE azerothai_lifecycle SET state='active',entry_level="..startingLevel(player)..",activated_at=COALESCE(activated_at,NOW()) WHERE guid="..guid.." AND state='reserve'")
if AzerothAIEmitPlayerSnapshot then AzerothAIEmitPlayerSnapshot(row.name) end
PrintInfo("[AzerothAI] New level-1 resident entered the world: "..row.name)
PrintInfo("[AzerothAI] New resident entered at class starting level: "..row.name)
else
-- A login already in flight must not push its faction over the target.
mgr:Remove(player)