Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <CheatTable CheatEngineTableVersion="46">
- <CheatEntries>
- <CheatEntry>
- <ID>6</ID>
- <Description>"Infinite Health"</Description>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[enable]
- {$lua}
- if syntaxcheck then return end
- LaunchMonoDataCollector()
- if dotnetdetours==nil then
- dotnetdetours={}
- else
- local di=dotnetdetours['Player.AlterHealthBy']
- if di and di.processid==getOpenedProcessID() then
- --already detoured. Undo first
- local r,err=autoAssemble(di.disablescript, di.disableinfo)
- if not r then
- error(err)
- else
- dotnetdetours['Player.AlterHealthBy']=nil
- end
- end
- end
- local detourinfo={}
- local csharpscript=[[
- using System.Runtime.CompilerServices; //for NoInlining
- //feel free to add more
- public class patchedPlayer : Game.Player.Player
- {
- public void newAlterHealthBy(int delta)
- {
- if (delta < 0)
- {
- delta = 0;
- }
- oldAlterHealthBy(delta);
- return;
- }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public void oldAlterHealthBy(int delta)
- {
- //don't bother putting code in here. It will get replaced (just some stuff to make sure there's space)
- return ;
- }
- }
- ]]
- local references, sysfile=dotnetpatch_getAllReferences() --you're free to build your own list
- -- Iterate backwards through the table
- for i = #references, 1, -1 do
- -- Check if the current item contains "mscorlib.dll" (case insensitive)
- if string.find(string.lower(references[i]), "mscorlib.dll") then
- -- Remove the item at index 'i'
- table.remove(references, i)
- end
- end
- local csfile,msg=compileCS(csharpscript, references, sysfile)
- if csfile==nil then
- --sometimes having the sysfile causes an issue. Try without
- csfile,msg=compileCS(csharpscript, references)
- if csfile==nil then
- if msg==nil then msg=' (?Unknown error?)' end
- messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
- error(msg)
- end
- end
- --still here, c# dll created, now inject and hook
- local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Player::AlterHealthBy","patchedPlayer::newAlterHealthBy","patchedPlayer::oldAlterHealthBy")
- if result then
- detourinfo.disableinfo=di
- detourinfo.disablescript=disablescript
- detourinfo.processid=getOpenedProcessID()
- dotnetdetours['Player.AlterHealthBy']=detourinfo
- else
- if disableinfo==nil then disableinfo='no reason' end
- error('InjectDotNetDetour failed : '..disableinfo) --prevents checking
- end
- {$asm}
- [disable]
- {$lua}
- if syntaxcheck then return end
- if dotnetdetours['Player.AlterHealthBy'] then
- autoAssemble(dotnetdetours['Player.AlterHealthBy'].disablescript, dotnetdetours['Player.AlterHealthBy'].disableinfo)
- end
- {$asm}
- </AssemblerScript>
- </CheatEntry>
- <CheatEntry>
- <ID>7</ID>
- <Description>"Infinite Money"</Description>
- <Options moAlwaysHideChildren="1" moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1"/>
- <Color>000000</Color>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[ENABLE]
- {$lua}
- if syntaxcheck then return end
- memrec.Color = 0x0080FF
- memrec.Description = "Infinite Money (Activating...)"
- -- 1. Launch the collector ONCE for the whole group
- LaunchMonoDataCollector()
- -- 2. Do the heavy scan ONCE
- local refs, sys = dotnetpatch_getAllReferences()
- -- 3. Run your filter loop ONCE
- for i = #refs, 1, -1 do
- if string.find(string.lower(refs[i]), "mscorlib.dll") then
- table.remove(refs, i)
- end
- end
- -- 4. Save to GLOBAL variables (Notice no 'local' keyword)
- -- We use unique names to avoid conflicts with other cheat tables
- Shared_References = refs
- Shared_SysFile = sys
- {$asm}
- // ... (Your existing allocations/code) ...
- [DISABLE]
- {$lua}
- if syntaxcheck then return end
- memrec.Color = 0x000000
- memrec.Description = "Infinite Money"
- -- Optional: Clear the globals to save memory, though not strictly necessary
- Shared_References = nil
- Shared_SysFile = nil
- {$asm}
- </AssemblerScript>
- <CheatEntries>
- <CheatEntry>
- <ID>3</ID>
- <Description>"Money doesn't decrease when buying"</Description>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[enable]
- {$lua}
- if syntaxcheck then return end
- LaunchMonoDataCollector()
- if dotnetdetours==nil then
- dotnetdetours={}
- else
- local di=dotnetdetours['Player.SpendMoney']
- if di and di.processid==getOpenedProcessID() then
- --already detoured. Undo first
- local r,err=autoAssemble(di.disablescript, di.disableinfo)
- if not r then
- error(err)
- else
- dotnetdetours['Player.SpendMoney']=nil
- end
- end
- end
- local detourinfo={}
- local csharpscript=[[
- using System.Runtime.CompilerServices; //for NoInlining
- using Game.Player;
- //feel free to add more
- public class patchedPlayer : Player
- {
- public void newSpendMoney(GameData.MoneyValue money)
- {
- //you have access to public fields. Use reflection if you wish to access private fields
- // We want this function to do nothing, so we don't call the old one
- return;
- }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public void oldSpendMoney(GameData.MoneyValue money)
- {
- //don't bother putting code in here. It will get replaced (just some stuff to make sure there's space)
- return ;
- }
- }
- ]]
- local references, sysfile
- -- CHECK: Did the header already do the work?
- if Shared_References and Shared_SysFile then
- -- Yes! Use the cached list (Instant)
- references = Shared_References
- sysfile = Shared_SysFile
- else
- -- No (Header wasn't used). We must scan manually.
- LaunchMonoDataCollector() -- Just in case
- references, sysfile = dotnetpatch_getAllReferences()
- -- The Filter Loop (Only runs if fallback is triggered)
- for i = #references, 1, -1 do
- if string.find(string.lower(references[i]), "mscorlib.dll") then
- table.remove(references, i)
- end
- end
- end
- local csfile,msg=compileCS(csharpscript, references, sysfile)
- if csfile==nil then
- --sometimes having the sysfile causes an issue. Try without
- csfile,msg=compileCS(csharpscript, references)
- if csfile==nil then
- if msg==nil then msg=' (?Unknown error?)' end
- messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
- error(msg)
- end
- end
- --still here, c# dll created, now inject and hook
- local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Player::SpendMoney","patchedPlayer::newSpendMoney","patchedPlayer::oldSpendMoney")
- if result then
- detourinfo.disableinfo=di
- detourinfo.disablescript=disablescript
- detourinfo.processid=getOpenedProcessID()
- dotnetdetours['Player.SpendMoney']=detourinfo
- else
- if disableinfo==nil then disableinfo='no reason' end
- error('InjectDotNetDetour failed : '..disableinfo) --prevents checking
- end
- {$asm}
- [disable]
- {$lua}
- if syntaxcheck then return end
- if dotnetdetours['Player.SpendMoney'] then
- autoAssemble(dotnetdetours['Player.SpendMoney'].disablescript, dotnetdetours['Player.SpendMoney'].disableinfo)
- end
- {$asm}
- </AssemblerScript>
- </CheatEntry>
- <CheatEntry>
- <ID>1</ID>
- <Description>"Can buy items that you can't afford"</Description>
- <Options moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1"/>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[enable]
- {$lua}
- if syntaxcheck then return end
- LaunchMonoDataCollector()
- if dotnetdetours==nil then
- dotnetdetours={}
- else
- local di=dotnetdetours['Player.BuyItemFromMarket']
- if di and di.processid==getOpenedProcessID() then
- --already detoured. Undo first
- local r,err=autoAssemble(di.disablescript, di.disableinfo)
- if not r then
- error(err)
- else
- dotnetdetours['Player.BuyItemFromMarket']=nil
- end
- end
- end
- local detourinfo={}
- local csharpscript=[[
- using System.Runtime.CompilerServices; //for NoInlining
- using Game.Player;
- public class patchedPlayer : Player
- {
- public System.Boolean newBuyItemFromMarket(GameResources.Items.IItem item, GameData.MoneyValue price, Game.Luggage.Suitcase suitcase, Game.Luggage.SuitcasePosition suitcasePosition)
- {
- //you have access to public fields. Use reflection if you wish to access private fields
- return oldBuyItemFromMarket(item, GameData.MoneyValue.zero, suitcase, suitcasePosition);
- }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public System.Boolean oldBuyItemFromMarket(GameResources.Items.IItem item, GameData.MoneyValue price, Game.Luggage.Suitcase suitcase, Game.Luggage.SuitcasePosition suitcasePosition)
- {
- //don't bother putting code in here. It will get replaced (just some stuff to make sure there's space)
- return true;
- }
- }
- ]]
- local references, sysfile
- -- CHECK: Did the header already do the work?
- if Shared_References and Shared_SysFile then
- -- Yes! Use the cached list (Instant)
- references = Shared_References
- sysfile = Shared_SysFile
- else
- -- No (Header wasn't used). We must scan manually.
- LaunchMonoDataCollector() -- Just in case
- references, sysfile = dotnetpatch_getAllReferences()
- -- The Filter Loop (Only runs if fallback is triggered)
- for i = #references, 1, -1 do
- if string.find(string.lower(references[i]), "mscorlib.dll") then
- table.remove(references, i)
- end
- end
- end
- local csfile,msg=compileCS(csharpscript, references, sysfile)
- if csfile==nil then
- --sometimes having the sysfile causes an issue. Try without
- csfile,msg=compileCS(csharpscript, references)
- if csfile==nil then
- if msg==nil then msg=' (?Unknown error?)' end
- messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
- error(msg)
- end
- end
- --still here, c# dll created, now inject and hook
- local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Player::BuyItemFromMarket","patchedPlayer::newBuyItemFromMarket","patchedPlayer::oldBuyItemFromMarket")
- if result then
- detourinfo.disableinfo=di
- detourinfo.disablescript=disablescript
- detourinfo.processid=getOpenedProcessID()
- dotnetdetours['Player.BuyItemFromMarket']=detourinfo
- else
- if disableinfo==nil then disableinfo='no reason' end
- error('InjectDotNetDetour failed : '..disableinfo) --prevents checking
- end
- {$asm}
- [disable]
- {$lua}
- if syntaxcheck then return end
- if dotnetdetours['Player.BuyItemFromMarket'] then
- autoAssemble(dotnetdetours['Player.BuyItemFromMarket'].disablescript, dotnetdetours['Player.BuyItemFromMarket'].disableinfo)
- end
- {$asm}
- </AssemblerScript>
- <CheatEntries>
- <CheatEntry>
- <ID>5</ID>
- <Description>"CanBuyItemAtPrice Patch"</Description>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[enable]
- {$lua}
- if syntaxcheck then return end
- LaunchMonoDataCollector()
- if dotnetdetours==nil then
- dotnetdetours={}
- else
- local di=dotnetdetours['Player.CanBuyItemAtPrice']
- if di and di.processid==getOpenedProcessID() then
- --already detoured. Undo first
- local r,err=autoAssemble(di.disablescript, di.disableinfo)
- if not r then
- error(err)
- else
- dotnetdetours['Player.CanBuyItemAtPrice']=nil
- end
- end
- end
- local detourinfo={}
- local csharpscript=[[
- using System.Runtime.CompilerServices; //for NoInlining
- //feel free to add more
- public class patchedPlayer : Game.Player.Player
- {
- public System.Boolean newCanBuyItemAtPrice(GameResources.Items.IItem item, GameData.MoneyValue price)
- {
- //you have access to public fields. Use reflection if you wish to access private fields
- return oldCanBuyItemAtPrice(item, GameData.MoneyValue.zero);
- }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public System.Boolean oldCanBuyItemAtPrice(GameResources.Items.IItem item, GameData.MoneyValue price)
- {
- //don't bother putting code in here. It will get replaced (just some stuff to make sure there's space)
- return true;
- }
- }
- ]]
- local references, sysfile
- -- CHECK: Did the header already do the work?
- if Shared_References and Shared_SysFile then
- -- Yes! Use the cached list (Instant)
- references = Shared_References
- sysfile = Shared_SysFile
- else
- -- No (Header wasn't used). We must scan manually.
- LaunchMonoDataCollector() -- Just in case
- references, sysfile = dotnetpatch_getAllReferences()
- -- The Filter Loop (Only runs if fallback is triggered)
- for i = #references, 1, -1 do
- if string.find(string.lower(references[i]), "mscorlib.dll") then
- table.remove(references, i)
- end
- end
- end
- local csfile,msg=compileCS(csharpscript, references, sysfile)
- if csfile==nil then
- --sometimes having the sysfile causes an issue. Try without
- csfile,msg=compileCS(csharpscript, references)
- if csfile==nil then
- if msg==nil then msg=' (?Unknown error?)' end
- messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
- error(msg)
- end
- end
- --still here, c# dll created, now inject and hook
- local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Player::CanBuyItemAtPrice","patchedPlayer::newCanBuyItemAtPrice","patchedPlayer::oldCanBuyItemAtPrice")
- if result then
- detourinfo.disableinfo=di
- detourinfo.disablescript=disablescript
- detourinfo.processid=getOpenedProcessID()
- dotnetdetours['Player.CanBuyItemAtPrice']=detourinfo
- else
- if disableinfo==nil then disableinfo='no reason' end
- error('InjectDotNetDetour failed : '..disableinfo) --prevents checking
- end
- {$asm}
- [disable]
- {$lua}
- if syntaxcheck then return end
- if dotnetdetours['Player.CanBuyItemAtPrice'] then
- autoAssemble(dotnetdetours['Player.CanBuyItemAtPrice'].disablescript, dotnetdetours['Player.CanBuyItemAtPrice'].disableinfo)
- end
- {$asm}
- </AssemblerScript>
- </CheatEntry>
- </CheatEntries>
- </CheatEntry>
- <CheatEntry>
- <ID>2</ID>
- <Description>"Can buy suitcases regardless of money"</Description>
- <VariableType>Auto Assembler Script</VariableType>
- <AssemblerScript>[enable]
- {$lua}
- if syntaxcheck then return end
- LaunchMonoDataCollector()
- if dotnetdetours==nil then
- dotnetdetours={}
- else
- local di=dotnetdetours['Player.BuyAndAddSuitcase']
- if di and di.processid==getOpenedProcessID() then
- --already detoured. Undo first
- local r,err=autoAssemble(di.disablescript, di.disableinfo)
- if not r then
- error(err)
- else
- dotnetdetours['Player.BuyAndAddSuitcase']=nil
- end
- end
- end
- local detourinfo={}
- local csharpscript=[[
- using System;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using Game.Player;
- public class patchedPlayer : Player
- {
- public System.Boolean newBuyAndAddSuitcase(Game.Luggage.Suitcase suitcase)
- {
- var type = typeof(Player);
- var prop = type.GetProperty("gameData", BindingFlags.Static | BindingFlags.NonPublic);
- GameData.IGameData data = (GameData.IGameData)prop.GetValue(null);
- // Now we can access 'markets' through the interface
- GameData.MoneyValue moneyValue = data.markets.PriceOfSuitcaseInMarket(this.currentCity);
- this.AddSuitcase(suitcase);
- this.SpendMoney(moneyValue);
- return true;
- }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public System.Boolean oldBuyAndAddSuitcase(Game.Luggage.Suitcase suitcase)
- {
- return true;
- }
- }
- ]]
- local references, sysfile
- -- CHECK: Did the header already do the work?
- if Shared_References and Shared_SysFile then
- -- Yes! Use the cached list (Instant)
- references = Shared_References
- sysfile = Shared_SysFile
- else
- -- No (Header wasn't used). We must scan manually.
- LaunchMonoDataCollector() -- Just in case
- references, sysfile = dotnetpatch_getAllReferences()
- -- The Filter Loop (Only runs if fallback is triggered)
- for i = #references, 1, -1 do
- if string.find(string.lower(references[i]), "mscorlib.dll") then
- table.remove(references, i)
- end
- end
- end
- local csfile,msg=compileCS(csharpscript, references, sysfile)
- if csfile==nil then
- --sometimes having the sysfile causes an issue. Try without
- csfile,msg=compileCS(csharpscript, references)
- if csfile==nil then
- if msg==nil then msg=' (?Unknown error?)' end
- messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
- error(msg)
- end
- end
- --still here, c# dll created, now inject and hook
- local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Player::BuyAndAddSuitcase","patchedPlayer::newBuyAndAddSuitcase","patchedPlayer::oldBuyAndAddSuitcase")
- if result then
- detourinfo.disableinfo=di
- detourinfo.disablescript=disablescript
- detourinfo.processid=getOpenedProcessID()
- dotnetdetours['Player.BuyAndAddSuitcase']=detourinfo
- else
- if disableinfo==nil then disableinfo='no reason' end
- error('InjectDotNetDetour failed : '..disableinfo) --prevents checking
- end
- local rec = memrec.Parent
- if rec then
- rec.Color = 0x008000
- rec.Description = "Infinite Money (Activated)"
- end
- {$asm}
- [disable]
- {$lua}
- if syntaxcheck then return end
- if dotnetdetours['Player.BuyAndAddSuitcase'] then
- autoAssemble(dotnetdetours['Player.BuyAndAddSuitcase'].disablescript, dotnetdetours['Player.BuyAndAddSuitcase'].disableinfo)
- end
- {$asm}
- </AssemblerScript>
- </CheatEntry>
- </CheatEntries>
- </CheatEntry>
- </CheatEntries>
- <UserdefinedSymbols/>
- </CheatTable>
Advertisement
Add Comment
Please, Sign In to add comment