Update 2.2.0
- Fixed: $1 coins should now work as expected outside of the newly added coin slots. - Added: Currency symbols are now also applied to price tags where the price has never been set. - Added: Currency Value Factor is now applied to Bank Loans. - Added: Currency Value Factor is now applied to Store Sections. - Added: Currency Value Factor is now applied to Storage Sections. - Added: Currency Value Factor is now applied to Furniture Prices. - Added: Currency Value Factor is now applied to the amount of money a new save game starts with. - Added: Currency Value Factor is now applied to Restocker hiring & daily cost. - Added: Currency Value Factor is now applied to Cashier hiring & daily cost. - Added: Price Rounding, for when a currency doesn't support certain low denominations. You can now configure product prices as well as customer payments to not make you use 1 cent coins, or even coins below $1, if you wish. - The new feature above has been preconfigured to 5 cents in the config file for the canadian dollar, making that currency's penny obsolete. - Preconfigured config files have been updated to reflect changes made in this version.
This commit is contained in:
parent
0afdc1d02f
commit
6e2d2fac98
17 changed files with 324 additions and 4 deletions
51
Patches/CashierItem_Setup_Patch.cs
Normal file
51
Patches/CashierItem_Setup_Patch.cs
Normal file
|
|
@ -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<IDManager>.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<PriceManager>.Instance.m_PricesSetByPlayer.ForEach(pricing =>
|
||||
{
|
||||
pricing.Price = Plugin.Rounder.Round(pricing.Price);
|
||||
List<DisplaySlot> displaySlots = Singleton<DisplayManager>.Instance.GetDisplaySlots(pricing.ProductID, false);
|
||||
if (displaySlots != null)
|
||||
{
|
||||
foreach (DisplaySlot obj in displaySlots)
|
||||
{
|
||||
obj.PricingChanged(pricing.ProductID);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,6 @@ namespace CurrencyChanger2.Patches
|
|||
|
||||
TextMeshProUGUI Coin6Text = null;
|
||||
TextMeshProUGUI Coin7Text = null;
|
||||
|
||||
if (!Plugin.MoneyGeneratorDone)
|
||||
{
|
||||
Plugin.Bill1.Apply(Singleton<MoneyGenerator>.Instance.m_MoneyPrefabs[5]);
|
||||
|
|
|
|||
17
Patches/CustomerPayment_GenerateRandomPayment_Patch.cs
Normal file
17
Patches/CustomerPayment_GenerateRandomPayment_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/FurnitureSalesItem_Setup_Patch.cs
Normal file
16
Patches/FurnitureSalesItem_Setup_Patch.cs
Normal file
|
|
@ -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<TextMeshProUGUI>().enableWordWrapping = false;
|
||||
__instance.transform.GetChild(2).GetChild(4).gameObject.SetActive(false);
|
||||
__instance.transform.GetChild(2).GetChild(4).gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/IDManager_BankCreditSO_Patch.cs
Normal file
16
Patches/IDManager_BankCreditSO_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/IDManager_FurnitureSO_Patch.cs
Normal file
16
Patches/IDManager_FurnitureSO_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/IDManager_ProductLicenseSO_Patch.cs
Normal file
16
Patches/IDManager_ProductLicenseSO_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Patches/IDManager_SectionSO_Patch.cs
Normal file
17
Patches/IDManager_SectionSO_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/IDManager_StorageSO_Patch.cs
Normal file
16
Patches/IDManager_StorageSO_Patch.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Patches/PriceTag_EnableTag_Patch.cs
Normal file
16
Patches/PriceTag_EnableTag_Patch.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Patches/PricingInteraction_ClosePricingMenu_Patch.cs
Normal file
10
Patches/PricingInteraction_ClosePricingMenu_Patch.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
29
Patches/RestockerItem_Setup_Patch.cs
Normal file
29
Patches/RestockerItem_Setup_Patch.cs
Normal file
|
|
@ -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<IDManager>.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Patches/SaveManager_Clear_Patch.cs
Normal file
13
Patches/SaveManager_Clear_Patch.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Patches/StorageTab_Start_Patch.cs
Normal file
13
Patches/StorageTab_Start_Patch.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue