diff --git a/Fika-Plugin.sln b/Fika-Plugin.sln index 9654b29c..dacd4736 100644 --- a/Fika-Plugin.sln +++ b/Fika-Plugin.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fika.Core", "Fika.Core\Fika.Core.csproj", "{79F0E889-A195-42B4-8656-4F35685BBB80}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fika.Dedicated", "Fika.Dedicated\Fika.Dedicated.csproj", "{95F55C25-695F-4153-8F18-2637FC49FDE3}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,12 +18,6 @@ Global {79F0E889-A195-42B4-8656-4F35685BBB80}.GoldMaster|Any CPU.Build.0 = GoldMaster|Any CPU {79F0E889-A195-42B4-8656-4F35685BBB80}.Release|Any CPU.ActiveCfg = Release|Any CPU {79F0E889-A195-42B4-8656-4F35685BBB80}.Release|Any CPU.Build.0 = Release|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.GoldMaster|Any CPU.ActiveCfg = Debug|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.GoldMaster|Any CPU.Build.0 = Debug|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95F55C25-695F-4153-8F18-2637FC49FDE3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Fika.Core/Coop/Custom/FikaHealthBar.cs b/Fika.Core/Coop/Custom/FikaHealthBar.cs index 6612a4ed..f2fb34be 100644 --- a/Fika.Core/Coop/Custom/FikaHealthBar.cs +++ b/Fika.Core/Coop/Custom/FikaHealthBar.cs @@ -6,6 +6,7 @@ using EFT.UI; using Fika.Core.Bundles; using Fika.Core.Coop.Players; +using Fika.Core.Coop.Utils; using Fika.Core.Utils; using System; using UnityEngine; @@ -170,7 +171,19 @@ private void CreateHealthBar() SetPlayerPlateFactionVisibility(FikaPlugin.UsePlateFactionSide.Value); SetPlayerPlateHealthVisibility(FikaPlugin.HideHealthBar.Value); - playerPlate.gameObject.SetActive(FikaPlugin.UseNamePlates.Value); + + if (currentPlayer.ProfileId == FikaBackendUtils.GetGroupId()) + { + if (FikaBackendUtils.IsDedicated) + { + // Do not show dedicated client name plate + Destroy(this); + } + } + else + { + playerPlate.gameObject.SetActive(FikaPlugin.UseNamePlates.Value); + } FikaPlugin.UsePlateFactionSide.SettingChanged += UsePlateFactionSide_SettingChanged; FikaPlugin.HideHealthBar.SettingChanged += HideHealthBar_SettingChanged; diff --git a/Fika.Core/Networking/FikaPingingClient.cs b/Fika.Core/Networking/FikaPingingClient.cs index fdeae689..8b8fbea7 100644 --- a/Fika.Core/Networking/FikaPingingClient.cs +++ b/Fika.Core/Networking/FikaPingingClient.cs @@ -33,6 +33,7 @@ public bool Init(string serverId) GetHostResponse result = FikaRequestHandler.GetHost(body); FikaBackendUtils.IsHostNatPunch = result.NatPunch; + FikaBackendUtils.IsDedicated = result.IsDedicated; NetClient.Start(); diff --git a/Fika.Core/Networking/FikaServer.cs b/Fika.Core/Networking/FikaServer.cs index 42ad99eb..55529511 100644 --- a/Fika.Core/Networking/FikaServer.cs +++ b/Fika.Core/Networking/FikaServer.cs @@ -206,7 +206,7 @@ public async Task Init() iconType: EFT.Communications.ENotificationIconType.Alert); } - SetHostRequest body = new(Ips, Port, FikaPlugin.UseNatPunching.Value); + SetHostRequest body = new(Ips, Port, FikaPlugin.UseNatPunching.Value, FikaBackendUtils.IsDedicated); FikaRequestHandler.UpdateSetHost(body); FikaEventDispatcher.DispatchEvent(new FikaServerCreatedEvent(this)); diff --git a/Fika.Core/Networking/Models/GetHostResponse.cs b/Fika.Core/Networking/Models/GetHostResponse.cs index 929c0068..513a1915 100644 --- a/Fika.Core/Networking/Models/GetHostResponse.cs +++ b/Fika.Core/Networking/Models/GetHostResponse.cs @@ -14,11 +14,15 @@ public struct GetHostResponse [DataMember(Name = "natPunch")] public bool NatPunch; - public GetHostResponse(string[] ips, int port, bool natPunch) + [DataMember(Name = "isDedicated")] + public bool IsDedicated; + + public GetHostResponse(string[] ips, int port, bool natPunch, bool isDedicated) { Ips = ips; Port = port; NatPunch = natPunch; + IsDedicated = isDedicated; } } } \ No newline at end of file diff --git a/Fika.Core/Networking/Models/SetHostRequest.cs b/Fika.Core/Networking/Models/SetHostRequest.cs index df68b130..c8876aaa 100644 --- a/Fika.Core/Networking/Models/SetHostRequest.cs +++ b/Fika.Core/Networking/Models/SetHostRequest.cs @@ -18,12 +18,16 @@ public struct SetHostRequest [DataMember(Name = "natPunch")] public bool NatPunch; - public SetHostRequest(string[] ips, int port, bool natPunch) + [DataMember(Name = "isDedicated")] + public bool IsDedicated; + + public SetHostRequest(string[] ips, int port, bool natPunch, bool isDedicated) { ServerId = CoopHandler.GetServerId(); Ips = ips; Port = port; NatPunch = natPunch; + IsDedicated = isDedicated; } } } \ No newline at end of file diff --git a/Fika.Core/Networking/Websocket/DedicatedRaidWebSocketClient.cs b/Fika.Core/Networking/Websocket/DedicatedRaidWebSocketClient.cs index 28afb564..879e2057 100644 --- a/Fika.Core/Networking/Websocket/DedicatedRaidWebSocketClient.cs +++ b/Fika.Core/Networking/Websocket/DedicatedRaidWebSocketClient.cs @@ -6,19 +6,14 @@ using LiteNetLib; using SPT.Common.Http; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using WebSocketSharp; using HarmonyLib; using Newtonsoft.Json.Linq; using Comfort.Common; -using Fika.Core.Models; -using UnityEngine; -using UnityEngine.UI; using TMPro; +using UnityEngine.UI; +using Fika.Core.Coop.Utils; namespace Fika.Core.Networking.Websocket { @@ -36,7 +31,6 @@ public bool Connected return _webSocket.ReadyState == WebSocketState.Open; } } - public event EventHandler OnFikaDedicatedJoinMatch; private WebSocket _webSocket; @@ -120,8 +114,9 @@ private void WebSocket_OnMessage(object sender, MessageEventArgs e) TarkovApplication tarkovApplication = (TarkovApplication)Singleton>.Instance; tarkovApplication.StartCoroutine(MatchMakerUIScript.JoinMatch(tarkovApplication.Session.Profile.Id, matchId, null, () => - { - Traverse.Create(matchMakerAcceptScreen).Field("_acceptButton").Value.OnClick.Invoke(); + { + // MatchmakerAcceptScreen -> next screen (accept) + matchMakerAcceptScreen.method_22(); Destroy(matchmakerUI.gameObject); Destroy(matchmakerUI); diff --git a/Fika.Dedicated/Classes/DedicatedMovementContext.cs b/Fika.Dedicated/Classes/DedicatedMovementContext.cs deleted file mode 100644 index 4344f64d..00000000 --- a/Fika.Dedicated/Classes/DedicatedMovementContext.cs +++ /dev/null @@ -1,20 +0,0 @@ -using EFT; -using System; -using UnityEngine; - -namespace Fika.Core.Coop.ObservedClasses -{ - public class DedicatedMovementContext : MovementContext - { - public override void ApplyGravity(ref Vector3 motion, float deltaTime, bool stickToGround) - { - // Do nothing - } - - public new static DedicatedMovementContext Create(Player player, Func animatorGetter, Func characterControllerGetter, LayerMask groundMask) - { - DedicatedMovementContext movementContext = Create(player, animatorGetter, characterControllerGetter, groundMask); - return movementContext; - } - } -} diff --git a/Fika.Dedicated/Classes/DedicatedRaidWebSocketServer.cs b/Fika.Dedicated/Classes/DedicatedRaidWebSocketServer.cs deleted file mode 100644 index f8f3ee14..00000000 --- a/Fika.Dedicated/Classes/DedicatedRaidWebSocketServer.cs +++ /dev/null @@ -1,99 +0,0 @@ -using BepInEx.Logging; -using EFT.UI.Matchmaker; -using EFT.UI; -using EFT; -using Fika.Core.UI.Custom; -using SPT.Common.Http; -using System; -using UnityEngine; -using WebSocketSharp; -using HarmonyLib; -using Newtonsoft.Json.Linq; -using Comfort.Common; -using Fika.Core.Models; -using Fika.Dedicated; - -namespace Fika.Core.Networking -{ - public class DedicatedRaidWebSocketServer - { - private static ManualLogSource logger = BepInEx.Logging.Logger.CreateLogSource("Fika.DedicatedWebSocket"); - - public string Host { get; set; } - public string Url { get; set; } - public string SessionId { get; set; } - public bool Connected - { - get - { - return _webSocket.ReadyState == WebSocketState.Open; - } - } - - private WebSocket _webSocket; - - public DedicatedRaidWebSocketServer() - { - Host = RequestHandler.Host.Replace("http", "ws"); - SessionId = RequestHandler.SessionId; - Url = $"{Host}/fika/dedicatedraidservice/{SessionId}?"; - - _webSocket = new WebSocket(Url) - { - WaitTime = TimeSpan.FromMinutes(1), - EmitOnPing = true - }; - - _webSocket.OnOpen += WebSocket_OnOpen; - _webSocket.OnMessage += WebSocket_OnMessage; - } - - public void Connect() - { - logger.LogInfo($"WS Connect()"); - logger.LogInfo($"Attempting to connect to {Url}..."); - _webSocket.Connect(); - } - - public void Close() - { - _webSocket.Close(); - } - - - private void WebSocket_OnOpen(object sender, EventArgs e) - { - logger.LogInfo("Connected to FikaDedicatedRaidWebSocket as server"); - } - - private void WebSocket_OnMessage(object sender, MessageEventArgs e) - { - if (e == null) - { - return; - } - - if (string.IsNullOrEmpty(e.Data)) - { - return; - } - - JObject jsonObject = JObject.Parse(e.Data); - - if(!jsonObject.ContainsKey("type")) - { - return; - } - - string type = jsonObject["type"].ToString(); - - switch (type) - { - case "fikaDedicatedStartRaid": - StartDedicatedRequest request = jsonObject.ToObject(); - FikaDedicatedPlugin.Instance.OnFikaStartRaid(request); - break; - } - } - } -} diff --git a/Fika.Dedicated/Fika.Dedicated.csproj b/Fika.Dedicated/Fika.Dedicated.csproj deleted file mode 100644 index 0636080e..00000000 --- a/Fika.Dedicated/Fika.Dedicated.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\References\spt-common.dll - - - ..\References\spt-core.dll - - - ..\References\spt-custom.dll - - - ..\References\spt-debugging.dll - - - ..\References\spt-reflection.dll - - - ..\References\spt-singleplayer.dll - - - - - - - ..\References\websocket-sharp.dll - - - - - - diff --git a/Fika.Dedicated/FikaDedicatedPlugin.cs b/Fika.Dedicated/FikaDedicatedPlugin.cs deleted file mode 100644 index b8e4d952..00000000 --- a/Fika.Dedicated/FikaDedicatedPlugin.cs +++ /dev/null @@ -1,327 +0,0 @@ -using System; -using System.Collections; -using System.Diagnostics; -using System.Net; -using System.Reflection; -using BepInEx; -using Comfort.Common; -using EFT; -using EFT.HealthSystem; -using EFT.UI; -using EFT.UI.Matchmaker; -using Fika.Core; -using Fika.Core.Models; -using Fika.Core.UI.Custom; -using Fika.Dedicated.Patches; -using HarmonyLib; -using Newtonsoft.Json; -using SPT.SinglePlayer.Patches.MainMenu; -using UnityEngine; -using Fika.Core.Networking.Http; -using SPT.Common.Http; -using System.Threading.Tasks; -using Fika.Core.Coop.Utils; -using Fika.Core.Networking; - -namespace Fika.Dedicated -{ - [BepInPlugin("com.project-fika.dedicated", "Dedicated", "1.0.0")] - [BepInDependency("com.fika.core", BepInDependency.DependencyFlags.HardDependency)] - [BepInDependency("com.SPT.custom", BepInDependency.DependencyFlags.HardDependency)] - public class FikaDedicatedPlugin : BaseUnityPlugin - { - public static FikaDedicatedPlugin Instance { get; private set; } - //private static FieldInfo _hydrationField = typeof(ActiveHealthController).GetField("healthValue_1", BindingFlags.NonPublic | BindingFlags.Instance); - //private static FieldInfo _energyField = typeof(ActiveHealthController).GetField("healthValue_0", BindingFlags.NonPublic | BindingFlags.Instance); - private static DedicatedRaidWebSocketServer fikaDedicatedWebSocket; - - public Coroutine setDedicatedStatusRoutine; - - private void Awake() - { - Instance = this; - FikaPlugin.AutoExtract.Value = true; - new DLSSPatch1().Enable(); - new DLSSPatch2().Enable(); - new DLSSPatch3().Enable(); - new DLSSPatch4().Enable(); - new VRAMPatch1().Enable(); - new VRAMPatch2().Enable(); - new VRAMPatch3().Enable(); - new VRAMPatch4().Enable(); - new BetaLogoPatch().Disable(); - new SessionResultExitStatusPatch().Enable(); - new MenuScreenPatch().Enable(); - new HealthTreamentScreenPatch().Enable(); - new CreateMovementContextPatch().Enable(); - new HealthControllerPlayerAfterInitPatch().Enable(); - //InvokeRepeating("ClearRenderables", 1f, 1f); - - Logger.LogInfo("Fika.Dedicated loaded!"); - - fikaDedicatedWebSocket = new DedicatedRaidWebSocketServer(); - fikaDedicatedWebSocket.Connect(); - } - - // Done every second as a way to minimize processing time - private void ClearRenderables() - { - Stopwatch sw = Stopwatch.StartNew(); - var renderers = FindObjectsOfType(); - foreach (var renderer in renderers) - { - Destroy(renderer); - } - - Logger.LogInfo($"ClearRenderables: ${sw.ElapsedMilliseconds}"); - } - - /*private void FixedUpdate() - { - if (!Singleton.Instantiated) - { - return; - } - - Player localPlayer = Singleton.Instance.MainPlayer; - if (localPlayer == null) - { - return; - } - - *//*MovementContext localPlayerMovementContext = localPlayer.MovementContext; - if (localPlayerMovementContext != null) - { - *//* - * Disables gravity. Even though we are teleporting ourselves high - * eventually the fall time will become great enough to cause us to fall - *//* - localPlayerMovementContext.FreefallTime = 0f; - }*/ - - /*ActiveHealthController localPlayerHealthController = localPlayer.ActiveHealthController; - if (localPlayerHealthController != null) - { - // Make headless immune to damage - localPlayerHealthController.DamageCoeff = 0f; - localPlayerHealthController.DisableMetabolism(); - - // This bit is required because even with coefficient at 0 - // you will still take damage from dehydration and starvation - { - // Keep hydration at max - HealthValue healthValue = _hydrationField.GetValue(localPlayerHealthController) as HealthValue; - if (healthValue != null) - { - healthValue.Current = healthValue.Maximum; - } - - // Keep energy at max - healthValue = _energyField.GetValue(localPlayerHealthController) as HealthValue; - if (healthValue != null) - { - healthValue.Current = healthValue.Maximum; - } - } - }*//* - - // Keep dedicated client underground - putting the client high up in the air seems to mess with AI/spawn mods - BifacialTransform localPlayerTransform = localPlayer.Transform; - localPlayerTransform.position = localPlayerTransform.position.WithY(-50f); - }*/ - - public void OnFikaStartRaid(StartDedicatedRequest request) - { - if (!Singleton>.Instantiated) - { - Logger.LogError("We have not finished loading the main menu"); - return; - } - - TarkovApplication tarkovApplication = (TarkovApplication)Singleton>.Instance; - ISession session = tarkovApplication.GetClientBackEndSession(); - if (!session.LocationSettings.locations.TryGetValue(request.LocationId, out var location)) - { - Logger.LogError($"Failed to find location {request.LocationId}"); - return; - } - - Logger.LogInfo($"Starting on location {location.Name}"); - RaidSettings raidSettings = Traverse.Create(tarkovApplication).Field("_raidSettings").Value; - Logger.LogInfo("Initialized raid settings"); - StartCoroutine(BeginFikaStartRaid(request, session, raidSettings, location)); - } - - private IEnumerator BeginFikaStartRaid(StartDedicatedRequest request, ISession session, RaidSettings raidSettings, LocationSettingsClass.Location location) - { - /* - * Runs through the menus. Eventually this can be replaced - * but it works for now and I was getting a CTD with other method - */ - - Task.Run(async () => - { - StopCoroutine(setDedicatedStatusRoutine); - SetDedicatedStatusRequest setDedicatedStatusRequest = new SetDedicatedStatusRequest(RequestHandler.SessionId, "inraid"); - - await FikaRequestHandler.SetDedicatedStatus(setDedicatedStatusRequest); - }); - - ConsoleScreen.Log($"request: {JsonConvert.SerializeObject(request)}"); - - MenuScreen menuScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - menuScreen = FindObjectOfType(); - } while (menuScreen == null); - yield return null; - menuScreen.method_9(); // main menu -> faction selection screen - //menuScreen.method_8(); - - MatchMakerSideSelectionScreen sideSelectionScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - sideSelectionScreen = FindObjectOfType(); - } while (sideSelectionScreen == null); - yield return null; - - Action targetFactionCallback = raidSettings.Side == ESideType.Pmc ? - sideSelectionScreen.method_12 : - sideSelectionScreen.method_13; - targetFactionCallback(true); // select scav/pmc - yield return null; - - //sideSelectionScreen.UpdateSideSelection(request.Side); - sideSelectionScreen.method_11(request.Side); - - yield return null; - - sideSelectionScreen.method_17(); // faction selection screen -> location selection screen - yield return null; - - MatchMakerSelectionLocationScreen locationSelectionScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - locationSelectionScreen = FindObjectOfType(); - } while (locationSelectionScreen == null); - yield return null; - - locationSelectionScreen.Location_0 = session.LocationSettings.locations[request.LocationId]; - locationSelectionScreen.method_6(request.Time); - //locationSelectionScreen.method_7(locationSelectionScreen.Location_0, request.Time); - locationSelectionScreen.method_10(); // location selection screen -> offline raid screen - //locationSelectionScreen.method_8(); - - MatchmakerOfflineRaidScreen offlineRaidScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - offlineRaidScreen = FindObjectOfType(); - } while (offlineRaidScreen == null); - yield return null; - offlineRaidScreen.method_10(); // offline raid screen -> insurance screen - - MatchmakerInsuranceScreen insuranceScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - insuranceScreen = FindObjectOfType(); - } while (insuranceScreen == null); - yield return null; - insuranceScreen.method_8(); // insurance screen -> accept screen - - yield return null; - - raidSettings.PlayersSpawnPlace = request.SpawnPlace; - raidSettings.MetabolismDisabled = request.MetabolismDisabled; - raidSettings.BotSettings = request.BotSettings; - raidSettings.WavesSettings = request.WavesSettings; - - MatchMakerAcceptScreen acceptScreen; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - acceptScreen = FindObjectOfType(); - } while (acceptScreen == null); - yield return null; - - yield return new WaitForSeconds(1f); - MatchMakerUIScript fikaMatchMakerScript; - do - { - yield return StaticManager.Instance.WaitFrames(5, null); - fikaMatchMakerScript = FindObjectOfType(); - } while (fikaMatchMakerScript == null); - yield return null; - - //Singleton.Instance.PlayUISound(EUISoundType.ButtonClick); - if (FikaPlugin.ForceIP.Value != "") - { - // We need to handle DNS entries as well - string ip = FikaPlugin.ForceIP.Value; - try - { - IPAddress[] dnsAddress = Dns.GetHostAddresses(FikaPlugin.ForceIP.Value); - if (dnsAddress.Length > 0) - { - ip = dnsAddress[0].ToString(); - } - } - catch - { - - } - - if (!IPAddress.TryParse(ip, out _)) - { - Singleton.Instance.ShowCriticalErrorScreen("ERROR FORCING IP", - $"'{ip}' is not a valid IP address to connect to! Check your 'Force IP' setting.", - ErrorScreen.EButtonType.OkButton, 10f, null, null); - yield break; - } - } - - if (FikaPlugin.ForceBindIP.Value != "Disabled") - { - if (!IPAddress.TryParse(FikaPlugin.ForceBindIP.Value, out _)) - { - Singleton.Instance.ShowCriticalErrorScreen("ERROR BINDING", - $"'{FikaPlugin.ForceBindIP.Value}' is not a valid IP address to bind to! Check your 'Force Bind IP' setting.", - ErrorScreen.EButtonType.OkButton, 10f, null, null); - yield break; - } - } - - Logger.LogInfo($"Starting with: {JsonConvert.SerializeObject(request)}"); - - FikaBackendUtils.HostExpectedNumberOfPlayers = request.ExpectedNumPlayers + 1; - FikaBackendUtils.CreateMatch(session.Profile.ProfileId, session.Profile.Info.Nickname, raidSettings); - FikaBackendUtils.IsDedicated = true; - - fikaMatchMakerScript.AcceptButton.OnClick.Invoke(); - } - - public IEnumerator SetDedicatedStatus() - { - while(true) - { - SetDedicatedStatusRequest setDedicatedStatusRequest = new SetDedicatedStatusRequest(RequestHandler.SessionId, "ready"); - - Task.Run(async () => - { - await FikaRequestHandler.SetDedicatedStatus(setDedicatedStatusRequest); - }); - - yield return new WaitForSeconds(15.0f); - } - } - - public void StartSetDedicatedStatusRoutine() - { - setDedicatedStatusRoutine = StartCoroutine(SetDedicatedStatus()); - } - } -} diff --git a/Fika.Dedicated/Patches/CreateMovementContextPatch.cs b/Fika.Dedicated/Patches/CreateMovementContextPatch.cs deleted file mode 100644 index 130f17ba..00000000 --- a/Fika.Dedicated/Patches/CreateMovementContextPatch.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Reflection; -using EFT; -using Fika.Core.Coop.ObservedClasses; -using SPT.Reflection.Patching; -using UnityEngine; - -namespace Fika.Dedicated.Patches -{ - public class CreateMovementContextPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(Player).GetMethod(nameof(Player.CreateMovementContext)); - } - - [PatchPrefix] - private static bool Prefix(Player __instance) - { - if (__instance.IsYourPlayer) - { - LayerMask movement_MASK = EFTHardSettings.Instance.MOVEMENT_MASK; - __instance.MovementContext = DedicatedMovementContext.Create(__instance, new Func(__instance.GetBodyAnimatorCommon), - new Func(__instance.GetCharacterControllerCommon), movement_MASK); - - return false; - } - - return true; - } - } -} diff --git a/Fika.Dedicated/Patches/DLSSPatch1.cs b/Fika.Dedicated/Patches/DLSSPatch1.cs deleted file mode 100644 index adcca205..00000000 --- a/Fika.Dedicated/Patches/DLSSPatch1.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Reflection; -using SPT.Reflection.Patching; -using UnityEngine; -using UnityEngine.Rendering; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000004 RID: 4 - public class DLSSPatch1 : ModulePatch - { - // Token: 0x0600000B RID: 11 RVA: 0x0000223C File Offset: 0x0000043C - protected override MethodBase GetTargetMethod() - { - return typeof(SystemInfo).GetProperty("graphicsDeviceType").GetGetMethod(); - } - - // Token: 0x0600000C RID: 12 RVA: 0x00002268 File Offset: 0x00000468 - [PatchPrefix] - private static bool Prefix(ref GraphicsDeviceType __result) - { - __result = GraphicsDeviceType.Direct3D11; - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/DLSSPatch2.cs b/Fika.Dedicated/Patches/DLSSPatch2.cs deleted file mode 100644 index b97c784e..00000000 --- a/Fika.Dedicated/Patches/DLSSPatch2.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using SPT.Reflection.Patching; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000005 RID: 5 - public class DLSSPatch2 : ModulePatch - { - // Token: 0x0600000E RID: 14 RVA: 0x00002288 File Offset: 0x00000488 - protected override MethodBase GetTargetMethod() - { - return typeof(DLSSWrapper).GetMethod("IsDLSSLibraryLoaded"); - } - - // Token: 0x0600000F RID: 15 RVA: 0x000022B0 File Offset: 0x000004B0 - [PatchPrefix] - private static bool Prefix(ref bool __result) - { - __result = false; - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/DLSSPatch3.cs b/Fika.Dedicated/Patches/DLSSPatch3.cs deleted file mode 100644 index 71c48d7a..00000000 --- a/Fika.Dedicated/Patches/DLSSPatch3.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using SPT.Reflection.Patching; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000006 RID: 6 - public class DLSSPatch3 : ModulePatch - { - // Token: 0x06000011 RID: 17 RVA: 0x000022D0 File Offset: 0x000004D0 - protected override MethodBase GetTargetMethod() - { - return typeof(DLSSWrapper).GetMethod("IsDLSSSupported"); - } - - // Token: 0x06000012 RID: 18 RVA: 0x000022F8 File Offset: 0x000004F8 - [PatchPrefix] - private static bool Prefix(ref bool __result) - { - __result = false; - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/DLSSPatch4.cs b/Fika.Dedicated/Patches/DLSSPatch4.cs deleted file mode 100644 index 2370efd3..00000000 --- a/Fika.Dedicated/Patches/DLSSPatch4.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Reflection; -using SPT.Reflection.Patching; -using UnityEngine; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000007 RID: 7 - public class DLSSPatch4 : ModulePatch - { - // Token: 0x06000014 RID: 20 RVA: 0x00002318 File Offset: 0x00000518 - protected override MethodBase GetTargetMethod() - { - return typeof(DLSSWrapper).GetConstructor(new Type[] - { - typeof(Material), - typeof(Material) - }); - } - - // Token: 0x06000015 RID: 21 RVA: 0x00002359 File Offset: 0x00000559 - [PatchPostfix] - private static void Postfix(SSAAImpl __instance) - { - __instance.DLSSDebug = true; - __instance.DLSSDebugDisable = true; - __instance.EnableDLSS = false; - } - } -} diff --git a/Fika.Dedicated/Patches/ErrorScreenShowPatch.cs b/Fika.Dedicated/Patches/ErrorScreenShowPatch.cs deleted file mode 100644 index 1605be61..00000000 --- a/Fika.Dedicated/Patches/ErrorScreenShowPatch.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Reflection; -using EFT.UI; -using SPT.Reflection.Patching; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000008 RID: 8 - internal class ErrorScreenShowPatch : ModulePatch - { - // Token: 0x06000017 RID: 23 RVA: 0x0000237C File Offset: 0x0000057C - protected override MethodBase GetTargetMethod() - { - return typeof(ErrorScreen).GetMethod("Show"); - } - - // Token: 0x06000018 RID: 24 RVA: 0x000023A4 File Offset: 0x000005A4 - [PatchPrefix] - private static bool Prefix(string message) - { - Logger.LogError("ErrorScreen.Show: " + message); - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/HealthControllerPlayerAfterInitPatch.cs b/Fika.Dedicated/Patches/HealthControllerPlayerAfterInitPatch.cs deleted file mode 100644 index d04c6404..00000000 --- a/Fika.Dedicated/Patches/HealthControllerPlayerAfterInitPatch.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using EFT; -using SPT.Reflection.Patching; -using EFT.HealthSystem; -using UnityEngine; - -namespace Fika.Dedicated.Patches -{ - public class HealthControllerPlayerAfterInitPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(Player).GetMethod(nameof(Player.Init)); - } - - [PatchPostfix] - private static void Postfix(Player __instance) - { - if (__instance.IsYourPlayer) - { - ActiveHealthController healthController = __instance.ActiveHealthController; - if (healthController != null) - { - healthController.SetDamageCoeff(0f); - healthController.DisableMetabolism(); - } - } - - Vector3 currentPosition = __instance.Position; - __instance.Teleport(new(currentPosition.x, currentPosition.y - 50f, currentPosition.z)); - } - } -} diff --git a/Fika.Dedicated/Patches/HealthTreamentScreenPatch.cs b/Fika.Dedicated/Patches/HealthTreamentScreenPatch.cs deleted file mode 100644 index 923993da..00000000 --- a/Fika.Dedicated/Patches/HealthTreamentScreenPatch.cs +++ /dev/null @@ -1,28 +0,0 @@ -using SPT.Reflection.Patching; -using EFT.UI.SessionEnd; -using EFT; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using EFT.UI; - -namespace Fika.Dedicated.Patches -{ - public class HealthTreamentScreenPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(HealthTreatmentScreen).GetMethod(nameof(HealthTreatmentScreen.IsAvailable), BindingFlags.Public | BindingFlags.Static); - } - - [PatchPrefix] - static bool PatchPrefix(ref bool __result) - { - __result = false; - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/MenuScreenPatch.cs b/Fika.Dedicated/Patches/MenuScreenPatch.cs deleted file mode 100644 index f04ae6e2..00000000 --- a/Fika.Dedicated/Patches/MenuScreenPatch.cs +++ /dev/null @@ -1,35 +0,0 @@ -using SPT.Reflection.Patching; -using EFT.UI.SessionEnd; -using EFT; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using EFT.UI; -using SPT.Common.Http; -using Fika.Core.Models; -using Fika.Core.Networking.Http; - -namespace Fika.Dedicated.Patches -{ - public class MenuScreenPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(MenuScreen).GetMethod(nameof(MenuScreen.Show), - [ - typeof(Profile), - typeof(MatchmakerPlayerControllerClass), - typeof(ESessionMode) - ]); - } - - [PatchPostfix] - static void PatchPostfix() - { - FikaDedicatedPlugin.Instance.StartSetDedicatedStatusRoutine(); - } - } -} \ No newline at end of file diff --git a/Fika.Dedicated/Patches/SessionResultExitStatusPatchcs.cs b/Fika.Dedicated/Patches/SessionResultExitStatusPatchcs.cs deleted file mode 100644 index ac892e84..00000000 --- a/Fika.Dedicated/Patches/SessionResultExitStatusPatchcs.cs +++ /dev/null @@ -1,28 +0,0 @@ -using SPT.Reflection.Patching; -using EFT; -using EFT.UI; -using EFT.UI.SessionEnd; -using System; -using System.Reflection; -namespace Fika.Dedicated.Patches -{ - public class SessionResultExitStatusPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(SessionResultExitStatus).GetMethod(nameof(SessionResultExitStatus.Show), [typeof(Profile), - typeof(PlayerVisualRepresentation), - typeof(ESideType), - typeof(ExitStatus), - typeof(TimeSpan), - typeof(ISession), - typeof(bool)]); - } - - [PatchPostfix] - static void PatchPostfix(DefaultUIButton ____mainMenuButton) - { - ____mainMenuButton.OnClick.Invoke(); - } - } -} diff --git a/Fika.Dedicated/Patches/VRAMPatch1.cs b/Fika.Dedicated/Patches/VRAMPatch1.cs deleted file mode 100644 index 2b28d4aa..00000000 --- a/Fika.Dedicated/Patches/VRAMPatch1.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using EFT.UI; -using HarmonyLib; -using SPT.Reflection.Patching; -using UnityEngine; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x02000009 RID: 9 - public class VRAMPatch1 : ModulePatch - { - // Token: 0x0600001A RID: 26 RVA: 0x000023D8 File Offset: 0x000005D8 - protected override MethodBase GetTargetMethod() - { - return typeof(EnvironmentUIRoot).GetMethod("SetCameraActive"); - } - - // Token: 0x0600001B RID: 27 RVA: 0x00002400 File Offset: 0x00000600 - [PatchPrefix] - private static bool Prefix(EnvironmentUIRoot __instance, bool value) - { - Transform cameraContainer = Traverse.Create(__instance).Field("CameraContainer").Value; - cameraContainer.gameObject.SetActive(value); - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/VRAMPatch2.cs b/Fika.Dedicated/Patches/VRAMPatch2.cs deleted file mode 100644 index 013e07fd..00000000 --- a/Fika.Dedicated/Patches/VRAMPatch2.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Reflection; -using HarmonyLib; -using SPT.Reflection.Patching; -using UnityEngine; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x0200000A RID: 10 - public class VRAMPatch2 : ModulePatch - { - // Token: 0x0600001D RID: 29 RVA: 0x00002440 File Offset: 0x00000640 - protected override MethodBase GetTargetMethod() - { - return typeof(CameraClass).GetMethod("SetCamera"); - } - - // Token: 0x0600001E RID: 30 RVA: 0x00002468 File Offset: 0x00000668 - [PatchPrefix] - private static bool Prefix(CameraClass __instance, Camera camera) - { - __instance.Reset(); - __instance.Camera = camera; - __instance.method_2(); - Action action = Traverse.Create(__instance).Field("action_1").Value; - if (action != null) - { - action(); - } - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/VRAMPatch3.cs b/Fika.Dedicated/Patches/VRAMPatch3.cs deleted file mode 100644 index 8b350e85..00000000 --- a/Fika.Dedicated/Patches/VRAMPatch3.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using SPT.Reflection.Patching; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x0200000B RID: 11 - public class VRAMPatch3 : ModulePatch - { - // Token: 0x06000020 RID: 32 RVA: 0x000024BC File Offset: 0x000006BC - protected override MethodBase GetTargetMethod() - { - return typeof(CameraClass).GetMethod("GetVRamUsage"); - } - - // Token: 0x06000021 RID: 33 RVA: 0x000024E4 File Offset: 0x000006E4 - [PatchPrefix] - private static bool Prefix() - { - return false; - } - } -} diff --git a/Fika.Dedicated/Patches/VRAMPatch4.cs b/Fika.Dedicated/Patches/VRAMPatch4.cs deleted file mode 100644 index ff4aa47f..00000000 --- a/Fika.Dedicated/Patches/VRAMPatch4.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using EFT.UI.Settings; -using SPT.Reflection.Patching; - -namespace Fika.Dedicated.Patches -{ - // Token: 0x0200000C RID: 12 - public class VRAMPatch4 : ModulePatch - { - // Token: 0x06000023 RID: 35 RVA: 0x00002500 File Offset: 0x00000700 - protected override MethodBase GetTargetMethod() - { - return typeof(GraphicsSettingsTab).GetMethod("UpdateRecommendedVRAMLabel"); - } - - // Token: 0x06000024 RID: 36 RVA: 0x00002528 File Offset: 0x00000728 - [PatchPrefix] - private static bool Prefix() - { - return false; - } - } -}