Files
GaCy-GO/tools/cw_portals_export.lua

26 lines
1.3 KiB
Lua

-- Read existing portal wrappers; one row per heartbeat, no gameplay mutations.
do
_G.__gacCwPortalsExport1=_G.__gacCwPortalsExport1 or {index=0}
local s=_G.__gacCwPortalsExport1;if s.done then return end
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_PORTALS] '..tostring(v))end
local ok,err=pcall(function()
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
if not s.rows then s.rows=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule:GetHandBookAllPortalData();if s.rows.Count>1024 then error('portal capture bound exceeded')end;log('BEGIN count='..s.rows.Count)end
for batch=1,4 do
if s.index>=s.rows.Count then s.done=true;log('END');return end
local wrapper=s.rows[s.index];local t=wrapper:GetType();local row=nil
for depth=1,4 do
if not t then break end
local fs=t:GetFields(flags)
for j=0,math.min(fs.Length-1,47)do if fs[j].FieldType.FullName=='RPG.GameCore.GridFightPortalBuffConfigRow' then row=fs[j]:GetValue(wrapper);break end end
if row then break end;t=t.BaseType
end
if not row then error('portal wrapper row unavailable')end
local text=CS.Newtonsoft.Json.JsonConvert.SerializeObject(row);if #text>32768 then error('portal row exceeds capture bound')end
log('ROW '..text);s.index=s.index+1
end
end)
if not ok then log('ERROR '..tostring(err));s.done=true end
end