mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
224 files changed
+1321
-1281
No files matched your search
@@ -3,7 +3,7 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "0.38.5",
|
||||
"version": "1.1.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
|
||||
@@ -30,7 +30,6 @@ test: off
|
||||
|
||||
artifacts:
|
||||
- path: ./build/*.zip
|
||||
- path: ./build/*.tar.gz
|
||||
- path: ./build/*.nupkg
|
||||
- path: ./build/*.snupkg
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
#addin "nuget:?package=SharpZipLib&Version=1.3.0"
|
||||
#addin "nuget:?package=Cake.Compression&Version=0.2.4"
|
||||
#addin "nuget:?package=Cake.FileHelpers&Version=3.3.0"
|
||||
#addin "nuget:?package=SharpZipLib&Version=1.3.1"
|
||||
#addin "nuget:?package=Cake.Compression&Version=0.2.6"
|
||||
#addin "nuget:?package=Cake.FileHelpers&Version=4.0.1"
|
||||
|
||||
var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER") ?? EnvironmentVariable("APPVEYOR_BUILD_VERSION");
|
||||
var buildRelease = EnvironmentVariable("APPVEYOR_REPO_TAG") == "true";
|
||||
|
||||
@@ -3,5 +3,9 @@
|
||||
<VersionPrefix>1.3.0</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -3,40 +3,40 @@ using Impostor.Api.Innersloth;
|
||||
namespace Impostor.Api.Events.Announcements
|
||||
{
|
||||
/// <summary>
|
||||
/// Event fired after client requests a announcement.
|
||||
/// Event fired after client requests a announcement.
|
||||
/// </summary>
|
||||
public interface IAnnouncementRequestEvent : IEvent
|
||||
{
|
||||
public interface IResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets FreeWeekendState, currently unused by the client.
|
||||
/// Gets or sets FreeWeekendState, currently unused by the client.
|
||||
/// </summary>
|
||||
public FreeWeekendState FreeWeekendState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether announcement should be loaded from client's cache, can save some bytes.
|
||||
/// Gets or sets a value indicating whether announcement should be loaded from client's cache, can save some bytes.
|
||||
/// </summary>
|
||||
public bool UseCached { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets announcement, should be null when <see cref="UseCached"/> is set to true.
|
||||
/// Gets or sets announcement, should be null when <see cref="UseCached" /> is set to true.
|
||||
/// </summary>
|
||||
public Announcement? Announcement { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets client's last announcement id.
|
||||
/// Gets client's last announcement id.
|
||||
/// </summary>
|
||||
public int Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets client's language.
|
||||
/// Gets client's language.
|
||||
/// </summary>
|
||||
public Language Language { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets plugin made response.
|
||||
/// Gets or sets plugin made response.
|
||||
/// </summary>
|
||||
public IResponse Response { get; set; }
|
||||
}
|
||||
|
||||
@@ -17,18 +17,18 @@ namespace Impostor.Api.Events
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The priority of the event listener.
|
||||
/// Gets or sets the priority of the event listener.
|
||||
/// </summary>
|
||||
public EventPriority Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The events that the listener is listening to.
|
||||
/// Gets or sets the event that the listener is listening to.
|
||||
/// </summary>
|
||||
public Type? Event { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If set to true, the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled"/>.
|
||||
/// Gets or sets a value indicating whether the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled" />.
|
||||
/// </summary>
|
||||
public bool IgnoreCancelled { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a new <see cref="IGame"/> is created.
|
||||
/// Called whenever a new <see cref="IGame" /> is created.
|
||||
/// </summary>
|
||||
public interface IGameCreatedEvent : IGameEvent
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a new <see cref="IGame"/> is destroyed.
|
||||
/// Called whenever a new <see cref="IGame" /> is destroyed.
|
||||
/// </summary>
|
||||
public interface IGameDestroyedEvent : IGameEvent
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Impostor.Api.Events
|
||||
public interface IGameEvent : IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IGame"/> this event belongs to.
|
||||
/// Gets the <see cref="IGame" /> this event belongs to.
|
||||
/// </summary>
|
||||
IGame Game { get; }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// Called when the game is going to start.
|
||||
/// When this is called, not all players are initialized properly yet.
|
||||
/// If you want to get correct player states, use <see cref="IGameStartedEvent"/>.
|
||||
/// If you want to get correct player states, use <see cref="IGameStartedEvent" />.
|
||||
/// </summary>
|
||||
public interface IGameStartingEvent : IGameEvent
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace Impostor.Api.Events.Player
|
||||
public interface IPlayerEvent : IGameEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IClientPlayer"/> that triggered this <see cref="IPlayerEvent"/>.
|
||||
/// Gets the <see cref="IClientPlayer" /> that triggered this <see cref="IPlayerEvent" />.
|
||||
/// </summary>
|
||||
IClientPlayer ClientPlayer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the networked <see cref="IInnerPlayerControl"/> that triggered this <see cref="IPlayerEvent"/>.
|
||||
/// This <see cref="IInnerPlayerControl"/> belongs to the <see cref="IClientPlayer"/>.
|
||||
/// Gets the networked <see cref="IInnerPlayerControl" /> that triggered this <see cref="IPlayerEvent" />.
|
||||
/// This <see cref="IInnerPlayerControl" /> belongs to the <see cref="IClientPlayer" />.
|
||||
/// </summary>
|
||||
IInnerPlayerControl PlayerControl { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Impostor.Api.Events.Player
|
||||
public interface IPlayerStartMeetingEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button
|
||||
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button.
|
||||
/// </summary>
|
||||
IInnerPlayerControl? Body { get; }
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
public interface IEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
public interface IEventCancelable : IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// True if the event was cancelled.
|
||||
/// Gets or sets a value indicating whether the event was cancelled.
|
||||
/// </summary>
|
||||
bool IsCancelled { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,4 @@
|
||||
public interface IEventListener
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IManualEventListener : IEventListener
|
||||
{
|
||||
EventPriority Priority { get; set; }
|
||||
|
||||
public bool CanExecute<T>();
|
||||
|
||||
public ValueTask Execute(IEvent @event);
|
||||
|
||||
EventPriority Priority { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,20 +16,20 @@ namespace Impostor.Api.Events.Managers
|
||||
where TListener : IEventListener;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if an event with the type <see cref="TEvent"/> is registered.
|
||||
/// Returns true if an event with the type <typeparamref name="TEvent" /> is registered.
|
||||
/// </summary>
|
||||
/// <returns>True if the <see cref="TEvent"/> is registered.</returns>
|
||||
/// <returns>True if the <typeparamref name="TEvent" /> is registered.</returns>
|
||||
/// <typeparam name="TEvent">Type of the event.</typeparam>
|
||||
bool IsRegistered<TEvent>()
|
||||
where TEvent : IEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Call all the event listeners for the type <see cref="TEvent"/>.
|
||||
/// Call all the event listeners for the type <typeparamref name="TEvent" />.
|
||||
/// </summary>
|
||||
/// <param name="event">The event argument.</param>
|
||||
/// <typeparam name="TEvent">Type of the event.</typeparam>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask CallAsync<TEvent>(TEvent @event)
|
||||
where TEvent : IEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,6 @@ namespace Impostor.Api
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorConfigException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorConfigException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
@@ -20,5 +16,9 @@ namespace Impostor.Api
|
||||
public ImpostorConfigException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorConfigException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,6 @@ namespace Impostor.Api
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
@@ -20,5 +16,9 @@ namespace Impostor.Api
|
||||
public ImpostorException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,6 @@ namespace Impostor.Api
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorProtocolException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorProtocolException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
@@ -20,5 +16,9 @@ namespace Impostor.Api
|
||||
public ImpostorProtocolException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorProtocolException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
|
||||
namespace Impostor.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Priovides a StreamReader-like api throught extensions
|
||||
/// Priovides a StreamReader-like api throught extensions.
|
||||
/// </summary>
|
||||
public static class SpanReaderExtensions
|
||||
{
|
||||
@@ -53,11 +53,11 @@ namespace Impostor.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the position of <see cref="input"/> by the size of <see cref="T"/>.
|
||||
/// Advances the position of <paramref name="input" /> by the size of <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type that will be read.</typeparam>
|
||||
/// <param name="input">input "stream"/span.</param>
|
||||
/// <returns>The original input</returns>
|
||||
/// <returns>The original input.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static unsafe ReadOnlySpan<byte> Advance<T>(ref ReadOnlySpan<byte> input)
|
||||
where T : unmanaged
|
||||
@@ -67,4 +67,4 @@ namespace Impostor.Api
|
||||
return original;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ namespace Impostor.Api
|
||||
return SystemTypeHelpers.Names[(int)type];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,4 @@ namespace Impostor.Api.Games
|
||||
return game.SendToAsync(writer, player.Client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,4 @@ namespace Impostor.Api.Games
|
||||
return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << (byte)game.Options.Map)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,19 +48,19 @@ namespace Impostor.Api.Games
|
||||
|
||||
public static GameCode From(string value) => new GameCode(value);
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <inheritdoc />
|
||||
public bool Equals(GameCode other)
|
||||
{
|
||||
return Code == other.Code && Value == other.Value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is GameCode other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Code, Value);
|
||||
@@ -71,4 +71,4 @@ namespace Impostor.Api.Games
|
||||
return Code;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,8 @@
|
||||
/// Custom error by a plugin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A custom message can be set in <see cref="GameJoinResult.Message"/>.
|
||||
/// A custom message can be set in <see cref="GameJoinResult.Message" />.
|
||||
/// </remarks>
|
||||
Custom,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,4 @@ namespace Impostor.Api.Games
|
||||
return new GameJoinResult(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Impostor.Api.Games
|
||||
bool IsPublic { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets display name on game list.
|
||||
/// Gets or sets display name on game list.
|
||||
/// </summary>
|
||||
string? DisplayName { get; set; }
|
||||
|
||||
@@ -37,34 +37,33 @@ namespace Impostor.Api.Games
|
||||
|
||||
int HostId { get; }
|
||||
|
||||
IClientPlayer GetClientPlayer(int clientId);
|
||||
IClientPlayer? GetClientPlayer(int clientId);
|
||||
|
||||
T? FindObjectByNetId<T>(uint netId)
|
||||
where T : IInnerNetObject;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an <see cref="IPAddress"/> to the ban list of this game.
|
||||
/// Prevents all future joins from this <see cref="IPAddress"/>.
|
||||
///
|
||||
/// This does not kick the player with that <see cref="IPAddress"/> from the lobby.
|
||||
/// Adds an <see cref="IPAddress" /> to the ban list of this game.
|
||||
/// Prevents all future joins from this <see cref="IPAddress" />.
|
||||
/// This does not kick the player with that <see cref="IPAddress" /> from the lobby.
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">
|
||||
/// The <see cref="IPAddress"/> to ban.
|
||||
/// The <see cref="IPAddress" /> to ban.
|
||||
/// </param>
|
||||
void BanIp(IPAddress ipAddress);
|
||||
|
||||
/// <summary>
|
||||
/// Syncs the internal <see cref="GameOptionsData"/> to all players.
|
||||
/// Syncs the internal <see cref="GameOptionsData" /> to all players.
|
||||
/// Necessary to do if you modified it, otherwise it won't be used.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SyncSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Sets game's privacy.
|
||||
/// </summary>
|
||||
/// <param name="isPublic">Privacy to set.</param>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SetPrivacyAsync(bool isPublic);
|
||||
|
||||
/// <summary>
|
||||
@@ -72,7 +71,7 @@ namespace Impostor.Api.Games
|
||||
/// </summary>
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="states">Required limbo state of the player.</param>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAllAsync(IMessageWriter writer, LimboStates states = LimboStates.NotLimbo);
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +80,7 @@ namespace Impostor.Api.Games
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="senderId">The player to exclude from sending the message.</param>
|
||||
/// <param name="states">Required limbo state of the player.</param>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAllExceptAsync(IMessageWriter writer, int senderId, LimboStates states = LimboStates.NotLimbo);
|
||||
|
||||
/// <summary>
|
||||
@@ -89,7 +88,7 @@ namespace Impostor.Api.Games
|
||||
/// </summary>
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="id">ID of the client.</param>
|
||||
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAsync(IMessageWriter writer, int id);
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,4 @@
|
||||
{
|
||||
GameCode Create();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,4 @@ namespace Impostor.Api.Games.Managers
|
||||
|
||||
ValueTask<IGame> CreateAsync(GameOptionsData options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<CodeAnalysisRuleSet>ProjectRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet>../ProjectRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>9</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -15,11 +15,17 @@
|
||||
<PackageId>Impostor.Api</PackageId>
|
||||
<PackageTags>Among Us;Impostor;Impostor Plugin</PackageTags>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/Impostor/Impostor/dev/docs/images/logo_64.png</PackageIconUrl>
|
||||
<PackageIcon>logo_64.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/Impostor/Impostor</PackageProjectUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Impostor/Impostor</RepositoryUrl>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="../../docs/images/logo_64.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
||||
@@ -33,4 +39,4 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -4,4 +4,4 @@
|
||||
{
|
||||
ChangePrivacy = 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,4 @@
|
||||
{
|
||||
DidVote = 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@
|
||||
Kill = 1,
|
||||
Disconnect = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,52 +3,66 @@
|
||||
public enum DisconnectReason
|
||||
{
|
||||
ExitGame = 0,
|
||||
Destroy = 16,
|
||||
|
||||
// The game you tried to join is full.
|
||||
// Check with the host to see if you can join next round.
|
||||
GameFull = 1,
|
||||
|
||||
// The game you tried to join already started.
|
||||
// Check with the host to see if you can join next round.
|
||||
GameStarted = 2,
|
||||
// Could not find the game you're looking for.
|
||||
|
||||
// Could not find the game you're looking for..
|
||||
GameMissing = 3,
|
||||
IncorrectGame = 18,
|
||||
// For these a message can be given, specifying an empty message shows
|
||||
|
||||
// For this a message can be given, specifying an empty message shows
|
||||
// "An unknown error disconnected you from the server."
|
||||
CustomMessage1 = 4,
|
||||
// 4, 12, 13, 14, 15 also count as Custom
|
||||
Custom = 8,
|
||||
// CustomMessage3 = 11,
|
||||
// CustomMessage4 = 12,
|
||||
// CustomMessage5 = 13,
|
||||
// CustomMessage6 = 14,
|
||||
// CustomMessage7 = 15,
|
||||
|
||||
// You are running an older version of the game.
|
||||
// Please update to play with others.
|
||||
IncorrectVersion = 5,
|
||||
|
||||
// You were banned from { GameCode ?? "the room" }
|
||||
// You cannot rejoin that room.
|
||||
// You were banned
|
||||
Banned = 6,
|
||||
// You can rejoin if the room hasn't started
|
||||
// You were kicked
|
||||
|
||||
// You were kicked from { GameCode ?? "the room" }
|
||||
// You can rejoin if the room hasn't started.
|
||||
Kicked = 7,
|
||||
|
||||
// You were banned for hacking.
|
||||
// Please stop.
|
||||
Hacking = 10,
|
||||
Destroy = 16,
|
||||
|
||||
// GameModes.LocalGame:
|
||||
// You disconnected from the host.
|
||||
// If this happens often, check your WiFi strength.
|
||||
//
|
||||
// GameModes.OnlineGame:
|
||||
// You disconnected from the server.
|
||||
// If this happens often, check your network strength.
|
||||
// This may also be a server issue.
|
||||
Error = 17,
|
||||
|
||||
// The server stopped this game. Possibly due to inactivity.
|
||||
ServerRequest = 19,
|
||||
|
||||
// The Among Us servers are overloaded.
|
||||
// Sorry! Please try again later!
|
||||
ServerFull = 20,
|
||||
|
||||
FocusLostBackground = 207,
|
||||
|
||||
// You may not join another game for another { BanMinutesLeft } minutes after intentionally disconnecting.
|
||||
IntentionalLeaving = 208,
|
||||
|
||||
// You were disconnected because Among Us was suspended by another app.
|
||||
FocusLost = 209,
|
||||
|
||||
NewConnection = 210,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,36 +9,11 @@ namespace Impostor.Api.Innersloth
|
||||
public static class GameCodeParser
|
||||
{
|
||||
private const string V2 = "QWXRTYLPESDFGHUJKZOCVBINMA";
|
||||
private static readonly int[] V2Map = {
|
||||
25,
|
||||
21,
|
||||
19,
|
||||
10,
|
||||
8,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
22,
|
||||
15,
|
||||
16,
|
||||
6,
|
||||
24,
|
||||
23,
|
||||
18,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
9,
|
||||
4,
|
||||
14,
|
||||
20,
|
||||
1,
|
||||
2,
|
||||
5,
|
||||
17
|
||||
};
|
||||
|
||||
private static readonly int[] V2Map = Enumerable.Range(65, 26).Select(v => V2.IndexOf((char)v)).ToArray();
|
||||
|
||||
private static readonly RNGCryptoServiceProvider Random = new RNGCryptoServiceProvider();
|
||||
|
||||
|
||||
public static string IntToGameName(int input)
|
||||
{
|
||||
// V2.
|
||||
@@ -57,22 +32,6 @@ namespace Impostor.Api.Innersloth
|
||||
#endif
|
||||
}
|
||||
|
||||
private static string IntToGameNameV2(int input)
|
||||
{
|
||||
var a = input & 0x3FF;
|
||||
var b = (input >> 10) & 0xFFFFF;
|
||||
|
||||
return new string(new []
|
||||
{
|
||||
V2[a % 26],
|
||||
V2[a / 26],
|
||||
V2[b % 26],
|
||||
V2[b / 26 % 26],
|
||||
V2[b / (26 * 26) % 26],
|
||||
V2[b / (26 * 26 * 26) % 26]
|
||||
});
|
||||
}
|
||||
|
||||
public static int GameNameToInt(string code)
|
||||
{
|
||||
var upper = code.ToUpperInvariant();
|
||||
@@ -80,7 +39,7 @@ namespace Impostor.Api.Innersloth
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
var len = code.Length;
|
||||
if (len == 6)
|
||||
{
|
||||
@@ -91,24 +50,9 @@ namespace Impostor.Api.Innersloth
|
||||
{
|
||||
return code[0] | ((code[1] | ((code[2] | (code[3] << 8)) << 8)) << 8);
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static int GameNameToIntV2(string code)
|
||||
{
|
||||
var a = V2Map[code[0] - 65];
|
||||
var b = V2Map[code[1] - 65];
|
||||
var c = V2Map[code[2] - 65];
|
||||
var d = V2Map[code[3] - 65];
|
||||
var e = V2Map[code[4] - 65];
|
||||
var f = V2Map[code[5] - 65];
|
||||
|
||||
var one = (a + 26 * b) & 0x3FF;
|
||||
var two = (c + 26 * (d + 26 * (e + 26 * f)));
|
||||
|
||||
return (int) (one | ((two << 10) & 0x3FFFFC00) | 0x80000000);
|
||||
}
|
||||
|
||||
public static int GenerateCode(int len)
|
||||
{
|
||||
@@ -116,7 +60,7 @@ namespace Impostor.Api.Innersloth
|
||||
{
|
||||
throw new ArgumentException("should be 4 or 6", nameof(len));
|
||||
}
|
||||
|
||||
|
||||
// Generate random bytes.
|
||||
#if NETSTANDARD2_0
|
||||
var data = new byte[len];
|
||||
@@ -124,7 +68,7 @@ namespace Impostor.Api.Innersloth
|
||||
Span<byte> data = stackalloc byte[len];
|
||||
#endif
|
||||
Random.GetBytes(data);
|
||||
|
||||
|
||||
// Convert to their char representation.
|
||||
Span<char> dataChar = stackalloc char[len];
|
||||
for (var i = 0; i < len; i++)
|
||||
@@ -138,5 +82,36 @@ namespace Impostor.Api.Innersloth
|
||||
return GameNameToInt(new string(dataChar));
|
||||
#endif
|
||||
}
|
||||
|
||||
private static string IntToGameNameV2(int input)
|
||||
{
|
||||
var a = input & 0x3FF;
|
||||
var b = (input >> 10) & 0xFFFFF;
|
||||
|
||||
return new string(new[]
|
||||
{
|
||||
V2[a % 26],
|
||||
V2[a / 26],
|
||||
V2[b % 26],
|
||||
V2[(b / 26) % 26],
|
||||
V2[(b / (26 * 26)) % 26],
|
||||
V2[(b / (26 * 26 * 26)) % 26],
|
||||
});
|
||||
}
|
||||
|
||||
private static int GameNameToIntV2(string code)
|
||||
{
|
||||
var a = V2Map[code[0] - 65];
|
||||
var b = V2Map[code[1] - 65];
|
||||
var c = V2Map[code[2] - 65];
|
||||
var d = V2Map[code[3] - 65];
|
||||
var e = V2Map[code[4] - 65];
|
||||
var f = V2Map[code[5] - 65];
|
||||
|
||||
var one = (a + (26 * b)) & 0x3FF;
|
||||
var two = c + (26 * (d + (26 * (e + (26 * f)))));
|
||||
|
||||
return (int)(one | ((two << 10) & 0x3FFFFC00) | 0x80000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,4 @@ namespace Impostor.Api.Innersloth
|
||||
Polish = 128,
|
||||
English = 256,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,130 +7,130 @@ namespace Impostor.Api.Innersloth
|
||||
public class GameOptionsData
|
||||
{
|
||||
/// <summary>
|
||||
/// The latest major version of the game client.
|
||||
/// The latest major version of the game client.
|
||||
/// </summary>
|
||||
public const int LatestVersion = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets host's version of the game.
|
||||
/// Gets or sets host's version of the game.
|
||||
/// </summary>
|
||||
public byte Version { get; set; } = LatestVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum amount of players for this lobby.
|
||||
/// Gets or sets the maximum amount of players for this lobby.
|
||||
/// </summary>
|
||||
public byte MaxPlayers { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language of the lobby as per <see cref="GameKeywords"/> enum.
|
||||
/// Gets or sets the language of the lobby as per <see cref="GameKeywords" /> enum.
|
||||
/// </summary>
|
||||
public GameKeywords Keywords { get; set; } = GameKeywords.English;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Map selected for this lobby.
|
||||
/// Gets or sets the Map selected for this lobby.
|
||||
/// </summary>
|
||||
public MapTypes Map { get; set; } = MapTypes.Skeld;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Player speed modifier.
|
||||
/// Gets or sets the Player speed modifier.
|
||||
/// </summary>
|
||||
public float PlayerSpeedMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Light modifier for the players that are members of the crew as a multiplier value.
|
||||
/// Gets or sets the Light modifier for the players that are members of the crew as a multiplier value.
|
||||
/// </summary>
|
||||
public float CrewLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
|
||||
/// Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
|
||||
/// </summary>
|
||||
public float ImpostorLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Impostor cooldown to kill in seconds.
|
||||
/// Gets or sets the Impostor cooldown to kill in seconds.
|
||||
/// </summary>
|
||||
public float KillCooldown { get; set; } = 15f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of common tasks.
|
||||
/// Gets or sets the number of common tasks.
|
||||
/// </summary>
|
||||
public int NumCommonTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// </summary>
|
||||
public int NumLongTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of short tasks.
|
||||
/// Gets or sets the number of short tasks.
|
||||
/// </summary>
|
||||
public int NumShortTasks { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum amount of emergency meetings each player can call during the game in seconds.
|
||||
/// Gets or sets the maximum amount of emergency meetings each player can call during the game in seconds.
|
||||
/// </summary>
|
||||
public int NumEmergencyMeetings { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
|
||||
/// Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
|
||||
/// </summary>
|
||||
public int EmergencyCooldown { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of impostors for this lobby.
|
||||
/// Gets or sets the number of impostors for this lobby.
|
||||
/// </summary>
|
||||
public int NumImpostors { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
|
||||
/// Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
|
||||
/// </summary>
|
||||
public bool GhostsDoTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Kill as per values in <see cref="KillDistances"/>.
|
||||
/// Gets or sets the Kill as per values in <see cref="KillDistances" />.
|
||||
/// </summary>
|
||||
public KillDistances KillDistance { get; set; } = KillDistances.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time for discussion before voting time in seconds.
|
||||
/// Gets or sets the time for discussion before voting time in seconds.
|
||||
/// </summary>
|
||||
public int DiscussionTime { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time for voting in seconds.
|
||||
/// Gets or sets the time for voting in seconds.
|
||||
/// </summary>
|
||||
public int VotingTime { get; set; } = 120;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether an ejected player is an impostor or not.
|
||||
/// Gets or sets a value indicating whether an ejected player is an impostor or not.
|
||||
/// </summary>
|
||||
public bool ConfirmImpostor { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether players are able to see tasks being performed by other players.
|
||||
/// Gets or sets a value indicating whether players are able to see tasks being performed by other players.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// By being set to true, tasks such as Empty Garbage, Submit Scan, Clear asteroids, Prime shields execution will be visible to other players.
|
||||
/// By being set to true, tasks such as Empty Garbage, Submit Scan, Clear asteroids, Prime shields execution will be visible to other players.
|
||||
/// </remarks>
|
||||
public bool VisualTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the vote is anonymous.
|
||||
/// Gets or sets a value indicating whether the vote is anonymous.
|
||||
/// </summary>
|
||||
public bool AnonymousVotes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate"/>.
|
||||
/// Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate" />.
|
||||
/// </summary>
|
||||
public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the GameOptions are the default ones.
|
||||
/// Gets or sets a value indicating whether the GameOptions are the default ones.
|
||||
/// </summary>
|
||||
public bool IsDefaults { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a packet/message to a new GameOptionsData object.
|
||||
/// Deserialize a packet/message to a new GameOptionsData object.
|
||||
/// </summary>
|
||||
/// <param name="reader">Message reader object containing the raw message.</param>
|
||||
/// <returns>GameOptionsData object.</returns>
|
||||
@@ -142,7 +142,7 @@ namespace Impostor.Api.Innersloth
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes this instance of GameOptionsData object to a specified BinaryWriter.
|
||||
/// Serializes this instance of GameOptionsData object to a specified BinaryWriter.
|
||||
/// </summary>
|
||||
/// <param name="writer">The stream to write the message to.</param>
|
||||
/// <param name="version">The version of the game.</param>
|
||||
@@ -198,7 +198,7 @@ namespace Impostor.Api.Innersloth
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a ReadOnlyMemory object to this instance of the GameOptionsData object.
|
||||
/// Deserialize a ReadOnlyMemory object to this instance of the GameOptionsData object.
|
||||
/// </summary>
|
||||
/// <param name="memory">Memory containing the message/packet.</param>
|
||||
public void Deserialize(ReadOnlyMemory<byte> memory)
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
ImpostorByVote = 2,
|
||||
ImpostorByKill = 3,
|
||||
ImpostorBySabotage = 4,
|
||||
|
||||
// Unused (?)
|
||||
ImpostorDisconnect = 5,
|
||||
HumansDisconnect = 6,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@
|
||||
Ended = 3,
|
||||
Destroyed = 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,4 @@ namespace Impostor.Api.Innersloth
|
||||
return (year * 25000) + (month * 1800) + (day * 50) + rev;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ namespace Impostor.Api.Innersloth
|
||||
MiraHQ = 2,
|
||||
Polus = 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@
|
||||
MiraHQ = 1,
|
||||
Polus = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,22 +13,11 @@ namespace Impostor.Api.Innersloth
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Ping { get; }
|
||||
|
||||
public IReadOnlyList<ServerInfo> Servers { get; }
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(Name);
|
||||
writer.Write(Ping);
|
||||
writer.Write(Servers.Count);
|
||||
|
||||
foreach (var server in Servers)
|
||||
{
|
||||
server.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public static RegionInfo Deserialize(BinaryReader reader)
|
||||
{
|
||||
var unknown = reader.ReadInt32();
|
||||
@@ -44,5 +33,18 @@ namespace Impostor.Api.Innersloth
|
||||
|
||||
return new RegionInfo(name, ping, servers);
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(Name);
|
||||
writer.Write(Ping);
|
||||
writer.Write(Servers.Count);
|
||||
|
||||
foreach (var server in Servers)
|
||||
{
|
||||
server.Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,24 +5,18 @@ namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class ServerInfo
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Ip { get; }
|
||||
public ushort Port { get; }
|
||||
|
||||
public ServerInfo(string name, string ip, ushort port)
|
||||
{
|
||||
Name = name;
|
||||
Ip = ip;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Name);
|
||||
writer.Write(IPAddress.Parse(Ip).GetAddressBytes());
|
||||
writer.Write(Port);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Ip { get; }
|
||||
|
||||
public ushort Port { get; }
|
||||
|
||||
public static ServerInfo Deserialize(BinaryReader reader)
|
||||
{
|
||||
@@ -30,8 +24,16 @@ namespace Impostor.Api.Innersloth
|
||||
var ip = new IPAddress(reader.ReadBytes(4)).ToString();
|
||||
var port = reader.ReadUInt16();
|
||||
var unknown = reader.ReadInt32();
|
||||
|
||||
|
||||
return new ServerInfo(name, ip, port);
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Name);
|
||||
writer.Write(IPAddress.Parse(Ip).GetAddressBytes());
|
||||
writer.Write(Port);
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,9 @@ namespace Impostor.Api.Innersloth
|
||||
SystemTypes.LifeSupp => "O2",
|
||||
SystemTypes.LowerEngine => "Lower Engine",
|
||||
SystemTypes.LockerRoom => "Locker Room",
|
||||
_ => x.ToString()
|
||||
_ => x.ToString(),
|
||||
};
|
||||
}).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,40 +3,69 @@
|
||||
public enum SystemTypes : byte
|
||||
{
|
||||
Hallway = 0,
|
||||
|
||||
Storage = 1,
|
||||
|
||||
Cafeteria = 2,
|
||||
|
||||
Reactor = 3,
|
||||
|
||||
UpperEngine = 4,
|
||||
|
||||
Nav = 5,
|
||||
|
||||
Admin = 6,
|
||||
|
||||
Electrical = 7,
|
||||
|
||||
LifeSupp = 8,
|
||||
|
||||
Shields = 9,
|
||||
|
||||
MedBay = 10,
|
||||
|
||||
Security = 11,
|
||||
|
||||
Weapons = 12,
|
||||
|
||||
LowerEngine = 13,
|
||||
|
||||
Comms = 14,
|
||||
|
||||
ShipTasks = 15,
|
||||
|
||||
Doors = 16,
|
||||
|
||||
Sabotage = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Decontam on Mira and bottom decontam on Polus
|
||||
/// Decontam on Mira and bottom decontam on Polus
|
||||
/// </summary>
|
||||
Decontamination = 18,
|
||||
|
||||
Launchpad = 19,
|
||||
|
||||
LockerRoom = 20,
|
||||
|
||||
Laboratory = 21,
|
||||
|
||||
Balcony = 22,
|
||||
|
||||
Office = 23,
|
||||
|
||||
Greenhouse = 24,
|
||||
|
||||
Dropship = 25,
|
||||
|
||||
/// <summary>
|
||||
/// Top decontam on Polus
|
||||
/// Top decontam on Polus
|
||||
/// </summary>
|
||||
Decontamination2 = 26,
|
||||
|
||||
Outside = 27,
|
||||
|
||||
Specimens = 28,
|
||||
BoilerRoom = 29
|
||||
|
||||
BoilerRoom = 29,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
Always = 0,
|
||||
Meetings = 1,
|
||||
Never = 2
|
||||
Never = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,4 +46,4 @@
|
||||
RecordTemperature = 41,
|
||||
RebootWifi = 42,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,4 @@
|
||||
return i == ' ' || (i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9') || (i >= 'À' && i <= 'ÿ') || (i >= 'Ѐ' && i <= 'џ') || (i >= 'ㄱ' && i <= 'ㆎ') || (i >= '가' && i <= '힣');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Impostor.Api.Net
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets mods sent by client in modded handshake.
|
||||
/// Gets mods sent by client in modded handshake.
|
||||
/// </summary>
|
||||
ISet<Mod> Mods { get; }
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Impostor.Api.Net
|
||||
IDictionary<object, object> Items { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current game data of the <see cref="IClient"/>.
|
||||
/// Gets the current game data of the <see cref="IClient" />.
|
||||
/// </summary>
|
||||
IClientPlayer? Player { get; }
|
||||
|
||||
@@ -68,16 +68,16 @@ namespace Impostor.Api.Net
|
||||
ValueTask HandleDisconnectAsync(string reason);
|
||||
|
||||
/// <summary>
|
||||
/// Disconnect the client with a <see cref="DisconnectReason"/>.
|
||||
/// Disconnect the client with a <see cref="DisconnectReason" />.
|
||||
/// </summary>
|
||||
/// <param name="reason">
|
||||
/// The message to show to the player.
|
||||
/// </param>
|
||||
/// <param name="message">
|
||||
/// Only used when <see cref="reason"/> is set to <see cref="DisconnectReason.Custom"/>.
|
||||
/// Only used when <paramref name="reason" /> is set to <see cref="DisconnectReason.Custom" />.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="ValueTask"/> representing the asynchronous operation.
|
||||
/// A <see cref="ValueTask" /> representing the asynchronous operation.
|
||||
/// </returns>
|
||||
ValueTask DisconnectAsync(DisconnectReason reason, string? message = null);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using Impostor.Api.Net.Inner.Objects;
|
||||
namespace Impostor.Api.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a player in <see cref="IGame"/>.
|
||||
/// Represents a player in <see cref="IGame" />.
|
||||
/// </summary>
|
||||
public interface IClientPlayer
|
||||
{
|
||||
@@ -16,7 +16,7 @@ namespace Impostor.Api.Net
|
||||
IClient Client { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the game where the <see cref="IClientPlayer"/> belongs to.
|
||||
/// Gets the game where the <see cref="IClientPlayer" /> belongs to.
|
||||
/// </summary>
|
||||
IGame Game { get; }
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace Impostor.Api.Net
|
||||
public bool IsHost { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the specified <see cref="IInnerNetObject"/> is owned by <see cref="IClientPlayer"/>.
|
||||
/// Checks if the specified <see cref="IInnerNetObject" /> is owned by <see cref="IClientPlayer" />.
|
||||
/// </summary>
|
||||
/// <param name="netObject">The <see cref="IInnerNetObject"/>.</param>
|
||||
/// <returns>Returns true if owned by <see cref="IClientPlayer"/>.</returns>
|
||||
/// <param name="netObject">The <see cref="IInnerNetObject" />.</param>
|
||||
/// <returns>Returns true if owned by <see cref="IClientPlayer" />.</returns>
|
||||
bool IsOwner(IInnerNetObject netObject);
|
||||
|
||||
ValueTask KickAsync();
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
{
|
||||
public interface IConnection
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Impostor.Api.Net
|
||||
bool IsConnected { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client of the connection.
|
||||
/// Gets or sets the client of the connection.
|
||||
/// </summary>
|
||||
IClient? Client { get; set; }
|
||||
|
||||
@@ -28,14 +28,14 @@ namespace Impostor.Api.Net
|
||||
/// Sends a message writer to the connection.
|
||||
/// </summary>
|
||||
/// <param name="writer">The message.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
ValueTask SendAsync(IMessageWriter writer);
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects the client and invokes the disconnect handler.
|
||||
/// </summary>
|
||||
/// <param name="reason">A reason.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
ValueTask DisconnectAsync(string? reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ namespace Impostor.Api.Net.Inner
|
||||
/// </summary>
|
||||
public interface IGameNet
|
||||
{
|
||||
IInnerLobbyBehaviour LobbyBehaviour { get; }
|
||||
IInnerLobbyBehaviour? LobbyBehaviour { get; }
|
||||
|
||||
IInnerGameData GameData { get; }
|
||||
IInnerGameData? GameData { get; }
|
||||
|
||||
IInnerVoteBanSystem VoteBan { get; }
|
||||
IInnerVoteBanSystem? VoteBan { get; }
|
||||
|
||||
IInnerShipStatus ShipStatus { get; }
|
||||
IInnerShipStatus? ShipStatus { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
public int OwnerId { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace Impostor.Api.Net.Inner.Objects.Components
|
||||
Vector2 Velocity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Snaps the current to the given position <see cref="IInnerPlayerControl"/>.
|
||||
/// Snaps the current to the given position <see cref="IInnerPlayerControl" />.
|
||||
/// </summary>
|
||||
/// <param name="position">The target position.</param>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
|
||||
@@ -7,30 +7,30 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
public interface IInnerPlayerControl : IInnerNetObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PlayerId"/> assigned by the client of the host of the game.
|
||||
/// Gets the <see cref="PlayerId" /> assigned by the client of the host of the game.
|
||||
/// </summary>
|
||||
byte PlayerId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IInnerPlayerPhysics"/> of the <see cref="IInnerPlayerControl"/>.
|
||||
/// Gets the <see cref="IInnerPlayerPhysics" /> of the <see cref="IInnerPlayerControl" />.
|
||||
/// Contains vent logic.
|
||||
/// </summary>
|
||||
IInnerPlayerPhysics Physics { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IInnerCustomNetworkTransform"/> of the <see cref="IInnerPlayerControl"/>.
|
||||
/// Gets the <see cref="IInnerCustomNetworkTransform" /> of the <see cref="IInnerPlayerControl" />.
|
||||
/// Contains position data about the player.
|
||||
/// </summary>
|
||||
IInnerCustomNetworkTransform NetworkTransform { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IInnerPlayerInfo"/> of the <see cref="IInnerPlayerControl"/>.
|
||||
/// Gets the <see cref="IInnerPlayerInfo" /> of the <see cref="IInnerPlayerControl" />.
|
||||
/// Contains metadata about the player.
|
||||
/// </summary>
|
||||
IInnerPlayerInfo PlayerInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the name of the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Sets the name of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="name">A name for the player.</param>
|
||||
@@ -38,7 +38,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SetNameAsync(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color of the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Sets the color of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="colorType">A color for the player.</param>
|
||||
@@ -46,7 +46,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SetColorAsync(ColorType colorType);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the hat of the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Sets the hat of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="hatType">An hat for the player.</param>
|
||||
@@ -54,7 +54,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SetHatAsync(HatType hatType);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the pet of the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Sets the pet of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="petType">A pet for the player.</param>
|
||||
@@ -62,7 +62,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SetPetAsync(PetType petType);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the skin of the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Sets the skin of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="skinType">A skin for the player.</param>
|
||||
@@ -70,7 +70,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SetSkinAsync(SkinType skinType);
|
||||
|
||||
/// <summary>
|
||||
/// Send a chat message as the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Send a chat message as the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="text">The message to send.</param>
|
||||
@@ -78,7 +78,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SendChatAsync(string text);
|
||||
|
||||
/// <summary>
|
||||
/// Send a chat message as the current <see cref="IInnerPlayerControl"/>.
|
||||
/// Send a chat message as the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to only the current.
|
||||
/// </summary>
|
||||
/// <param name="text">The message to send.</param>
|
||||
@@ -90,7 +90,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl? player = null);
|
||||
|
||||
/// <summary>
|
||||
/// Murder <paramref name="target"/> player.
|
||||
/// Murder <paramref name="target" /> player.
|
||||
/// </summary>
|
||||
/// <param name="target">Target player to murder.</param>
|
||||
/// <exception cref="ImpostorProtocolException">Thrown when player is not the impostor.</exception>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
{
|
||||
public interface IInnerShipStatus : IInnerNetObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,5 @@
|
||||
{
|
||||
public interface IInnerVoteBanSystem : IInnerNetObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Net.Inner.Objects
|
||||
{
|
||||
|
||||
@@ -33,6 +33,6 @@
|
||||
RepairSystem = 28,
|
||||
SetTasks = 29,
|
||||
UpdateGameData = 30,
|
||||
CustomRpc = byte.MaxValue
|
||||
CustomRpc = byte.MaxValue,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@ namespace Impostor.Api.Net
|
||||
WaitingForHost = 4,
|
||||
All = PreSpawn | NotLimbo | WaitingForHost,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@ namespace Impostor.Api.Net.Manager
|
||||
{
|
||||
IEnumerable<IClient> Clients { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,9 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
/// <summary>
|
||||
/// Deserialize a packet.
|
||||
/// </summary>
|
||||
/// <param name="reader"><see cref="IMessageReader"/> with <see cref="IMessageReader.Tag"/> 0.</param>
|
||||
/// <param name="reader"><see cref="IMessageReader" /> with <see cref="IMessageReader.Tag" /> 0.</param>
|
||||
/// <param name="chatType">The chat type selected in the client of the player.</param>
|
||||
/// <returns>Deserialized <see cref="GameOptionsData"/>.</returns>
|
||||
/// <returns>Deserialized <see cref="GameOptionsData" />.</returns>
|
||||
public static GameOptionsData Deserialize(IMessageReader reader, out ChatType chatType)
|
||||
{
|
||||
var gameOptionsData = GameOptionsData.DeserializeCreate(reader);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Games;
|
||||
using System;
|
||||
using Impostor.Api.Games;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out GameCode gameCode)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public class Message04RemovePlayerC2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out int playerId, out byte reason)
|
||||
@@ -13,4 +15,4 @@
|
||||
reason = reader.ReadByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out GameOverReason gameOverReason)
|
||||
@@ -15,4 +16,4 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
reader.ReadBoolean(); // showAd
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out AlterGameTags gameTag, out bool isPublic)
|
||||
@@ -17,4 +18,4 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
isPublic = slice.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public class Message11KickPlayerC2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out int playerId, out bool isBan)
|
||||
@@ -13,4 +15,4 @@
|
||||
isBan = reader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out GameOptionsData options, out ChatType chatType)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Impostor.Api.Net.Messages
|
||||
byte[] Buffer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the offset of our current <see cref="IMessageReader"/> in the entire <see cref="Buffer"/>.
|
||||
/// Gets the offset of our current <see cref="IMessageReader" /> in the entire <see cref="Buffer" />.
|
||||
/// </summary>
|
||||
int Offset { get; }
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Impostor.Api.Net.Messages
|
||||
void Write(string value);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a <see cref="IPAddress"/> to the message.
|
||||
/// Writes a <see cref="IPAddress" /> to the message.
|
||||
/// </summary>
|
||||
/// <param name="value">Value to write.</param>
|
||||
void Write(IPAddress value);
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
public interface IMessageWriterProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="IMessageWriter"/> from the internal pool.
|
||||
/// Make sure to call <see cref="IMessageWriter.Dispose"/> when you are done!
|
||||
/// Retrieves a <see cref="IMessageWriter" /> from the internal pool.
|
||||
/// Make sure to call <see cref="System.IDisposable.Dispose" /> when you are done!.
|
||||
/// </summary>
|
||||
/// <param name="sendOption">
|
||||
/// Whether to send the message as <see cref="MessageType.Reliable"/> or <see cref="MessageType.Unreliable"/>.
|
||||
/// Whether to send the message as <see cref="MessageType.Reliable" /> or <see cref="MessageType.Unreliable" />.
|
||||
/// Reliable packets will ensure delivery while unreliable packets may be lost.
|
||||
/// </param>
|
||||
/// <returns>A <see cref="IMessageWriter"/> from the pool.</returns>
|
||||
/// <returns>A <see cref="IMessageWriter" /> from the pool.</returns>
|
||||
IMessageWriter Get(MessageType sendOption = MessageType.Unreliable);
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,4 @@
|
||||
public const byte GetGameList = 9;
|
||||
public const byte GetGameListV2 = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,4 @@ namespace Impostor.Api.Net.Messages
|
||||
/// </remarks>
|
||||
Reliable,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,4 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
public static class Message07JoinedGameS2C
|
||||
{
|
||||
@@ -25,7 +27,7 @@
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
public class Message11KickPlayerS2C
|
||||
{
|
||||
@@ -18,7 +20,7 @@
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
public class Message12WaitForHostS2C
|
||||
{
|
||||
@@ -17,7 +19,7 @@
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Impostor.Api.Games;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.S2C
|
||||
@@ -33,7 +34,7 @@ namespace Impostor.Api.Net.Messages.S2C
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,4 @@ namespace Impostor.Api.Plugins
|
||||
|
||||
ValueTask ReloadAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ namespace Impostor.Api.Plugins
|
||||
|
||||
void ConfigureServices(IServiceCollection services);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@ namespace Impostor.Api.Plugins
|
||||
|
||||
public string Version { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,4 @@ namespace Impostor.Api.Plugins
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<RuleSet Name="Rules for Hello World project" Description="These rules focus on critical issues for the Hello World app." ToolsVersion="10.0">
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.OrderingRules">
|
||||
<Rule Id="SA1200" Action="None" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.DocumentationRules">
|
||||
<Rule Id="SA1600" Action="None" />
|
||||
<Rule Id="SA1601" Action="None" />
|
||||
<Rule Id="SA1602" Action="None" />
|
||||
<Rule Id="SA1633" Action="None" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.ReadabilityRules">
|
||||
<Rule Id="SA1101" Action="None" />
|
||||
<Rule Id="SA1111" Action="None" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.NamingRules">
|
||||
<Rule Id="SA1309" Action="None" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
@@ -1,3 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly:InternalsVisibleTo("Impostor.Server")]
|
||||
[assembly: InternalsVisibleTo("Impostor.Server")]
|
||||
@@ -1,22 +1,22 @@
|
||||
namespace Impostor.Api.Reactor
|
||||
{
|
||||
/// <summary>
|
||||
/// Plugin side used in modded handshake
|
||||
/// Plugin side used in modded handshake.
|
||||
/// </summary>
|
||||
public enum PluginSide : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Required by both sides, reject connection if missing on the other side
|
||||
/// Required by both sides, reject connection if missing on the other side
|
||||
/// </summary>
|
||||
Both,
|
||||
|
||||
/// <summary>
|
||||
/// Required only by client
|
||||
/// Required only by client
|
||||
/// </summary>
|
||||
ClientOnly,
|
||||
|
||||
/// <summary>
|
||||
/// Required only by server
|
||||
/// Required only by server
|
||||
/// </summary>
|
||||
ServerOnly,
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
public static class Mathf
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Clamps the given value between the given minimum float and maximum float values. Returns the given value if it is within the min and max range.</para>
|
||||
/// <para>Clamps the given value between the given minimum float and maximum float values. Returns the given value if it is within the min and max range.</para>
|
||||
/// </summary>
|
||||
/// <param name="value">The floating point value to restrict inside the range defined by the min and max values.</param>
|
||||
/// <param name="min">The minimum floating point value to compare against.</param>
|
||||
/// <param name="max">The maximum floating point value to compare against.</param>
|
||||
/// <returns>
|
||||
/// <para>The float result between the min and max values.</para>
|
||||
/// <para>The float result between the min and max values.</para>
|
||||
/// </returns>
|
||||
public static float Clamp(float value, float min, float max)
|
||||
{
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Clamps value between 0 and 1 and returns value.</para>
|
||||
/// <para>Clamps value between 0 and 1 and returns value.</para>
|
||||
/// </summary>
|
||||
/// <param name="value">Value.</param>
|
||||
/// <returns>Clamped value.</returns>
|
||||
@@ -41,13 +41,13 @@
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Linearly interpolates between a and b by t.</para>
|
||||
/// <para>Linearly interpolates between a and b by t.</para>
|
||||
/// </summary>
|
||||
/// <param name="a">The start value.</param>
|
||||
/// <param name="b">The end value.</param>
|
||||
/// <param name="t">The interpolation value between the two floats.</param>
|
||||
/// <returns>
|
||||
/// <para>The interpolated float result between the two float values.</para>
|
||||
/// <para>The interpolated float result between the two float values.</para>
|
||||
/// </returns>
|
||||
public static float Lerp(float a, float b, float t) => a + ((b - a) * Clamp01(t));
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Impostor.Benchmarks.Data
|
||||
|
||||
public bool ReadBoolean()
|
||||
{
|
||||
byte val = FastByte();
|
||||
var val = FastByte();
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Impostor.Benchmarks.Data
|
||||
float output = 0;
|
||||
fixed (byte* bufPtr = &this.Buffer[Position])
|
||||
{
|
||||
byte* outPtr = (byte*)&output;
|
||||
var outPtr = (byte*)&output;
|
||||
|
||||
*outPtr = *bufPtr;
|
||||
*(outPtr + 1) = *(bufPtr + 1);
|
||||
@@ -134,13 +134,13 @@ namespace Impostor.Benchmarks.Data
|
||||
|
||||
public uint ReadPackedUInt32()
|
||||
{
|
||||
bool readMore = true;
|
||||
int shift = 0;
|
||||
var readMore = true;
|
||||
var shift = 0;
|
||||
uint output = 0;
|
||||
|
||||
while (readMore)
|
||||
{
|
||||
byte b = FastByte();
|
||||
var b = FastByte();
|
||||
if (b >= 0x80)
|
||||
{
|
||||
readMore = true;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Impostor.Benchmarks.Data
|
||||
|
||||
public bool ReadBoolean()
|
||||
{
|
||||
byte val = FastByte();
|
||||
var val = FastByte();
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Impostor.Benchmarks.Data
|
||||
float output = 0;
|
||||
fixed (byte* bufPtr = &this.Buffer[Position])
|
||||
{
|
||||
byte* outPtr = (byte*)&output;
|
||||
var outPtr = (byte*)&output;
|
||||
|
||||
*outPtr = *bufPtr;
|
||||
*(outPtr + 1) = *(bufPtr + 1);
|
||||
@@ -158,13 +158,13 @@ namespace Impostor.Benchmarks.Data
|
||||
|
||||
public uint ReadPackedUInt32()
|
||||
{
|
||||
bool readMore = true;
|
||||
int shift = 0;
|
||||
var readMore = true;
|
||||
var shift = 0;
|
||||
uint output = 0;
|
||||
|
||||
while (readMore)
|
||||
{
|
||||
byte b = FastByte();
|
||||
var b = FastByte();
|
||||
if (b >= 0x80)
|
||||
{
|
||||
readMore = true;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
|
||||
namespace Impostor.Benchmarks.Data
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace Impostor.Benchmarks.Data
|
||||
{
|
||||
public class MessageWriter
|
||||
{
|
||||
private static int BufferSize = 64000;
|
||||
|
||||
public MessageType SendOption { get; private set; }
|
||||
|
||||
private Stack<int> messageStarts = new Stack<int>();
|
||||
@@ -34,7 +32,7 @@ namespace Impostor.Benchmarks.Data
|
||||
{
|
||||
if (includeHeader)
|
||||
{
|
||||
byte[] output = new byte[this.Length];
|
||||
var output = new byte[this.Length];
|
||||
System.Buffer.BlockCopy(this.Buffer, 0, output, 0, this.Length);
|
||||
return output;
|
||||
}
|
||||
@@ -43,17 +41,17 @@ namespace Impostor.Benchmarks.Data
|
||||
switch (this.SendOption)
|
||||
{
|
||||
case MessageType.Reliable:
|
||||
{
|
||||
byte[] output = new byte[this.Length - 3];
|
||||
System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
|
||||
return output;
|
||||
}
|
||||
{
|
||||
var output = new byte[this.Length - 3];
|
||||
System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
|
||||
return output;
|
||||
}
|
||||
case MessageType.Unreliable:
|
||||
{
|
||||
byte[] output = new byte[this.Length - 1];
|
||||
System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
|
||||
return output;
|
||||
}
|
||||
{
|
||||
var output = new byte[this.Length - 1];
|
||||
System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
|
||||
return output;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -89,7 +87,7 @@ namespace Impostor.Benchmarks.Data
|
||||
public void EndMessage()
|
||||
{
|
||||
var lastMessageStart = messageStarts.Pop();
|
||||
ushort length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
|
||||
var length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
|
||||
this.Buffer[lastMessageStart] = (byte)length;
|
||||
this.Buffer[lastMessageStart + 1] = (byte)(length >> 8);
|
||||
}
|
||||
@@ -175,7 +173,7 @@ namespace Impostor.Benchmarks.Data
|
||||
{
|
||||
fixed (byte* ptr = &this.Buffer[this.Position])
|
||||
{
|
||||
byte* valuePtr = (byte*)&value;
|
||||
var valuePtr = (byte*)&value;
|
||||
|
||||
*ptr = *valuePtr;
|
||||
*(ptr + 1) = *(valuePtr + 1);
|
||||
@@ -262,7 +260,7 @@ namespace Impostor.Benchmarks.Data
|
||||
{
|
||||
do
|
||||
{
|
||||
byte b = (byte)(value & 0xFF);
|
||||
var b = (byte)(value & 0xFF);
|
||||
if (value >= 0x80)
|
||||
{
|
||||
b |= 0x80;
|
||||
@@ -277,7 +275,7 @@ namespace Impostor.Benchmarks.Data
|
||||
|
||||
public void Write(MessageWriter msg, bool includeHeader)
|
||||
{
|
||||
int offset = 0;
|
||||
var offset = 0;
|
||||
if (!includeHeader)
|
||||
{
|
||||
switch (msg.SendOption)
|
||||
@@ -300,8 +298,8 @@ namespace Impostor.Benchmarks.Data
|
||||
byte b;
|
||||
unsafe
|
||||
{
|
||||
int i = 1;
|
||||
byte* bp = (byte*)&i;
|
||||
var i = 1;
|
||||
var bp = (byte*)&i;
|
||||
b = *bp;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using Impostor.Hazel;
|
||||
|
||||
namespace Impostor.Benchmarks.Data.Span
|
||||
{
|
||||
|
||||
@@ -4,10 +4,8 @@ using BenchmarkDotNet.Attributes;
|
||||
using Impostor.Benchmarks.Data;
|
||||
using Impostor.Benchmarks.Data.Pool;
|
||||
using Impostor.Benchmarks.Extensions;
|
||||
using Impostor.Hazel;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using MessageWriter = Impostor.Benchmarks.Data.MessageWriter;
|
||||
|
||||
namespace Impostor.Benchmarks.Tests
|
||||
{
|
||||
@@ -24,7 +22,7 @@ namespace Impostor.Benchmarks.Tests
|
||||
message.StartMessage(1);
|
||||
message.Write((ushort)3100);
|
||||
message.Write((byte)100);
|
||||
message.Write((int) int.MaxValue);
|
||||
message.Write((int)int.MaxValue);
|
||||
message.WritePacked(int.MaxValue);
|
||||
message.EndMessage();
|
||||
|
||||
|
||||
Loaded 100 of 224 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user