-- Capture existing division stage/level rows only; no constructors or loaders. -- At most two dictionary rows per heartbeat and no work during Battle. do _G.__gacCwDivisionRows1=_G.__gacCwDivisionRows1 or {table=1,index=0} local s=_G.__gacCwDivisionRows1 if s.done then return end local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60) local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager local phase=manager and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(manager) if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end local names={'DivisionStageConfigs','DivisionLevelConfigs'} local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_DIVISION_ROWS] '..tostring(v))end local ok,err=pcall(function() if not s.iterator then local module=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule local rows=module[names[s.table]] if rows.Count>1024 then error('Division row count exceeds bound')end s.iterator=rows:GetEnumerator();s.count=0;s.expected=rows.Count log('BEGIN '..names[s.table]..' count='..rows.Count) end for batch=1,2 do if not s.iterator:MoveNext()then if s.count~=s.expected then error('Division table changed during capture')end log('END '..names[s.table]..' count='..s.count) s.iterator=nil;s.table=s.table+1 if s.table>#names then s.done=true;log('END')end return end local row=s.iterator.Current.Value local t=row:GetType() local fields=t:GetFields(flags) if s.count==0 then log('TYPE '..t.FullName) for i=0,math.min(fields.Length-1,47)do log('FIELD '..tostring(fields[i]))end end local captured=0 for i=0,math.min(fields.Length-1,47)do local f=fields[i] if not f.IsStatic and f.FieldType.FullName:find('RPG.GameCore.',1,true)==1 then local value=f:GetValue(row) if value then local encoded=CS.Newtonsoft.Json.JsonConvert.SerializeObject(value) if #encoded>65536 then error('Raw division row exceeds output bound')end log('ROW '..names[s.table]..' '..f.FieldType.FullName..' '..encoded) captured=captured+1 end end end if captured==0 then log('NO_ROW '..names[s.table]..' '..s.count)end s.count=s.count+1 end end) if not ok then s.done=true;s.iterator=nil;log('ERROR '..tostring(err))end end