From 1e27428538865a3a9a549ab1cda44a43afc36d35 Mon Sep 17 00:00:00 2001 From: Gerrit Kitts Date: Sat, 1 Jun 2019 09:39:04 -0400 Subject: [PATCH] - Blue fixes - Corrects Wang to Yang in dialog tree - Fixes issue with unable to withdraw after Sumire is overhead and then leaves --- .../DisorderlyWithdrawal/Patches/Patches.cs | 198 ++++++------------ .../DisorderlyWithdrawal/Patches/UIPatches.cs | 71 ++++++- .../Properties/AssemblyInfo.cs | 4 +- .../DisorderlyWithdrawal/Utils/Logger.cs | 3 +- .../DisorderlyWithdrawal/Utils/ModConfig.cs | 5 +- .../DisorderlyWithdrawal/Utils/State.cs | 23 +- .../5a3845b6623035d41400002a.convo.bytes | Bin 50931 -> 50931 bytes 7 files changed, 157 insertions(+), 147 deletions(-) diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/Patches.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/Patches.cs index e2145fe..db61fdf 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/Patches.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/Patches.cs @@ -11,14 +11,16 @@ namespace DisorderlyWithdrawal.Patches { [HarmonyPatch(typeof(CombatHUDRetreatEscMenu), "OnRetreatButtonPressed")] public static class CombatHUDRetreatESCMenu_OnRetreatButtonPressed { public static bool Prefix(CombatHUDRetreatEscMenu __instance, HBSDOTweenButton ___RetreatButton, CombatGameState ___Combat, CombatHUD ___HUD) { - Mod.Log.Debug($"CHUDREM:ORBP - triggered:{ModState.WithdrawalTriggered} " + - $"tillOverhead:{ModState.RoundsUntilOverhead} tillReady:{ModState.RoundsUntilReady}"); + Mod.Log.Trace($"CHUDREM:ORBP entered"); - if (ModState.WithdrawalTriggered && ModState.RoundsUntilOverhead == 0) { - Mod.Log.Debug($"CHUDREM:ORBP - Checking for combat damage and active enemies"); - ModState.CombatDamage = Helper.CalculateCombatDamage(); - if (ModState.CombatDamage > 0 && ___Combat.TurnDirector.DoAnyUnitsHaveContactWithEnemy) { - int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; + Mod.Log.Debug($" RetreatButton pressed -> withdrawStarted:{State.WithdrawStarted} " + + $"CurrentRound:{___Combat.TurnDirector.CurrentRound} CanWithdrawOn:{State.CanWithdrawOnRound} CanApproachOn:{State.CanApproachOnRound}"); + + if (State.WithdrawStarted && State.CanWithdrawOnRound == ___Combat.TurnDirector.CurrentRound) { + Mod.Log.Debug($"Checking for combat damage and active enemies"); + State.CombatDamage = Helper.CalculateCombatDamage(); + if (State.CombatDamage > 0 && ___Combat.TurnDirector.DoAnyUnitsHaveContactWithEnemy) { + int repairCost = (int)Math.Ceiling(State.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; void withdrawAction() { OnImmediateWithdraw(__instance.IsGoodFaithEffort()); } GenericPopupBuilder builder = GenericPopupBuilder.Create(GenericPopupType.Warning, $"Enemies are within weapons range! If you withdraw now the Leopard will take {SimGameState.GetCBillString(repairCost)} worth of damage.") @@ -29,6 +31,7 @@ public static bool Prefix(CombatHUDRetreatEscMenu __instance, HBSDOTweenButton _ ___HUD.SelectionHandler.GenericPopup = builder.Render(); return false; } else { + Mod.Log.Info($" Immediate withdraw due to no enemies"); OnImmediateWithdraw(__instance.IsGoodFaithEffort()); return false; } @@ -38,41 +41,42 @@ public static bool Prefix(CombatHUDRetreatEscMenu __instance, HBSDOTweenButton _ } public static void OnImmediateWithdraw(bool isGoodFaith) { - Mod.Log.Debug($"CHUDREM:ORBP:OnImmediateWithdraw - {isGoodFaith}"); + Mod.Log.Trace($"CHUDREM:ORBP:OnImmediateWithdraw - {isGoodFaith}"); CombatGameState Combat = UnityGameInstance.BattleTechGame.Combat; MissionRetreatMessage message = new MissionRetreatMessage(isGoodFaith); Combat.MessageCenter.PublishMessage(message); - ModState.HUD.SelectionHandler.GenericPopup = null; + State.HUD.SelectionHandler.GenericPopup = null; } } [HarmonyPatch(typeof(CombatHUDRetreatEscMenu), "OnRetreatConfirmed")] public static class CombatHUDRetreatESCMenu_OnRetreatConfirmed { public static bool Prefix(CombatHUDRetreatEscMenu __instance, CombatGameState ___Combat, CombatHUD ___HUD) { - Mod.Log.Debug("CHUDREM:ORC entered"); + Mod.Log.Trace("CHUDREM:ORC entered"); if (___Combat == null || ___Combat.ActiveContract.IsArenaSkirmish) { return true; } else { int roundsToWait = Helper.RoundsToWaitByAerospace(); - Mod.Log.Info($"Player must wait:{roundsToWait} rounds for pickup."); if (roundsToWait > 0) { - ModState.RoundsUntilOverhead = roundsToWait; - ModState.WithdrawalTriggered = true; - ModState.RetreatButton = __instance.RetreatButton; - ModState.HUD = ___HUD; + State.WithdrawStarted = true; + State.CanWithdrawOnRound = ___Combat.TurnDirector.CurrentRound + roundsToWait; + State.CanApproachOnRound = State.CanWithdrawOnRound + Helper.RoundsToWaitByAerospace(); ; + Mod.Log.Info($" Withdraw triggered on round {___Combat.TurnDirector.CurrentRound}. canWithdrawOn:{State.CanWithdrawOnRound} canApproachOn: {State.CanApproachOnRound}"); + + State.RetreatButton = __instance.RetreatButton; + State.HUD = ___HUD; Transform textT = __instance.RetreatButton.gameObject.transform.Find("Text"); if (textT != null) { GameObject textGO = textT.gameObject; - ModState.RetreatButtonText = textGO.GetComponent(); + State.RetreatButtonText = textGO.GetComponent(); } - //ModState.RetreatButton.SetState(ButtonState.Disabled, true); - ModState.RetreatButtonText.SetText($"In { roundsToWait } Rounds", new object[] { }); + State.RetreatButtonText.SetText($"In { roundsToWait } Rounds", new object[] { }); GenericPopupBuilder genericPopupBuilder = GenericPopupBuilder.Create(GenericPopupType.Info, @@ -90,7 +94,7 @@ public static bool Prefix(CombatHUDRetreatEscMenu __instance, CombatGameState __ public static void OnContinue() { Mod.Log.Debug($"CHUDREM:ORC OnContinue"); - ModState.HUD.SelectionHandler.GenericPopup = null; + State.HUD.SelectionHandler.GenericPopup = null; } } @@ -98,29 +102,35 @@ public static void OnContinue() { [HarmonyPatch(typeof(CombatHUDRetreatEscMenu), "Update")] public static class CombatHUDRetreatESCMenu_Update { public static void Postfix(CombatHUDRetreatEscMenu __instance, CombatGameState ___Combat, CombatHUD ___HUD, bool ___isArena) { - //DisorderlyWithdrawal.Logger.Debug($"CHUDREM:U entered - isArena:{___isArena} untilOverhead:{ModState.RoundsUntilOverhead} untilReady:{ModState.RoundsUntilReady}"); + Mod.Log.Trace("CHUDREM:U entered"); if (!___isArena) { - if (ModState.RoundsUntilOverhead > 0) { - //DisorderlyWithdrawal.Logger.Debug($"CHUDREM:U - wait til overhead - untilOverhead:{ModState.RoundsUntilOverhead} untilReady:{ModState.RoundsUntilReady}"); + Mod.Log.Debug($" On ESCmenu update -> currentRound:{___Combat.TurnDirector.CurrentRound} canWithdrawOn:{State.CanWithdrawOnRound} canApproachOn:{State.CanApproachOnRound}"); + if (___Combat.TurnDirector.CurrentRound < State.CanWithdrawOnRound) { + int withdrawIn = State.CanWithdrawOnRound - ___Combat.TurnDirector.CurrentRound; + Mod.Log.Debug($" Turns to withdraw: {withdrawIn} currentRound:{___Combat.TurnDirector.CurrentRound} canWithdrawOn:{State.CanWithdrawOnRound} canApproachOn:{State.CanApproachOnRound}"); + __instance.RetreatButton.SetState(ButtonState.Disabled, false); - ModState.RetreatButtonText.fontSize = 24; - ModState.RetreatButtonText.color = Color.white; - ModState.RetreatButtonText.SetText($"In { ModState.RoundsUntilOverhead } Rounds", new object[] { }); - } else if (ModState.RoundsUntilOverhead == 0) { - //DisorderlyWithdrawal.Logger.Debug($"CHUDREM:U - withdraw turn - untilOverhead:{ModState.RoundsUntilOverhead} untilReady:{ModState.RoundsUntilReady}"); + State.RetreatButtonText.fontSize = 24; + State.RetreatButtonText.color = Color.white; + State.RetreatButtonText.SetText($"In { withdrawIn } Rounds", new object[] { }); + } else if (___Combat.TurnDirector.CurrentRound == State.CanWithdrawOnRound) { + Mod.Log.Debug($" Can withdraw on this turn. currentRound:{___Combat.TurnDirector.CurrentRound} canWithdrawOn:{State.CanWithdrawOnRound} canApproachOn:{State.CanApproachOnRound}"); + if (__instance.RetreatButton.BaseState != ButtonState.Enabled) { __instance.RetreatButton.SetState(ButtonState.Enabled, false); } - ModState.RetreatButtonText.fontSize = 24; - ModState.RetreatButtonText.color = Color.white; - ModState.RetreatButtonText.SetText($"Withdraw", new object[] { }); - } else if (ModState.RoundsUntilReady > 0) { - //DisorderlyWithdrawal.Logger.Debug($"CHUDREM:U - wait til ready - untilOverhead:{ModState.RoundsUntilOverhead} untilReady:{ModState.RoundsUntilReady}"); + State.RetreatButtonText.fontSize = 24; + State.RetreatButtonText.color = Color.white; + State.RetreatButtonText.SetText($"Withdraw", new object[] { }); + } else if (State.CanApproachOnRound > ___Combat.TurnDirector.CurrentRound) { + int readyIn = State.CanApproachOnRound - ___Combat.TurnDirector.CurrentRound; + Mod.Log.Debug($" Turns to ready: {readyIn} currentRound:{___Combat.TurnDirector.CurrentRound} canWithdrawOn:{State.CanWithdrawOnRound} canApproachOn:{State.CanApproachOnRound}"); + __instance.RetreatButton.SetState(ButtonState.Disabled, false); - ModState.RetreatButtonText.fontSize = 24; - ModState.RetreatButtonText.color = Color.white; - ModState.RetreatButtonText.SetText($"In { ModState.RoundsUntilReady } Rounds", new object[] { }); + State.RetreatButtonText.fontSize = 24; + State.RetreatButtonText.color = Color.white; + State.RetreatButtonText.SetText($"In { readyIn } Rounds", new object[] { }); } } } @@ -128,56 +138,37 @@ public static void Postfix(CombatHUDRetreatEscMenu __instance, CombatGameState _ [HarmonyPatch(typeof(TurnDirector), "BeginNewRound")] public static class TurnDirector_BeginNewRound { - static void Postfix(TurnDirector __instance) { - Mod.Log.Debug($"TD:BNR entered - withdrawalTrigger:{ModState.WithdrawalTriggered} roundsUntilWithdrawal:{ModState.RoundsUntilOverhead}"); - - if (ModState.WithdrawalTriggered) { - if (ModState.RoundsUntilOverhead == 0) { - ModState.RoundsUntilReady = Helper.RoundsToWaitByAerospace(); + static void Postfix(TurnDirector __instance, int round) { + Mod.Log.Trace("TD:BNR entered"); + Mod.Log.Debug($" OnNewRound -> withdrawStarted:{State.WithdrawStarted} canWithdrawOn:{State.CanWithdrawOnRound}"); + if (State.WithdrawStarted) { + if (round == State.CanWithdrawOnRound) { + int readyIn = State.CanApproachOnRound - round; GenericPopupBuilder genericPopupBuilder = GenericPopupBuilder.Create(GenericPopupType.Info, - $"Sumire is overhead. If you don't withdraw on this round, she will retreat. She will be unavailable for another {ModState.RoundsUntilReady} rounds!") + $"Sumire is overhead. If you don't withdraw on this round, she will retreat. She will be unavailable for another {readyIn} rounds!") .AddButton("Continue", new Action(OnContinue), true, null); genericPopupBuilder.IsNestedPopupWithBuiltInFade = true; - ModState.HUD.SelectionHandler.GenericPopup = genericPopupBuilder.Render(); + State.HUD.SelectionHandler.GenericPopup = genericPopupBuilder.Render(); - ModState.RetreatButton.SetState(ButtonState.Enabled, true); - ModState.RetreatButtonText.SetText($"Withdraw Now", new object[] { }); + State.RetreatButton.SetState(ButtonState.Enabled, true); + State.RetreatButtonText.SetText($"Withdraw Now", new object[] { }); - } else if (ModState.RoundsUntilReady == 0) { - ModState.WithdrawalTriggered = false; - ModState.RoundsUntilOverhead = -1; - ModState.RoundsUntilReady = -1; + } else if (round == State.CanApproachOnRound) { + State.WithdrawStarted = false; + State.CanApproachOnRound = -1; + State.CanWithdrawOnRound = -1; - ModState.RetreatButton.SetState(ButtonState.Enabled, false); - ModState.RetreatButtonText.SetText($"Withdraw", new object[] { }); + State.RetreatButton.SetState(ButtonState.Enabled, false); + State.RetreatButtonText.SetText($"Withdraw", new object[] { }); } } } public static void OnContinue() { Mod.Log.Debug($"TD:BNR OnContinue"); - ModState.HUD.SelectionHandler.GenericPopup = null; - } - } - - [HarmonyPatch(typeof(TurnDirector), "EndCurrentRound")] - public static class TurnDirector_EndCurrentRound { - static void Postfix(TurnDirector __instance) { - Mod.Log.Debug($"TD:ECR entered - withdrawalTrigger:{ModState.WithdrawalTriggered} roundsUntilWithdrawal:{ModState.RoundsUntilOverhead}"); - - if (ModState.WithdrawalTriggered) { - if (ModState.RoundsUntilOverhead == 0) { - // Player didn't withdraw. Reset the button and prevent them from restarting for N turns - ModState.WithdrawalTriggered = false; - ModState.RoundsUntilOverhead = -1; - } else if (ModState.RoundsUntilOverhead > 0) { - ModState.RoundsUntilOverhead = ModState.RoundsUntilOverhead - 1; - } else if (ModState.RoundsUntilReady > 0) { - ModState.RoundsUntilReady = ModState.RoundsUntilReady - 1; - } - } + State.HUD.SelectionHandler.GenericPopup = null; } } @@ -186,73 +177,10 @@ public static class TurnDirector_OnCombatGameDestroyed { static void Postfix(TurnDirector __instance) { Mod.Log.Debug("TD:OCGD entered"); - ModState.WithdrawalTriggered = false; - ModState.RoundsUntilOverhead = 0; - ModState.RoundsUntilReady = 0; - ModState.RetreatButton = null; - ModState.RetreatButtonText = null; - ModState.HUD = null; + State.Reset(); // DO NOT OVERWRITE CombatDamage! } } - [HarmonyPatch(typeof(SimGameState), "GetExpenditures")] - [HarmonyAfter(new string[] { "de.morphyum.MechMaintenanceByCost" })] - public static class SimGameState_GetExpenditures { - public static void Postfix(SimGameState __instance, ref int __result, bool proRate) { - Mod.Log.Debug($"SGS:GE entered with {__result}"); - - Statistic aerospaceAssets = __instance.CompanyStats.GetStatistic("AerospaceAssets"); - int aerospaceSupport = aerospaceAssets != null ? aerospaceAssets.Value() : 0; - - switch (aerospaceSupport) { - case 3: - __result = __result + Mod.Config.HeavyWingMonthlyCost; - Mod.Log.Debug($"Charging player for a heavy wing, result = {__result}."); - break; - case 2: - __result = __result + Mod.Config.MediumWingMonthlyCost; - Mod.Log.Debug($"Charging player for a medium wing, result = {__result}."); - break; - case 1: - __result = __result + Mod.Config.LightWingMonthlyCost; - Mod.Log.Debug($"Charging player for a light wing, result = {__result}."); - break; - default: - Mod.Log.Debug($"Charging player for no aerospace, result = {__result}"); - break; - } - } - } - - [HarmonyPatch(typeof(AAR_ContractObjectivesWidget), "FillInObjectives")] - [HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech" })] - public static class AAR_ContractObjectivesWidget_FillInObjectives { - - static void Prefix(AAR_ContractObjectivesWidget __instance, Contract ___theContract) { - int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; - if (repairCost != 0) { - Mod.Log.Debug($"AAR_COW:FIO adding repair cost objective:{repairCost}"); - string objectiveLabel = $"LEOPARD REPAIR COSTS: {SimGameState.GetCBillString(repairCost)}"; - MissionObjectiveResult missionObjectiveResult = new MissionObjectiveResult(objectiveLabel, "7facf07a-626d-4a3b-a1ec-b29a35ff1ac0", false, true, ObjectiveStatus.Succeeded, false); - ___theContract.MissionObjectiveResultList.Add(missionObjectiveResult); - } - } - } - - [HarmonyPatch(typeof(Contract), "CompleteContract")] - [HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech", "de.morphyum.PersistentMapClient" })] - public static class Contract_CompleteContract { - - static void Postfix(Contract __instance) { - int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; - if (repairCost != 0) { - Mod.Log.Debug($"C:CC adding repair costs:{repairCost}"); - int newMoneyResults = Mathf.FloorToInt(__instance.MoneyResults - repairCost); - Traverse traverse = Traverse.Create(__instance).Property("MoneyResults"); - traverse.SetValue(newMoneyResults); - } - } - } } diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/UIPatches.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/UIPatches.cs index f03ba46..501ceac 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/UIPatches.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/UIPatches.cs @@ -1,4 +1,5 @@ using BattleTech; +using BattleTech.Framework; using BattleTech.UI; using Harmony; using System; @@ -9,11 +10,41 @@ using UnityEngine; namespace DisorderlyWithdrawal.Patches { - + + [HarmonyPatch(typeof(SimGameState), "GetExpenditures")] + [HarmonyPatch(new Type[] { typeof(EconomyScale), typeof(bool) })] + [HarmonyAfter(new string[] { "de.morphyum.MechMaintenanceByCost", "us.frostraptor.IttyBittyLivingSpace" })] + public static class SimGameState_GetExpenditures { + public static void Postfix(SimGameState __instance, ref int __result, EconomyScale expenditureLevel, bool proRate) { + Mod.Log.Trace($"SGS:GE entered with {__result}"); + + Statistic aerospaceAssets = __instance.CompanyStats.GetStatistic("AerospaceAssets"); + int aerospaceSupport = aerospaceAssets != null ? aerospaceAssets.Value() : 0; + + switch (aerospaceSupport) { + case 3: + __result = __result + Mod.Config.HeavyWingMonthlyCost; + Mod.Log.Trace($"Charging player for a heavy wing, result = {__result}."); + break; + case 2: + __result = __result + Mod.Config.MediumWingMonthlyCost; + Mod.Log.Trace($"Charging player for a medium wing, result = {__result}."); + break; + case 1: + __result = __result + Mod.Config.LightWingMonthlyCost; + Mod.Log.Trace($"Charging player for a light wing, result = {__result}."); + break; + default: + Mod.Log.Trace($"Charging player for no aerospace, result = {__result}"); + break; + } + } + } + [HarmonyPatch(typeof(SGCaptainsQuartersStatusScreen), "RefreshData")] - [HarmonyAfter(new string[] { "dZ.Zappo.MonthlyTechAdjustment", "us.frostraptor.IttyBittyLivingSpace" })] + [HarmonyAfter(new string[] { "dZ.Zappo.MonthlyTechAdjustment", "us.frostraptor.IttyBittyLivingSpace", "us.frostraptor.IttyBittyLivingSpace" })] public static class SGCaptainsQuartersStatusScreen_RefreshData { - public static void Postfix(SGCaptainsQuartersStatusScreen __instance, bool showMoraleChange, + public static void Postfix(SGCaptainsQuartersStatusScreen __instance, EconomyScale expenditureLevel, bool showMoraleChange, Transform ___SectionOneExpensesList, TextMeshProUGUI ___SectionOneExpensesField, SimGameState ___simState) { @@ -23,6 +54,9 @@ public static void Postfix(SGCaptainsQuartersStatusScreen __instance, bool showM return; } + // TODO: Add this to mech parts maybe? + //float expenditureCostModifier = simGameState.GetExpenditureCostModifier(expenditureLevel); + // Determine the level of aerospace support Statistic aerospaceAssets = simGameState.CompanyStats.GetStatistic("AerospaceAssets"); int aerospaceSupport = aerospaceAssets != null ? aerospaceAssets.Value() : 0; @@ -79,7 +113,6 @@ public static void Postfix(SGCaptainsQuartersStatusScreen __instance, bool showM } } - public static List> GetCurrentKeys(Transform container, SimGameState sgs) { List> currentKeys = new List>(); @@ -146,4 +179,34 @@ private static void ClearListLineItems(Transform container, SimGameState sgs) { } } + [HarmonyPatch(typeof(AAR_ContractObjectivesWidget), "FillInObjectives")] + [HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech" })] + public static class AAR_ContractObjectivesWidget_FillInObjectives { + + static void Prefix(AAR_ContractObjectivesWidget __instance, Contract ___theContract) { + int repairCost = (int)Math.Ceiling(State.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; + if (repairCost != 0) { + Mod.Log.Debug($"AAR_COW:FIO adding repair cost objective:{repairCost}"); + string objectiveLabel = $"LEOPARD REPAIR COSTS: {SimGameState.GetCBillString(repairCost)}"; + MissionObjectiveResult missionObjectiveResult = new MissionObjectiveResult(objectiveLabel, "7facf07a-626d-4a3b-a1ec-b29a35ff1ac0", false, true, ObjectiveStatus.Succeeded, false); + ___theContract.MissionObjectiveResultList.Add(missionObjectiveResult); + } + } + } + + [HarmonyPatch(typeof(Contract), "CompleteContract")] + [HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech", "de.morphyum.PersistentMapClient" })] + public static class Contract_CompleteContract { + + static void Postfix(Contract __instance) { + int repairCost = (int)Math.Ceiling(State.CombatDamage) * Mod.Config.LeopardRepairCostPerDamage; + if (repairCost != 0) { + Mod.Log.Debug($"C:CC adding repair costs:{repairCost}"); + int newMoneyResults = Mathf.FloorToInt(__instance.MoneyResults - repairCost); + Traverse traverse = Traverse.Create(__instance).Property("MoneyResults"); + traverse.SetValue(newMoneyResults); + } + } + } + } diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Properties/AssemblyInfo.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Properties/AssemblyInfo.cs index f00a5f4..c327509 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Properties/AssemblyInfo.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.0.0")] -[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyVersion("0.4.0.0")] +[assembly: AssemblyFileVersion("0.4.0.0")] diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/Logger.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/Logger.cs index 667b996..a671653 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/Logger.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/Logger.cs @@ -18,7 +18,8 @@ public Logger(string modDir, string logName) { LogStream = File.AppendText(LogFile); } - public void Debug(string message) { if (Mod.Config.Debug) { Info("[DBG] " + message); } } + public void Debug(string message) { if (Mod.Config.Debug) { Info(message); } } + public void Trace(string message) { if (Mod.Config.Trace) { Info(message); } } public void Info(string message) { string now = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture); diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/ModConfig.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/ModConfig.cs index 1e2508a..016b4e8 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/ModConfig.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/ModConfig.cs @@ -3,9 +3,12 @@ namespace DisorderlyWithdrawal { public class ModConfig { - // If true, extra logging will be used + // If true, troubleshooting logging will be enabled public bool Debug = false; + // If true, all logging will be enabled + public bool Trace = false; + public int LeopardRepairCostPerDamage = 100; public int LightWingMonthlyCost = 50000; diff --git a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/State.cs b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/State.cs index 2250f69..45509f3 100644 --- a/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/State.cs +++ b/DisorderlyWithdrawal/DisorderlyWithdrawal/Utils/State.cs @@ -3,16 +3,31 @@ namespace DisorderlyWithdrawal { - public static class ModState { + public static class State { - public static bool WithdrawalTriggered = false; - public static int RoundsUntilOverhead = -1; - public static int RoundsUntilReady = -1; + public static bool WithdrawStarted = false; + + public static int CanWithdrawOnRound = -1; + public static int CanApproachOnRound = -1; public static HBSDOTweenButton RetreatButton = null; public static TextMeshProUGUI RetreatButtonText = null; public static CombatHUD HUD = null; public static float CombatDamage = 0f; + + public static void Reset() { + // Reinitialize state + WithdrawStarted = false; + + CanWithdrawOnRound = -1; + CanWithdrawOnRound = -1; + + RetreatButton = null; + RetreatButtonText = null; + HUD = null; + + CombatDamage = 0f; + } } } diff --git a/StreamingAssets/data/simGameConversations/5a3845b6623035d41400002a.convo.bytes b/StreamingAssets/data/simGameConversations/5a3845b6623035d41400002a.convo.bytes index f963f943d2c9a80a7e9a98dce1e0ebf541d7787b..e645485027d1b99c69b483c56c5be7aca8708ef2 100644 GIT binary patch delta 34 qcmey|%lx^Qc>~W{#>~yUYjc@-A`|n{)r%E;Q~W{#{A8^Yjc@-!V~k-)r%E;Q