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

35 lines
1.3 KiB
Lua

-- Read the existing initialized config cache. Never invokes mission loaders.
do
if not _G.__gacMissionConfigKeys1 then
local s={done=false};_G.__gacMissionConfigKeys1=s
local function log(v)CS.UnityEngine.Debug.Log('[GAC_MISSION_CONFIG_KEYS] '..tostring(v))end
local ok,e=pcall(function()
local m=CS.RPG.Client.GlobalVars.s_ModuleManager.MissionModule
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local f=m:GetType():GetField('_SubMissionInfoConfigs',flags)
local d=f:GetValue(m)
if not d or d.Count>100000 then error('missing or oversized initialized cache')end
log('BEGIN count='..d.Count)
s.iterator=d.Keys:GetEnumerator()
s.tick=function()
if s.done then return end
local frame=CS.UnityEngine.Time.frameCount
if s.frame==frame then return end
s.frame=frame
local good,err=pcall(function()
local ids={}
for n=1,128 do
if not s.iterator:MoveNext()then s.done=true;break end
ids[#ids+1]=tostring(s.iterator.Current)
end
if #ids>0 then log('IDS '..table.concat(ids,','))end
if s.done then s.iterator:Dispose();s.iterator=nil;log('END')end
end)
if not good then s.done=true;log('ERROR '..tostring(err))end
end
CS.UnityEngine.Application.onBeforeRender('+',s.tick)
end)
if not ok then s.done=true;log('ERROR '..tostring(e))end
end
end