67 lines
2.9 KiB
Lua
67 lines
2.9 KiB
Lua
-- Read-only current-session capture. Keep outside scripts/ until coordinated.
|
|
-- Reads only the established Preparation page and live Stage/session metadata.
|
|
do local function capture()
|
|
local s=_G.__gacCwTeaConsumer1 or {phase=1,index=0,beats=0};_G.__gacCwTeaConsumer1=s
|
|
if s.done then return end
|
|
s.beats=s.beats+1;if s.beats>32 then s.done=true;return end
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
local gm=CS.RPG.Client.GlobalVars.s_GamePhaseManager
|
|
local f=gm and gm:GetType():GetField('_CurrentPhase',flags)
|
|
local phase=f and f:GetValue(gm)
|
|
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
|
|
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_TEA_CONSUMER] '..tostring(v))end
|
|
if s.phase==1 then
|
|
local page=CS.RPG.Client.GlobalVars.s_UIManager:GetPageByName('GridFightPreparationPage')
|
|
local obj=page and page.LuaTable
|
|
if type(obj)~='table'then log('NO_LOADED_PREPARATION');s.phase=2;return end
|
|
s.obj=obj;s.phase=3;s.index=1;return
|
|
end
|
|
if s.phase==3 then
|
|
local names={'_on_start_battle_click','_enter_battle','_check_enter_battle_by_reason'}
|
|
local name=names[s.index];s.index=s.index+1
|
|
if not name then s.obj=nil;s.phase=2;return end
|
|
local fn=s.obj[name]
|
|
if type(fn)=='function'then
|
|
local info=debug.getinfo(fn,'S');log('SOURCE '..name..' '..tostring(info and info.source))
|
|
for i=1,24 do
|
|
local k,v=debug.getupvalue(fn,i);if not k then break end
|
|
log('UPVALUE '..name..' '..k..' '..type(v))
|
|
end
|
|
local raw=string.dump(fn)
|
|
if #raw<=32768 then
|
|
local bytes=CS.System.Array.CreateInstance(typeof(CS.System.Byte),#raw)
|
|
for i=1,#raw do bytes[i-1]=raw:byte(i)end
|
|
log('BYTECODE '..name..' '..CS.System.Convert.ToBase64String(bytes))
|
|
else log('FUNCTION_TOO_LARGE '..name)end
|
|
else log('NO_FUNCTION '..name)end
|
|
return
|
|
end
|
|
if s.phase==2 then
|
|
local module=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule
|
|
local session=module and module.CurGameSession
|
|
s.obj=session;s.target=1;s.phase=4;s.index=0;return
|
|
end
|
|
if s.phase==4 then
|
|
if not s.obj then log('NO_LIVE_TARGET '..tostring(s.target));s.done=true;return end
|
|
if not s.fields then
|
|
s.t=s.obj:GetType();s.fields=s.t:GetFields(flags);log('TYPE '..s.t.FullName)
|
|
end
|
|
for n=1,8 do
|
|
if s.index>=s.fields.Length then
|
|
if s.target==1 then
|
|
s.obj=s.obj.Stage;s.target=2;s.index=0;s.fields=nil;return
|
|
end
|
|
s.done=true;s.obj=nil;s.fields=nil;log('END');return
|
|
end
|
|
local field=s.fields[s.index];s.index=s.index+1
|
|
if field.DeclaringType==s.t then
|
|
log('FIELD '..field.Name..' '..field.FieldType.FullName)
|
|
if field.Name:lower():find('bonfire',1,true)then
|
|
local value=field:GetValue(s.obj)
|
|
log('BONFIRE_VALUE_TYPE '..field.Name..' '..tostring(value and value:GetType().FullName))
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end local ok,e=pcall(capture);if not ok then _G.__gacCwTeaConsumer1={done=true};CS.UnityEngine.Debug.Log('[GAC_CW_TEA_CONSUMER] ERROR '..tostring(e))end end
|