Add speed modifier to tavernmaster
This commit is contained in:
@@ -12,9 +12,11 @@ namespace TavernDave {
|
|||||||
private const string pluginVersion = "1.0.0";
|
private const string pluginVersion = "1.0.0";
|
||||||
|
|
||||||
public static ConfigEntry<float> moneyMultiplier;
|
public static ConfigEntry<float> moneyMultiplier;
|
||||||
|
public static ConfigEntry<int> fastSpeed;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
|
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
|
||||||
|
fastSpeed = Config.Bind("General", "FastSpeed", 1);
|
||||||
|
|
||||||
Logger.LogInfo("Cyka mod loaded");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
@@ -32,10 +34,18 @@ namespace TavernDave {
|
|||||||
public class Patches {
|
public class Patches {
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
|
[HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
|
||||||
public static void Prefix(ref int value) {
|
public static void PrefixMoney(ref int value) {
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
value = (int)(value * Main.moneyMultiplier.Value);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user