function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
local domainId = mono_enumDomains()[1]
print('domainId = ' .. domainId)
local classId = mono_findClass('', 'CombatManager')
print('classId = ' .. classId)
local methodId = mono_class_findMethod(classId, 'SceneStart')
print('methodId = ' .. methodId)
methodId = mono_findMethod('', 'CombatManager', 'SceneStart')
print('methodId = ' .. methodId)
--print(dump(mono_class_enumFields(classId)))
--print(dump(mono_enumDomains()))
--print()
print(mono_class_getStaticFieldAddress(domainId, classId))
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
local domainId = mono_enumDomains()[1]
print('domainId = ' .. domainId)
local classId = mono_findClass('', 'CombatManager')
print('classId = ' .. classId)
local methodId = mono_class_findMethod(classId, 'SceneStart')
print('methodId = ' .. methodId)
methodId = mono_findMethod('', 'CombatManager', 'SceneStart')
print('methodId = ' .. methodId)
--print(dump(mono_class_enumFields(classId)))
--print(dump(mono_enumDomains()))
--print()
print(mono_class_getStaticFieldAddress(domainId, classId))
local function getCombatManager()
local c = mono_findClass('Assembly-CSharp.dll', 'CombatManager')
local f = mono_class_enumFields(c, true)
for i in pairs(f) do
if f[i].isStatic and f[i].Name == 'instance' then
local v = mono_class_getStaticFieldValue(c, f[i].field)
return v
end
end
end
print(string.format('%X', getCombatManager()))
Thank you so much for nudging in the right direction!
So the change that made stuff work was the true param in mono_class_enumFields which is "includeParents". That seems to make the static field appear.
Since your code didnt work, here is the small correction. As the field "name" is case sensitive, this is what made it work. (fields.name instead of fields.Name)
local classId = mono_findClass('Assembly-CSharp.dll', 'CombatManager')
print(classId)
local fields = mono_class_enumFields(classId, true)
for i in pairs(fields) do
if fields[i].isStatic and fields[i].name == 'instance' then
local instance = mono_class_getStaticFieldValue(classId, fields[i].field)
print(instance)
local methodId = mono_class_findMethod(classId, 'SceneStart')
print(methodId)
mono_invoke_method('Assembly-CSharp.dll', methodId, instance, {})
end
end
Thank you so much for nudging in the right direction!
So the change that made stuff work was the true param in mono_class_enumFields which is "includeParents". That seems to make the static field appear.
Since your code didnt work, here is the small correction. As the field "name" is case sensitive, this is what made it work. (fields.name instead of fields.Name)
local classId = mono_findClass('Assembly-CSharp.dll', 'CombatManager')
print(classId)
local fields = mono_class_enumFields(classId, true)
for i in pairs(fields) do
if fields[i].isStatic and fields[i].name == 'instance' then
local instance = mono_class_getStaticFieldValue(classId, fields[i].field)
print(instance)
local methodId = mono_class_findMethod(classId, 'SceneStart')
print(methodId)
mono_invoke_method('Assembly-CSharp.dll', methodId, instance, {})
end
end
Again thank you so much for the quick help!
You're welcome . Ah yes, my mistake. Force of habit with typing in camelCase
hey sorry to quote you out of the blue but since you're the ones who've written these scripts i hope you may have an answer, it seems to work for me in other games but, in this game i get a response that doesnt match the value that's shown in my .net window. would you or anyone here have an idea on why this happens and how to fix it?
i'v tried reading it as a pointer, doesn't work, i've tried renaming .field to .value and even .address doesn't produce the same address as shown in the window