Add native gameplay outcomes, recovery verification, and realm diagnostics
Core tests / core (push) Successful in 40s
Core tests / core (push) Successful in 40s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- Conservative recovery for managed residents with fresh quest/explore intent.
|
||||
-- Native position/progress is sampled independently of dashboard summaries.
|
||||
local intents, observations = {}, {}
|
||||
local intents, observations, pendingResults = {}, {}, {}
|
||||
local LIMIT = 600
|
||||
local COOLDOWN = 1800
|
||||
local function sqltext(s)
|
||||
@@ -10,6 +10,25 @@ AuthDBExecute([[CREATE TABLE IF NOT EXISTS azerothai_recovery_log (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,guid INT UNSIGNED NOT NULL,
|
||||
name VARCHAR(64) NOT NULL,at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
detail VARCHAR(255) NOT NULL,INDEX(guid,at))]])
|
||||
AuthDBExecute([[CREATE TABLE IF NOT EXISTS azerothai_recovery_results (
|
||||
attempt_id BIGINT UNSIGNED PRIMARY KEY,status VARCHAR(24) NOT NULL,
|
||||
checked_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,detail VARCHAR(255) NOT NULL)]])
|
||||
local function checkResults(now)
|
||||
for guid,r in pairs(pendingResults) do
|
||||
local p=GetPlayerByName(r.name);local status,detail
|
||||
if not p or not p:IsPlayerbot() or p:GetGUIDLow()~=guid or p:GetAccountId()~=r.account or p:IsDead() then
|
||||
status='unverified';detail='Resident unavailable before verification'
|
||||
elseif p:GetMapId()~=r.map or p:GetLevel()~=r.level or (p:GetX()-r.x)^2+(p:GetY()-r.y)^2+(p:GetZ()-r.z)^2>25 then
|
||||
status='resumed';detail='Native movement or level progress observed after recovery'
|
||||
elseif now-r.at>=180 then
|
||||
status='no_progress';detail='No movement or level progress observed within three minutes'
|
||||
end
|
||||
if status then
|
||||
AuthDBExecute('INSERT IGNORE INTO azerothai_recovery_results(attempt_id,status,detail) SELECT id,'..sqltext(status)..','..sqltext(detail)..' FROM azerothai_recovery_log WHERE guid='..guid..' AND UNIX_TIMESTAMP(at)='..r.at..' ORDER BY id DESC LIMIT 1')
|
||||
pendingResults[guid]=nil
|
||||
end
|
||||
end
|
||||
end
|
||||
function AzerothAISetRecoveryIntents(rows)
|
||||
local nextIntents={}
|
||||
for _,r in ipairs(rows) do
|
||||
@@ -31,6 +50,7 @@ local function safe(p,a)
|
||||
end
|
||||
local function sample()
|
||||
local now=os.time()
|
||||
checkResults(now)
|
||||
for guid,r in pairs(intents) do
|
||||
local p=GetPlayerByName(r.name)
|
||||
if now-r.at>120 or not p or not p:IsPlayerbot() or p:GetGUIDLow()~=guid or p:GetAccountId()~=r.account then
|
||||
@@ -55,6 +75,7 @@ local function sample()
|
||||
local moved=a:DoSpecificAction('move random',true)
|
||||
local detail=(staleFlight and 'Cleared stale flight; ' or '')..'AI replanned; walking request='..tostring(moved)
|
||||
AuthDBExecute('INSERT INTO azerothai_recovery_log(guid,name,detail) VALUES ('..guid..','..sqltext(r.name)..','..sqltext(detail)..')')
|
||||
pendingResults[guid]={name=r.name,account=r.account,at=now,x=x,y=y,z=z,map=map,level=level}
|
||||
PrintInfo('[AzerothAI recovery] '..r.name..': '..detail)
|
||||
end
|
||||
old.since=now
|
||||
|
||||
Reference in New Issue
Block a user