81 lines
3.5 KiB
Lua
81 lines
3.5 KiB
Lua
-- Offline-analysis data capture only; do not keep in the heartbeat scripts/.
|
|
-- Reads already constructed repositories. Never initializes a repository,
|
|
-- invokes a gameplay method, creates a scene, or changes live state.
|
|
do
|
|
local function capture()
|
|
local s=_G.__gacComicStellaConfig1 or {stage=1,row=0}
|
|
_G.__gacComicStellaConfig1=s
|
|
if s.stage>5 then return end
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager
|
|
if not manager then return end
|
|
local phase=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 modules=CS.RPG.Client.GlobalVars.s_ModuleManager
|
|
local comic=modules and modules.ComicDessertModule
|
|
if not comic then return end
|
|
local log=function(v) CS.UnityEngine.Debug.Log('[GAC_COMIC_STELLA_CONFIG] '..tostring(v)) end
|
|
local function json(v)
|
|
local text=CS.Newtonsoft.Json.JsonConvert.SerializeObject(v)
|
|
if #text>32768 then error('single configuration exceeds 32768-byte output bound') end
|
|
return text
|
|
end
|
|
if s.stage==1 then
|
|
-- Exact existing named method handles, no assembly enumeration.
|
|
local t=comic:GetType()
|
|
for _,name in ipairs({'_OnGetDataSuccess','_SetUpProgress','_SetUpUpgradeTree'}) do
|
|
local method=t:GetMethod(name,flags)
|
|
if method then log('METHOD '..t.FullName..' '..tostring(method)..' HANDLE '..tostring(method.MethodHandle.Value)) end
|
|
end
|
|
local network=comic.NetworkService
|
|
local method=network and network:GetType():GetMethod('NPFCAEIAFOM',flags)
|
|
if method then log('METHOD '..network:GetType().FullName..' '..tostring(method)..' HANDLE '..tostring(method.MethodHandle.Value)) end
|
|
s.stage=2;return
|
|
end
|
|
if s.stage==2 then
|
|
-- Callback parameter supplies the true response type, avoiding xLua placeholders.
|
|
local method=comic:GetType():GetMethod('_OnGetDataSuccess',flags)
|
|
local parameters=method:GetParameters()
|
|
local t=parameters[0].ParameterType
|
|
log('RESPONSE_TYPE '..t.FullName)
|
|
s.fields=t:GetFields(flags);s.index=0;s.stage=3;return
|
|
end
|
|
if s.stage==3 then
|
|
for n=1,8 do
|
|
if s.index>=s.fields.Length then s.fields=nil;s.stage=4;return end
|
|
local f=s.fields[s.index];s.index=s.index+1
|
|
log('RESPONSE_FIELD '..f.Name..' '..f.FieldType.FullName)
|
|
end
|
|
return
|
|
end
|
|
if s.stage==4 or s.stage==5 then
|
|
local name=s.stage==4 and 'CycleConfigRepository' or 'LevelConfigRepository'
|
|
local repository=comic[name]
|
|
if not repository then log('MISSING '..name);s.stage=s.stage+1;return end
|
|
if not s.enumerator then
|
|
local t=repository:GetType()
|
|
local f=t:GetField('BDBOGJHLEIG',flags)
|
|
local dictionary=f and f:GetValue(repository)
|
|
if not dictionary then log('MISSING_DICTIONARY '..name);s.stage=s.stage+1;return end
|
|
if dictionary.Count>256 then error('repository row bound') end
|
|
log('BEGIN '..name..' count='..dictionary.Count)
|
|
s.enumerator=dictionary:GetEnumerator();s.row=0
|
|
end
|
|
if s.enumerator:MoveNext() then
|
|
local pair=s.enumerator.Current;s.row=s.row+1
|
|
log('ROW '..name..' '..json(pair.Value))
|
|
else
|
|
s.enumerator:Dispose();s.enumerator=nil
|
|
log('END_REPOSITORY '..name..' rows='..s.row);s.stage=s.stage+1
|
|
if s.stage>5 then log('END') end
|
|
end
|
|
return
|
|
end
|
|
end
|
|
local ok,e=pcall(capture)
|
|
if not ok then
|
|
_G.__gacComicStellaConfig1={stage=99}
|
|
CS.UnityEngine.Debug.Log('[GAC_COMIC_STELLA_CONFIG] ERROR '..tostring(e))
|
|
end
|
|
end
|