From 5acd7186ca75b3dff67774cf776c71665f41529e Mon Sep 17 00:00:00 2001
From: MrOkiDoki <0mrokidoki@gmail.com>
Date: Mon, 28 Aug 2023 18:21:32 +0300
Subject: [PATCH] bug fixes
---
.../Networking/NetworkCommuncation.cs | 2 ++
BattleBitAPI/Server/GameServer.cs | 2 ++
BattleBitAPI/Server/ServerListener.cs | 32 ++++++++++++++++---
CommunityServerAPI.csproj | 2 +-
4 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/BattleBitAPI/Networking/NetworkCommuncation.cs b/BattleBitAPI/Networking/NetworkCommuncation.cs
index b687440..e504326 100644
--- a/BattleBitAPI/Networking/NetworkCommuncation.cs
+++ b/BattleBitAPI/Networking/NetworkCommuncation.cs
@@ -43,5 +43,7 @@
NotifyNewRoundID = 73,
Log = 74,
OnSquadLeaderChanged = 75,
+ UpdateNewGameData = 76,
+ UpdateConnectedPlayers = 77,
}
}
diff --git a/BattleBitAPI/Server/GameServer.cs b/BattleBitAPI/Server/GameServer.cs
index 3624e9a..0963f71 100644
--- a/BattleBitAPI/Server/GameServer.cs
+++ b/BattleBitAPI/Server/GameServer.cs
@@ -1357,6 +1357,8 @@ namespace BattleBitAPI.Server
this.RoundIndex = roundIndex;
this.SessionID = sessionID;
+ this.Players.Clear();
+
this.ServerSettings.Reset();
this._RoomSettings.Reset();
this.IsDirtyRoomSettings = false;
diff --git a/BattleBitAPI/Server/ServerListener.cs b/BattleBitAPI/Server/ServerListener.cs
index b2eb487..8a68220 100644
--- a/BattleBitAPI/Server/ServerListener.cs
+++ b/BattleBitAPI/Server/ServerListener.cs
@@ -486,10 +486,6 @@ namespace BattleBitAPI.Server
sessionID = readStream.ReadInt64();
}
-
-
-
-
server = this.mInstanceDatabase.GetServerInstance(hash, out resources, this.OnCreatingGameServerInstance, ip, (ushort)gamePort);
resources.Set(
this.mExecutePackage,
@@ -859,6 +855,34 @@ namespace BattleBitAPI.Server
var communcation = (NetworkCommuncation)stream.ReadInt8();
switch (communcation)
{
+ case NetworkCommuncation.UpdateNewGameData:
+ {
+ if (stream.CanRead(10))
+ {
+ resources.CurrentPlayerCount = stream.ReadInt8();
+ resources.InQueuePlayerCount = stream.ReadInt8();
+ resources.MaxPlayerCount = stream.ReadInt8();
+ resources.MaxPlayerCount = stream.ReadInt8();
+ stream.TryReadString(out resources.Gamemode);
+ resources.MapSize = (MapSize)stream.ReadInt8();
+ stream.TryReadString(out resources.Map);
+ byte gameType = stream.ReadInt8();
+ resources.DayNight = (MapDayNight)stream.ReadInt8();
+ }
+ break;
+ }
+ case NetworkCommuncation.UpdateConnectedPlayers:
+ {
+ if (stream.CanRead(4))
+ {
+ resources.CurrentPlayerCount = stream.ReadInt8();
+ resources.InQueuePlayerCount = stream.ReadInt8();
+ resources.MaxPlayerCount = stream.ReadInt8();
+ resources.MaxPlayerCount = stream.ReadInt8();
+ }
+ break;
+ }
+
case NetworkCommuncation.PlayerConnected:
{
if (stream.CanRead(8 + 2 + 4 + (1 + 1 + 1)))
diff --git a/CommunityServerAPI.csproj b/CommunityServerAPI.csproj
index fcd53a0..6470c51 100644
--- a/CommunityServerAPI.csproj
+++ b/CommunityServerAPI.csproj
@@ -18,7 +18,7 @@
https://github.com/MrOkiDoki/BattleBit-Community-Server-API
https://github.com/MrOkiDoki/BattleBit-Community-Server-API
BattleBit
- 1.0.4
+ 1.0.4.1