Files
GaCy-GO/tools/cw_node_property_handles.lua

34 lines
1.7 KiB
Lua

-- Getters on four named CW types only; sixteen metadata entries per heartbeat.
-- No getter invocation, object construction, or gameplay mutation.
do
local names={'OHMDHKGAEMM','BCCIJHPLJOJ','RPG.Client.GridFightStageNode','NIHNGPKHEPC'}
_G.__gacCwNodeHandles1=_G.__gacCwNodeHandles1 or {type=1,offset=0}
local s=_G.__gacCwNodeHandles1
if s.type>#names 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(v)CS.UnityEngine.Debug.Log('[GAC_CW_PROPERTY_HANDLE] '..tostring(v))end
local good,err=pcall(function()
if not s.properties then
local a=typeof(CS.RPG.Client.GridFightModule).Assembly
local t=a:GetType(names[s.type])
if not t then t=typeof(CS[names[s.type]])end
s.properties=t:GetProperties(flags)
end
for i=s.offset,math.min(s.offset+15,s.properties.Length-1)do
local p=s.properties[i]
local getter=p:GetGetMethod(true)
if getter and not getter.IsStatic and p:GetIndexParameters().Length==0 and
(p.PropertyType.IsPrimitive or p.PropertyType.IsEnum)then
log('GETTER '..names[s.type]..' '..p.Name..' '..tostring(getter.MethodHandle.Value)..' '..p.PropertyType.FullName)
end
end
s.offset=s.offset+16
if s.offset>=s.properties.Length then s.properties=nil;s.offset=0;s.type=s.type+1 end
end)
if not good then log('ERROR '..tostring(err));s.properties=nil;s.offset=0;s.type=s.type+1 end
if s.type>#names then log('END')end
end