guide_firstsrmod
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guide_firstsrmod [2019/07/04 11:43] – [Method 2 (Harmony Postfix)] umfdev | guide_firstsrmod [2019/07/04 12:27] (current) – umfdev | ||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
~~Title: My First Slime Rancher Mod (Modding Guide) ~~ | ~~Title: My First Slime Rancher Mod (Modding Guide) ~~ | ||
- | {{tag> | + | {{tag> |
===== My First Slime Rancher Mod (Modding Guide) ===== | ===== My First Slime Rancher Mod (Modding Guide) ===== | ||
<WRAP center round info 100%> | <WRAP center round info 100%> | ||
Line 247: | Line 247: | ||
- Rename '' | - Rename '' | ||
- Add the following to the top of '' | - Add the following to the top of '' | ||
+ | * This lets us target the **PlayerModel** class which is inside the **MonomiPark.SlimeRancher.DataModel** namespace without having to type the full namespace everytime. | ||
- Set **typeof** in the first HarmonyPatch attribute to use the **PlayerModel** class we discovered with dnSpy. <sxh csharp> | - Set **typeof** in the first HarmonyPatch attribute to use the **PlayerModel** class we discovered with dnSpy. <sxh csharp> | ||
+ | * You could also use **MonomiPark.SlimeRancher.DataModel.PlayerModel** instead for the type. | ||
- Set the second **HarmonyPatch** attribute to the **ApplyUpgrade** function we discovered with dnSpy. <sxh csharp> | - Set the second **HarmonyPatch** attribute to the **ApplyUpgrade** function we discovered with dnSpy. <sxh csharp> | ||
- Inside the patch class create the following postfix function: <sxh csharp> | - Inside the patch class create the following postfix function: <sxh csharp> | ||
Line 307: | Line 309: | ||
* The Traverse will bypass any private or readonly variable and let you read/write to it. | * The Traverse will bypass any private or readonly variable and let you read/write to it. | ||
* Traverse does not need to be used inside a Harmony patch, it can be used anywhere anytime in any code, however you have to make sure it doesn' | * Traverse does not need to be used inside a Harmony patch, it can be used anywhere anytime in any code, however you have to make sure it doesn' | ||
+ | * This will function exactly like Method 2, and is wholly unnecessary since **maxHealth** is public and not readonly. | ||
- See [[# | - See [[# | ||
\\ | \\ |
guide_firstsrmod.1562237020.txt.gz · Last modified: 2019/07/04 11:43 by umfdev