Files
GaCy-GO/tools/peak_battle_cache_probe.lua
T

27 lines
1.2 KiB
Lua

-- Read only named BattleModule field metadata and cached protobuf values.
do
local s=_G.__gacPeakBattleCache1 or {index=0};_G.__gacPeakBattleCache1=s
if not s.done then
local function log(v)CS.UnityEngine.Debug.Log('[GAC_PEAK_BATTLE_CACHE] '..tostring(v))end
local ok,err=pcall(function()
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
if not s.module then
s.module=CS.RPG.Client.GlobalVars.s_ModuleManager.BattleModule
s.fields=s.module:GetType():GetFields(flags);log('MODULE '..tostring(s.module:GetType()))
end
for i=s.index,math.min(s.index+15,s.fields.Length-1)do
local f=s.fields[i];log('FIELD '..f.Name..' '..tostring(f.FieldType))
local n=f.Name:lower();local tn=tostring(f.FieldType)
if not f.IsStatic and (n:find('statistic') or n:find('result') or n:find('report') or tn:find('BattleStatistics',1,true))then
local ok,v=pcall(function()return f:GetValue(s.module)end)
if ok and v~=nil then
log('VALUE '..f.Name..' '..tostring(v))
end
end
end
s.index=s.index+16;if s.index>=s.fields.Length then s.done=true;log('END')end
end)
if not ok then s.done=true;log('ERROR '..tostring(err))end
end
end