-- Read cached completed-battle statistics; never change the battle or modules. do local s=_G.__gacPeakCachedStats1 or {phase=1,index=0};_G.__gacPeakCachedStats1=s if s.phase<=2 then local function log(v)CS.UnityEngine.Debug.Log('[GAC_PEAK_CACHED_STATS] '..tostring(v))end local ok,err=pcall(function() local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60) if not s.obj then local m=CS.RPG.Client.GlobalVars.s_ModuleManager.BattleModule if s.phase==1 then s.obj=m.LastBattleStatistic else s.obj=m:GetType():GetField('_BattleResultInfo',flags):GetValue(m)end if s.obj==nil then log('NIL '..s.phase);s.phase=s.phase+1;return end s.fields=s.obj:GetType():GetFields(flags);log('TYPE '..s.phase..' '..tostring(s.obj:GetType())) end for i=s.index,math.min(s.index+15,s.fields.Length-1)do local f=s.fields[i];local tn=tostring(f.FieldType);log('FIELD '..s.phase..' '..f.Name..' '..tn) if not f.IsStatic then local good,v=pcall(function()return f:GetValue(s.obj)end) if good and v~=nil then if f.FieldType.IsPrimitive or tn:find('System.String',1,true) or f.FieldType.IsEnum then log('VALUE '..s.phase..' '..f.Name..' '..tostring(v)) elseif f.Name:lower():find('statistic') or f.Name:lower():find('result') then local encoded,bytes=pcall(function()return CS.Google.Protobuf.MessageExtensions.ToByteArray(v)end) if encoded then log('PROTO '..f.Name..' '..CS.System.Convert.ToBase64String(bytes))end end end end end s.index=s.index+16;if s.index>=s.fields.Length then s.phase=s.phase+1;s.index=0;s.obj=nil;log('END_PHASE')end end) if not ok then log('ERROR '..tostring(err));s.phase=3 end end end