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

24 lines
1.3 KiB
Lua

-- Read initialized handbook defaults, four families per heartbeat, never Battle.
do local function capture()
local s=_G.__gacCwCurrentDefaults2 or {index=0};_G.__gacCwCurrentDefaults2=s
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 log=function(x)CS.UnityEngine.Debug.Log('[GAC_CW_CURRENT_DEFAULTS] '..tostring(x))end
if not s.rows then
s.rows=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule:GetHandBookAllRoleConfig()
if s.rows.Count>512 then error('handbook bound')end
log('BEGIN '..s.rows.Count)
end
for n=1,4 do
if s.index>=s.rows.Count then s.done=true;log('END');return end
local family=s.rows[s.index];s.index=s.index+1
local role=family.DefaultRole
local config=role.RoleConfig
log('ROW {"AvatarID":'..config.AvatarID..',"RoleID":'..role.ID..',"Price":'..config.Price..',"Rarity":'..config.Rarity..'}')
end
end;local ok,e=pcall(capture);if not ok then _G.__gacCwCurrentDefaults2={done=true};CS.UnityEngine.Debug.Log('[GAC_CW_CURRENT_DEFAULTS] ERROR '..tostring(e))end end