Files
GaCy-GO/tools/cw_shop_handle_export.lua

31 lines
1.6 KiB
Lua

-- Exact shop/protobuf getters and two named constructors; metadata only.
do
local names={'POCJDMMANBM','HDEIAANGMDB','BOPHDCKJMMN','RPG.Client.GridFightShopGood','RPG.Client.GridFightShopRole','RPG.Client.GridFightRoleShop'}
_G.__gacCwShopHandles1=_G.__gacCwShopHandles1 or {type=1,offset=0}
local s=_G.__gacCwShopHandles1
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_SHOP_HANDLE] '..tostring(v))end
local good,err=pcall(function()
if not s.properties then
local t=typeof(CS.RPG.Client.GridFightModule).Assembly: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 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