Files
GaCy-GO/tools/damage_level_components_probe.lua
T

34 lines
1.7 KiB
Lua

do
local s=_G.__gacDamageLevelComponents1 or {index=0,entity=0};_G.__gacDamageLevelComponents1=s
if not s.done then
local function log(v)CS.UnityEngine.Debug.Log('[GAC_DAMAGE_LEVEL_COMPONENT] '..tostring(v))end
local ok,err=pcall(function()
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
if not s.entities then
local pm=CS.RPG.Client.GlobalVars.s_GamePhaseManager
local phase=typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(pm)
if not typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
local instance=phase.BattleInstanceRef
if instance==nil then return end
local world=instance:GetType():GetField('_GameWorld',flags):GetValue(instance)
s.entities=world:GetType():GetField('_EntityList',flags):GetValue(world)
log('ENTITIES '..s.entities.Count)
end
if s.components then
for i=s.index,math.min(s.index+31,s.components.Length-1)do if s.components[i]then log('COMPONENT '..i..' '..tostring(s.components[i]:GetType()))end end
s.index=s.index+32;if s.index>=s.components.Length then s.components=nil;s.index=0 end
else
for i=s.entity,math.min(s.entity+15,s.entities.Count-1)do
local e=s.entities[i];s.entity=i+1
if e and (e.RuntimeID==CS.RPG.GameCore.GameWorld.CommonLevelEntityRuntimeID or e.RuntimeID==CS.RPG.GameCore.GameWorld.BattleLevelEntityRuntimeID)then
log('ENTITY '..e.RuntimeID)
s.components=e:GetType():GetField('_ComponentArray',flags):GetValue(e);s.index=0;return
end
end
if s.entity>=s.entities.Count then s.done=true;log('END')end
end
end)
if not ok then s.done=true;log('ERROR '..tostring(err))end
end
end