Add debug option
This commit is contained in:
@@ -12,6 +12,8 @@ namespace TavernDave {
|
||||
private const string pluginName = "TavernDave";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<bool> debug;
|
||||
|
||||
public static ConfigEntry<float> moneyMultiplier;
|
||||
public static ConfigEntry<int> fastSpeed;
|
||||
public static ConfigEntry<float> staffXpMultiplier;
|
||||
@@ -20,6 +22,8 @@ namespace TavernDave {
|
||||
public static ConfigEntry<float> prestigeMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
debug = Config.Bind("General", "Debug", false);
|
||||
|
||||
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
|
||||
fastSpeed = Config.Bind("General", "FastSpeed", 1);
|
||||
staffXpMultiplier = Config.Bind("General", "StaffXpMultiplier", 1f);
|
||||
@@ -44,9 +48,11 @@ namespace TavernDave {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
|
||||
public static void PrefixMoney(ref int value) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Money is {value}");
|
||||
if (value > 0) {
|
||||
value = (int)(value * Main.moneyMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Money modified to {value}");
|
||||
}
|
||||
}
|
||||
@@ -54,9 +60,11 @@ namespace TavernDave {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
|
||||
public static void PrefixSpeed(ref int gameSpeed) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Game speed is {gameSpeed}");
|
||||
if (gameSpeed > 1) {
|
||||
gameSpeed = Main.fastSpeed.Value;
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Game speed modified to {gameSpeed}");
|
||||
}
|
||||
}
|
||||
@@ -64,9 +72,11 @@ namespace TavernDave {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StaffModel), "UpdateXp")]
|
||||
public static void PrefixXp(ref int id, ref int amount) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Staff xp is {amount}");
|
||||
if (amount > 0) {
|
||||
amount = (int)(amount * Main.staffXpMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Staff xp modified to {amount}");
|
||||
}
|
||||
}
|
||||
@@ -81,9 +91,11 @@ namespace TavernDave {
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TavernModel), nameof(TavernModel.GetQuality))]
|
||||
public static void PostfixQuality(ref int __result) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Quality is {__result}");
|
||||
if (__result > 0) {
|
||||
__result = (int)(__result * Main.prestigeMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Quality modified to {__result}");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user