Add money prefix

This commit is contained in:
2024-09-27 21:53:08 +02:00
parent 54406c7c8a
commit b0b46db004
2 changed files with 23 additions and 13 deletions

View File

@@ -1,7 +1,14 @@
using System.Linq;
using System;
using System.Linq;
using Il2CppFunGI.ATTT.Game.Gameplay.FinancialReport;
using MelonLoader;
namespace ArmsTradeTycoonTanks {
public static class Global {
public static bool Debug = true;
public static float MoneyMultiplier = 1.0f;
}
public class ArmsTradeTycoonTanksMelonMod : MelonMod {
public override void OnInitializeMelon() {
LoggerInstance.Msg("Phat Melon mod loaded");
@@ -18,18 +25,18 @@ namespace ArmsTradeTycoonTanks {
[HarmonyLib.HarmonyPatch]
public class Patches {
// [HarmonyLib.HarmonyPrefix]
// [HarmonyLib.HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
// public static void PrefixMoney(ref int value) {
// if (Main.debug.Value)
// Console.WriteLine($"Money is {value}");
// if (value > 0) {
// value = (int)(value * Main.moneyMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Money modified to {value}");
// }
// }
[HarmonyLib.HarmonyPrefix]
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "ChangeMoney")]
public static void PrefixMoney(ref long __0) {
if (Global.Debug)
Console.WriteLine($"Money is {__0}");
if (__0 > 0) {
__0 = (long)(__0 * Global.MoneyMultiplier);
if (Global.Debug)
Console.WriteLine($"Money modified to {__0}");
}
}
// [HarmonyLib.HarmonyPostfix]
// [HarmonyLib.HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
// public static void PostfixPeoplePerMinute(ref float __result) {

View File

@@ -54,6 +54,9 @@
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Il2CppFunGI">
<HintPath>$(GAME_MANAGED)/Il2CppATTT.Game.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
</Project>