Skip to content

Commit

Permalink
Remove Fika.Dedicated + hide dedicated client name plate
Browse files Browse the repository at this point in the history
  • Loading branch information
trippyone committed Jul 8, 2024
1 parent 6bab406 commit b96b327
Show file tree
Hide file tree
Showing 25 changed files with 31 additions and 917 deletions.
8 changes: 0 additions & 8 deletions Fika-Plugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 14 additions & 1 deletion Fika.Core/Coop/Custom/FikaHealthBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Fika.Core/Networking/FikaPingingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public bool Init(string serverId)
GetHostResponse result = FikaRequestHandler.GetHost(body);

FikaBackendUtils.IsHostNatPunch = result.NatPunch;
FikaBackendUtils.IsDedicated = result.IsDedicated;

NetClient.Start();

Expand Down
2 changes: 1 addition & 1 deletion Fika.Core/Networking/FikaServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 5 additions & 1 deletion Fika.Core/Networking/Models/GetHostResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
6 changes: 5 additions & 1 deletion Fika.Core/Networking/Models/SetHostRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
15 changes: 5 additions & 10 deletions Fika.Core/Networking/Websocket/DedicatedRaidWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -36,7 +31,6 @@ public bool Connected
return _webSocket.ReadyState == WebSocketState.Open;
}
}
public event EventHandler<string> OnFikaDedicatedJoinMatch;

private WebSocket _webSocket;

Expand Down Expand Up @@ -120,8 +114,9 @@ private void WebSocket_OnMessage(object sender, MessageEventArgs e)
TarkovApplication tarkovApplication = (TarkovApplication)Singleton<ClientApplication<ISession>>.Instance;

tarkovApplication.StartCoroutine(MatchMakerUIScript.JoinMatch(tarkovApplication.Session.Profile.Id, matchId, null, () =>
{
Traverse.Create(matchMakerAcceptScreen).Field<DefaultUIButton>("_acceptButton").Value.OnClick.Invoke();
{
// MatchmakerAcceptScreen -> next screen (accept)
matchMakerAcceptScreen.method_22();

Destroy(matchmakerUI.gameObject);
Destroy(matchmakerUI);
Expand Down
20 changes: 0 additions & 20 deletions Fika.Dedicated/Classes/DedicatedMovementContext.cs

This file was deleted.

99 changes: 0 additions & 99 deletions Fika.Dedicated/Classes/DedicatedRaidWebSocketServer.cs

This file was deleted.

63 changes: 0 additions & 63 deletions Fika.Dedicated/Fika.Dedicated.csproj

This file was deleted.

Loading

0 comments on commit b96b327

Please sign in to comment.