36 lines
1.7 KiB
Lua
36 lines
1.7 KiB
Lua
-- Read cached native character statistics; 16 named-type fields per heartbeat.
|
|
do
|
|
local s=_G.__gacDamageNativeProbe1 or {index=0};_G.__gacDamageNativeProbe1=s
|
|
if not s.done then
|
|
local function log(v)CS.UnityEngine.Debug.Log('[GAC_DAMAGE_NATIVE] '..tostring(v))end
|
|
local ok,err=pcall(function()
|
|
local stat=CS.RPG.Client.GlobalVars.s_ModuleManager.BattleModule.LastBattleStatistic
|
|
if stat==nil then return end
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
if not s.obj then
|
|
local a=stat.lightTeamStt
|
|
log('ARRAY '..type(a)..' '..tostring(a))
|
|
if a==nil then s.done=true;return end
|
|
s.obj=a[0];s.fields=s.obj:GetType():GetFields(flags);log('TYPE '..tostring(s.obj:GetType()))
|
|
local bytes=CS.Google.Protobuf.MessageExtensions.ToByteArray(stat.lightTeamBattleInfoList[0])
|
|
log('BYTES '..type(bytes)..' len='..tostring(bytes.Length)..' hashlen='..tostring(#bytes))
|
|
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))
|
|
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 f.FieldType.IsEnum then log('VALUE '..f.Name..' '..tostring(v))
|
|
elseif f.Name:lower():find('damage')or f.Name:lower():find('skill')then
|
|
local success,body=pcall(function()return CS.Newtonsoft.Json.JsonConvert.SerializeObject(v)end)
|
|
if success and #body<24000 then log('JSON '..f.Name..' '..body)end
|
|
end
|
|
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
|