Mono:Lua:mono loadAssemblyFromFile
This can be used to load an external mono assembly from a file, which you can then access like an assembly from the game.
As an example, you could create a new class library project in Visual Studio and reference the assemblies from the folder for the game "Our Adventurer's Guild" and create a class like this. This has a method that can be called in place of the game's "CraftingWindowUI:CheckCraftable" method and skips the checks it does for inventory and only enables the button and calls the UpdateUI() method called in the original method to make it visible. A program called 'dnspy' is useful for examining the game's "Assembly-CSharp.dll" assembly and finding out what the game code does.
namespace MyGuild
{
public static class CraftingWindowExtensions
{
public static void CheckCraftable(this CraftingWindowUI ui)
{
ui.CraftButton.interactable = true;
ui.CraftPrompt.UpdateUI();
}
}
}
Then an autoassembly script table entery can be created to load the DLL into the game's process:
[enable]
{$lua}
mono_loadAssemblyFromFile("C:\\git\\MyGuild\\bin\\Debug\\MyGuild.dll")
{$asm}
[disable]
Then another autoassembly script table entry can be created that will inject a jmp into the game's original code to call the replacement method instead:
define(hook,"CraftingWindowUI:CheckCraftable") define(bytes,55 48 8B EC 48 81 EC 80 00 00 00 48 89 75 F0) [enable] assert(hook, bytes) hook: jmp far MyGuild.CraftingWindowExtensions.CheckCraftable [disable] hook: db bytes