Skip to content
Bannerlord Wiki


Initial Setup
Within Some Init function:
Access and Modify Arguments of Methods
Access, Set, Call Class Fields/Methods
Create Type
Call Method of Type
GetValue of Type
Get Existing Patches
var originalMethods = Harmony.GetAllPatchedMethods();
foreach (var method in originalMethods) { }

Modify Original Method IL Code
Use Transpiler
Patch After Another Patch (Priority)
[HarmonyAfter(new string[] {"name.of.other.harmony.p/atch"}]
static void Postfix(...)
{... };
Read or Change Result of Original Method
Use Postfix
A postfix is a method that is executed after the original method. It is commonly used to
read or change the result of the original method
access the arguments of the original method
read custom state from the prefix
Suppress Exceptions
Use Finalizer
A finalizer is a method that is executed after all postfixes. It will wrap the original, all prefixes and postfixes in a try/catch logic and is either called with null (no exception) or with an exception if one occured. It is commonly used to:
run a piece of code at the end that is guaranteed to be executed
handle exceptions and suppress them
handle exceptions and alter them
Target Class Constructor
Change Method Parameters
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.