- 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.
51 lines
2 KiB
C#
51 lines
2 KiB
C#
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);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|