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