diff --git a/project/SPT.Core/Patches/WebSocketPatch.cs b/project/SPT.Core/Patches/WebSocketPatch.cs index 49910be..c8cc78d 100644 --- a/project/SPT.Core/Patches/WebSocketPatch.cs +++ b/project/SPT.Core/Patches/WebSocketPatch.cs @@ -1,5 +1,5 @@ +using HarmonyLib; using SPT.Reflection.Patching; -using SPT.Reflection.Utils; using System; using System.Reflection; @@ -9,10 +9,7 @@ namespace SPT.Core.Patches { protected override MethodBase GetTargetMethod() { - var targetInterface = PatchConstants.EftTypes.SingleCustom(x => x == typeof(IConnectionHandler) && x.IsInterface); - var typeThatMatches = PatchConstants.EftTypes.SingleCustom(x => targetInterface.IsAssignableFrom(x) && x.IsAbstract && !x.IsInterface); - - return typeThatMatches.GetMethods(BindingFlags.Public | BindingFlags.Instance).SingleCustom(x => x.ReturnType == typeof(Uri)); + return AccessTools.Method(typeof(UriParamsClass), nameof(UriParamsClass.method_0)); } // This is a pass through postfix and behaves a little differently than usual diff --git a/project/SPT.Custom/BTR/BTRRoadKillTrigger.cs b/project/SPT.Custom/BTR/BTRRoadKillTrigger.cs index e4cd4fa..5f92490 100644 --- a/project/SPT.Custom/BTR/BTRRoadKillTrigger.cs +++ b/project/SPT.Custom/BTR/BTRRoadKillTrigger.cs @@ -8,7 +8,7 @@ namespace SPT.Custom.BTR { public override bool IsStatic => false; - public override void AddPenalty(GInterface106 player) + public override void AddPenalty(IPlayerOwner player) { } @@ -16,7 +16,7 @@ namespace SPT.Custom.BTR { } - public override void ProceedDamage(GInterface106 player, BodyPartCollider bodyPart) + public override void ProceedDamage(IPlayerOwner player, BodyPartCollider bodyPart) { bodyPart.ApplyInstantKill(new DamageInfo() { @@ -31,7 +31,7 @@ namespace SPT.Custom.BTR }); } - public override void RemovePenalty(GInterface106 player) + public override void RemovePenalty(IPlayerOwner player) { } } diff --git a/project/SPT.Custom/BTR/Patches/BTRActivateTraderDialogPatch.cs b/project/SPT.Custom/BTR/Patches/BTRActivateTraderDialogPatch.cs index 193152c..f6874d2 100644 --- a/project/SPT.Custom/BTR/Patches/BTRActivateTraderDialogPatch.cs +++ b/project/SPT.Custom/BTR/Patches/BTRActivateTraderDialogPatch.cs @@ -6,7 +6,7 @@ using EFT.Vehicle; using HarmonyLib; using System; using System.Reflection; -using BTRDialog = EFT.UI.TraderDialogScreen.GClass3157; +using BTRDialog = EFT.UI.TraderDialogScreen.BTRDialogClass; namespace SPT.Custom.BTR.Patches { diff --git a/project/SPT.Custom/CustomAI/AiHelpers.cs b/project/SPT.Custom/CustomAI/AiHelpers.cs index 804f848..bbc1979 100644 --- a/project/SPT.Custom/CustomAI/AiHelpers.cs +++ b/project/SPT.Custom/CustomAI/AiHelpers.cs @@ -1,5 +1,4 @@ -using SPT.PrePatch; -using EFT; +using EFT; namespace SPT.Custom.CustomAI { diff --git a/project/SPT.Custom/Patches/CustomAiPatch.cs b/project/SPT.Custom/Patches/CustomAiPatch.cs index 5aaec07..b8f2b10 100644 --- a/project/SPT.Custom/Patches/CustomAiPatch.cs +++ b/project/SPT.Custom/Patches/CustomAiPatch.cs @@ -3,7 +3,6 @@ using EFT; using System; using Comfort.Common; using System.Reflection; -using SPT.PrePatch; using SPT.Custom.CustomAI; using HarmonyLib; diff --git a/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs b/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs index f34c854..f2af68d 100644 --- a/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs +++ b/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs @@ -31,7 +31,7 @@ namespace SPT.Custom.Patches var player = Singleton.Instance.MainPlayer; if (profileId == player?.Profile.Id) { - GClass3131.Instance.CloseAllScreensForced(); + CurrentScreenSingleton.Instance.CloseAllScreensForced(); } return true; diff --git a/project/SPT.Custom/Patches/IsEnemyPatch.cs b/project/SPT.Custom/Patches/IsEnemyPatch.cs index 7dfd8f5..1813f39 100644 --- a/project/SPT.Custom/Patches/IsEnemyPatch.cs +++ b/project/SPT.Custom/Patches/IsEnemyPatch.cs @@ -22,6 +22,13 @@ namespace SPT.Custom.Patches [PatchPrefix] private static bool PatchPrefix(ref bool __result, BotsGroup __instance, IPlayer requester) { + if (requester == null) + { + __result = false; + + return false; // Skip original + } + if (__instance.InitialBotType == WildSpawnType.peacefullZryachiyEvent || __instance.InitialBotType == WildSpawnType.shooterBTR || __instance.InitialBotType == WildSpawnType.gifter diff --git a/project/SPT.Custom/Patches/LocationLootCacheBustingPatch.cs b/project/SPT.Custom/Patches/LocationLootCacheBustingPatch.cs index 4fd83e8..a393165 100644 --- a/project/SPT.Custom/Patches/LocationLootCacheBustingPatch.cs +++ b/project/SPT.Custom/Patches/LocationLootCacheBustingPatch.cs @@ -2,6 +2,8 @@ using SPT.Reflection.Patching; using SPT.Reflection.Utils; using System.Reflection; using EFT; +using HarmonyLib; +using System.Linq; namespace SPT.Custom.Patches { diff --git a/project/SPT.Custom/Patches/PmcFirstAidPatch.cs b/project/SPT.Custom/Patches/PmcFirstAidPatch.cs index a5db7da..d620890 100644 --- a/project/SPT.Custom/Patches/PmcFirstAidPatch.cs +++ b/project/SPT.Custom/Patches/PmcFirstAidPatch.cs @@ -1,5 +1,4 @@ -using SPT.PrePatch; -using SPT.Reflection.Patching; +using SPT.Reflection.Patching; using SPT.Reflection.Utils; using EFT; using System; diff --git a/project/SPT.Custom/Patches/RagfairFeePatch.cs b/project/SPT.Custom/Patches/RagfairFeePatch.cs index 6fe4726..e06f680 100644 --- a/project/SPT.Custom/Patches/RagfairFeePatch.cs +++ b/project/SPT.Custom/Patches/RagfairFeePatch.cs @@ -17,8 +17,8 @@ namespace SPT.Custom.Patches public RagfairFeePatch() { // Remember to update prefix parameter if below lines are broken - _ = nameof(GClass3091.IsAllSelectedItemSame); - _ = nameof(GClass3091.AutoSelectSimilar); + _ = nameof(RagfairOfferSellHelperClass.IsAllSelectedItemSame); + _ = nameof(RagfairOfferSellHelperClass.AutoSelectSimilar); } protected override MethodBase GetTargetMethod() @@ -34,14 +34,14 @@ namespace SPT.Custom.Patches /// RequirementsPrice /// SellInOnePiece [PatchPrefix] - private static void PatchPrefix(ref Item ___item_0, ref GClass3091 ___gclass3091_0, ref double ___double_0, ref bool ___bool_0) + private static void PatchPrefix(ref Item ___item_0, ref RagfairOfferSellHelperClass ___ragfairOfferSellHelperClass, ref double ___double_0, ref bool ___bool_0) { RequestHandler.PutJson("/client/ragfair/offerfees", new { id = ___item_0.Id, tpl = ___item_0.TemplateId, - count = ___gclass3091_0.OfferItemCount, - fee = Mathf.CeilToInt((float)GClass2105.CalculateTaxPrice(___item_0, ___gclass3091_0.OfferItemCount, ___double_0, ___bool_0)) + count = ___ragfairOfferSellHelperClass.OfferItemCount, + fee = Mathf.CeilToInt((float)FleaTaxCalculatorAbstractClass.CalculateTaxPrice(___item_0, ___ragfairOfferSellHelperClass.OfferItemCount, ___double_0, ___bool_0)) }.ToJson()); } } diff --git a/project/SPT.Debugging/Patches/BTRDebugCommandPatch.cs b/project/SPT.Debugging/Patches/BTRDebugCommandPatch.cs index 8fd53e7..81a0b81 100644 --- a/project/SPT.Debugging/Patches/BTRDebugCommandPatch.cs +++ b/project/SPT.Debugging/Patches/BTRDebugCommandPatch.cs @@ -5,7 +5,6 @@ using EFT; using EFT.UI; using HarmonyLib; using System.Reflection; -using DialogControlClass = GClass1973; namespace SPT.Debugging.Patches { @@ -20,7 +19,7 @@ namespace SPT.Debugging.Patches [PatchPostfix] internal static void PatchPostfix() { - ConsoleScreen.Processor.RegisterCommandGroup(); + ConsoleScreen.Processor.RegisterCommandGroup(); ConsoleScreen.Processor.RegisterCommand("btr_deliver_items", new System.Action(BtrDeliverItemsCommand)); } @@ -36,7 +35,7 @@ namespace SPT.Debugging.Patches { protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(DialogControlClass), nameof(DialogControlClass.ShowDialogScreen)); + return AccessTools.Method(typeof(TraderDialogInteractionScreenClass), nameof(TraderDialogInteractionScreenClass.ShowDialogScreen)); } [PatchPrefix] diff --git a/project/SPT.Debugging/Patches/ExfilDumper.cs b/project/SPT.Debugging/Patches/ExfilDumper.cs index f541f16..e28fcda 100644 --- a/project/SPT.Debugging/Patches/ExfilDumper.cs +++ b/project/SPT.Debugging/Patches/ExfilDumper.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using ExitSettingsClass = GClass1234; namespace SPT.Debugging.Patches { @@ -23,7 +22,7 @@ namespace SPT.Debugging.Patches } [PatchPostfix] - public static void PatchPreFix(ExitSettingsClass[] settings) + public static void PatchPreFix(LocationExitClass[] settings) { var gameWorld = Singleton.Instance; string mapName = gameWorld.MainPlayer.Location.ToLower(); @@ -37,7 +36,7 @@ namespace SPT.Debugging.Patches foreach (var exfil in pmcExfilPoints.Concat(scavExfilPoints)) { - ExitSettingsClass exitSettings = settings.FirstOrDefault(x => x.Name == exfil.Settings.Name); + LocationExitClass exitSettings = settings.FirstOrDefault(x => x.Name == exfil.Settings.Name); exfils.Add(new SPTExfilData(exfil, exitSettings)); } @@ -73,7 +72,7 @@ namespace SPT.Debugging.Patches public string RequirementTip = ""; public string Side = ""; - public SPTExfilData(ExfiltrationPoint point, ExitSettingsClass settings) + public SPTExfilData(ExfiltrationPoint point, LocationExitClass settings) { // PMC and shared extracts, prioritize settings over the map data to match base behaviour if (settings != null && (!(point is ScavExfiltrationPoint) || point is SharedExfiltrationPoint)) diff --git a/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs b/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs index 9356ebc..aec68bc 100644 --- a/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs +++ b/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs @@ -20,7 +20,7 @@ namespace SPT.Debugging.Patches public SptSpawnHelper() { - IEnumerable locationSpawnPoints = GClass2949.CreateFromScene(); + IEnumerable locationSpawnPoints = SpawnPointManagerClass.CreateFromScene(); var playerSpawns = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList(); this.playerSpawnPoints = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList(); @@ -61,7 +61,7 @@ namespace SPT.Debugging.Patches } [PatchPrefix] - public static bool PatchPrefix(GClass1483 __instance, GClass591 data) + public static bool PatchPrefix(GClass1483 __instance, BotCreationDataClass data) { var firstBotRole = data.Profiles[0].Info.Settings.Role; if (firstBotRole != WildSpawnType.pmcBEAR || firstBotRole != WildSpawnType.pmcUSEC) diff --git a/project/SPT.SinglePlayer/Models/Progression/LighthouseProgressionClass.cs b/project/SPT.SinglePlayer/Models/Progression/LighthouseProgressionClass.cs index ebdebc2..6021931 100644 --- a/project/SPT.SinglePlayer/Models/Progression/LighthouseProgressionClass.cs +++ b/project/SPT.SinglePlayer/Models/Progression/LighthouseProgressionClass.cs @@ -120,14 +120,14 @@ namespace SPT.SinglePlayer.Models.Progression /// /// Set all brdige mines to desire state /// - /// What state mines should be - private void SetBridgeMinesStatus(bool active) + /// What state should bridge mines be set to + private void SetBridgeMinesStatus(bool desiredMineState) { - // Find mines with opposite state of what we want - foreach (var mine in _bridgeMines.Where(mine => mine.gameObject.activeSelf == !active && mine.transform.parent.gameObject.name == "Directional_mines_LHZONE")) + var mines = _bridgeMines.Where(mine => mine.gameObject.activeSelf == !desiredMineState && mine.transform.parent.gameObject.name == "Directional_mines_LHZONE"); + foreach (var mine in mines) { - mine.gameObject.SetActive(active); + mine.gameObject.SetActive(desiredMineState); } } @@ -137,7 +137,7 @@ namespace SPT.SinglePlayer.Models.Progression /// private void SetupZryachiyAndFollowerHostility() { - // only process non-players (ai) + // Only process non-players (ai) foreach (var aiBot in _gameWorld.AllAlivePlayersList.Where(x => !x.IsYourPlayer)) { // Bots that die on mounted guns get stuck in AllAlivePlayersList, need to check health @@ -150,16 +150,7 @@ namespace SPT.SinglePlayer.Models.Progression if (aiBot.AIData.BotOwner.IsRole(WildSpawnType.bossZryachiy) || aiBot.AIData.BotOwner.IsRole(WildSpawnType.followerZryachiy)) { // Subscribe to bots OnDeath event - aiBot.OnPlayerDeadOrUnspawn += player1 => - { - // If player kills zryachiy or follower, force aggressor state - // Also set players Lk standing to negative (allows access to quest chain (Making Amends)) - if (player1?.KillerId == _player?.ProfileId) - { - _aggressor = true; - _player?.Profile.TradersInfo[_lightKeeperTid].SetStanding(-0.01); - } - }; + aiBot.OnPlayerDeadOrUnspawn += OnZryachiyOrFollowerDeath; // Save bot to list for later access if (!_zryachiyAndFollowers.Contains(aiBot)) @@ -170,6 +161,22 @@ namespace SPT.SinglePlayer.Models.Progression } } + /// + /// Set aggression + standing loss when Zryachiy/follower is killed by player + /// + /// The player who killed Zryachiy/follower. + private void OnZryachiyOrFollowerDeath(Player player) + { + // Check if zryachiy/follower was killed by player + if (player?.KillerId == _player?.ProfileId) + { + // If player kills zryachiy or follower, force aggressor state + // Also set players Lk standing to negative (allows access to quest chain (Making Amends)) + _aggressor = true; + _player?.Profile.TradersInfo[_lightKeeperTid].SetStanding(-0.01); + } + } + /// /// Disable door + set transmitter to 'red' /// diff --git a/project/SPT.SinglePlayer/Patches/RaidFix/GetNewBotTemplatesPatch.cs b/project/SPT.SinglePlayer/Patches/RaidFix/GetNewBotTemplatesPatch.cs index 29b2aa9..88d6dbb 100644 --- a/project/SPT.SinglePlayer/Patches/RaidFix/GetNewBotTemplatesPatch.cs +++ b/project/SPT.SinglePlayer/Patches/RaidFix/GetNewBotTemplatesPatch.cs @@ -44,7 +44,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix /// BotsPresets.GetNewProfile() /// [PatchPrefix] - private static bool PatchPrefix(ref Task __result, BotsPresets __instance, List ___list_0, GClass591 data, ref bool withDelete) + private static bool PatchPrefix(ref Task __result, BotsPresets __instance, List ___list_0, BotCreationDataClass data, ref bool withDelete) { /* When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition) diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs index 5fc583c..473ab63 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs @@ -124,7 +124,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode .Single(field => field.FieldType == typeof(MatchmakerPlayerControllerClass)) ?.GetValue(menuController) as MatchmakerPlayerControllerClass; - var gclass = new MatchmakerOfflineRaidScreen.GClass3182(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular); + var gclass = new MatchmakerOfflineRaidScreen.CreateRaidSettingsForProfileClass(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular); gclass.OnShowNextScreen += LoadOfflineRaidNextScreen; diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs index 5dd0e23..99d985d 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs @@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode protected override MethodBase GetTargetMethod() { // Correct Gclass has sessionCounters - return AccessTools.Method(typeof(GClass1802), nameof(GClass1802.OnEnemyKill)); + return AccessTools.Method(typeof(LocationStatisticsCollectorAbstractClass), nameof(LocationStatisticsCollectorAbstractClass.OnEnemyKill)); } [PatchPrefix] diff --git a/project/SPT.SinglePlayer/Utils/TraderServices/TraderServicesManager.cs b/project/SPT.SinglePlayer/Utils/TraderServices/TraderServicesManager.cs index c3287cd..6226d30 100644 --- a/project/SPT.SinglePlayer/Utils/TraderServices/TraderServicesManager.cs +++ b/project/SPT.SinglePlayer/Utils/TraderServices/TraderServicesManager.cs @@ -10,8 +10,6 @@ using System.Linq; using System.Reflection; using UnityEngine; using static BackendConfigSettingsClass; -using TraderServiceClass = GClass1806; -using QuestDictClass = GClass2147; using StandingListClass = GClass2149; namespace SPT.SinglePlayer.Utils.TraderServices @@ -86,7 +84,7 @@ namespace SPT.SinglePlayer.Utils.TraderServices // Only populate trader services that don't exist yet if (!servicesData.ContainsKey(traderServiceModel.ServiceType)) { - TraderServiceClass traderService = new TraderServiceClass + TraderServicesClass traderService = new TraderServicesClass { TraderId = traderId, ServiceType = serviceType, @@ -110,12 +108,12 @@ namespace SPT.SinglePlayer.Utils.TraderServices serviceData.TraderServiceRequirements.Standings.AddRange(traderServiceModel.Requirements.Standings); // BSG has a bug in their code, we _need_ to initialize this if Standings isn't null - serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictClass(); + serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictionaryClass(); } if (traderServiceModel.Requirements.CompletedQuests != null) { - serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictClass(); + serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictionaryClass(); serviceData.TraderServiceRequirements.CompletedQuests.Concat(traderServiceModel.Requirements.CompletedQuests); } } diff --git a/project/Shared/Hollowed/hollowed.dll b/project/Shared/Hollowed/hollowed.dll index 9dd4191..6cd6700 100644 Binary files a/project/Shared/Hollowed/hollowed.dll and b/project/Shared/Hollowed/hollowed.dll differ