Compare commits

...

6 Commits

Author SHA1 Message Date
6dbbf5a9b9 Give up 2024-09-27 23:48:37 +02:00
96ac1e3bc2 Fix improperly loading preferences 2024-09-27 23:06:12 +02:00
86991edbd2 Add Melonpreferences 2024-09-27 22:21:06 +02:00
69eb2794ca Fix up money patch 2024-09-27 21:59:38 +02:00
6f9e30534e Add sync file 2024-09-27 21:59:34 +02:00
d86c563f60 Update developer name 2024-09-27 21:59:31 +02:00
4 changed files with 49 additions and 12 deletions

View File

@@ -1,15 +1,28 @@
using System;
using System.Linq;
using System.Linq;
using Il2CppFunGI.ATTT.Game.Gameplay.FinancialReport;
using Il2CppSystem;
using MelonLoader;
using UnityEngine;
namespace ArmsTradeTycoonTanks {
public static class Global {
public static bool Debug = true;
public static float MoneyMultiplier = 1.0f;
private static MelonPreferences_Category category;
public static MelonPreferences_Entry<bool> Debug;
public static MelonPreferences_Entry<float> MoneyMultiplier;
public static void InitializePreferences() {
category = MelonPreferences.CreateCategory("ArmsTradeTycoonTanksMelonMod");
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 OnApplicationStart() {
Global.InitializePreferences();
}
public override void OnInitializeMelon() {
LoggerInstance.Msg("Phat Melon mod loaded");
HarmonyLib.Harmony harmony = HarmonyInstance;
@@ -23,20 +36,23 @@ namespace ArmsTradeTycoonTanks {
}
}
// I could not get this to work...
// IL2CPP fucked it up beyond any recognition
// Such a shame
[HarmonyLib.HarmonyPatch]
public class Patches {
[HarmonyLib.HarmonyPrefix]
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "ChangeMoney")]
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "HandleMoneyUpdated")]
public static void PrefixMoney(ref long __0) {
if (Global.Debug)
Console.WriteLine($"Money is {__0}");
// if (Global.Debug.Value)
Console.WriteLine($"Money is {__0}");
if (__0 > 0) {
__0 = (long)(__0 * Global.MoneyMultiplier);
if (Global.Debug)
__0 = (long)(__0 * Global.MoneyMultiplier.Value);
if (Global.Debug.Value)
Console.WriteLine($"Money modified to {__0}");
}
}
// [HarmonyLib.HarmonyPostfix]
// [HarmonyLib.HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
// public static void PostfixPeoplePerMinute(ref float __result) {

View File

@@ -3,8 +3,10 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<PropertyGroup>
<GAME_DIR>C:/Games/Arms Trade Tycoon Tanks</GAME_DIR>
<GAME_USER_LIBS>$(GAME_DIR)/UserLibs</GAME_USER_LIBS>
<GAME_MELON>$(GAME_DIR)/MelonLoader</GAME_MELON>
<GAME_MANAGED>$(GAME_MELON)/Il2CppAssemblies</GAME_MANAGED>
<GAME_NET6>$(GAME_MELON)/net6</GAME_NET6>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
@@ -51,12 +53,30 @@
<Reference Include="UnityEngine">
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GAME_MANAGED)/UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GAME_MANAGED)/UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Il2CppFunGI">
<HintPath>$(GAME_MANAGED)/Il2CppATTT.Game.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>$(GAME_MANAGED)/Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>$(GAME_MANAGED)/Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>$(GAME_NET6)/Il2CppInterop.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Common">
<HintPath>$(GAME_NET6)/Il2CppInterop.Common.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
</Project>

View File

@@ -7,7 +7,7 @@ using MelonLoader;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: MelonInfo(typeof(ArmsTradeTycoonTanksMelonMod), "Phat Melon Mod", "1.0.0", "Phat Phuck Dave")]
[assembly: MelonGame("Microprose", "Arms Trade Tycoon Tanks")]
[assembly: MelonGame("FunGI", "Arms Trade Tycoon Tanks")]
[assembly: AssemblyTitle("Phat Melon Mod")]
[assembly: AssemblyProduct("Phat Melon Mod")]
[assembly: AssemblyDescription("")]

1
sync Normal file
View File

@@ -0,0 +1 @@
ArmsTradeTycoonTanks/bin/Release/ArmsTradeTycoonTanks.dll,"C:\Games\Arms Trade Tycoon Tanks\Mods\ArmsTradeTycoonTanks.dll"