mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
2021.3.5
This commit is contained in:
1 parent
e769b874c8
commit
9bd43b4629
8 files changed
+29
-39
No files matched your search
@@ -0,0 +1,8 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum ChatType
|
||||
{
|
||||
FreeChatOrQuickChat = 1,
|
||||
QuickChatOnly = 2,
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,12 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
public static GameOptionsData Deserialize(IMessageReader reader)
|
||||
public static GameOptionsData Deserialize(IMessageReader reader, out ChatType chatType)
|
||||
{
|
||||
return GameOptionsData.DeserializeCreate(reader);
|
||||
var gameOptionsData = GameOptionsData.DeserializeCreate(reader);
|
||||
chatType = (ChatType)reader.ReadByte();
|
||||
|
||||
return gameOptionsData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static class Message01JoinGameC2S
|
||||
{
|
||||
@@ -9,12 +7,11 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out int gameCode, out byte unknown)
|
||||
public static void Deserialize(IMessageReader reader, out int gameCode)
|
||||
{
|
||||
var slice = reader.ReadBytes(sizeof(Int32) + sizeof(byte)).Span;
|
||||
var slice = reader.ReadBytes(sizeof(int)).Span;
|
||||
|
||||
gameCode = slice.ReadInt32();
|
||||
unknown = slice.ReadByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,11 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out GameOptionsData options)
|
||||
public static void Deserialize(IMessageReader reader, out GameOptionsData options, out ChatType chatType)
|
||||
{
|
||||
reader.ReadPackedInt32(); // Hardcoded 0.
|
||||
options = GameOptionsData.DeserializeCreate(reader);
|
||||
chatType = (ChatType)reader.ReadByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,10 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
public class Message16GetGameListS2C
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, int skeldGameCount, int miraHqGameCount, int polusGameCount, IEnumerable<IGame> games)
|
||||
public static void Serialize(IMessageWriter writer, IEnumerable<IGame> games)
|
||||
{
|
||||
writer.StartMessage(MessageFlags.GetGameListV2);
|
||||
|
||||
// Count
|
||||
writer.StartMessage(1);
|
||||
writer.Write(skeldGameCount); // The Skeld
|
||||
writer.Write(miraHqGameCount); // Mira HQ
|
||||
writer.Write(polusGameCount); // Polus
|
||||
writer.EndMessage();
|
||||
|
||||
// Listing
|
||||
writer.StartMessage(0);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Impostor.Server.Net
|
||||
case MessageFlags.HostGame:
|
||||
{
|
||||
// Read game settings.
|
||||
var gameInfo = Message00HostGameC2S.Deserialize(reader);
|
||||
var gameInfo = Message00HostGameC2S.Deserialize(reader, out _);
|
||||
|
||||
// Create game.
|
||||
var game = await _gameManager.CreateAsync(gameInfo);
|
||||
@@ -80,10 +80,7 @@ namespace Impostor.Server.Net
|
||||
|
||||
case MessageFlags.JoinGame:
|
||||
{
|
||||
Message01JoinGameC2S.Deserialize(
|
||||
reader,
|
||||
out var gameCode,
|
||||
out _);
|
||||
Message01JoinGameC2S.Deserialize(reader, out var gameCode);
|
||||
|
||||
var game = _gameManager.Find(gameCode);
|
||||
if (game == null)
|
||||
@@ -248,7 +245,7 @@ namespace Impostor.Server.Net
|
||||
|
||||
case MessageFlags.GetGameListV2:
|
||||
{
|
||||
Message16GetGameListC2S.Deserialize(reader, out var options);
|
||||
Message16GetGameListC2S.Deserialize(reader, out var options, out _);
|
||||
await OnRequestGameListAsync(options);
|
||||
break;
|
||||
}
|
||||
@@ -334,11 +331,7 @@ namespace Impostor.Server.Net
|
||||
|
||||
var games = _gameManager.FindListings((MapFlags)options.Map, options.NumImpostors, options.Keywords);
|
||||
|
||||
var skeldGameCount = _gameManager.GetGameCount(MapFlags.Skeld);
|
||||
var miraHqGameCount = _gameManager.GetGameCount(MapFlags.MiraHQ);
|
||||
var polusGameCount = _gameManager.GetGameCount(MapFlags.Polus);
|
||||
|
||||
Message16GetGameListS2C.Serialize(message, skeldGameCount, miraHqGameCount, polusGameCount, games);
|
||||
Message16GetGameListS2C.Serialize(message, games);
|
||||
|
||||
return Connection.SendAsync(message);
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ namespace Impostor.Server.Net.Manager
|
||||
{
|
||||
private static HashSet<int> SupportedVersions { get; } = new HashSet<int>
|
||||
{
|
||||
GameVersion.GetVersion(2020, 09, 07), // 2020.09.07 - 2020.09.22
|
||||
GameVersion.GetVersion(2020, 10, 08), // 2020.10.08
|
||||
GameVersion.GetVersion(2020, 11, 17), // 2020.11.17
|
||||
GameVersion.GetVersion(2021, 3, 5), // 2021.3.5
|
||||
};
|
||||
|
||||
private static string ServerBrand { get; } = $"Impostor {DotnetUtils.GetVersion()}";
|
||||
@@ -108,4 +106,4 @@ namespace Impostor.Server.Net.Manager
|
||||
&& ReferenceEquals(client, registeredClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,10 +54,7 @@ namespace Impostor.Server.Net.Redirector
|
||||
|
||||
case MessageFlags.JoinGame:
|
||||
{
|
||||
Message01JoinGameC2S.Deserialize(
|
||||
reader,
|
||||
out var gameCode,
|
||||
out _);
|
||||
Message01JoinGameC2S.Deserialize(reader, out var gameCode);
|
||||
|
||||
using var packet = MessageWriter.Get(MessageType.Reliable);
|
||||
var endpoint = await _nodeLocator.FindAsync(GameCodeParser.IntToGameName(gameCode));
|
||||
@@ -97,4 +94,4 @@ namespace Impostor.Server.Net.Redirector
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user