diff --git a/CurrencyChanger2.csproj b/CurrencyChanger2.csproj
index b0604e3..e3c94fa 100644
--- a/CurrencyChanger2.csproj
+++ b/CurrencyChanger2.csproj
@@ -4,7 +4,7 @@
netstandard2.1
ChangeCurrency
My first plugin
- 2.1.2
+ 2.2.0
true
latest
@@ -32,6 +32,9 @@
D:\SteamLibrary\steamapps\common\Supermarket Simulator\Supermarket Simulator_Data\Managed\MyBox.dll
+
+ D:\SteamLibrary\steamapps\common\Supermarket Simulator\Supermarket Simulator_Data\Managed\Unity.Localization.dll
+
D:\SteamLibrary\steamapps\common\Supermarket Simulator\Supermarket Simulator_Data\Managed\Unity.TextMeshPro.dll
diff --git a/Patches/CashierItem_Setup_Patch.cs b/Patches/CashierItem_Setup_Patch.cs
new file mode 100644
index 0000000..4dcfcec
--- /dev/null
+++ b/Patches/CashierItem_Setup_Patch.cs
@@ -0,0 +1,51 @@
+using HarmonyLib;
+using MyBox;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(CashierItem), "Setup")]
+ public static class CashierItem_Setup_Patch
+ {
+ public static bool Done = false;
+ public static void Postfix(CashierItem __instance)
+ {
+ if (!Done)
+ {
+ Done = true;
+ Singleton.Instance.m_Cashiers.ForEach(x => { x.DailyWage *= Plugin.CurrencyValueFactor.Value; x.HiringCost *= Plugin.CurrencyValueFactor.Value; });
+ }
+ __instance.m_LocalizedDailyWageText.StringReference.Arguments = new object[]
+ {
+ __instance.m_CashierSetup.DailyWage.ToMoneyText(__instance.m_DailyWageText.fontSize)
+ };
+ __instance.m_LocalizedDailyWageText.RefreshString();
+ __instance.m_LocalizedHiringCostText.StringReference.Arguments = new object[]
+ {
+ __instance.m_CashierSetup.HiringCost.ToMoneyText(__instance.m_HiringCostText.fontSize)
+ };
+ __instance.m_LocalizedHiringCostText.RefreshString();
+ }
+ }
+ [HarmonyPatch(typeof(DayCycleManager), "StartNextDay")]
+ public static class DayCycleManager_StartNextDay_Patch
+ {
+ public static void Postfix() => UpdatePlayerPricing();
+ public static void UpdatePlayerPricing()
+ {
+ Singleton.Instance.m_PricesSetByPlayer.ForEach(pricing =>
+ {
+ pricing.Price = Plugin.Rounder.Round(pricing.Price);
+ List displaySlots = Singleton.Instance.GetDisplaySlots(pricing.ProductID, false);
+ if (displaySlots != null)
+ {
+ foreach (DisplaySlot obj in displaySlots)
+ {
+ obj.PricingChanged(pricing.ProductID);
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/Patches/CheckoutDrawer_Awake_Patch.cs b/Patches/CheckoutDrawer_Awake_Patch.cs
index f3f25cf..fe47fa7 100644
--- a/Patches/CheckoutDrawer_Awake_Patch.cs
+++ b/Patches/CheckoutDrawer_Awake_Patch.cs
@@ -35,7 +35,6 @@ namespace CurrencyChanger2.Patches
TextMeshProUGUI Coin6Text = null;
TextMeshProUGUI Coin7Text = null;
-
if (!Plugin.MoneyGeneratorDone)
{
Plugin.Bill1.Apply(Singleton.Instance.m_MoneyPrefabs[5]);
diff --git a/Patches/CustomerPayment_GenerateRandomPayment_Patch.cs b/Patches/CustomerPayment_GenerateRandomPayment_Patch.cs
new file mode 100644
index 0000000..32ad33c
--- /dev/null
+++ b/Patches/CustomerPayment_GenerateRandomPayment_Patch.cs
@@ -0,0 +1,17 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(CustomerPayment), "GenerateRandomPayment")]
+ public static class CustomerPayment_GenerateRandomPayment_Patch
+ {
+ public static void Postfix(ref float __result)
+ {
+ if(Plugin.Rounder == null)
+ {
+ return;
+ }
+ __result = Plugin.Rounder.Round(__result);
+ }
+ }
+}
diff --git a/Patches/FurnitureSalesItem_Setup_Patch.cs b/Patches/FurnitureSalesItem_Setup_Patch.cs
new file mode 100644
index 0000000..9e3ebc7
--- /dev/null
+++ b/Patches/FurnitureSalesItem_Setup_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+using TMPro;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(FurnitureSalesItem), "Setup")]
+ public static class FurnitureSalesItem_Setup_Patch
+ {
+ public static void Postfix(FurnitureSalesItem __instance)
+ {
+ __instance.transform.GetChild(2).GetChild(4).GetComponent().enableWordWrapping = false;
+ __instance.transform.GetChild(2).GetChild(4).gameObject.SetActive(false);
+ __instance.transform.GetChild(2).GetChild(4).gameObject.SetActive(true);
+ }
+ }
+}
diff --git a/Patches/IDManager_BankCreditSO_Patch.cs b/Patches/IDManager_BankCreditSO_Patch.cs
new file mode 100644
index 0000000..ef722b5
--- /dev/null
+++ b/Patches/IDManager_BankCreditSO_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(IDManager), "BankCreditSO")]
+ public static class IDManager_BankCreditSO_Patch
+ {
+ public static bool Done = false;
+ public static void Prefix(IDManager __instance)
+ {
+ if (Done) return;
+ Done = true;
+ __instance.Loans.ForEach(x => x.Amount *= Plugin.CurrencyValueFactor.Value);
+ }
+ }
+}
diff --git a/Patches/IDManager_FurnitureSO_Patch.cs b/Patches/IDManager_FurnitureSO_Patch.cs
new file mode 100644
index 0000000..b92f5f5
--- /dev/null
+++ b/Patches/IDManager_FurnitureSO_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(IDManager), "FurnitureSO")]
+ public static class IDManager_FurnitureSO_Patch
+ {
+ public static bool Done = false;
+ public static void Prefix(IDManager __instance)
+ {
+ if (Done) return;
+ Done = true;
+ __instance.Furnitures.ForEach(x => x.Cost *= Plugin.CurrencyValueFactor.Value);
+ }
+ }
+}
diff --git a/Patches/IDManager_ProductLicenseSO_Patch.cs b/Patches/IDManager_ProductLicenseSO_Patch.cs
new file mode 100644
index 0000000..10a974b
--- /dev/null
+++ b/Patches/IDManager_ProductLicenseSO_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(IDManager), "ProductLicenseSO")]
+ public static class IDManager_ProductLicenseSO_Patch
+ {
+ public static bool Done = false;
+ public static void Prefix(IDManager __instance)
+ {
+ if (Done) return;
+ Done = true;
+ __instance.m_ProductLicenses.ForEach(x => x.PurchasingCost *= Plugin.CurrencyValueFactor.Value);
+ }
+ }
+}
diff --git a/Patches/IDManager_SectionSO_Patch.cs b/Patches/IDManager_SectionSO_Patch.cs
new file mode 100644
index 0000000..84cc1e6
--- /dev/null
+++ b/Patches/IDManager_SectionSO_Patch.cs
@@ -0,0 +1,17 @@
+using HarmonyLib;
+using UnityEngine.XR;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(IDManager), "SectionSO")]
+ public static class IDManager_SectionSO_Patch
+ {
+ public static bool Done = false;
+ public static void Prefix(IDManager __instance)
+ {
+ if (Done) return;
+ Done = true;
+ __instance.Sections.ForEach(x => x.Cost *= Plugin.CurrencyValueFactor.Value);
+ }
+ }
+}
diff --git a/Patches/IDManager_StorageSO_Patch.cs b/Patches/IDManager_StorageSO_Patch.cs
new file mode 100644
index 0000000..dcae769
--- /dev/null
+++ b/Patches/IDManager_StorageSO_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(IDManager), "StorageSO")]
+ public static class IDManager_StorageSO_Patch
+ {
+ public static bool Done = false;
+ public static void Prefix(IDManager __instance)
+ {
+ if (Done) return;
+ Done = true;
+ __instance.StorageSections.ForEach(x => x.Cost *= Plugin.CurrencyValueFactor.Value);
+ }
+ }
+}
diff --git a/Patches/PriceTag_EnableTag_Patch.cs b/Patches/PriceTag_EnableTag_Patch.cs
new file mode 100644
index 0000000..43eee38
--- /dev/null
+++ b/Patches/PriceTag_EnableTag_Patch.cs
@@ -0,0 +1,16 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(PriceTag), "EnableTag")]
+ public static class PriceTag_EnableTag_Patch
+ {
+ public static void Postfix(PriceTag __instance)
+ {
+ if(__instance.m_PriceText.text == "$-")
+ {
+ __instance.m_PriceText.text = Plugin.CurrencyPrefix.Value + "-" + Plugin.CurrencySuffix.Value;
+ }
+ }
+ }
+}
diff --git a/Patches/PricingInteraction_ClosePricingMenu_Patch.cs b/Patches/PricingInteraction_ClosePricingMenu_Patch.cs
new file mode 100644
index 0000000..939e940
--- /dev/null
+++ b/Patches/PricingInteraction_ClosePricingMenu_Patch.cs
@@ -0,0 +1,10 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(PricingInteraction), "ClosePricingMenu")]
+ public static class PricingInteraction_ClosePricingMenu_Patch
+ {
+ public static void Postfix() => DayCycleManager_StartNextDay_Patch.UpdatePlayerPricing();
+ }
+}
diff --git a/Patches/RestockerItem_Setup_Patch.cs b/Patches/RestockerItem_Setup_Patch.cs
new file mode 100644
index 0000000..b59e132
--- /dev/null
+++ b/Patches/RestockerItem_Setup_Patch.cs
@@ -0,0 +1,29 @@
+using HarmonyLib;
+using MyBox;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(RestockerItem), "Setup")]
+ public static class RestockerItem_Setup_Patch
+ {
+ public static bool Done = false;
+ public static void Postfix(RestockerItem __instance)
+ {
+ if (!Done)
+ {
+ Done = true;
+ Singleton.Instance.m_Restockers.ForEach(x => { x.DailyWage *= Plugin.CurrencyValueFactor.Value; x.HiringCost *= Plugin.CurrencyValueFactor.Value; });
+ }
+ __instance.m_LocalizedDailyWageText.StringReference.Arguments = new object[]
+ {
+ __instance.m_RestockerSetup.DailyWage.ToMoneyText(__instance.m_DailyWageText.fontSize)
+ };
+ __instance.m_LocalizedDailyWageText.RefreshString();
+ __instance.m_LocalizedHiringCostText.StringReference.Arguments = new object[]
+ {
+ __instance.m_RestockerSetup.HiringCost.ToMoneyText(__instance.m_HiringCostText.fontSize)
+ };
+ __instance.m_LocalizedHiringCostText.RefreshString();
+ }
+ }
+}
diff --git a/Patches/SaveManager_Clear_Patch.cs b/Patches/SaveManager_Clear_Patch.cs
new file mode 100644
index 0000000..d8bc85a
--- /dev/null
+++ b/Patches/SaveManager_Clear_Patch.cs
@@ -0,0 +1,13 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(SaveManager), "Clear")]
+ public static class SaveManager_Clear_Patch
+ {
+ public static void Postfix(SaveManager __instance)
+ {
+ __instance.Progression.Money *= Plugin.CurrencyValueFactor.Value;
+ }
+ }
+}
diff --git a/Patches/StorageTab_Start_Patch.cs b/Patches/StorageTab_Start_Patch.cs
new file mode 100644
index 0000000..4d9571c
--- /dev/null
+++ b/Patches/StorageTab_Start_Patch.cs
@@ -0,0 +1,13 @@
+using HarmonyLib;
+
+namespace CurrencyChanger2.Patches
+{
+ [HarmonyPatch(typeof(StorageTab), "Start")]
+ public static class StorageTab_Start_Patch
+ {
+ public static void Prefix(StorageTab __instance)
+ {
+ __instance.m_Cost *= Plugin.CurrencyValueFactor.Value;
+ }
+ }
+}
diff --git a/Plugin.cs b/Plugin.cs
index f5a44d0..6d6190f 100644
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Reflection;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
@@ -55,6 +56,8 @@ namespace CurrencyChanger2
public static ConfigComp Coin5 { get; set; }
public static ConfigComp Coin6 { get; set; }
public static ConfigComp Coin7 { get; set; }
+
+ public static PriceRounder Rounder { get; set; }
private void Awake()
{
StaticLogger = Logger;
@@ -78,6 +81,19 @@ namespace CurrencyChanger2
Harmony harmony = new Harmony(PluginInfo.PLUGIN_GUID);
harmony.PatchAll();
+ //HarmonyMethod eCommerce = new HarmonyMethod(typeof(Plugin).GetMethod("eCommercePatch"));
+ //if(Assembly.Load("eCommerce") is Assembly assembly)
+ //{
+ // if(assembly.GetType("eCommerce", false) is Type eCommerceType)
+ // {
+ // if(eCommerceType.GetMethod("OnLateUpdate") is MethodInfo method)
+ // {
+ // Logger.LogWarning("eCommerce is present - applying patch");
+ // harmony.Patch(method, postfix: eCommerce);
+ // }
+ // }
+ //}
+
SceneManager.sceneLoaded += (a, b) =>
{
if (SceneManager.GetActiveScene().name == "Main Menu")
@@ -87,7 +103,33 @@ namespace CurrencyChanger2
MoneyGeneratorDone = false;
}
};
+
+ Rounder = new PriceRounder(Config);
}
+ //public static Dictionary