Files
GaCy-GO/tools/cw_spotlight_export.lua
T

22 lines
1.2 KiB
Lua

-- Four initialized handbook rows per heartbeat, pauses in Battle.
do
local s=_G.__gacCwSpotRows1 or {index=0};_G.__gacCwSpotRows1=s
if s.done then return end
local log=function(x)CS.UnityEngine.Debug.Log('[GAC_CW_SPOT_ROWS] '..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
if not s.rows then s.rows=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule:GetHandBookAllSpotLightData();if s.rows.Count>512 then error('bound exceeded')end;log('BEGIN '..s.rows.Count)end
for batch=1,4 do
if s.index>=s.rows.Count then s.done=true;log('END');return end
local c=s.rows[s.index];s.index=s.index+1
local row=c:GetType():GetField('_Row',flags):GetValue(c)
local text=tostring(CS.Newtonsoft.Json.JsonConvert.SerializeObject(row));if #text>32768 then error('row bound exceeded')end
log('ROW '..text)
end
end)
if not ok then s.done=true;log('ERROR '..tostring(err))end
end