Files
GaCy-GO/tools/cw_active_season_probe.lua
T

39 lines
2.0 KiB
Lua

-- Read-only active-season lookup from the native named constant table.
do
if not _G.__gacCwActiveSeason1 then
_G.__gacCwActiveSeason1=true
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_ACTIVE] '..tostring(v))end
local ok,err=pcall(function()
local constants=CS.RPG.GameCore.ConstValueCommonExcelTable
local seasonID=constants.GetData('GridFight_Season_ID').Value.IntValue
local subSeasonID=constants.GetData('GridFight_Sub_Season_ID').Value.IntValue
log('IDS '..seasonID..' '..subSeasonID)
local module=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule
local season=module:GetSeason(seasonID,subSeasonID)
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local invoke=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),0)
local args=CS.System.Array.CreateInstance(typeof(CS.System.Object),0)
local row=season:GetType():GetMethod('get__Meta',flags):Invoke(season,invoke,nil,args,nil)
log('SEASON_ROW '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(row))
local configs=season.SeasonDivision.SeasonDivisionConfigs
log('DIVISIONS '..configs.Count)
_G.__gacCwActiveDivisionExport={configs=configs,index=0}
end)
if not ok then log('ERROR '..tostring(err))end
end
local state=_G.__gacCwActiveDivisionExport
if state and not state.done then
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_ACTIVE_DIVISIONS] '..tostring(v))end
local ok,err=pcall(function()
if state.index==0 then log('BEGIN count='..state.configs.Count)end
for i=state.index,math.min(state.index+7,state.configs.Count-1)do
local row=state.configs[i]
log('ROW {"ID":'..row.ID..',"SeasonID":'..row.SeasonID..',"DivisionLevel":'..row.DivisionLevel..',"Progress":'..row.Progress..',"IsPromotion":'..tostring(row.IsPromotion)..'}')
end
state.index=state.index+8
if state.index>=state.configs.Count then log('END');state.done=true end
end)
if not ok then log('ERROR '..tostring(err));state.done=true end
end
end