Files

27 lines
1.7 KiB
Lua
Raw Permalink Normal View History

2026-10-28 18:54:43 +07:00
-- Caller supplies IDs/world level from the catalog/world resource. Flat rows
-- only; no avatar creation or level graph. Two lookups per heartbeat.
do local function capture()
local s=_G.__gacCwTrialExport1 or {index=1};_G.__gacCwTrialExport1=s
if s.done then return end
local log=function(x)CS.UnityEngine.Debug.Log('[GAC_CW_TRIAL_ROW] '..tostring(x))end
local ok,err=pcall(function()
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager
local phase=manager and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(manager)
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
local plan=_G.__GAC_CW_TRIAL_PLAN;if not plan or #plan>128 then error('bounded capture plan missing')end
if not s.begun then log('BEGIN '..#plan);s.begun=true end
for batch=1,2 do
local request=plan[s.index];if not request then s.done=true;log('END');return end
if s.world==nil then s.world=request.WorldLevel end
local row=CS.RPG.GameCore.SpecialAvatarExcelTable.GetData(request.SpecialAvatarID,s.world)
if row then
if row.SpecialAvatarID~=request.SpecialAvatarID or row.AvatarID~=request.AvatarID or row.WorldLevel~=s.world then error('trial row identity differs')end
local text=tostring(CS.Newtonsoft.Json.JsonConvert.SerializeObject(row));if #text>65536 then error('row exceeds bound')end
log('ROW '..text);s.index=s.index+1;s.world=nil
elseif s.world>0 then s.world=s.world-1
else error('trial row not found in supported world levels')end
end
end)
if not ok then s.done=true;log('ERROR '..tostring(err))end
end;capture()end