Files
GaCy-GO/tools/cw_active_encounter_capture.lua
T
2026-10-28 18:54:43 +07:00

70 lines
4.2 KiB
Lua

-- Read-only, one-shot probe for the current Currency Wars encounter.
do
local state=_G.__gacCwActiveEncounterCapture7 or {done=false};_G.__gacCwActiveEncounterCapture7=state
if not state.done then
local function log(value)CS.UnityEngine.Debug.Log('[GAC_CW_ACTIVE_ENCOUNTER] '..tostring(value))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 return end
local stage
local fs=session:GetType():GetFields(flags)
for i=0,math.min(fs.Length-1,63)do if fs[i].FieldType.FullName=='RPG.Client.GridFightStage'then stage=fs[i]:GetValue(session);break end end
if not stage or not stage.CurNode then return end
local node=stage.CurNode
local function field(obj,name)
if not obj then return nil end
local all=obj:GetType():GetFields(flags)
for i=0,math.min(all.Length-1,63)do if all[i].Name==name then return all[i]:GetValue(obj)end end
end
local function list(obj)
local array=field(obj,'array');local count=field(obj,'count')or 0;local out={}
if array then for i=0,math.min(count-1,31)do out[#out+1]=array[i]end end
return out
end
local function showRow(tableName,id,getter)
local success,row=pcall(function()return getter(id)end)
if not success then log('TABLE_ERROR '..tableName..' id='..id..' '..tostring(row));return end
if not row then log('TABLE_EMPTY '..tableName..' id='..id);return end
local encodedOK,encoded=pcall(function()return CS.Newtonsoft.Json.JsonConvert.SerializeObject(row)end)
if encodedOK and #tostring(encoded)<=24000 then log('TABLE '..tableName..' id='..id..' '..tostring(encoded))else log('TABLE_ERROR '..tableName..' id='..id..' '..tostring(encoded))end
end
log('PROBE_VERSION=7')
log('BEGIN route='..stage.RouteID..' chapter='..stage.ChapterID..' section='..stage.SectionID..' stage='..node.StageID..' level='..stage.CurMonsterLevel..' base_diff='..stage:GetBaseDiffAddLv()..' current_diff='..stage:GetCurrentMonsterDiffAddLv()..' all_diff='..stage:GetAllDiffAddLv())
local stageRow=CS.RPG.GameCore.StageExcelTable.GetData(node.StageID)
log('ROW StageExcelTable '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(stageRow))
local battleField=node:GetType():GetField('_BattleNodeInfo',flags)
local battle=battleField and battleField:GetValue(node)
local branches=list(field(battle,'EOHMIOEPOGP'))
log('BRANCH_COUNT '..#branches)
for branchIndex=1,#branches do
local branch=branches[branchIndex]
local option=field(branch,'DDKGLOFJIHH')or 0
local penalty=field(branch,'KDCDJDFHIPP')or 0
local difficulty=field(branch,'PANBGEDCMCH')or 0
local waveObjects=list(field(branch,'EMGPLPNHBHF'))
log('BRANCH index='..branchIndex..' option='..option..' penalty='..penalty..' extra_difficulty='..difficulty..' waves='..#waveObjects)
for waveIndex=1,#waveObjects do
local wave=waveObjects[waveIndex]
local waveID=field(wave,'BLCIEPPJJCC')or 0
local monsters=list(field(wave,'ABMPKGNBMNA'))
local summary={}
for monsterIndex=1,#monsters do
local monster=monsters[monsterIndex]
summary[#summary+1]=tostring(field(monster,'OEPOBIODAJH')or 0)..':'..tostring(field(monster,'NNLJKKAEICI')or 0)
end
log('WAVE branch='..branchIndex..' id='..waveID..' count='..#monsters..' monster_id:role_star='..table.concat(summary,','))
showRow('GridFightFormationWaveExcelTable',waveID,function(id)return CS.RPG.GameCore.GridFightFormationWaveExcelTable.GetData(id)end)
showRow('GridFightFormationWaveConfigExcelTable',waveID,function(id)return CS.RPG.GameCore.GridFightFormationWaveConfigExcelTable.GetData(id)end)
showRow('GridFightEliteGroupExcelTable',waveID,function(id)return CS.RPG.GameCore.GridFightEliteGroupExcelTable.GetData(id)end)
showRow('GridFightEliteGroupConfigExcelTable',waveID,function(id)return CS.RPG.GameCore.GridFightEliteGroupConfigExcelTable.GetData(id)end)
end
end
local penaltyRow=node:GetType():GetProperty('_PenaltyRuleConfigRow',flags)
if penaltyRow then log('ROW PenaltyRule '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(penaltyRow:GetValue(node,nil)))end
log('END');state.done=true
end)
if not ok then log('ERROR '..tostring(err));state.done=true end
end
end