Files

105 lines
5.1 KiB
Lua
Raw Permalink Normal View History

2026-10-28 18:54:43 +07:00
-- One-shot, read-only inspection of the active Beta client's current CW node.
-- This inspects only objects reachable from the active node, with bounded depth/counts.
do
local state = _G.__gacCwActiveNodeContext2 or { done = false }
_G.__gacCwActiveNodeContext2 = state
if not state.done then
local lines = {}
local function add(s)
if #lines < 260 then lines[#lines + 1] = tostring(s) end
end
local ok, err = pcall(function()
local flags = CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags), 60)
local session = CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule.CurGameSession
if not session then add('NO_SESSION'); return end
local function field(obj, name)
if not obj then return nil end
local fs = obj:GetType():GetFields(flags)
for i = 0, math.min(fs.Length - 1, 79) do
if fs[i].Name == name then return fs[i]:GetValue(obj) end
end
end
local function value(v)
if v == nil then return 'nil' end
local t = type(v)
if t == 'string' or t == 'number' or t == 'boolean' then return tostring(v) end
local success, managed = pcall(function() return v:GetType() end)
if success then
if managed.IsEnum or managed.IsPrimitive then return tostring(v) end
return '<' .. tostring(managed.FullName) .. '>'
end
return '<' .. t .. '>'
end
local function inspect(label, obj, maxFields)
if not obj then add('OBJECT ' .. label .. ' nil'); return end
local ty = obj:GetType()
add('OBJECT ' .. label .. ' ' .. tostring(ty.FullName))
local fs = ty:GetFields(flags)
local emitted = 0
for i = 0, math.min(fs.Length - 1, 95) do
local f = fs[i]
if not f.IsStatic and emitted < (maxFields or 48) then
local got, v = pcall(function() return f:GetValue(obj) end)
add('FIELD ' .. label .. '.' .. tostring(f.Name) .. ' ' .. tostring(f.FieldType.FullName) .. '=' .. (got and value(v) or '<read-error>'))
emitted = emitted + 1
end
end
end
local stage
local sessionFields = session:GetType():GetFields(flags)
for i = 0, math.min(sessionFields.Length - 1, 79) do
if sessionFields[i].FieldType.FullName == 'RPG.Client.GridFightStage' then
stage = sessionFields[i]:GetValue(session); break
end
end
if not stage or not stage.CurNode then add('NO_ACTIVE_NODE'); return end
local node = stage.CurNode
add('RUN route=' .. tostring(stage.RouteID) .. ' chapter=' .. tostring(stage.ChapterID) ..
' section=' .. tostring(stage.SectionID) .. ' stage=' .. tostring(node.StageID) ..
' level=' .. tostring(stage.CurMonsterLevel))
inspect('stage.levelInfo', field(stage, '_LevelInfo'), 24)
inspect('stage.normalMonsterData', field(stage, '<NormalMonsterStageData>k__BackingField'), 36)
inspect('stage.powerfulMonsterData', field(stage, '<PowerfulMonsterStageData>k__BackingField'), 36)
inspect('stage.route', field(stage, 'Route'), 12)
inspect('node', node, 24)
inspect('node.routeData', field(node, '_RouteNode'), 24)
local battleField = node:GetType():GetField('_BattleNodeInfo', flags)
local battle = battleField and battleField:GetValue(node)
inspect('battle', battle, 16)
local function list(obj)
local arr = field(obj, 'array') or field(obj, '_items')
local count = field(obj, 'count') or field(obj, '_size') or 0
local out = {}
if arr then for i = 0, math.min(count - 1, 31) do out[#out + 1] = arr[i] end end
return out
end
local branches = list(field(battle, 'EOHMIOEPOGP'))
add('BRANCHES ' .. tostring(#branches))
for bi = 1, math.min(#branches, 4) do
local branch = branches[bi]
add('BRANCH index=' .. bi .. ' option=' .. value(field(branch, 'DDKGLOFJIHH')) ..
' penalty=' .. value(field(branch, 'KDCDJDFHIPP')) ..
' difficulty=' .. value(field(branch, 'PANBGEDCMCH')))
inspect('branch' .. bi, branch, 16)
local waves = list(field(branch, 'EMGPLPNHBHF'))
for wi = 1, math.min(#waves, 4) do
local wave = waves[wi]
add('WAVE branch=' .. bi .. ' index=' .. wi .. ' id=' .. value(field(wave, 'BLCIEPPJJCC')))
inspect('wave' .. bi .. '_' .. wi, wave, 16)
local monsters = list(field(wave, 'ABMPKGNBMNA'))
for mi = 1, #monsters do
local monster = monsters[mi]
if (bi == 1 and mi == 10) or (bi == 2 and mi == 11) then
add('MONSTER branch=' .. bi .. ' wave=' .. wi .. ' index=' .. mi ..
' id=' .. value(field(monster, 'OEPOBIODAJH')) .. ' star=' .. value(field(monster, 'NNLJKKAEICI')))
inspect('monster' .. bi .. '_' .. wi .. '_' .. mi, monster, 16)
end
end
end
end
end)
if not ok then add('ERROR ' .. tostring(err)) end
CS.UnityEngine.Debug.Log('[GAC_CW_ACTIVE_NODE_CONTEXT]\n' .. table.concat(lines, '\n'))
state.done = true
end
end