Files
GaCy-GO/tools/cw_table_state_probe.lua
T

42 lines
1.9 KiB
Lua

-- Current loaded props only; table IDs substituted from captured room config.
do
local ids=__PROP_IDS__
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_TABLE_STATE] '..tostring(v))end
_G.__gacCwTableState2=_G.__gacCwTableState2 or {index=0,hits=0}
local state=_G.__gacCwTableState2
if not state.done then
local ok,err=pcall(function()
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
if not state.rows then
local map=CS.RPG.Client.GlobalVars.s_ModuleManager.AdventureModule.MapDef
local collection=map.AllMapEntityDefs
state.rows=collection:GetType():GetField('BPPKNKJBABP',flags):GetValue(collection)
log('BEGIN '..state.rows.Count)
for _,id in ipairs(ids)do
local row=CS.RPG.GameCore.PropExcelTable.GetData(id)
log('PROP_ROW '..row.ID..' path='..tostring(row.JsonPath)..' states='..CS.Newtonsoft.Json.JsonConvert.SerializeObject(row.PropStateList))
end
end
for i=state.index,math.min(state.index+31,state.rows.Count-1)do
local p=state.rows[i]
for _,id in ipairs(ids)do if p.PropID==id then
state.hits=state.hits+1
log('MATCH '..p.PropID)
for _,name in ipairs({'ID','GroupID','InstID','EntityID','PropState','State','IsActive','IsClientOnly','IsLoaded','IsDelete'})do
local good,value=pcall(function()return p[name]end)
if good and type(value)~='userdata' and type(value)~='table' then log('VALUE '..name..' '..tostring(value))end
end
local methods=p:GetType():GetMethods(flags)
for j=0,methods.Length-1 do
local m=methods[j]
if m.DeclaringType==p:GetType() and (m.Name:find('State')or m.Name:find('Entity')or m.Name:find('Active'))then log('METHOD '..tostring(m))end
end
end end
end
state.index=state.index+32
if state.index>=state.rows.Count then state.done=true;log('END hits='..state.hits)end
end)
if not ok then state.done=true;log('ERROR '..tostring(err))end
end
end