diff --git a/References/Assembly-CSharp.dll b/References/Assembly-CSharp.dll index 0ac51357..cdd90f40 100644 Binary files a/References/Assembly-CSharp.dll and b/References/Assembly-CSharp.dll differ diff --git a/Source/AkiSupport/Singleplayer/Patches/Healing/PostRaidHealScreenPatch.cs b/Source/AkiSupport/Singleplayer/Patches/Healing/PostRaidHealScreenPatch.cs index 01ba0eef..f01e627a 100644 --- a/Source/AkiSupport/Singleplayer/Patches/Healing/PostRaidHealScreenPatch.cs +++ b/Source/AkiSupport/Singleplayer/Patches/Healing/PostRaidHealScreenPatch.cs @@ -7,8 +7,7 @@ public class PostRaidHealScreenPatch : ModulePatch { protected override MethodBase GetTargetMethod() { - var desiredType = typeof(ProfileChangeHandler); - return ReflectionHelpers.GetMethodForType(desiredType, "smethod_0"); + return ReflectionHelpers.GetMethodForType(typeof(Operation42), "smethod_0"); } [PatchPrefix] diff --git a/Source/Coop/ASITGame.cs b/Source/Coop/ASITGame.cs index 57d53fbf..13a10b5f 100644 --- a/Source/Coop/ASITGame.cs +++ b/Source/Coop/ASITGame.cs @@ -14,7 +14,7 @@ public abstract class ASITGame : BaseLocalGame, IBotGame { public new bool InRaid { get { return true; } } - public IBackEndSession BackEndSession { get { return StayInTarkovHelperConstants.BackEndSession; } } + public ISession BackEndSession { get { return StayInTarkovHelperConstants.BackEndSession; } } BotsController IBotGame.BotsController { @@ -72,7 +72,7 @@ InputTree inputTree , Callback callback , float fixedDeltaTime , EUpdateQueue updateQueue - , IBackEndSession backEndSession + , ISession backEndSession , TimeSpan sessionTime) where T : ASITGame { @@ -93,7 +93,7 @@ InputTree inputTree (null, new object[] { r.gameObject , location.waves - , new Action((wave) => r.PBotsController.ActivateBotsByWave(wave)) + , new Action((wave) => r.PBotsController.ActivateBotsByWave(wave)) , location }); var bosswavemanagerValue = ReflectionHelpers.GetMethodForType(typeof(BossWaveManager), "smethod_0").Invoke diff --git a/Source/Coop/Components/ActionPacketHandlerComponent.cs b/Source/Coop/Components/ActionPacketHandlerComponent.cs index cf2c8e82..b60c382c 100644 --- a/Source/Coop/Components/ActionPacketHandlerComponent.cs +++ b/Source/Coop/Components/ActionPacketHandlerComponent.cs @@ -250,62 +250,19 @@ bool ProcessPlayerPacket(Dictionary packet) return false; } - //var profilePlayers = Players.Where(x => x.Key == profileId && x.Value != null).ToArray(); - - // --------------------------------------------------- - // Causes instance reference errors? - //var plyr = Singleton.Instance.GetAlivePlayerByProfileID(profileId);// Players[profileId]; - - // --------------------------------------------------- - // if (!Players.ContainsKey(profileId)) return false; var plyr = Players[profileId]; - bool processed = false; - - //foreach (var plyr in profilePlayers) - { - //if (plyr.Value.TryGetComponent(out var prc)) - var prc = plyr.GetComponent(); - { - prc.ProcessPacket(packet); - processed = true; - } - //else - //{ - // Logger.LogError($"Player {profileId} doesn't have a PlayerReplicatedComponent!"); - //} - - if (packet.ContainsKey("Extracted")) - { - if (CoopGame != null) - { - //Logger.LogInfo($"Received Extracted ProfileId {packet["profileId"]}"); - if (!CoopGame.ExtractedPlayers.Contains(packet["profileId"].ToString())) - CoopGame.ExtractedPlayers.Add(packet["profileId"].ToString()); - - if (!MatchmakerAcceptPatches.IsClient) - { - var botController = (BotsController)ReflectionHelpers.GetFieldFromTypeByFieldType(typeof(BaseLocalGame), typeof(BotsController)).GetValue(Singleton.Instance); - if (botController != null) - { - if (!RemovedFromAIPlayers.Contains(profileId)) - { - RemovedFromAIPlayers.Add(profileId); - Logger.LogDebug("Removing Client Player to Enemy list"); - var botSpawner = (BotSpawner)ReflectionHelpers.GetFieldFromTypeByFieldType(typeof(BotsController), typeof(BotSpawner)).GetValue(botController); - botSpawner.DeletePlayer(plyr); - } - } - } - } - - processed = true; - } - } + if(plyr == null) + return false; - return processed; + var prc = plyr.GetComponent(); + if (prc == null) + return false; + + prc.ProcessPacket(packet); + return true; } async Task WaitForPlayerAndProcessPacket(string profileId, Dictionary packet) diff --git a/Source/Coop/Components/CoopGameComponent.cs b/Source/Coop/Components/CoopGameComponent.cs index fa943bc4..018c82f9 100644 --- a/Source/Coop/Components/CoopGameComponent.cs +++ b/Source/Coop/Components/CoopGameComponent.cs @@ -30,7 +30,7 @@ namespace StayInTarkov.Coop /// /// Coop Game Component is the User 1-2-1 communication to the Server. This can be seen as an extension component to CoopGame. /// - public class CoopGameComponent : MonoBehaviour, IFrameIndexer + public class CoopGameComponent : MonoBehaviour { #region Fields/Properties public WorldInteractiveObject[] ListOfInteractiveObjects { get; set; } @@ -300,7 +300,6 @@ private IEnumerator EverySecondCoroutine() yield return waitSeconds; var playersToExtract = new List(); - // TODO: Store the exfil point in the ExtractingPlayers dict, need it for timer foreach (var exfilPlayer in coopGame.ExtractingPlayers) { var exfilTime = new TimeSpan(0, 0, (int)exfilPlayer.Value.Item1); @@ -329,15 +328,19 @@ private IEnumerator EverySecondCoroutine() var world = Singleton.Instance; // Hide extracted Players - foreach (var playerId in coopGame.ExtractedPlayers) + foreach (var profileId in coopGame.ExtractedPlayers) { - var player = world.RegisteredPlayers.Find(x => x.ProfileId == playerId) as EFT.Player; + var player = world.RegisteredPlayers.Find(x => x.ProfileId == profileId) as EFT.Player; if (player == null) continue; - AkiBackendCommunicationCoop.PostLocalPlayerData(player - , new Dictionary() { { "Extracted", true } } - , true); + if (!ExtractedProfilesSent.Contains(profileId)) + { + ExtractedProfilesSent.Add(profileId); + AkiBackendCommunicationCoop.PostLocalPlayerData(player + , new Dictionary() { { "m", "Extraction" }, { "Extracted", true } } + ); + } if (player.ActiveHealthController != null) { @@ -349,12 +352,18 @@ private IEnumerator EverySecondCoroutine() player.ActiveHealthController.PauseAllEffects(); player.SwitchRenderer(false); + + // TODO: Currently. Destroying your own Player just breaks the game and it appears to be "frozen". Need to learn a new way to do a FreeCam! + if(Singleton.Instance.MainPlayer.ProfileId != profileId) + GameObject.Destroy(player); } } } } } + private HashSet ExtractedProfilesSent = new(); + void OnDestroy() { StayInTarkovHelperConstants.Logger.LogDebug($"CoopGameComponent:OnDestroy"); @@ -425,37 +434,36 @@ public EQuitState GetQuitState() var numberOfPlayersAlive = PlayerUsers.Count(x => x.HealthController.IsAlive); var numberOfPlayersExtracted = coopGame.ExtractedPlayers.Count; + // Simple check to see if you are dead + if (!Singleton.Instance.MainPlayer.PlayerHealthController.IsAlive) + { + quitState = EQuitState.YouAreDead; + } + + // You are playing with a team if (PlayerUsers.Count() > 1) { + // All Player's in the Raid are dead if (PlayerUsers.Count() == numberOfPlayersDead) { quitState = EQuitState.YourTeamIsDead; } - else if (!Singleton.Instance.MainPlayer.PlayerHealthController.IsAlive) - { - quitState = EQuitState.YouAreDead; - } - } - else if (PlayerUsers.Any(x => !x.HealthController.IsAlive)) - { - quitState = EQuitState.YouAreDead; } - if ( - numberOfPlayersAlive > 0 - && - (numberOfPlayersAlive == numberOfPlayersExtracted || PlayerUsers.Count() == numberOfPlayersExtracted) - ) - { - quitState = EQuitState.YourTeamHasExtracted; - } - else if (coopGame.ExtractedPlayers.Contains(Singleton.Instance.MainPlayer.ProfileId)) + // ------------------------- + // Extractions + if (coopGame.ExtractedPlayers.Contains(Singleton.Instance.MainPlayer.ProfileId)) { if (MatchmakerAcceptPatches.IsClient) quitState = EQuitState.YouHaveExtractedOnlyAsClient; else if (MatchmakerAcceptPatches.IsServer) quitState = EQuitState.YouHaveExtractedOnlyAsHost; } + + if (numberOfPlayersAlive == numberOfPlayersExtracted || PlayerUsers.Count() == numberOfPlayersExtracted) + { + quitState = EQuitState.YourTeamHasExtracted; + } return quitState; } @@ -479,7 +487,11 @@ void ProcessQuitting() if (MatchmakerAcceptPatches.IsServer) { // A host needs to wait for the team to extract or die! - if ((quitState == EQuitState.YourTeamHasExtracted || quitState == EQuitState.YourTeamIsDead)) + if((PlayerUsers.Count() > 1) && (quitState == EQuitState.YouAreDead || quitState == EQuitState.YouHaveExtractedOnlyAsHost)) + { + NotificationManagerClass.DisplayWarningNotification("HOSTING: You cannot exit the game until all clients have escaped or dead"); + } + else { Singleton.Instance.Stop( Singleton.Instance.MainPlayer.ProfileId @@ -487,10 +499,6 @@ void ProcessQuitting() , Singleton.Instance.MyExitLocation , 0); } - else - { - NotificationManagerClass.DisplayWarningNotification("HOSTING: You cannot exit the game until all clients have escaped or dead"); - } } else { diff --git a/Source/Coop/Components/PlayerReplicatedComponent.cs b/Source/Coop/Components/PlayerReplicatedComponent.cs index 9ea43629..92d44e4d 100644 --- a/Source/Coop/Components/PlayerReplicatedComponent.cs +++ b/Source/Coop/Components/PlayerReplicatedComponent.cs @@ -15,7 +15,7 @@ using System.Security.Cryptography; using System.Text; using UnityEngine; -using static AHealthController; +using static AHealthController; namespace StayInTarkov.Core.Player { @@ -321,7 +321,7 @@ void Update() var packet = new Dictionary(); packet.Add("dmt", EDamageType.Undefined.ToString()); packet.Add("m", "Kill"); - AkiBackendCommunicationCoop.PostLocalPlayerData(player, packet, true); + AkiBackendCommunicationCoop.PostLocalPlayerData(player, packet); } } } diff --git a/Source/Coop/CoopGame.cs b/Source/Coop/CoopGame.cs index 3b48184b..cc92af96 100644 --- a/Source/Coop/CoopGame.cs +++ b/Source/Coop/CoopGame.cs @@ -48,7 +48,7 @@ public sealed class CoopGame : BaseLocalGame, IBotGame, ISITGam public FriendlyAIPMCSystem FriendlyAIPMCSystem { get; set; } = new FriendlyAIPMCSystem(); - public IBackEndSession BackEndSession { get { return StayInTarkovHelperConstants.BackEndSession; } } + public ISession BackEndSession { get { return StayInTarkovHelperConstants.BackEndSession; } } BotsController IBotGame.BotsController { @@ -107,7 +107,7 @@ InputTree inputTree , Callback callback , float fixedDeltaTime , EUpdateQueue updateQueue - , IBackEndSession backEndSession + , ISession backEndSession , TimeSpan sessionTime) { BotsController = null; @@ -134,7 +134,7 @@ InputTree inputTree (null, new object[] { coopGame.gameObject , location.waves - , new Action((wave) => coopGame.PBotsController.ActivateBotsByWave(wave)) + , new Action((wave) => coopGame.PBotsController.ActivateBotsByWave(wave)) , location }); var bosswavemanagerValue = ReflectionHelpers.GetMethodForType(typeof(BossWaveManager), "smethod_0").Invoke @@ -839,7 +839,7 @@ public void CreateExfiltrationPointAndInitDeathHandler() SpawnPoints spawnPoints = SpawnPoints.CreateFromScene(DateTime.Now, base.Location_0.SpawnPointParams); int spawnSafeDistance = ((Location_0.SpawnSafeDistanceMeters > 0) ? Location_0.SpawnSafeDistanceMeters : 100); SpawnSystemSettings settings = new(Location_0.MinDistToFreePoint, Location_0.MaxDistToFreePoint, Location_0.MaxBotPerZone, spawnSafeDistance); - SpawnSystem = SpawnSystemFactory.CreateSpawnSystem(settings, () => Time.time, Singleton.Instance, PBotsController, spawnPoints); + SpawnSystem = SpawnSystemFactory.CreateSpawnSystem(settings, () => UnityEngine.Time.time, Singleton.Instance, PBotsController, spawnPoints); base.GameTimer.Start(); //base.vmethod_5(); @@ -872,6 +872,9 @@ public void CreateExfiltrationPointAndInitDeathHandler() private void ExfiltrationPoint_OnCancelExtraction(ExfiltrationPoint point, EFT.Player player) { + if (player.IsAI) + return; + Logger.LogDebug("ExfiltrationPoint_OnCancelExtraction"); Logger.LogDebug(point.Status); @@ -883,6 +886,9 @@ private void ExfiltrationPoint_OnCancelExtraction(ExfiltrationPoint point, EFT.P private void ExfiltrationPoint_OnStartExtraction(ExfiltrationPoint point, EFT.Player player) { + if (player.IsAI) + return; + Logger.LogDebug("ExfiltrationPoint_OnStartExtraction"); Logger.LogDebug(point.Settings.Name); Logger.LogDebug(point.Status); diff --git a/Source/Coop/CoopHealthController.cs b/Source/Coop/CoopHealthController.cs index a4e711f5..18163788 100644 --- a/Source/Coop/CoopHealthController.cs +++ b/Source/Coop/CoopHealthController.cs @@ -6,7 +6,7 @@ namespace StayInTarkov.Coop { internal class CoopHealthController : PlayerHealthController { - public CoopHealthController(Profile.Health0 healthInfo, EFT.Player player, InventoryController inventoryController, SkillManager skillManager, bool aiHealth) + public CoopHealthController(Profile.ProfileHealth healthInfo, EFT.Player player, InventoryController inventoryController, SkillManager skillManager, bool aiHealth) : base(healthInfo, player, inventoryController, skillManager, aiHealth) { } @@ -16,7 +16,7 @@ public override bool ApplyItem(Item item, EBodyPart bodyPart, float? amount = nu return base.ApplyItem(item, bodyPart, amount); } - protected override void AddEffectToList(AbstractHealthEffect effect) + protected override void AddEffectToList(AbstractEffect effect) { base.AddEffectToList(effect); } diff --git a/Source/Coop/CoopHealthControllerForClientDrone.cs b/Source/Coop/CoopHealthControllerForClientDrone.cs index 98d0435c..afc94e5f 100644 --- a/Source/Coop/CoopHealthControllerForClientDrone.cs +++ b/Source/Coop/CoopHealthControllerForClientDrone.cs @@ -6,7 +6,7 @@ namespace StayInTarkov.Coop { internal class CoopHealthControllerForClientDrone : PlayerHealthController { - public CoopHealthControllerForClientDrone(Profile.Health0 healthInfo, EFT.Player player, InventoryController inventoryController, SkillManager skillManager, bool aiHealth) + public CoopHealthControllerForClientDrone(Profile.ProfileHealth healthInfo, EFT.Player player, InventoryController inventoryController, SkillManager skillManager, bool aiHealth) : base(healthInfo, player, inventoryController, skillManager, aiHealth) { } @@ -26,7 +26,7 @@ public override bool ApplyItem(Item item, EBodyPart bodyPart, float? amount = nu return base.ApplyItem(item, bodyPart, amount); } - protected override void AddEffectToList(AbstractHealthEffect effect) + protected override void AddEffectToList(AbstractEffect effect) { base.AddEffectToList(effect); } diff --git a/Source/Coop/CoopInventoryController.cs b/Source/Coop/CoopInventoryController.cs index 0b45f4e4..4a28059a 100644 --- a/Source/Coop/CoopInventoryController.cs +++ b/Source/Coop/CoopInventoryController.cs @@ -26,12 +26,6 @@ public CoopInventoryController(EFT.Player player, Profile profile, bool examined base.ResetDiscardLimits(); } - public override void Execute(SearchContentOperation operation, Callback callback) - { - //BepInLogger.LogInfo($"CoopInventoryController: {operation}"); - base.Execute(operation, callback); - } - public override Task LoadMagazine(BulletClass sourceAmmo, MagazineClass magazine, int loadCount, bool ignoreRestrictions) { //BepInLogger.LogInfo("LoadMagazine"); diff --git a/Source/Coop/CoopPlayer.cs b/Source/Coop/CoopPlayer.cs index f45a641b..8efc29ae 100644 --- a/Source/Coop/CoopPlayer.cs +++ b/Source/Coop/CoopPlayer.cs @@ -192,7 +192,7 @@ private void SendDamageToAllClients(DamageInfo damageInfo, EBodyPart bodyPartTyp PreviousSentDamageInfoPackets.Add(packet.ToJson()); // ----------------------------------------------------------- - AkiBackendCommunicationCoop.PostLocalPlayerData(this, packet, true); + AkiBackendCommunicationCoop.PostLocalPlayerData(this, packet); } public void ReceiveDamageFromServer(Dictionary dict) @@ -336,9 +336,12 @@ public void ReceiveRotate(Vector2 rotation, bool ignoreClamp = false) public override void Move(Vector2 direction) { + var prc = GetComponent(); + if(prc == null) + return; + base.Move(direction); - var prc = GetComponent(); if (prc.IsClientDrone) return; @@ -416,7 +419,7 @@ public void ReceiveSay(EPhraseTrigger trigger, int index) private TagBank GetTagBank(EPhraseTrigger trigger) { - Voice asset = Singleton.Instance.GetAsset(ResourceBundleConstants.TakePhrasePath(this.Profile.Info.Voice)); + Voice asset = Singleton.Instance.GetAsset(ResourceBundleConstants.TakePhrasePath(this.Profile.Info.Voice)); if (asset == null) { BepInLogger.LogError($"{nameof(Say)}: Asset is null"); diff --git a/Source/Coop/CoopPlayerClient.cs b/Source/Coop/CoopPlayerClient.cs index 5943379d..b85555ef 100644 --- a/Source/Coop/CoopPlayerClient.cs +++ b/Source/Coop/CoopPlayerClient.cs @@ -10,7 +10,7 @@ public override void InitVoip(EVoipState voipState) { //base.InitVoip(voipState); SoundSettings settings = Singleton.Instance.Sound.Settings; - var allVoipMethods = ReflectionHelpers.GetAllMethodsForType(typeof(PlayerVoipController), true); + //var allVoipMethods = ReflectionHelpers.GetAllMethodsForType(typeof(PlayerVoipController), true); //var playerVOIP = (PlayerVoipController)(typeof(PlayerVoipController).GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.CreateInstance).First(x => x.IsConstructor).Invoke(null, new object[] { this, settings })); } diff --git a/Source/Coop/Matchmaker/MatchmakerAccept/MatchmakerAcceptScreenShowPatch.cs b/Source/Coop/Matchmaker/MatchmakerAccept/MatchmakerAcceptScreenShowPatch.cs index e1f687d6..f767c8ca 100644 --- a/Source/Coop/Matchmaker/MatchmakerAccept/MatchmakerAcceptScreenShowPatch.cs +++ b/Source/Coop/Matchmaker/MatchmakerAccept/MatchmakerAcceptScreenShowPatch.cs @@ -35,7 +35,7 @@ protected override MethodBase GetTargetMethod() [PatchPrefix] private static void Pre( - ref IBackEndSession session, + ref ISession session, ref RaidSettings raidSettings, Profile ___profile_0, MatchMakerAcceptScreen __instance, @@ -87,7 +87,7 @@ MatchMakerPlayerPreview ____playerModelView [PatchPostfix] private static void Post( - ref IBackEndSession session, + ref ISession session, ref RaidSettings raidSettings, Profile ___profile_0, MatchMakerAcceptScreen __instance, diff --git a/Source/Coop/Player/FirearmControllerPatches/FirearmController_ReloadMag_Patch.cs b/Source/Coop/Player/FirearmControllerPatches/FirearmController_ReloadMag_Patch.cs index 36ad9bc5..4d37912d 100644 --- a/Source/Coop/Player/FirearmControllerPatches/FirearmController_ReloadMag_Patch.cs +++ b/Source/Coop/Player/FirearmControllerPatches/FirearmController_ReloadMag_Patch.cs @@ -74,7 +74,7 @@ EFT.Player.FirearmController __instance { "ga", gridAddressDict }, { "m", "ReloadMag" } }; - AkiBackendCommunicationCoop.PostLocalPlayerData(player, dictionary, true); + AkiBackendCommunicationCoop.PostLocalPlayerData(player, dictionary); //GetLogger().LogDebug("FirearmController_ReloadMag_Patch:PostPatch"); // --------------------------------------------------------------------------------------------------------------------- diff --git a/Source/Coop/Player/Health/RestoreBodyPartPatch.cs b/Source/Coop/Player/Health/RestoreBodyPartPatch.cs index 10fc6d88..20b953df 100644 --- a/Source/Coop/Player/Health/RestoreBodyPartPatch.cs +++ b/Source/Coop/Player/Health/RestoreBodyPartPatch.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Reflection; using UnityEngine; -using static AHealthController; +using static AHealthController; namespace StayInTarkov.Coop.Player.Health { diff --git a/Source/Coop/Player/Proceed/Player_Proceed_FoodDrink_Patch.cs b/Source/Coop/Player/Proceed/Player_Proceed_FoodDrink_Patch.cs index 5961b53a..368fae33 100644 --- a/Source/Coop/Player/Proceed/Player_Proceed_FoodDrink_Patch.cs +++ b/Source/Coop/Player/Proceed/Player_Proceed_FoodDrink_Patch.cs @@ -59,7 +59,7 @@ public override void Replicated(EFT.Player player, Dictionary di { CallLocally.Add(player.ProfileId); - Callback callback = null; + Callback callback = null; if (player.IsAI) { BotOwner botOwner = player.AIData.BotOwner; diff --git a/Source/Coop/Player/Proceed/Player_Proceed_Meds_Patch.cs b/Source/Coop/Player/Proceed/Player_Proceed_Meds_Patch.cs index a305100e..9c8ad012 100644 --- a/Source/Coop/Player/Proceed/Player_Proceed_Meds_Patch.cs +++ b/Source/Coop/Player/Proceed/Player_Proceed_Meds_Patch.cs @@ -30,7 +30,7 @@ public static bool PrePatch(EFT.Player __instance) } [PatchPostfix] - public static void PostPatch(EFT.Player __instance, Meds0 meds, EBodyPart bodyPart, int animationVariant, bool scheduled) + public static void PostPatch(EFT.Player __instance, Meds meds, EBodyPart bodyPart, int animationVariant, bool scheduled) { if (CallLocally.Contains(__instance.ProfileId)) { @@ -70,11 +70,11 @@ public override void Replicated(EFT.Player player, Dictionary di if (ItemFinder.TryFindItem(playerProceedMedsPacket.ItemId, out Item item)) { - if (item is Meds0 meds) + if (item is Meds meds) { CallLocally.Add(player.ProfileId); - Callback callback = null; + Callback callback = null; if (player.IsAI) { BotOwner botOwner = player.AIData.BotOwner; diff --git a/Source/Coop/Player/Proceed/Player_Proceed_QuickKnifeKick_Patch.cs b/Source/Coop/Player/Proceed/Player_Proceed_QuickKnifeKick_Patch.cs index 3c56f9e2..776ce291 100644 --- a/Source/Coop/Player/Proceed/Player_Proceed_QuickKnifeKick_Patch.cs +++ b/Source/Coop/Player/Proceed/Player_Proceed_QuickKnifeKick_Patch.cs @@ -1,4 +1,5 @@ using Comfort.Common; +using EFT; using EFT.InventoryLogic; using StayInTarkov.Coop.NetworkPacket; using StayInTarkov.Networking; @@ -24,7 +25,7 @@ protected override MethodBase GetTargetMethod() && x.GetParameters()[0].Name == "knife" && x.GetParameters()[1].Name == "callback" && x.GetParameters()[2].Name == "scheduled" - && x.GetParameters()[1].ParameterType == typeof(Callback)); + && x.GetParameters()[1].ParameterType == typeof(Callback)); } [PatchPrefix] @@ -42,9 +43,9 @@ public static void PostPatch(EFT.Player __instance, KnifeComponent knife, bool s return; } - if (knife.Item is Knife0 knife0) + //if (knife.Item is Knife knife0) { - PlayerProceedPacket playerProceedPacket = new(__instance.ProfileId, knife0.Id, knife0.TemplateId, scheduled, "ProceedQuickKnifeKick"); + PlayerProceedPacket playerProceedPacket = new(__instance.ProfileId, knife.Item.Id, knife.Item.TemplateId, scheduled, "ProceedQuickKnifeKick"); AkiBackendCommunication.Instance.SendDataToPool(playerProceedPacket.Serialize()); } } @@ -65,7 +66,7 @@ public override void Replicated(EFT.Player player, Dictionary di if (item.TryGetItemComponent(out KnifeComponent knifeComponent)) { CallLocally.Add(player.ProfileId); - player.Proceed(knifeComponent, (Callback)null, playerProceedPacket.Scheduled); + player.Proceed(knifeComponent, (Callback)null, playerProceedPacket.Scheduled); } else { diff --git a/Source/Coop/Player/Proceed/Player_TryProceed_Patch.cs b/Source/Coop/Player/Proceed/Player_TryProceed_Patch.cs index dd333fdf..fdb8ecb0 100644 --- a/Source/Coop/Player/Proceed/Player_TryProceed_Patch.cs +++ b/Source/Coop/Player/Proceed/Player_TryProceed_Patch.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Reflection; namespace StayInTarkov.Coop.Player.Proceed @@ -62,7 +63,7 @@ public override void Replicated(EFT.Player player, Dictionary di CallLocally.Add(player.ProfileId); // Make sure Tagilla and Cultists are using correct callback. - if (player.IsAI && item is Knife0) + if (player.IsAI && item.Attributes.Any(x => x.Name == "knifeDurab")) { BotOwner botOwner = player.AIData.BotOwner; if (botOwner != null) diff --git a/Source/Coop/TarkovApplication_LocalGameCreator_Patch.cs b/Source/Coop/TarkovApplication_LocalGameCreator_Patch.cs index 806dd1c6..cb25a83c 100644 --- a/Source/Coop/TarkovApplication_LocalGameCreator_Patch.cs +++ b/Source/Coop/TarkovApplication_LocalGameCreator_Patch.cs @@ -28,7 +28,7 @@ protected override MethodBase GetTargetMethod() ); } - static IBackEndSession CurrentSession { get; set; } + static ISession CurrentSession { get; set; } [PatchPrefix] public static bool Prefix(TarkovApplication __instance) @@ -38,7 +38,7 @@ public static bool Prefix(TarkovApplication __instance) if (MatchmakerAcceptPatches.IsSinglePlayer) return true; - IBackEndSession session = __instance.GetClientBackEndSession(); + ISession session = __instance.GetClientBackEndSession(); if (session == null) { Logger.LogError("Session is NULL. Continuing as Singleplayer."); @@ -95,7 +95,7 @@ string ____backendUrl Logger.LogDebug("TarkovApplication_LocalGameCreator_Patch:Postfix: Attempt to get Session"); - IBackEndSession session = CurrentSession; + ISession session = CurrentSession; //IBackEndSession session = ReflectionHelpers.GetFieldOrPropertyFromInstance(__instance, "Session", false);// Profile profile = base.Session.Profile; Profile profile = session.Profile; diff --git a/Source/Coop/Web/AkiBackendCommunicationCoop.cs b/Source/Coop/Web/AkiBackendCommunicationCoop.cs index 34414c77..0fd3628e 100644 --- a/Source/Coop/Web/AkiBackendCommunicationCoop.cs +++ b/Source/Coop/Web/AkiBackendCommunicationCoop.cs @@ -26,10 +26,9 @@ static AkiBackendCommunicationCoop() public static void PostLocalPlayerData( EFT.Player player , Dictionary data - , bool useWebSocket = false ) { - PostLocalPlayerData(player, data, useWebSocket, out _, out _); + PostLocalPlayerData(player, data, out _, out _); } /// @@ -42,7 +41,6 @@ EFT.Player player public static void PostLocalPlayerData( EFT.Player player , Dictionary data - , bool useWebSocket , out string returnedData , out Dictionary generatedData) { @@ -52,17 +50,13 @@ EFT.Player player { data.Add("t", DateTime.Now.Ticks.ToString("G")); } - if (!data.ContainsKey("tkn")) - { - data.Add("tkn", Randomizer.NextDouble()); - } if (!data.ContainsKey("serverId")) { data.Add("serverId", CoopGameComponent.GetServerId()); } if (!data.ContainsKey("profileId")) { - data.Add("profileId", player.ProfileId); // PatchConstants.GetPlayerProfileAccountId(profile)); + data.Add("profileId", player.ProfileId); } AkiBackendCommunication.Instance.SendDataToPool("", data); generatedData = data; diff --git a/Source/EssentialPatches/FileChecker/RunFilesCheckingPatch.cs b/Source/EssentialPatches/FileChecker/RunFilesCheckingPatch.cs index c0464e91..7846e506 100644 --- a/Source/EssentialPatches/FileChecker/RunFilesCheckingPatch.cs +++ b/Source/EssentialPatches/FileChecker/RunFilesCheckingPatch.cs @@ -11,7 +11,7 @@ internal class RunFilesCheckingPatch : ModulePatch { protected override MethodBase GetTargetMethod() { - return ReflectionHelpers.GetMethodForType(typeof(CommonClientApplication), "RunFilesChecking"); + return ReflectionHelpers.GetMethodForType(typeof(CommonClientApplication), "RunFilesChecking"); } [PatchPrefix] diff --git a/Source/EssentialPatches/Web/SendCommandsPatch.cs b/Source/EssentialPatches/Web/SendCommandsPatch.cs index aec452cc..9a815b8a 100644 --- a/Source/EssentialPatches/Web/SendCommandsPatch.cs +++ b/Source/EssentialPatches/Web/SendCommandsPatch.cs @@ -10,7 +10,7 @@ internal class SendCommandsPatch : ModulePatch { protected override MethodBase GetTargetMethod() { - return ReflectionHelpers.GetMethodForType(typeof(BackEnd0.BackEndSession2), "TrySendCommands"); + return ReflectionHelpers.GetMethodForType(typeof(BackEnd.BackEndSession), "TrySendCommands"); } [PatchPrefix] diff --git a/Source/Networking/AkiBackendCommunication.cs b/Source/Networking/AkiBackendCommunication.cs index ffbe5a10..1085acfc 100644 --- a/Source/Networking/AkiBackendCommunication.cs +++ b/Source/Networking/AkiBackendCommunication.cs @@ -286,6 +286,17 @@ private void WebSocket_OnMessage(object sender, WebSocketSharp.MessageEventArgs return; } + // Receiving a Player Extracted packet. Process into ExtractedPlayers List + if (packet.ContainsKey("Extracted")) + { + if (Singleton.Instantiated && !Singleton.Instance.ExtractedPlayers.Contains(packet["profileId"].ToString())) + { + Logger.LogInfo(e.Data); + Singleton.Instance.ExtractedPlayers.Add(packet["profileId"].ToString()); + } + return; + } + // If this is an endSession packet, end the session for the clients if (packet.ContainsKey("endSession") && MatchmakerAcceptPatches.IsClient) { diff --git a/Source/StayInTarkovHelperConstants.cs b/Source/StayInTarkovHelperConstants.cs index 436bf323..2befbab6 100644 --- a/Source/StayInTarkovHelperConstants.cs +++ b/Source/StayInTarkovHelperConstants.cs @@ -110,8 +110,8 @@ public static string GetPHPSESSID() public static Type JsonConverterType { get; } public static Newtonsoft.Json.JsonConverter[] JsonConverterDefault { get; } - private static IBackEndSession _backEndSession; - public static IBackEndSession BackEndSession + private static ISession _backEndSession; + public static ISession BackEndSession { get { @@ -120,9 +120,9 @@ public static IBackEndSession BackEndSession _backEndSession = Singleton.Instance.GetClientBackEndSession(); } - if (_backEndSession == null && Singleton>.Instantiated) + if (_backEndSession == null && Singleton>.Instantiated) { - _backEndSession = Singleton>.Instance.GetClientBackEndSession(); + _backEndSession = Singleton>.Instance.GetClientBackEndSession(); } return _backEndSession; @@ -239,9 +239,9 @@ public static bool TrySITParseJson(this string str, out T result) } } - public static ClientApplication GetClientApp() + public static ClientApplication GetClientApp() { - return Singleton>.Instance; + return Singleton>.Instance; } public static TarkovApplication GetMainApp() diff --git a/Source/ThirdParty/AI/DrakiaXYZ/SPT-Waypoints/Components/NavMeshDebugComponent.cs b/Source/ThirdParty/AI/DrakiaXYZ/SPT-Waypoints/Components/NavMeshDebugComponent.cs index 6cc4e3a4..9774b649 100644 --- a/Source/ThirdParty/AI/DrakiaXYZ/SPT-Waypoints/Components/NavMeshDebugComponent.cs +++ b/Source/ThirdParty/AI/DrakiaXYZ/SPT-Waypoints/Components/NavMeshDebugComponent.cs @@ -47,7 +47,7 @@ public void Awake() Vector3[] adjustedVertices = meshData.vertices.Select(v => new Vector3(v.x, v.y + Settings.NavMeshOffset.Value, v.z)).ToArray(); // Create our new mesh and add all the vertices - Mesh mesh = new(); + UnityEngine.Mesh mesh = new(); mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; mesh.vertices = adjustedVertices; mesh.triangles = meshData.indices; diff --git a/Source/UI/Ammo_CachedReadOnlyAttributes_Patch.cs b/Source/UI/Ammo_CachedReadOnlyAttributes_Patch.cs index b33b73ff..468b8f7c 100644 --- a/Source/UI/Ammo_CachedReadOnlyAttributes_Patch.cs +++ b/Source/UI/Ammo_CachedReadOnlyAttributes_Patch.cs @@ -17,15 +17,15 @@ protected override MethodBase GetTargetMethod() } [PatchPostfix] - private static void Postfix(ref AmmoTemplate __instance, ref List __result) + private static void Postfix(ref AmmoTemplate __instance, ref List __result) { - if (!__result.Any((ItemAttribute0 a) => (Attributes.ENewMaximumDurabilityId)a.Id == Attributes.ENewMaximumDurabilityId.Damage)) + if (!__result.Any((ItemAttribute a) => (Attributes.ENewMaximumDurabilityId)a.Id == Attributes.ENewMaximumDurabilityId.Damage)) { AddNewAttributes(ref __result, __instance); } } - public static void AddNewAttributes(ref List attributes, AmmoTemplate template) + public static void AddNewAttributes(ref List attributes, AmmoTemplate template) { if (template == null) return; @@ -34,7 +34,7 @@ public static void AddNewAttributes(ref List attributes, AmmoTem if (template.Damage > 0) { attributes.Add( - new ItemAttribute0(Attributes.ENewMaximumDurabilityId.Damage) + new ItemAttribute(Attributes.ENewMaximumDurabilityId.Damage) { Name = Attributes.ENewMaximumDurabilityId.Damage.GetName(), Base = (() => template.Damage), @@ -48,7 +48,7 @@ public static void AddNewAttributes(ref List attributes, AmmoTem if (template.ArmorDamage > 0) { attributes.Add( - new ItemAttribute0(Attributes.ENewMaximumDurabilityId.ArmorDamage) + new ItemAttribute(Attributes.ENewMaximumDurabilityId.ArmorDamage) { Name = Attributes.ENewMaximumDurabilityId.ArmorDamage.GetName(), Base = (() => template.ArmorDamage), @@ -62,7 +62,7 @@ public static void AddNewAttributes(ref List attributes, AmmoTem if (template.PenetrationPower > 0) { attributes.Add( - new ItemAttribute0(Attributes.ENewMaximumDurabilityId.Penetration) + new ItemAttribute(Attributes.ENewMaximumDurabilityId.Penetration) { Name = Attributes.ENewMaximumDurabilityId.Penetration.GetName(), Base = (() => template.PenetrationPower),