Files
MMOKitchen/Patches/DifficultyHelpersPatch.cs
T

51 lines
1.9 KiB
C#
Raw Normal View History

2024-04-01 08:12:01 +11:00
using HarmonyLib;
using Kitchen;
using KitchenLib.Preferences;
namespace MMOKitchen.Patches
{
[HarmonyPatch(typeof(DifficultyHelpers))]
public class DifficultyHelpersPatch
{
[HarmonyPatch("CustomerPlayersRateModifier")]
2026-03-05 17:09:17 +11:00
[HarmonyPrefix]
2026-03-08 21:33:59 +11:00
static bool CustomerPlayersRateModifier_Prefix(ref float __result, int player_count)
2024-04-01 08:12:01 +11:00
{
2026-03-08 21:33:59 +11:00
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
2026-03-05 17:09:17 +11:00
{
2026-03-08 21:33:59 +11:00
__result = (float)(1.5 + 0.25 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_CUSTOMER_SCALE_AMOUNT).Value);
2026-03-05 17:09:17 +11:00
return false;
}
2026-03-08 21:33:59 +11:00
Mod.Logger.LogInfo("5");
2026-03-05 17:09:17 +11:00
return true;
2024-04-01 08:12:01 +11:00
}
[HarmonyPatch("FireSpreadModifier")]
2026-03-08 21:33:59 +11:00
[HarmonyPrefix]
static bool FireSpreadModifier_Prefix(ref float __result, int player_count)
2024-04-01 08:12:01 +11:00
{
2026-03-08 21:33:59 +11:00
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
{
__result = (float)(1.15 + 0.05 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_FIRE_SCALE_AMOUNT).Value);
return false;
}
return true;
2024-04-01 08:12:01 +11:00
}
[HarmonyPatch("PatiencePlayerCountModifier")]
2026-03-08 21:33:59 +11:00
[HarmonyPrefix]
static bool PatiencePlayerCountModifier_Prefix(ref float __result, int player_count)
2024-04-01 08:12:01 +11:00
{
2026-03-08 21:33:59 +11:00
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
{
__result = (float)(1.5 + 0.25 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_PATIENCE_SCALE_AMOUNT).Value);
return false;
}
return true;
2024-04-01 08:12:01 +11:00
}
}
}