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

23 lines
1.5 KiB
Lua

-- Caller supplies exact rank IDs from the captured AvatarConfig. Bounded,
-- read-only flat-table lookups; no scene mutation or full assembly scan.
do local function capture()
local s=_G.__GacRankCostCapture1 or {i=1};_G.__GacRankCostCapture1=s
if s.done then return end
local ids=_G.__GAC_RANK_CAPTURE_IDS
if type(ids)~='table' or #ids==0 or #ids>64 then error('rank IDs missing or outside bound')end
local mgr=CS.RPG.Client.GlobalVars.s_GamePhaseManager
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local phase=mgr and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(mgr)
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
for n=1,5 do
local req=ids[s.i];if not req then s.done=true;CS.UnityEngine.Debug.Log('[GAC_RANK_COST] END');return end
s.i=s.i+1
local row=CS.RPG.GameCore.AvatarRankConfigExcelTable.GetData(req.rank_id)
if not row then CS.UnityEngine.Debug.Log('[GAC_RANK_COST] MISSING avatar='..req.avatar_id..' rank_id='..req.rank_id)
else
local serialized=CS.Newtonsoft.Json.JsonConvert.SerializeObject(row.UnlockCost)
CS.UnityEngine.Debug.Log('[GAC_RANK_COST] ROW {"avatar_id":'..req.avatar_id..',"rank_id":'..row.RankID..',"rank":'..row.Rank..',"cost":'..serialized..'}')
end
end
end local ok,e=pcall(capture);if not ok then _G.__GacRankCostCapture1={done=true};CS.UnityEngine.Debug.Log('[GAC_RANK_COST] ERROR '..tostring(e))end end