Add speed modifier to tavernmaster

This commit is contained in:
2024-09-26 14:38:26 +02:00
parent 2f42e410e8
commit bdf34571be

View File

@@ -12,9 +12,11 @@ namespace TavernDave {
private const string pluginVersion = "1.0.0";
public static ConfigEntry<float> moneyMultiplier;
public static ConfigEntry<int> fastSpeed;
public void Awake() {
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
fastSpeed = Config.Bind("General", "FastSpeed", 1);
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
@@ -32,10 +34,18 @@ namespace TavernDave {
public class Patches {
[HarmonyPrefix]
[HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
public static void Prefix(ref int value) {
public static void PrefixMoney(ref int value) {
if (value > 0) {
value = (int)(value * Main.moneyMultiplier.Value);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
public static void PrefixSpeed(ref int gameSpeed) {
if (gameSpeed > 0) {
gameSpeed = Main.fastSpeed.Value;
}
}
}
}