diff --git a/IRTweaks/IRTweaks/ModConfig.cs b/IRTweaks/IRTweaks/ModConfig.cs index 034cc65..2a37a13 100644 --- a/IRTweaks/IRTweaks/ModConfig.cs +++ b/IRTweaks/IRTweaks/ModConfig.cs @@ -19,6 +19,13 @@ public class StoreOpts public int QuantityOnControl = 20; } + public class CheatOpts + { + public bool CheatDetection = true; + public bool CheatDetectionNotify = false; + public string CheatDetectionStat = "CheatFound1"; + } + public class CombatOpts { public int PilotAttributesMax = 13; @@ -161,8 +168,7 @@ public class FixesFlags public bool WeakAgainstMeleeFix = true; // Misc - public bool CheatDetection = true; - public bool CheatDetectionNotify = false; + public bool DisableCampaign = true; public bool DisableLowFundsNotification = true; public bool DisableMPHashCalculation = true; @@ -201,6 +207,7 @@ public class ModConfig public FixesFlags Fixes = new FixesFlags(); public AbilityOpts Abilities = new AbilityOpts(); + public CheatOpts CheatDetection = new CheatOpts(); public CombatOpts Combat = new CombatOpts(); public StoreOpts Store = new StoreOpts(); @@ -260,6 +267,11 @@ public void LogConfig() Mod.Log.Info?.Write($" ApplyToEnemies:{Combat.SpawnProtection.ApplyToEnemies} ApplyToAllies:{Combat.SpawnProtection.ApplyToAllies} ApplyToNeutrals:{Combat.SpawnProtection.ApplyToNeutrals} "); Mod.Log.Info?.Write($" ApplyToReinforcements:{Combat.SpawnProtection.ApplyToReinforcements}"); + Mod.Log.Info?.Write(" -- Cheat Detection --"); + Mod.Log.Info?.Write($" CheatDetection:{CheatDetection.CheatDetection}"); + Mod.Log.Info?.Write($" CheatDetectionNotify:{CheatDetection.CheatDetectionNotify}"); + Mod.Log.Info?.Write($" CheatDetectionStat:{CheatDetection.CheatDetectionStat}"); + Mod.Log.Info?.Write(" -- ObstructionTweaks --"); Mod.Log.Info?.Write($" DRMechLocs:{Combat.ObstructionTweaks.DRMechLocs}"); Mod.Log.Info?.Write($" DRVehicleLocs:{Combat.ObstructionTweaks.DRVehicleLocs}"); diff --git a/IRTweaks/IRTweaks/Modules/Misc/CheatDetection.cs b/IRTweaks/IRTweaks/Modules/Misc/CheatDetection.cs index 2bf464c..5dbf2c9 100644 --- a/IRTweaks/IRTweaks/Modules/Misc/CheatDetection.cs +++ b/IRTweaks/IRTweaks/Modules/Misc/CheatDetection.cs @@ -15,7 +15,7 @@ namespace IRTweaks.Modules.Misc [HarmonyPatch(typeof(Team), "AddUnit")] public static class Mech_AddToTeam { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; //disabled for now + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; //disabled for now public static void Postfix(Team __instance, AbstractActor unit) { @@ -32,7 +32,7 @@ public static void Postfix(Team __instance, AbstractActor unit) [HarmonyPatch(typeof(Mech), "ApplyArmorStatDamage")] public static class Mech_ApplyArmorStatDamage { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; //disabled for now + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; //disabled for now public static void Postfix(Mech __instance) { @@ -51,13 +51,13 @@ public static void Postfix(Mech __instance) if (__instance.CurrentArmor > ModState.UnitCurrentArmor[__instance.GUID]) { - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated armor."); } if (__instance.CurrentArmor > ModState.UnitStartingArmor[__instance.GUID]) { - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated armor."); } @@ -69,7 +69,7 @@ public static void Postfix(Mech __instance) [HarmonyPatch("_heat", MethodType.Setter)] public static class Mech__heat_Setter { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; //disabled for now + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; //disabled for now public static void Postfix(Mech __instance, int value) { @@ -90,7 +90,7 @@ public static void Postfix(Mech __instance, int value) [HarmonyPatch("CurrentHeat", MethodType.Getter)] public static class Mech_CurrentHeat_Getter { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; //disabled for now. this is the one that breaks spawning and CTDs with no errors for some reason. + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; //disabled for now. this is the one that breaks spawning and CTDs with no errors for some reason. public static void Postfix(Mech __instance) { @@ -102,7 +102,7 @@ public static void Postfix(Mech __instance) } if (__instance.CurrentHeat != ModState.UnitCurrentHeat[__instance.GUID]) { - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated heat."); } } @@ -112,7 +112,7 @@ public static void Postfix(Mech __instance) [HarmonyPatch("OnCombatGameDestroyed")] public static class CombatGameState_OnCGSDestroyed { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; //disabled for now + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; //disabled for now public static void Prefix() { ModState.UnitCurrentArmor.Clear(); @@ -129,7 +129,7 @@ public static void Prefix() [HarmonyPatch("ExperienceUnspent", MethodType.Setter)] public static class Pilot_XPUnspent_Setter { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; public static void Postfix(PilotDef __instance, int value) { @@ -138,6 +138,7 @@ public static void Postfix(PilotDef __instance, int value) if (!ModState.PilotDefCurrentFreeXP.ContainsKey(__instance.Description.Id)) { ModState.PilotDefCurrentFreeXP.Add(__instance.Description.Id, __instance.ExperienceUnspent); + } ModState.PilotDefCurrentFreeXP[__instance.Description.Id] = value; } @@ -148,7 +149,7 @@ public static void Postfix(PilotDef __instance, int value) [HarmonyPatch("ExperienceUnspent", MethodType.Getter)] public static class Pilot_XPUnspent_Getter { - static bool Prepare() => Mod.Config.Fixes.CheatDetection && false; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection && false; public static void Postfix(PilotDef __instance) { @@ -168,7 +169,7 @@ public static void Postfix(PilotDef __instance) [HarmonyPatch("FromPilotDef")] public static class Pilot_FromPilotDef { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(Pilot __instance) { @@ -178,11 +179,11 @@ public static void Postfix(Pilot __instance) if (!ModState.PilotCurrentFreeXP.ContainsKey(__instance.GUID)) { ModState.PilotCurrentFreeXP.Add(__instance.GUID, __instance.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Set ExperienceUnspent to UnspentXP value."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Set ExperienceUnspent to UnspentXP value {__instance.UnspentXP} at FromPilotDef."); } ModState.PilotCurrentFreeXP[__instance.GUID] = __instance.pilotDef.ExperienceUnspent; - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: PilotCurrentXP now {ModState.PilotCurrentFreeXP[__instance.GUID]} after setting to {__instance.pilotDef.ExperienceUnspent}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: PilotCurrentXP now {ModState.PilotCurrentFreeXP[__instance.GUID]} after setting to {__instance.pilotDef.ExperienceUnspent} at FromPilotDef, Post."); } } @@ -190,7 +191,7 @@ public static void Postfix(Pilot __instance) [HarmonyPatch("AddExperience")] public static class Pilot_AddXP { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(Pilot __instance, int stackID, string sourceID, int value) { @@ -200,11 +201,12 @@ public static void Postfix(Pilot __instance, int stackID, string sourceID, int v if (!ModState.PilotCurrentFreeXP.ContainsKey(__instance.GUID)) { ModState.PilotCurrentFreeXP.Add(__instance.GUID, __instance.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Added key to PilotCurrentXP with {__instance.UnspentXP} UnspentXP value."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Added key to PilotCurrentXP with {__instance.UnspentXP} UnspentXP value at AddExperience, Post."); + return; } ModState.PilotCurrentFreeXP[__instance.GUID] += value; - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: PilotCurrentXP now {ModState.PilotCurrentFreeXP[__instance.GUID]} after adding {value}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: PilotCurrentXP now {ModState.PilotCurrentFreeXP[__instance.GUID]} after adding {value} at AddExperience, Post."); } } @@ -214,7 +216,7 @@ public static void Postfix(Pilot __instance, int stackID, string sourceID, int v [HarmonyPatch("SpendExperience")] public static class Pilot_SpendXP { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Prefix(Pilot __instance) { @@ -224,7 +226,7 @@ public static void Prefix(Pilot __instance) if (!ModState.PilotCurrentFreeXP.ContainsKey(__instance.GUID)) { ModState.PilotCurrentFreeXP.Add(__instance.GUID, __instance.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Added key to PilotCurrentXP with {__instance.UnspentXP} UnspentXP value."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Added key to PilotCurrentXP with {__instance.UnspentXP} UnspentXP value at SpendExperience, Pre."); } } @@ -233,21 +235,16 @@ public static void Postfix(Pilot __instance, int stackID, string sourceID, uint var sim = UnityGameInstance.BattleTechGame.Simulation; if (sim == null) return; if (String.IsNullOrEmpty(__instance.GUID)) return; - if (!ModState.PilotCurrentFreeXP.ContainsKey(__instance.GUID)) - { - ModState.PilotCurrentFreeXP.Add(__instance.GUID, __instance.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: Added key to PilotCurrentXP with UnspentXP value."); - } ModState.PilotCurrentFreeXP[__instance.GUID] -= (int)value; - Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: pilot UnspentXP was {__instance.UnspentXP} after subtracting {value}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: pilot UnspentXP was {__instance.UnspentXP} after subtracting {value} at SpendExperience, Post."); if (__instance.UnspentXP != ModState.PilotCurrentFreeXP[__instance.GUID]) { Mod.Log.Info?.Write($"CHEATDETECTION: {__instance.Description.Id}: pilot UnspentXP was {__instance.UnspentXP} but state variable was {ModState.PilotCurrentFreeXP[__instance.GUID]}."); - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated experience."); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); } } } @@ -255,7 +252,7 @@ public static void Postfix(Pilot __instance, int stackID, string sourceID, uint [HarmonyPatch(typeof(SGBarracksMWDetailPanel), "OnPilotReset")] public static class SGBarracksMWDetailPanel_OnPilotReset { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(SGBarracksMWDetailPanel __instance, Pilot ___tempPilot, Pilot ___curPilot) { var sim = UnityGameInstance.BattleTechGame.Simulation; @@ -264,19 +261,19 @@ public static void Postfix(SGBarracksMWDetailPanel __instance, Pilot ___tempPilo if (!ModState.PilotCurrentFreeXP.ContainsKey(___curPilot.GUID)) { ModState.PilotCurrentFreeXP.Add(___curPilot.GUID, ___curPilot.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP value, but should have been done already"); + Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP {___curPilot.UnspentXP} but should have been done already. At OnPilotReset, Post."); } ModState.PilotCurrentFreeXP[___curPilot.GUID] = ___curPilot.UnspentXP; Mod.Log.Info?.Write( - $"CHEATDETECTION: {___curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[___curPilot.GUID]} after changing to basePilot {___curPilot.UnspentXP}"); + $"CHEATDETECTION: {___curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[___curPilot.GUID]} after changing to basePilot {___curPilot.UnspentXP} at OnPilotReset, Post."); } } [HarmonyPatch(typeof(SGBarracksWidget), "ReceiveButtonPress")] public static class SGBarracksWidget_ReceiveButtonPress { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(SGBarracksWidget __instance, string button, SGBarracksMWDetailPanel ___mechWarriorDetails) { if (button != "Close") return; @@ -288,11 +285,11 @@ public static void Postfix(SGBarracksWidget __instance, string button, SGBarrack if (!ModState.PilotCurrentFreeXP.ContainsKey(curPilot.GUID)) { ModState.PilotCurrentFreeXP.Add(curPilot.GUID, curPilot.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP value, but should have been done already"); + Mod.Log.Info?.Write($"CHEATDETECTION: {curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP {curPilot.UnspentXP} but should have been done already. At SGBarracksWidget.ReceiveButtonPress, Post."); } ModState.PilotCurrentFreeXP[curPilot.GUID] = curPilot.UnspentXP; - Mod.Log.Info?.Write($"CHEATDETECTION: {curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[curPilot.GUID]} after changing to basePilot {curPilot.UnspentXP}"); + Mod.Log.Info?.Write($"CHEATDETECTION: {curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[curPilot.GUID]} after changing to basePilot {curPilot.UnspentXP} At SGBarracksWidget.ReceiveButtonPress, Post."); } } @@ -304,7 +301,7 @@ public static void Postfix(SGBarracksWidget __instance, string button, SGBarrack [HarmonyPriority(Priority.First)] public static class SGBarracksAdvancementPanel_OnValueClick_Patch { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Prefix(SGBarracksAdvancementPanel __instance, Pilot ___curPilot, Pilot ___basePilot, List ___gunPips, List ___pilotPips, List ___gutPips, List ___tacPips, string type, int value) @@ -317,11 +314,11 @@ public static void Prefix(SGBarracksAdvancementPanel __instance, Pilot ___curPil if (!ModState.PilotCurrentFreeXP.ContainsKey(___curPilot.GUID)) { ModState.PilotCurrentFreeXP.Add(___curPilot.GUID, ___curPilot.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP value, but should have been done already"); + Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Added key to PilotCurrentXP with UnspentXP {___curPilot.UnspentXP} but should have been done already. At SGBarracksAdvancementPanel.OnValueClick, Pre."); } ModState.PilotCurrentFreeXP[___curPilot.GUID] = ___basePilot.UnspentXP; - Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[___curPilot.GUID]} after changing to basePilot {___basePilot.UnspentXP}"); + Mod.Log.Info?.Write($"CHEATDETECTION: {___curPilot.Description.Id}: Free XP state was {ModState.PilotCurrentFreeXP[___curPilot.GUID]} after changing to basePilot {___basePilot.UnspentXP} At SGBarracksAdvancementPanel.OnValueClick, Pre."); } } } @@ -330,7 +327,7 @@ public static void Prefix(SGBarracksAdvancementPanel __instance, Pilot ___curPil [HarmonyPatch("AddFunds")] public static class SimGameState_AddFunds { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Prefix(SimGameState __instance, int val) { @@ -338,12 +335,12 @@ public static void Prefix(SimGameState __instance, int val) if (!ModState.SimGameFunds.ContainsKey(__instance.InstanceGUID)) { ModState.SimGameFunds.Add(__instance.InstanceGUID, __instance.Funds); - Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds}; this should have been done already...WTF"); + Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds}; this should have been done already...WTF. At AddFunds, Pre."); } if (__instance.Funds != ModState.SimGameFunds[__instance.InstanceGUID]) { - __instance.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); - Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]}"); + __instance.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); + Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]} at AddFunds, Pre"); } } @@ -352,15 +349,15 @@ public static void Postfix(SimGameState __instance, int val) if (!ModState.SimGameFunds.ContainsKey(__instance.InstanceGUID)) { ModState.SimGameFunds.Add(__instance.InstanceGUID, __instance.Funds); - Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds}; this should have been done already...WTF"); + Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds}; this should have been done already...WTF. At Addfunds, Post"); } ModState.SimGameFunds[__instance.InstanceGUID] += val; if (__instance.Funds != ModState.SimGameFunds[__instance.InstanceGUID]) { - __instance.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); - Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]} after adding {val}"); + __instance.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); + Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]} after adding {val} at AddFunds, Post"); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); } } @@ -371,7 +368,7 @@ public static void Postfix(SimGameState __instance, int val) public static class SGS_SetSimGameStat { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollection statCol) { var sim = UnityGameInstance.BattleTechGame.Simulation; @@ -389,7 +386,7 @@ public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollec { ModState.PilotCurrentFreeXP.Add(pilot.GUID, pilot.UnspentXP); Mod.Log.Info?.Write( - $"CHEATDETECTION: Added key to ExperienceUnspent with ExperienceUnspent {pilot.UnspentXP}; this should have been done already...WTF"); + $"CHEATDETECTION: Added key to ExperienceUnspent with ExperienceUnspent {pilot.UnspentXP}; this should have been done already...WTF. At SetSimGameStat, Post."); } var val = stat.ToInt(); @@ -402,11 +399,11 @@ public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollec ModState.PilotCurrentFreeXP[pilot.GUID] += val; if (pilot.UnspentXP != ModState.PilotCurrentFreeXP[pilot.GUID]) { - Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: pilot UnspentXP was {pilot.UnspentXP} but state variable was {ModState.PilotCurrentFreeXP[pilot.GUID]}."); - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: pilot UnspentXP was {pilot.UnspentXP} but state variable was {ModState.PilotCurrentFreeXP[pilot.GUID]}. At SetSimGameStat, Post."); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated experience."); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder .Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.") .AddButton("Okay", null, true, null).CancelOnEscape() @@ -422,13 +419,12 @@ public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollec if (statCol == sim.CompanyStats) { - Mod.Log.Info?.Write($"Found scope of company stats (can remove this from logging eventually)"); if (stat.name == "Funds" && (stat.Type == typeof(int) || stat.typeString == "System.Int32")) { if (!ModState.SimGameFunds.ContainsKey(sim.InstanceGUID)) { ModState.SimGameFunds.Add(sim.InstanceGUID, sim.Funds); - Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {sim.Funds}; this should have been done already...WTF"); + Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {sim.Funds}; this should have been done already...WTF, At SetSimGameStat, Post."); } var val = stat.ToInt(); @@ -441,10 +437,10 @@ public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollec ModState.SimGameFunds[sim.InstanceGUID] += val; if (sim.Funds != ModState.SimGameFunds[sim.InstanceGUID]) { - sim.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); - Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {sim.Funds} while tracker funds {ModState.SimGameFunds[sim.InstanceGUID]} after adding {stat}"); + sim.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); + Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {sim.Funds} while tracker funds {ModState.SimGameFunds[sim.InstanceGUID]} after adding {stat}. At SetSimGameStat, Post."); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); } } } @@ -458,19 +454,19 @@ public static void Postfix(SimGameState __instance, SimGameStat stat, StatCollec [HarmonyPatch("Rehydrate")] public static class SimGameState_Rehydrate_CH { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Postfix(SimGameState __instance) { if (!ModState.SimGameFunds.ContainsKey(__instance.InstanceGUID)) { ModState.SimGameFunds.Add(__instance.InstanceGUID, __instance.Funds); - Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds} on rehydrate."); + Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds} on rehydrate, post."); } else { ModState.SimGameFunds[__instance.InstanceGUID] = __instance.Funds; - Mod.Log.Info?.Write($"CHEATDETECTION: Set ModState.SimGameFunds to {__instance.Funds} on rehydrate."); + Mod.Log.Info?.Write($"CHEATDETECTION: Set ModState.SimGameFunds to {__instance.Funds} on rehydrate, post."); } var currentPilots = new List(__instance.PilotRoster); @@ -481,12 +477,12 @@ public static void Postfix(SimGameState __instance) if (!ModState.PilotCurrentFreeXP.ContainsKey(pilot.GUID)) { ModState.PilotCurrentFreeXP.Add(pilot.GUID, pilot.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Added key to PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Added key to PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP} on rehydrate, post."); } else { ModState.PilotCurrentFreeXP[pilot.GUID] = pilot.UnspentXP; - Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Set tracker PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Set tracker PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP} on rehydrate, post."); } } } @@ -497,22 +493,22 @@ public static void Postfix(SimGameState __instance) [HarmonyPatch("Dehydrate")] public static class SimGameState_Dehydrate_CH { - static bool Prepare() => Mod.Config.Fixes.CheatDetection; + static bool Prepare() => Mod.Config.CheatDetection.CheatDetection; public static void Prefix(SimGameState __instance) { if (!ModState.SimGameFunds.ContainsKey(__instance.InstanceGUID)) { ModState.SimGameFunds.Add(__instance.InstanceGUID, __instance.Funds); - Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds} on dehydrate."); + Mod.Log.Info?.Write($"CHEATDETECTION: Added key to SimGameFunds with Funds {__instance.Funds} on dehydrate, pre."); } if (__instance.Funds != ModState.SimGameFunds[__instance.InstanceGUID]) { - __instance.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); - Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]}"); + __instance.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); + Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated money. SGS Funds: {__instance.Funds} while tracker funds {ModState.SimGameFunds[__instance.InstanceGUID]} on dehydrate, pre"); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder.Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.").AddButton("Okay", null, true, null).CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior.Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); } @@ -524,16 +520,16 @@ public static void Prefix(SimGameState __instance) if (!ModState.PilotCurrentFreeXP.ContainsKey(pilot.GUID)) { ModState.PilotCurrentFreeXP.Add(pilot.GUID, pilot.UnspentXP); - Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Added key to PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP}."); + Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: Added key to PilotCurrentXP with ExperienceUnspent {pilot.UnspentXP} on dehydrate, pre."); } if (pilot.UnspentXP != ModState.PilotCurrentFreeXP[pilot.GUID]) { - Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: pilot UnspentXP was {pilot.UnspentXP} but state variable was {ModState.PilotCurrentFreeXP[pilot.GUID]}."); - __instance.CompanyStats.AddStatistic("CheaterCheaterPumpkinEater", true); + Mod.Log.Info?.Write($"CHEATDETECTION: {pilot.Description.Id}: pilot UnspentXP was {pilot.UnspentXP} but state variable was {ModState.PilotCurrentFreeXP[pilot.GUID]} on dehydrate, pre."); + __instance.CompanyStats.AddStatistic(Mod.Config.CheatDetection.CheatDetectionStat, true); Mod.Log.Info?.Write($"CHEATDETECTION: Caught you, you little shit. Cheated experience."); - if (Mod.Config.Fixes.CheatDetectionNotify) GenericPopupBuilder + if (Mod.Config.CheatDetection.CheatDetectionNotify) GenericPopupBuilder .Create("CHEAT DETECTED!", "t-bone thinks you're cheating. if you aren't, you should let the RT crew know on Discord.") .AddButton("Okay", null, true, null).CancelOnEscape() diff --git a/IRTweaks/IRTweaks/Properties/AssemblyInfo.cs b/IRTweaks/IRTweaks/Properties/AssemblyInfo.cs index d3e268d..b0ad7c8 100644 --- a/IRTweaks/IRTweaks/Properties/AssemblyInfo.cs +++ b/IRTweaks/IRTweaks/Properties/AssemblyInfo.cs @@ -31,5 +31,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.9.2.4")] -[assembly: AssemblyFileVersion("0.9.2.4")] +[assembly: AssemblyVersion("0.9.2.5")] +[assembly: AssemblyFileVersion("0.9.2.5")]