Add hiring cost multiplier and patch for cost calculation

This commit is contained in:
2025-05-17 13:17:01 +02:00
parent 5bde3c20b4
commit f72fcee86c

View File

@@ -25,6 +25,7 @@ namespace BlacksmithMaster {
public static ConfigEntry<float> decorationAdditionOffset; public static ConfigEntry<float> decorationAdditionOffset;
public static ConfigEntry<float> globalSpeedMultiplier; public static ConfigEntry<float> globalSpeedMultiplier;
public static ConfigEntry<float> globalSpeedOffset; public static ConfigEntry<float> globalSpeedOffset;
public static ConfigEntry<float> hiringCostMultiplier;
public static ConfigEntry<bool> alwaysEvenly; public static ConfigEntry<bool> alwaysEvenly;
public static ConfigEntry<bool> alwaysChad; public static ConfigEntry<bool> alwaysChad;
@@ -61,6 +62,9 @@ namespace BlacksmithMaster {
globalSpeedOffset = Config.Bind( globalSpeedOffset = Config.Bind(
"General", "Global Speed Offset", 0f, "General", "Global Speed Offset", 0f,
new ConfigDescription("Global Speed Offset", new AcceptableValueRange<float>(-1024f, 1024f))); new ConfigDescription("Global Speed Offset", new AcceptableValueRange<float>(-1024f, 1024f)));
hiringCostMultiplier = Config.Bind(
"General", "Hiring Cost Multiplier", 1f,
new ConfigDescription("Hiring Cost Multiplier", new AcceptableValueRange<float>(0.01f, 1024f)));
alwaysEvenly = alwaysEvenly =
Config.Bind("General", "Always Evenly", false, Config.Bind("General", "Always Evenly", false,
new ConfigDescription("Always Evenly", new AcceptableValueRange<bool>(false, true))); new ConfigDescription("Always Evenly", new AcceptableValueRange<bool>(false, true)));
@@ -146,6 +150,15 @@ namespace BlacksmithMaster {
} }
} }
[HarmonyPatch(typeof(StaffModel), "GetCostToHire")]
public class StaffModel_GetCostToHire {
public static void Postfix(ref int __result) {
Main.LogDebug("Original hiring cost: " + __result);
__result = (int)(__result * Main.hiringCostMultiplier.Value);
Main.LogDebug("Modified hiring cost: " + __result);
}
}
[HarmonyPatch(typeof(StaffUtil), "FillBasicInfo")] [HarmonyPatch(typeof(StaffUtil), "FillBasicInfo")]
public class StaffUtil_FillBasicInfo { public class StaffUtil_FillBasicInfo {
public static void Postfix(TavernData.StaffType staffType, Random rnd, ref TavernData.StaffInfo newPerson) { public static void Postfix(TavernData.StaffType staffType, Random rnd, ref TavernData.StaffInfo newPerson) {