generated from dave/MelonTemplate
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Il2CppFunGI.ATTT.Game.Gameplay.FinancialReport;
|
|
using MelonLoader;
|
|
using UnityEngine;
|
|
|
|
namespace ArmsTradeTycoonTanks {
|
|
public static class Global {
|
|
private static MelonPreferences_Category category;
|
|
public static MelonPreferences_Entry<bool> Debug;
|
|
public static MelonPreferences_Entry<float> MoneyMultiplier;
|
|
|
|
public static void InitializePreferences() {
|
|
category = MelonPreferences.CreateCategory("ArmsTradeTycoonTanks");
|
|
|
|
Debug = category.CreateEntry("Debug", true, description: "Enable debug mode");
|
|
MoneyMultiplier = category.CreateEntry("MoneyMultiplier", 1.0f, description: "Multiplier for money gains");
|
|
}
|
|
}
|
|
|
|
public class ArmsTradeTycoonTanksMelonMod : MelonMod {
|
|
public override void OnInitializeMelon() {
|
|
Global.InitializePreferences();
|
|
LoggerInstance.Msg("Phat Melon mod loaded");
|
|
HarmonyLib.Harmony harmony = HarmonyInstance;
|
|
harmony.PatchAll();
|
|
var originalMethods = harmony.GetPatchedMethods();
|
|
var methodBases = originalMethods.ToList();
|
|
LoggerInstance.Msg("Patched " + methodBases.Count() + " methods");
|
|
foreach (var method in methodBases) {
|
|
LoggerInstance.Msg("Patched " + method.Name);
|
|
}
|
|
}
|
|
}
|
|
|
|
[HarmonyLib.HarmonyPatch]
|
|
public class Patches {
|
|
[HarmonyLib.HarmonyPrefix]
|
|
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "HandleMoneyUpdated")]
|
|
public static void PrefixMoney(ref long __0) {
|
|
if (Global.Debug.Value)
|
|
Debug.Log($"Money is {__0}");
|
|
if (__0 > 0) {
|
|
__0 = (long)(__0 * Global.MoneyMultiplier.Value);
|
|
if (Global.Debug.Value)
|
|
Debug.Log($"Money modified to {__0}");
|
|
}
|
|
}
|
|
|
|
// [HarmonyLib.HarmonyPostfix]
|
|
// [HarmonyLib.HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
|
|
// public static void PostfixPeoplePerMinute(ref float __result) {
|
|
// __result *= Main.peoplePerMinuteMultiplier.Value;
|
|
// __result += Main.peoplePerMinuteOffset.Value;
|
|
// }
|
|
}
|
|
} |