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

21 lines
1.2 KiB
Lua

-- Candidate IDs are supplied from the inventory catalog; never infer rarity
-- from ID prefixes. Eight actual ItemRow lookups per non-battle heartbeat.
do local function capture()
local s=_G.__gacLootRarity1 or {index=1};_G.__gacLootRarity1=s
if s.done then return end
local ids=_G.__GAC_LOOT_CANDIDATES;if not ids then return end
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local gm=CS.RPG.Client.GlobalVars.s_GamePhaseManager
local phase=gm and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(gm)
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
for n=1,8 do
local id=ids[s.index]
if not id then s.done=true;CS.UnityEngine.Debug.Log('[GAC_LOOT_RARITY] END count='..#ids);return end
s.index=s.index+1
local item=CS.RPG.Client.ItemHelper.GetItem(id)
if item and item.Row then
CS.UnityEngine.Debug.Log('[GAC_LOOT_RARITY] id='..id..' rarity='..CS.Newtonsoft.Json.JsonConvert.SerializeObject(item.Row.Rarity))
else CS.UnityEngine.Debug.Log('[GAC_LOOT_RARITY] MISSING id='..id)end
end
end local ok,e=pcall(capture);if not ok then _G.__gacLootRarity1={done=true};CS.UnityEngine.Debug.Log('[GAC_LOOT_RARITY] ERROR '..tostring(e))end end