mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 11:39:41 +00:00
Compare commits
166
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b31e3bf1e3 | ||
|
|
c9bb8323f4 | ||
|
|
1521410e79 | ||
|
|
be8e4a49f0 | ||
|
|
631e994759 | ||
|
|
c06916084e | ||
|
|
c9c044365a | ||
|
|
5ab4bf70da | ||
|
|
58c8bdec26 | ||
|
|
5e080b290b | ||
|
|
97390a0882 | ||
|
|
23499929fb | ||
|
|
579f618ac6 | ||
|
|
6962d01dbd | ||
|
|
0fb6556365 | ||
|
|
9cd5de6a36 | ||
|
|
94015d475d | ||
|
|
11bb2dec47 | ||
|
|
e7d745608e | ||
|
|
a1120f8468 | ||
|
|
1fa684d843 | ||
|
|
fac4103d70 | ||
|
|
3b5b538b39 | ||
|
|
62f8a7099d | ||
|
|
f8b3bf7295 | ||
|
|
4e5edcee49 | ||
|
|
5a8927e4c9 | ||
|
|
752b155152 | ||
|
|
5a1f1c9d86 | ||
|
|
adb74f628c | ||
|
|
c106695707 | ||
|
|
a7fb2b8b19 | ||
|
|
d4ac24ae17 | ||
|
|
e0b85c959b | ||
|
|
980d172d4f | ||
|
|
8dfa38b4b5 | ||
|
|
d1ac9301be | ||
|
|
d667f99c9f | ||
|
|
679bfecb42 | ||
|
|
519bae28b5 | ||
|
|
e5db56317a | ||
|
|
ed89e00f3a | ||
|
|
d5165a79f1 | ||
|
|
7bb7d2178b | ||
|
|
39b7d626dc | ||
|
|
116bb3cda4 | ||
|
|
8fe5c2205e | ||
|
|
a418e1f15a | ||
|
|
a7cff4aef1 | ||
|
|
b9e8def90d | ||
|
|
dc530406c6 | ||
|
|
2de08da14d | ||
|
|
7a89e963dd | ||
|
|
8aaf75e381 | ||
|
|
59cb4a18e8 | ||
|
|
a0b5228e71 | ||
|
|
78351c1dbe | ||
|
|
45e0162c1a | ||
|
|
fcf8d66266 | ||
|
|
6b6fa08125 | ||
|
|
cea3d8980f | ||
|
|
d1ffdb95e1 | ||
|
|
4d11cf91ad | ||
|
|
84aba52198 | ||
|
|
6e4bb71289 | ||
|
|
8fec1a211e | ||
|
|
85a2fce6c1 | ||
|
|
224fdd1d5b | ||
|
|
380ba46f11 | ||
|
|
aeefc40ef1 | ||
|
|
743b8ed5cb | ||
|
|
ed008872f6 | ||
|
|
4797d899af | ||
|
|
c834013bd3 | ||
|
|
70c180fb19 | ||
|
|
729368d777 | ||
|
|
5c06d1dd4d | ||
|
|
446e5b8705 | ||
|
|
ae00ff9295 | ||
|
|
400592b99c | ||
|
|
9906c409da | ||
|
|
c26d03a8bc | ||
|
|
ca48d672d5 | ||
|
|
0b431dc5fa | ||
|
|
0b0c8274aa | ||
|
|
36f8255e26 | ||
|
|
919b094018 | ||
|
|
6125fd7006 | ||
|
|
a3c0c8cacf | ||
|
|
b252bf2ee7 | ||
|
|
9b5a63e030 | ||
|
|
6a8f089576 | ||
|
|
d994323083 | ||
|
|
3f374da44b | ||
|
|
bfd2efa716 | ||
|
|
6867dec7ee | ||
|
|
7132dc2d38 | ||
|
|
682bfac558 | ||
|
|
cc8d5d2a45 | ||
|
|
e6a35344c3 | ||
|
|
db52b48cd6 | ||
|
|
50a526a02d | ||
|
|
608414326d | ||
|
|
d8bcb52c90 | ||
|
|
d7d7547182 | ||
|
|
64e27c3e21 | ||
|
|
a0b433500c | ||
|
|
c51a1f9c1f | ||
|
|
e15ac51dcf | ||
|
|
bde3a22f6e | ||
|
|
6118e6b7b8 | ||
|
|
32ecfedfba | ||
|
|
b6fe79cc8b | ||
|
|
aeaffc849a | ||
|
|
a15f1b6a4c | ||
|
|
afb7051218 | ||
|
|
8a0e9e876e | ||
|
|
22f1d74cdf | ||
|
|
e6d38f4b72 | ||
|
|
93c80c1412 | ||
|
|
c3e0157209 | ||
|
|
0769752407 | ||
|
|
fba1a894cc | ||
|
|
4d1aec9070 | ||
|
|
e0c7086973 | ||
|
|
125da11d61 | ||
|
|
d86efc1345 | ||
|
|
301a851ec3 | ||
|
|
86c27402e2 | ||
|
|
c63eb3b2d1 | ||
|
|
a1dac9f8b7 | ||
|
|
3065e8df48 | ||
|
|
dc52e478dc | ||
|
|
eb86c3c683 | ||
|
|
e7c83769ef | ||
|
|
c6b8066794 | ||
|
|
1ec5a050ad | ||
|
|
1e7d132f31 | ||
|
|
9543134ef3 | ||
|
|
389c72caa6 | ||
|
|
66b4d860a9 | ||
|
|
dca26cff59 | ||
|
|
3437c86bff | ||
|
|
66fb8426a6 | ||
|
|
4c839e2dd8 | ||
|
|
c6aa596e3b | ||
|
|
d8843db3eb | ||
|
|
b918f25443 | ||
|
|
824359f93b | ||
|
|
046d09b5fa | ||
|
|
5410c71280 | ||
|
|
241e867343 | ||
|
|
11f2ffd24d | ||
|
|
9df01d2cf7 | ||
|
|
d2720442e9 | ||
|
|
ddedffd121 | ||
|
|
2f04f6ea98 | ||
|
|
5f4c40bf36 | ||
|
|
ef4cc5646b | ||
|
|
d894e9adc3 | ||
|
|
c086cf80b1 | ||
|
|
1118a59167 | ||
|
|
5154dd9aa5 | ||
|
|
a621225fcd | ||
|
|
73a5463848 | ||
|
|
02d25a290f |
No files matched your search
@@ -3,7 +3,7 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "1.1.0",
|
||||
"version": "2.2.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/ci.yml'
|
||||
- 'src/**/**'
|
||||
- '.gitmodules'
|
||||
- 'build.cake'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/ci.yml'
|
||||
- 'src/**/**'
|
||||
- '.gitmodules'
|
||||
- 'build.cake'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: 7.x
|
||||
|
||||
- name: Run the Cake script
|
||||
uses: cake-build/cake-action@v1
|
||||
with:
|
||||
verbosity: Diagnostic
|
||||
|
||||
- uses: softprops/action-gh-release@v1
|
||||
if: github.ref_type == 'tag'
|
||||
with:
|
||||
draft: true
|
||||
files: |
|
||||
./build/*.zip
|
||||
./build/*.tar.gz
|
||||
./build/*.nupkg
|
||||
./build/*.snupkg
|
||||
|
||||
- name: Push NuGet package
|
||||
if: github.ref_type == 'tag'
|
||||
run: |
|
||||
dotnet nuget push ./build/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_IMPOSTOR }}
|
||||
@@ -1,3 +0,0 @@
|
||||
[submodule "src/Impostor.Hazel"]
|
||||
path = src/Impostor.Hazel
|
||||
url = https://github.com/Impostor/Impostor.Hazel
|
||||
+3
-3
@@ -9,14 +9,14 @@ We are always looking for people to help improve Impostor.
|
||||
- Don't commit unnecessary changes to the codebase or debugging code.
|
||||
- Write meaningful commits or squash them.
|
||||
- Please try to follow the code style of the rest of the codebase. An `.editorconfig` file has been provided to keep consistency.
|
||||
- Stylecop is also enabled: please make sure your PR compiles without warnings.
|
||||
|
||||
## Pull requests
|
||||
|
||||
- Only make pull requests to the `dev` branch.
|
||||
- Only implement one feature per pull request to keep it easy to understand.
|
||||
- Expect comments or questions on your pull request from the project maintainers. We try to keep the code as consistent and maintainable as possible.
|
||||
- Each pull request should come from a new branch in your fork, it should have a meaningful name.
|
||||
- Each pull request should come from a new branch in your fork, it should have a meaningful name.
|
||||
- We try to respond to pull requests as fast as possible. If you think we might have missed it, let us know on [Discord](https://discord.gg/Mk3w6Tb).
|
||||
|
||||
|
||||
If you have any questions, let us know.
|
||||
If you have any questions, let us know.
|
||||
+17
-8
@@ -1,4 +1,4 @@
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
|
||||
# See for all possible platforms
|
||||
# https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17
|
||||
@@ -11,7 +11,7 @@ WORKDIR /source
|
||||
# Copy csproj and restore.
|
||||
COPY src/Impostor.Server/Impostor.Server.csproj ./src/Impostor.Server/Impostor.Server.csproj
|
||||
COPY src/Impostor.Api/Impostor.Api.csproj ./src/Impostor.Api/Impostor.Api.csproj
|
||||
COPY src/Impostor.Hazel/Hazel/Hazel.csproj ./src/Impostor.Hazel/Hazel/Hazel.csproj
|
||||
COPY src/Directory.Build.props ./src/Directory.Build.props
|
||||
|
||||
RUN case "$TARGETARCH" in \
|
||||
amd64) NETCORE_PLATFORM='linux-x64';; \
|
||||
@@ -20,8 +20,7 @@ RUN case "$TARGETARCH" in \
|
||||
*) echo "unsupported architecture"; exit 1 ;; \
|
||||
esac && \
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Server/Impostor.Server.csproj && \
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj && \
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Hazel/Hazel/Hazel.csproj
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj
|
||||
|
||||
# Copy everything else.
|
||||
COPY src/. ./src/
|
||||
@@ -31,12 +30,22 @@ RUN case "$TARGETARCH" in \
|
||||
arm) NETCORE_PLATFORM='linux-arm';; \
|
||||
*) echo "unsupported architecture"; exit 1 ;; \
|
||||
esac && \
|
||||
[[ $VERSIONSUFFIX = "none" ]] && VERSIONSUFFIX=; \
|
||||
[ $VERSIONSUFFIX = "none" ] && VERSIONSUFFIX=; \
|
||||
dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" -p:VersionSuffix="$VERSIONSUFFIX" --no-restore ./src/Impostor.Server/Impostor.Server.csproj
|
||||
|
||||
# Final image.
|
||||
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:5.0
|
||||
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:7.0
|
||||
WORKDIR /app
|
||||
COPY --from=build /app ./
|
||||
EXPOSE 22023/udp
|
||||
ENTRYPOINT ["./Impostor.Server"]
|
||||
|
||||
# Add Impostor.Http as a default built-in plugin
|
||||
ADD https://github.com/Impostor/Impostor.Http/releases/download/v0.4.0/Impostor.Http.dll /app/builtin-plugins/
|
||||
# Make it listen to 0.0.0.0 to expose it to the outside world.
|
||||
ENV IMPOSTOR_HTTP_HttpServer__ListenIp=0.0.0.0
|
||||
# Override ASPNETCORE_URLS to stop warning.
|
||||
ENV ASPNETCORE_URLS=
|
||||
# Enable the built-in plugin folder. Use a high number to prevent conflicts with existing configurations
|
||||
ENV IMPOSTOR_PluginLoader__Paths__76=/app/builtin-plugins
|
||||
|
||||
EXPOSE 22000/tcp 22023/udp
|
||||
ENTRYPOINT ["./Impostor.Server"]
|
||||
@@ -1,16 +1,13 @@
|
||||
# Impostor
|
||||
|
||||
[](https://discord.gg/Mk3w6Tb)
|
||||
[](https://ci.appveyor.com/project/Impostor/Impostor/branch/master)
|
||||
[](https://github.com/Impostor/Impostor/actions)
|
||||
|
||||
Impostor is one of the first **Among Us** private servers, written in C#.
|
||||
Impostor is the first working **Among Us** private server, written in C#.
|
||||
|
||||
| Impostor version | Among Us version | Experimental | Download |
|
||||
|-|-|-|-|
|
||||
| 1.1.0 | 2020.09.07 - 2020.09.22 | No | [](https://github.com/Impostor/Impostor/releases/tag/v1.1.0) |
|
||||
| 1.2.2 | 2020.09.22 - 2020.11.17 | No | [](https://github.com/Impostor/Impostor/releases/tag/v1.2.2) |
|
||||
| 1.3.0 | 2021.3.5 | No | [](https://github.com/Impostor/Impostor/releases/tag/v1.3.0) |
|
||||
| 1.4.0 | 2021.3.31 - 2021.4.2 | Yes | [](https://ci.appveyor.com/project/Impostor/Impostor/branch/master/artifacts) |
|
||||
As Among Us is actively updated, you may want to use the latest build from the master branch if you want to play on the latest version of Among Us that supported by Impostor.
|
||||
|
||||
If you want to play on an older version of Among Us, you can download old releases from [here](https://github.com/Impostor/Impostor/releases/), however these versions are less supported.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -22,34 +19,7 @@ Impostor is one of the first **Among Us** private servers, written in C#.
|
||||
|
||||
### Client
|
||||
|
||||
If you just want to play on a server hosted by someone else, you need to follow these instructions.
|
||||
|
||||
#### Windows
|
||||
|
||||
1. Find the [latest release](https://github.com/AeonLucid/Impostor/releases/latest).
|
||||
2. Download `Impostor-Patcher-win-x64.zip`.
|
||||
3. Extract the zip.
|
||||
4. Run `Impostor.Patcher.exe`.
|
||||
5. Follow the instructions inside the application.
|
||||
|
||||

|
||||
|
||||
If you do not wish to execute any programs. Follow the instructions in [this website](https://impostor.github.io/Impostor)
|
||||
|
||||
#### Android
|
||||
|
||||
##### Android 10 and below.
|
||||
1. Go to [this website](https://impostor.github.io/Impostor) **(ON YOUR MOBILE DEVICE)**
|
||||
2. Follow the instructions listed there.
|
||||
|
||||
##### Android 11.
|
||||
1. Connect your phone to a computer. Go to [this website](https://impostor.github.io/Impostor) on the computer and follow the steps 1 and 2 to generate a `regionInfo.dat` file.
|
||||
2. Instead of following the next steps, open the phone's internal storage on your computer and navigate to `/sdcard/Android/data/com.innersloth.spacemafia/files`.
|
||||
3. Copy the generated `regionInfo.dat` file into the `files` folder you just navigated to.
|
||||
|
||||
#### iOS
|
||||
|
||||
iOS devices need to be jailbroken in order to connect to Impostor servers.
|
||||
If you just want to play on a server hosted by someone else, you need to configure your client to connect to an Impostor server. Please go to [this website](https://impostor.github.io/Impostor) to set up your client by following the instructions for your OS there.
|
||||
|
||||
### Server
|
||||
|
||||
@@ -57,7 +27,7 @@ See the [docs](docs/Running-the-server.md) for instructions on how to set it up.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
See [TROUBLESHOOTING](docs/TROUBLESHOOTING.md) to solve issues the Impostor client or the server.
|
||||
See [TROUBLESHOOTING](docs/TROUBLESHOOTING.md) to solve issues with the Impostor client or the server.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
version: '{build}'
|
||||
|
||||
environment:
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
|
||||
branches:
|
||||
except:
|
||||
- gh-pages
|
||||
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
assembly_info:
|
||||
patch: false
|
||||
|
||||
dotnet_csproj:
|
||||
patch: false
|
||||
|
||||
image: Ubuntu2004
|
||||
|
||||
install:
|
||||
- git submodule update --init --recursive
|
||||
- ps: dotnet tool restore
|
||||
|
||||
build_script:
|
||||
- ps: dotnet cake build.cake --bootstrap
|
||||
- ps: dotnet cake build.cake --pack
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: ./build/*.zip
|
||||
- path: ./build/*.tar.gz
|
||||
- path: ./build/*.nupkg
|
||||
- path: ./build/*.snupkg
|
||||
|
||||
# deploy:
|
||||
# - provider: NuGet
|
||||
# artifact: /.*(\.|\.s)nupkg/
|
||||
# on:
|
||||
# branch: dev
|
||||
# api_key:
|
||||
# secure: 4OHXl+m1KVi60hB1j54MpdP8tVv0UNfkdF4rVP+2AhAjN4a2MVT+Bl90gJZ96xHF
|
||||
|
||||
only_commits:
|
||||
files:
|
||||
- appveyor.yml
|
||||
- build.cake
|
||||
- src/**/*
|
||||
- .gitmodules
|
||||
+39
-35
@@ -1,25 +1,33 @@
|
||||
#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"
|
||||
#addin "nuget:?package=SharpZipLib&Version=1.3.3"
|
||||
#addin "nuget:?package=Cake.Compression&Version=0.3.0"
|
||||
#addin "nuget:?package=Cake.FileHelpers&Version=5.0.0"
|
||||
|
||||
var workflow = BuildSystem.GitHubActions.Environment.Workflow;
|
||||
var buildId = workflow.RunNumber;
|
||||
var tag = workflow.RefType == GitHubActionsRefType.Tag ? workflow.RefName : null;
|
||||
|
||||
var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER") ?? EnvironmentVariable("APPVEYOR_BUILD_VERSION");
|
||||
var buildRelease = EnvironmentVariable("APPVEYOR_REPO_TAG") == "true";
|
||||
var buildVersion = FindRegexMatchGroupInFile("./src/Directory.Build.props", @"\<VersionPrefix\>(.*?)\<\/VersionPrefix\>", 1, System.Text.RegularExpressions.RegexOptions.None).Value;
|
||||
var buildDir = MakeAbsolute(Directory("./build"));
|
||||
|
||||
var target = Argument("target", "Deploy");
|
||||
var target = Argument("target", "Test");
|
||||
var configuration = Argument("configuration", "Release");
|
||||
|
||||
var msbuildSettings = new DotNetCoreMSBuildSettings();
|
||||
var msbuildSettings = new DotNetMSBuildSettings();
|
||||
|
||||
if (buildRelease)
|
||||
if (tag != null)
|
||||
{
|
||||
msbuildSettings.Properties["Version"] = new[] { buildVersion };
|
||||
if (tag[1..] != buildVersion) throw new Exception("Tag version has to be the same as VersionPrefix in Directory.Build.props");
|
||||
msbuildSettings.Version = buildVersion;
|
||||
}
|
||||
else if (buildId != null)
|
||||
else if (buildId != 0)
|
||||
{
|
||||
msbuildSettings.Properties["VersionSuffix"] = new[] { "ci." + buildId };
|
||||
buildId += 500;
|
||||
msbuildSettings.VersionSuffix = "ci." + buildId;
|
||||
buildVersion += "-ci." + buildId;
|
||||
}
|
||||
else
|
||||
{
|
||||
buildVersion += "-dev";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -31,10 +39,9 @@ private void ImpostorPublish(string name, string project, string runtime, bool i
|
||||
var projBuildDir = buildDir.Combine(name + "_" + runtime);
|
||||
var projBuildName = name + "_" + buildVersion + "_" + runtime;
|
||||
|
||||
DotNetCorePublish(project, new DotNetCorePublishSettings {
|
||||
DotNetPublish(project, new DotNetPublishSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net5.0",
|
||||
Runtime = runtime,
|
||||
SelfContained = false,
|
||||
PublishSingleFile = true,
|
||||
@@ -57,6 +64,10 @@ private void ImpostorPublish(string name, string project, string runtime, bool i
|
||||
} else {
|
||||
GZipCompress(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".tar.gz"));
|
||||
}
|
||||
|
||||
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
|
||||
BuildSystem.GitHubActions.Commands.UploadArtifact(projBuildDir, projBuildName);
|
||||
}
|
||||
}
|
||||
|
||||
private void ImpostorPublishNF(string name, string project) {
|
||||
@@ -64,7 +75,7 @@ private void ImpostorPublishNF(string name, string project) {
|
||||
var projBuildDir = buildDir.Combine(name + "_" + runtime);
|
||||
var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
|
||||
|
||||
DotNetCorePublish(project, new DotNetCorePublishSettings {
|
||||
DotNetPublish(project, new DotNetPublishSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net472",
|
||||
@@ -90,18 +101,17 @@ Task("Clean")
|
||||
|
||||
Task("Restore")
|
||||
.Does(() => {
|
||||
DotNetCoreRestore("./src/Impostor.sln");
|
||||
DotNetRestore("./src/Impostor.sln");
|
||||
});
|
||||
|
||||
Task("Replay")
|
||||
.Does(() => {
|
||||
// D:\Projects\GitHub\Impostor\Impostor\src\Impostor.Tools.ServerReplay\sessions
|
||||
DotNetCoreRun(
|
||||
DotNetRun(
|
||||
"./src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj",
|
||||
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetCoreRunSettings {
|
||||
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetRunSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net5.0"
|
||||
});
|
||||
});
|
||||
|
||||
@@ -111,16 +121,9 @@ Task("Build")
|
||||
.IsDependentOn("Replay")
|
||||
.Does(() => {
|
||||
// Tests.
|
||||
DotNetCoreBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreBuildSettings {
|
||||
DotNetBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetBuildSettings {
|
||||
Configuration = configuration,
|
||||
});
|
||||
|
||||
// Client.
|
||||
ImpostorPublishNF("Impostor-Patcher", "./src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj");
|
||||
|
||||
ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "win-x64");
|
||||
ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "osx-x64");
|
||||
ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "linux-x64");
|
||||
|
||||
// Server.
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "win-x64", true);
|
||||
@@ -130,32 +133,33 @@ Task("Build")
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64", true);
|
||||
|
||||
// API.
|
||||
DotNetCorePack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetCorePackSettings {
|
||||
DotNetPack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetPackSettings {
|
||||
Configuration = configuration,
|
||||
OutputDirectory = buildDir,
|
||||
IncludeSource = true,
|
||||
IncludeSymbols = true,
|
||||
MSBuildSettings = msbuildSettings
|
||||
});
|
||||
|
||||
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
|
||||
foreach (var file in GetFiles(buildDir + "/*.{nupkg,snupkg}"))
|
||||
{
|
||||
BuildSystem.GitHubActions.Commands.UploadArtifact(file, "Impostor.Api");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.IsDependentOn("Build")
|
||||
.Does(() => {
|
||||
DotNetCoreTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreTestSettings {
|
||||
DotNetTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetTestSettings {
|
||||
Configuration = configuration,
|
||||
NoBuild = true
|
||||
});
|
||||
});
|
||||
|
||||
Task("Deploy")
|
||||
.IsDependentOn("Test")
|
||||
.Does(() => {
|
||||
Information("Finished.");
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EXECUTION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
RunTarget(target);
|
||||
RunTarget(target);
|
||||
@@ -1,19 +1,20 @@
|
||||
# Building from source
|
||||
|
||||
The solution contains two main projects, the Impostor server and patcher. The server is built using [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0) and the winforms patcher is with [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472).
|
||||
The solution contains the Impostor server and its dependencies, like Hazel and the plugin API. The server is built using [.NET 7](https://dotnet.microsoft.com/download/dotnet/7.0).
|
||||
|
||||
## Cloning Impostor
|
||||
|
||||
You need to clone Impostor using git.
|
||||
You need to clone Impostor using git:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/AeonLucid/Impostor.git
|
||||
git clone https://github.com/Impostor/Impostor.git
|
||||
```
|
||||
|
||||
## Building the server
|
||||
|
||||
### Dependencies
|
||||
- [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)
|
||||
|
||||
- [.NET 7 SDK](https://dotnet.microsoft.com/download/dotnet/7.0)
|
||||
- [Rider](https://www.jetbrains.com/rider/) or [Visual Studio](https://visualstudio.microsoft.com/vs/) (Optional, only if you want the full IDE experience)
|
||||
|
||||
### Build using the CLI
|
||||
@@ -21,16 +22,8 @@ git clone https://github.com/AeonLucid/Impostor.git
|
||||
```bash
|
||||
cd src/Impostor.Server/
|
||||
dotnet build
|
||||
# Or if you want a single file, ready for production: (change linux-x64 to win-x64 if you use Windows)
|
||||
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true
|
||||
```
|
||||
|
||||
To setup the server, please look at [Running the server](Running-the-server.md).
|
||||
|
||||
## Building the winforms patcher
|
||||
|
||||
### Dependencies
|
||||
* [.NET Framework 4.7.2 Developer Pack](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net472-developer-pack-offline-installer) or [Mono](https://www.mono-project.com/download/)
|
||||
|
||||
### Build using the CLI
|
||||
```bash
|
||||
cd src/Impostor.Patcher/Impostor.Patcher.WinForms
|
||||
dotnet build
|
||||
```
|
||||
+7
-3
@@ -1,11 +1,15 @@
|
||||
# Frequently Answered Questions
|
||||
|
||||
## What is this?
|
||||
The Impostor project is a reverse engineered and open sourced server for the game Among Us. The game itself is developed by [InnerSloth](http://www.innersloth.com/) while this project is maintained by the community. This project was built out of frustration for the lack of server availability in certain regions and the inability for the core developer, [AeonLucid](https://github.com/AeonLucid), to join a public game. As of this time, it has not been officially endorsed by the studio.
|
||||
|
||||
The Impostor project is a reverse engineered and open source server for the game Among Us. The game itself is developed by [Innersloth](http://www.innersloth.com/) while this project is maintained by the community. This project was built out of frustration for the lack of server availability in certain regions and the inability for the core developer, [AeonLucid](https://github.com/AeonLucid), to join a public game. As of this time, it has not been officially endorsed by the studio.
|
||||
|
||||
## Can this be used with the mobile version of the game?
|
||||
Yes, Impostor can be used with both the Android and iOS\* versions of the game.
|
||||
###### \* In order to play on an Impostor server with iOS, you _must_ have a jailbroken device.
|
||||
|
||||
Yes, Impostor can be used with both the Android and iOS versions of the game. You can add a custom server via a link, you can do this using the [site](https://impostor.github.io/Impostor)
|
||||
|
||||
## How can I get started?
|
||||
|
||||
See [Setting up your Server](Running-the-server.md) for more information on running the server and [Client Setup](https://impostor.github.io/Impostor/) for helping your friends join in!
|
||||
|
||||
If you're having issues with the server software, check the [Troubleshooting page](TROUBLESHOOTING.md).
|
||||
+41
-77
@@ -1,30 +1,51 @@
|
||||
# Running the server
|
||||
|
||||
There are currently two modes to run the Impostor server in. The first way is the simplest one and is the one you should probably use. The other way will distribute players across other servers and is a more advanced configuration.
|
||||
There are currently two install methods for Impostor: You can install it normally or inside of a Docker container. If you do not have a particular preference, we recommend the normal installation over the Docker container method.
|
||||
|
||||
## Single server
|
||||
## General remarks for both install methods
|
||||
|
||||
### Without docker
|
||||
1. Install the **.NET 5.0 runtime**.
|
||||
- [Windows x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-5.0.0-windows-x64-installer)
|
||||
- [Linux x64](https://docs.microsoft.com/en-us/dotnet/core/install/linux)
|
||||
- [macOS x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-5.0.0-macos-x64-installer)
|
||||
2. Find the [latest master release](https://ci.appveyor.com/project/Impostor/Impostor/branch/master/artifacts).
|
||||
3. Download either the Windows or the Linux version.
|
||||
4. Extract the zip.
|
||||
5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md) *(this step is mandatory if you want to expose this server to other devices)*
|
||||
6. Run `Impostor.Server.exe` (Windows) / `Impostor.Server` (Linux)
|
||||
This section applies to both the normal installation as well as the Docker (Compose) installation
|
||||
|
||||
### Using docker
|
||||
To connect to the server, you need to configure and install a region file on https://impostor.github.io/Impostor/
|
||||
|
||||
[](https://hub.docker.com/repository/docker/aeonlucid/impostor)
|
||||
[](https://hub.docker.com/repository/docker/aeonlucid/impostor)
|
||||
Depending on your host you may also need to port forward Impostor to the internet or pass Impostor traffic by your firewall. By default Impostor uses two ports:
|
||||
|
||||
- Port **22023** using the **UDP** protocol
|
||||
- Port **22000** using the **TCP** protocol
|
||||
|
||||
As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
|
||||
|
||||
## Normal installation
|
||||
|
||||
1. Install [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0). We recommend either the ASP.NET Core Runtime or the SDK. The SDK is necessary in case you want to develop Impostor or Impostor plugins.
|
||||
2. Download the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master). Note that Impostor is built for multiple CPU-architectures and operating systems, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device with an ARM processor.
|
||||
3. Extract the zip.
|
||||
4. Download the [Impostor.Http](https://github.com/Impostor/Impostor.Http) plugin and put it in your `plugins` folder.
|
||||
5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md). You need to at least change `PublicIp` to the address people will connect to your server to.
|
||||
6. Run `Impostor.Server` (Linux/macOS) or `Impostor.Server.exe` (Windows)
|
||||
7. (OPTIONAL - Linux) Configure a systemd definition file and enable the service to start on boot - [systemd configuration](Server-configuration.md#systemd)
|
||||
|
||||
## Using Docker
|
||||
|
||||
[](https://hub.docker.com/r/aeonlucid/impostor)
|
||||
[](https://hub.docker.com/r/aeonlucid/impostor)
|
||||
|
||||
Docker is a program that allows you to run programs like Impostor in a container.
|
||||
|
||||
After installing Docker, you can just start a Docker container with `docker run`:
|
||||
|
||||
```
|
||||
docker run -p 22023:22023/udp aeonlucid/impostor:nightly
|
||||
docker run -p 22000:22000/tcp -p 22023:22023/udp -e IMPOSTOR_Server__PublicIp=your.public.ip.here aeonlucid/impostor:nightly
|
||||
```
|
||||
|
||||
### Using docker-compose
|
||||
Please replace `your.public.ip.here` with the public IP address of your server. This is the address Among Us will try to reach your client at.
|
||||
|
||||
To configure the docker container, either use environment variables or mount config.json in your container.
|
||||
|
||||
## Using Docker Compose
|
||||
|
||||
Docker Compose allows you to start a Docker container using a prefined configuration. This is an example configuration you can continue on:
|
||||
|
||||
```
|
||||
version: '3.4'
|
||||
|
||||
@@ -33,69 +54,12 @@ services:
|
||||
image: aeonlucid/impostor:nightly
|
||||
container_name: impostor
|
||||
ports:
|
||||
- 22000:22000/tcp
|
||||
- 22023:22023/udp
|
||||
environment: # Either configure Impostor using environment variables or mount a copy of config.json
|
||||
- IMPOSTOR_Server__PublicIp=your.public.ip.here
|
||||
volumes:
|
||||
- /path/to/local/config.json:/app/config.json # For easy editing of the config
|
||||
- /path/to/local/plugins:/app/plugins # Only needed if using plugins
|
||||
- /path/to/local/libraries:/app/libraries # Only needed if using external libraries
|
||||
```
|
||||
|
||||
## Multiple servers
|
||||
|
||||
Follow the steps from the single server on two or more servers.
|
||||
|
||||
### Master server
|
||||
|
||||
The master server will accept client connections and redirect them to the other servers listed in the configuration. It will not host any games itself.
|
||||
|
||||
Example configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"Server": {
|
||||
"PublicIp": "127.0.0.1",
|
||||
"PublicPort": 22023,
|
||||
"ListenIp": "0.0.0.0",
|
||||
"ListenPort": 22023
|
||||
},
|
||||
"ServerRedirector": {
|
||||
"Enabled": true,
|
||||
"Master": true,
|
||||
"Locator": {
|
||||
"Redis": "",
|
||||
"UdpMasterEndpoint": "127.0.0.1:22024"
|
||||
},
|
||||
"Nodes": [
|
||||
{
|
||||
"Ip": "127.0.0.1",
|
||||
"Port": 22025
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Node servers
|
||||
|
||||
The node server should have `ServerRedirector` enabled too, but `Master` **must be disabled**. Nodes do not need to be aware of each other.
|
||||
|
||||
Example configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"Server": {
|
||||
"PublicIp": "127.0.0.1",
|
||||
"PublicPort": 22025,
|
||||
"ListenIp": "0.0.0.0",
|
||||
"ListenPort": 22025
|
||||
},
|
||||
"ServerRedirector": {
|
||||
"Enabled": true,
|
||||
"Master": false,
|
||||
"Locator": {
|
||||
"Redis": "",
|
||||
"UdpMasterEndpoint": "127.0.0.1:22024"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
+132
-51
@@ -1,35 +1,79 @@
|
||||
# Server configuration
|
||||
|
||||
Some information about all the possible configurations. Click [here](https://github.com/AeonLucid/Impostor/blob/master/src/Impostor.Server/config.full.json) to see all the possible config options.
|
||||
Some information about all the possible configurations. Click [here](https://github.com/Impostor/Impostor/blob/master/src/Impostor.Server/config-full.json) to see all the possible config options.
|
||||
|
||||
## Options
|
||||
|
||||
### Required Server Configuration
|
||||
|
||||
| Key | Default | Description |
|
||||
|-|-|-|
|
||||
| **PublicIp** | `127.0.0.1` | This needs to the public IPv4 address of the server which you give to others to connect. You can find your IPv4 address [on this website](http://whatismyip.host/). Unless you are only planning to use Impostor privately, on your local network, you should change this to your public ip. It is also possible to use hostnames instead of IPv4 addresses, which will be resolved to IPv4 addresses. |
|
||||
| **PublicPort** | `22023` | The public port of the server which you give to others to connect. (**This is the external port you configure on your router when port forwarding.**) Usually `22023`. |
|
||||
| **ListenIp** | `0.0.0.0` | The network interface to listen on. If you do not know what to put here, use `0.0.0.0`. Since 1.2.2 it is also possible to use hostnames instead of IPv4 addresses, these must resolve to a valid IPv4 address. |
|
||||
| **ListenPort** | `22023` | The listen port of the server, usually `22023`. |
|
||||
| Key | Default | Description |
|
||||
| -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| **PublicIp** | `127.0.0.1` | This needs to the public IPv4 address of the server which you give to others to connect. You can find your IPv4 address [on this website](http://whatismyip.host/). Unless you are only planning to use Impostor privately, on your local network, you should change this to your public ip. It is also possible to use hostnames instead of IPv4 addresses, which will be resolved to IPv4 addresses. |
|
||||
| **PublicPort** | `22023` | The public port of the server which you give to others to connect. (**This is the external port you configure on your router when port forwarding.**) Usually `22023`. |
|
||||
| **ListenIp** | `0.0.0.0` | The network interface to listen on. If you do not know what to put here, use `0.0.0.0`. Since 1.2.2 it is also possible to use hostnames instead of IPv4 addresses, these must resolve to a valid IPv4 address. |
|
||||
| **ListenPort** | `22023` | The listen port of the server, usually `22023`. |
|
||||
|
||||
### AntiCheat
|
||||
|
||||
| Key | Default | Value |
|
||||
|-|-|-|
|
||||
| **Enabled** | `true` | Whether the anticheat should be enabled. |
|
||||
| **BanIpFromGame** | `true` | When a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. **(Setting this to false does not disable the anti-cheat!)** |
|
||||
Impostor has an Anticheat that makes it possible to kick cheaters from games automatically. Note that the anticheat is tuned on the vanilla version of the game, so client-side modifications could trigger the Anticheat if you're playing with them.
|
||||
|
||||
### ServerRedirector
|
||||
In a multi-node setup these need to be specified.
|
||||
| Key | Default | Value |
|
||||
|-|-|-|
|
||||
| **Enabled** | `false` | Whether the server runs in multi-node setup. If this is `false`, all other options in this section do not have any effect. |
|
||||
| **Master** | `false` | Whether the current server is a master. A master is responsible for redirecting clients to nodes |
|
||||
| **Locator** | | Fill in either `Redis` or `UdpMasterEndpoint` to choose which method to use for locating other nodes. This must be the same across all servers. |
|
||||
| **>Redis** | | Format `127.0.0.1.6379`, you can also use a password like so: `127.0.0.1.6379,password=value`. |
|
||||
| **>UdpMasterEndpoint** | | On the master, this value acts as a listen ip and port. On a node, this should be the public ip and port of the master. Format `127.0.0.1:32320`. |
|
||||
| **Nodes** | | An array containing public ips and ports of nodes. Only needs to be set on the master. See above for an example. |
|
||||
| Key | Default | Value |
|
||||
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Enabled** | `true` | Whether the anticheat should be enabled. |
|
||||
| **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. |
|
||||
|
||||
### Compatibility
|
||||
|
||||
Impostor has two compatibility options which allow some extra flexibility but may not work properly. Enabling either of these options is not recommended.
|
||||
|
||||
| Key | Default | Value |
|
||||
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| **AllowNewGameVersions** | `false` | Warning: Setting this option to `true` is unsupported and may cause issues when large updates to Among Us are released. Allow future versions of Among Us to join your server. |
|
||||
| **AllowVersionMixing** | `false` | Allow players using different game versions to play in one lobby. |
|
||||
|
||||
### Debug
|
||||
|
||||
The Debug configuration is used to enable the game recorder. This is mostly useful when developing Impostor.
|
||||
|
||||
| Key | Default | Value |
|
||||
| ----------------------- | ------- | -------------------------------------------- |
|
||||
| **GameRecorderEnabled** | `false` | Enables the Game Recorder. |
|
||||
| **GameRecorderPath** | _empty_ | Path where the recorded games will be saved. |
|
||||
|
||||
### Serilog (Logging)
|
||||
|
||||
Impostor's log framework, Serilog, can be configured in the config file. You can change its default log level and you can add additional sinks.
|
||||
|
||||
| Key | Default | Value |
|
||||
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| **MinimumLevel** | `Information` | Minimum log level for a message to be printed. If a log entry is as severe or more severe than this level, it will be printed. From most severe to least severe: `Fatal`,`Error`, `Warning`, `Information`, `Debug`, `Verbose` |
|
||||
| **Using** | `[]` | List of additional Serilog Sinks assemblies to load. |
|
||||
| **WriteTo** | `[]` | Additional logging sinks. See the Serilog documentation or the example in this section. Serilog |
|
||||
|
||||
For more information, check the [Serilog.Settings.Configuration](https://github.com/serilog/serilog-settings-configuration) documentation.
|
||||
|
||||
For example, to add logging to a file, you should add the following snippet to your configuration:
|
||||
|
||||
```json
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.File"
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "logs/log.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Next to that, you also need to copy over Serilog.Sinks.File.dll from [NuGet](https://www.nuget.org/packages/Serilog.Sinks.File/). See the [Serilog.Sinks.File documentation](https://github.com/serilog/serilog-sinks-file#json-appsettingsjson-configuration) for a list of parameters that can be configured.
|
||||
|
||||
Other Serilog sinks are also supported, but are out of scope for this documentation.
|
||||
|
||||
## Config providers
|
||||
|
||||
@@ -37,30 +81,9 @@ In a multi-node setup these need to be specified.
|
||||
|
||||
The simplest option to configure is by using the `config.json` file next to the server executable. For all possible options see the [config-full.json](https://github.com/Impostor/Impostor/blob/dev/src/Impostor.Server/config-full.json) file.
|
||||
|
||||
### Command line arguments
|
||||
|
||||
TODO
|
||||
|
||||
```
|
||||
Server:PublicIp=127.0.0.1
|
||||
Server:PublicPort=22023
|
||||
Server:ListenIp=0.0.0.0
|
||||
Server:ListenPort=22023
|
||||
AntiCheat:Enabled=true
|
||||
AntiCheat:BanIpFromGame=true
|
||||
ServerRedirector:Enabled=false
|
||||
ServerRedirector:Master=true
|
||||
ServerRedirector:Locator:Redis=127.0.0.1.6379
|
||||
ServerRedirector:Locator:UdpMasterEndpoint=127.0.0.1:32320
|
||||
ServerRedirector:Nodes:0:Ip=127.0.0.1
|
||||
ServerRedirector:Nodes:0:Port=22024
|
||||
ServerRedirector:Nodes:1:Ip=127.0.0.1
|
||||
ServerRedirector:Nodes:1:Port=22025
|
||||
```
|
||||
|
||||
### Environment variables
|
||||
|
||||
TODO
|
||||
If you're unable to edit the config.json file, you can instead set Environment variables to configure Impostor. The general pattern for each variable is `IMPOSTOR_SectionName__VariableName`. For example, to disable the anticheat, you can set the environment variable `IMPOSTOR_AntiCheat__Enabled=false`. Here are some more examples:
|
||||
|
||||
```
|
||||
IMPOSTOR_Server__PublicIp=127.0.0.1
|
||||
@@ -69,12 +92,70 @@ IMPOSTOR_Server__ListenIp=0.0.0.0
|
||||
IMPOSTOR_Server__ListenPort=22023
|
||||
IMPOSTOR_AntiCheat__Enabled=true
|
||||
IMPOSTOR_AntiCheat__BanIpFromGame=true
|
||||
IMPOSTOR_ServerRedirector__Enabled=false
|
||||
IMPOSTOR_ServerRedirector__Master=true
|
||||
IMPOSTOR_ServerRedirector__Locator__Redis=127.0.0.1.6379
|
||||
IMPOSTOR_ServerRedirector__Locator__UdpMasterEndpoint=127.0.0.1:32320
|
||||
IMPOSTOR_ServerRedirector__Nodes__0__Ip=127.0.0.1
|
||||
IMPOSTOR_ServerRedirector__Nodes__0__Port=22024
|
||||
IMPOSTOR_ServerRedirector__Nodes__1__Ip=127.0.0.1
|
||||
IMPOSTOR_ServerRedirector__Nodes__1__Port=22025
|
||||
```
|
||||
|
||||
# systemd
|
||||
|
||||
Linux users will likely want to create a systemd service definition to manage running the Impostor application. Benefits to using a systemd service include the following:
|
||||
|
||||
- The server process can automatically restart if the process dies
|
||||
- Impostor can be set to start on boot (handy if you do system updates regularly)
|
||||
- You can use systemd targets to ensure the process doesn't start until the system dependencies are met
|
||||
|
||||
Using your favorite text editor, create the following service file:
|
||||
|
||||
```
|
||||
sudoedit /etc/systemd/system/impostor.service
|
||||
```
|
||||
|
||||
Modify the following template to your needs and populate the service file.
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=Impostor private Among Us server - https://github.com/Impostor/Impostor
|
||||
|
||||
[Service]
|
||||
# Directory where Impostor is installed
|
||||
WorkingDirectory=/opt/impostor
|
||||
# Path to Impostor binary
|
||||
ExecStart=/opt/impostor/Impostor.Server
|
||||
Restart=always
|
||||
# Restart service after 10 seconds if the dotnet service crashes
|
||||
RestartSec=10
|
||||
KillSignal=SIGTERM
|
||||
SyslogIdentifier=impostor
|
||||
|
||||
# User and group that will run the Impostor server process -- ensure that user is allowed to execute the binary
|
||||
User=impostor
|
||||
Group=impostor
|
||||
TimeoutStopSec=10
|
||||
|
||||
[Install]
|
||||
# Wait until most system services have started before starting Impostor
|
||||
After=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Reload all systemd unit files to source in the new file you've created.
|
||||
|
||||
```
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
Start the service.
|
||||
|
||||
```
|
||||
sudo systemctl start impostor.service
|
||||
```
|
||||
|
||||
Check the log for the service and verify it has started correctly -- Hint: Use the Q key to quit out of journalctl.
|
||||
|
||||
```
|
||||
sudo journalctl -u impostor.service
|
||||
```
|
||||
|
||||
If everything has started correctly, ensure the service is set to start on boot.
|
||||
|
||||
```
|
||||
sudo systemctl enable impostor.service
|
||||
```
|
||||
+38
-9
@@ -1,28 +1,57 @@
|
||||
# Troubleshooting
|
||||
|
||||
If you're reading this, something went wrong.
|
||||
Don't worry though, as this is the most thorough guide to help you!
|
||||
|
||||
## `./Impostor.Server: line 1: ELF: not found` (plus other errors)
|
||||
|
||||
No idea where you got that system. But we clearly do **NOT** support it.
|
||||
|
||||
## `cannot execute binary file: Exec format error`
|
||||
Please check that you have downloaded the right version of Impostor, as we mantain two CPU architectures (x64 and ARM).
|
||||
Unless you are running Impostor on a SBC (Single-Board Computer), like the Raspberry Pi, you most likely want to use the x64 version.
|
||||
|
||||
Please check that you have downloaded the right version of Impostor, as we mantain two CPU architectures (x64 and ARM).
|
||||
Unless you are running Impostor on a computer like the Raspberry Pi, you most likely want to use the x64 version.
|
||||
|
||||
## `./Impostor.Server: Permission denied`
|
||||
|
||||
This is an error related to Linux file permissions.
|
||||
Some files do not hold their executable bit (the permission that allows them to run) during a download.
|
||||
You can solve this by doing: `chmod +x Impostor.Server`
|
||||
|
||||
## `You are using an older version of the game`
|
||||
You are using an older version of Impostor. The game does not really check who is outdated and blames it on the user.
|
||||
Make sure you got the latest working version of Impostor (probably in AppVeyor, not Github).
|
||||
## Disconnected with `Your client is too new, please update your Impostor to play`
|
||||
|
||||
## `You disconnected from the server. Reliable Packet 1 ...`
|
||||
Please double-check that you have followed the [Server Configuration](Server-configuration.md) correctly.
|
||||
**NOTE: Your public ip does not start with `127` nor `192`**
|
||||
This happens when your game is too new for your copy of Impostor to support.
|
||||
|
||||
If you're using an Impostor release, check if there is a newer release available that supports your version. If this doesn't exist, you can try the [latest build from CI](https://nightly.link/Impostor/Impostor/workflows/ci/master).
|
||||
|
||||
If even that build doesn't work, you can try looking through the Pull Requests to see if there is a pending pull request that aims to update it to the next version, but note these may be unstable and may contain malicious code, as they haven't been vetted by the Impostor development team yet.
|
||||
|
||||
## Disconnected with `Please update your game to play on this server`
|
||||
|
||||
This happens when you're using a version of Impostor that is too new for your game version. You can download an older version from [the GitHub release page](https://github.com/Impostor/Impostor/releases). We however don't support older versions of Impostor with new API's and bugfixes so we recommend to update your game instead.
|
||||
|
||||
## Disconnected with `You are using an older version of the game`
|
||||
|
||||
You are using a version of Impostor that is not designed for the version of the game you're playing. The game does not really check who is outdated and blames it on the user. Newer versions (v1.5.0+) do warn correctly and send the correct message.
|
||||
|
||||
Look at which version of the game you're playing, which you can see in the top left corner of the main menu, then download an Impostor version for that game. Every [release on the release page](https://github.com/Impostor/Impostor/releases) shows which version of the game it is compatible with. If your game version is newer than the latest release, check if the [latest build from CI works](https://nightly.link/Impostor/Impostor/workflows/ci/master).
|
||||
|
||||
## Disconnected with `You disconnected from the server. Reliable Packet 1 ...`
|
||||
|
||||
Please double-check that you have followed the [Server Configuration](Server-configuration.md) correctly.
|
||||
**NOTE: Your public ip does not start with `10`, `127` or `192`**
|
||||
Also check if the port Impostor (ListenPort) is listening on is correctly port-forwarded for UDP (or TCP/UDP).
|
||||
|
||||
## `Could not load file or assembly...`
|
||||
Please check that you only have **working** plugins in the `plugins` folder.
|
||||
|
||||
Please check that you only have **working** plugins in the `plugins` folder.
|
||||
This error can be caused by non-plugin files or plugins that are not working correctly.
|
||||
|
||||
## My question is not yet answered and I'm still having problems!
|
||||
|
||||
That's unfortunate. Join the [Impostor Discord](https://discord.gg/Mk3w6Tb), ask your question there and we'll try to help you out. Note that we're not always available, so it may take some time to get an answer. To make answering your question easier, please add the following details:
|
||||
|
||||
- Which version of Impostor are you using?
|
||||
- Which version or Among Us are you using?
|
||||
- Which operating system are you running Impostor on?
|
||||
- If you have console logs, attaching these will also help.
|
||||
+13
-16
@@ -19,31 +19,32 @@ Impostor has support for plugins. This document will help you to setup a develop
|
||||
- [Impostor versions](#impostor-versions)
|
||||
- [9. Missing/invalid data or want more functions?](#9-missinginvalid-data-or-want-more-functions)
|
||||
|
||||
## 1. Install .NET Core SDK
|
||||
## 1. Install .NET SDK
|
||||
|
||||
Download and install the latest .NET Core SDK.
|
||||
Download and install the latest .NET SDK.
|
||||
|
||||
https://dotnet.microsoft.com/download
|
||||
|
||||
## 2. Create a C# project
|
||||
|
||||
The first step is creating a new C# project, it must be a **Class Library (.NET Standard)**. The target framework can be any of those compatible with .NET 5, which includes:
|
||||
The first step is creating a new C# project, it must be a **Class Library (.NET Standard)**. The target framework can be any of those compatible with .NET 7, which includes:
|
||||
|
||||
- .NET Standard 2.0
|
||||
- .NET Standard 2.1
|
||||
- .NET Core 3.1
|
||||
- .NET 5
|
||||
- .NET 6
|
||||
- .NET 7
|
||||
|
||||
For more information about compatibility, see https://docs.microsoft.com/en-us/dotnet/standard/net-standard.
|
||||
|
||||
> At the moment of writing this document, I recommend you to use **.NET Standard 2.1** until .NET 5 is released officially. This should give you enough functionality. If not, upgrade to .NET Core 3.1.
|
||||
> At the moment of writing this document, I recommend you to use **.NET 7.0**.
|
||||
|
||||
When the project has been created, you should have `Class.cs` and `Project.csproj` files. Your `Project.csproj` should look something like this.
|
||||
|
||||
```xml
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
```
|
||||
@@ -62,16 +63,13 @@ Make sure to get a prerelease if you are writing a plugin for a dev release of t
|
||||
1. Right click your project.
|
||||
2. Click `Manage NuGet Packages`.
|
||||
3. Click `Browse`.
|
||||
4. Next to the search bar, enable `Include prerelease`.
|
||||
5. Search for `Impostor.Api`.
|
||||
6. Click the `Impostor.Api` result and press install on the right side.
|
||||
4. Search for `Impostor.Api`.
|
||||
5. Click the `Impostor.Api` result and press install on the right side.
|
||||
|
||||
### Dotnet CLI
|
||||
|
||||
> Make sure to grab the latest (pre-)release version from NuGet [here](https://www.nuget.org/packages/Impostor.Api).
|
||||
|
||||
1. Open your project folder in command prompt / bash.
|
||||
2. Run `dotnet add package Impostor.Api -v "1.2.0-ci.58"`.
|
||||
2. Run `dotnet add package Impostor.Api`.
|
||||
|
||||
## 4. The plugin class
|
||||
|
||||
@@ -272,7 +270,7 @@ Now your plugin is ready to be tested.
|
||||
|
||||
1. Right click your project and press `Build`.
|
||||
2. Right click your project and press `Open Folder in File Explorer`.
|
||||
3. Go to `bin/Debug/netstandard2.1/`.
|
||||
3. Go to `bin/Debug/net7.0/`.
|
||||
4. In this directory, you should find your plugin named `Project.dll`.
|
||||
5. Copy the `Project.dll` to the `plugins` directory in your Impostor server directory.
|
||||
6. (Re)start your Impostor server.
|
||||
@@ -295,7 +293,6 @@ Some extra information that might be useful for those developing plugins.
|
||||
- `IEventManager`
|
||||
- `IClientManager`
|
||||
- `IOptions<ServerConfig>`
|
||||
- `IOptions<ServerRedirectorConfig>`
|
||||
- You can add your own classes and `EventListener` implementation to the `IServiceProvider` by creating a new class and implementing `IPluginStartup`. Make sure to register them as a singleton `services.AddSingleton<IEventListener, GameEventListener>();`.
|
||||
|
||||
### Server configuration
|
||||
@@ -312,7 +309,7 @@ Constantly copying the plugin dll to your server directory can be pretty annoyin
|
||||
},
|
||||
"PluginLoader": {
|
||||
"Paths": [
|
||||
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\netstandard2.1"
|
||||
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\net7.0"
|
||||
],
|
||||
"LibraryPaths": []
|
||||
}
|
||||
@@ -340,4 +337,4 @@ Create an issue:
|
||||
- [Suggest a function](https://github.com/Impostor/Impostor/issues/new?template=3--api-suggestion.md)
|
||||
- [Data is invalid](https://github.com/Impostor/Impostor/issues/new?template=4--api-invalid.md)
|
||||
- [Data is unavailable](https://github.com/Impostor/Impostor/issues/new?template=5--api-missing.md)
|
||||
- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
|
||||
- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
|
||||
@@ -144,6 +144,12 @@ dotnet_naming_style.end_in_async.word_separator =
|
||||
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
|
||||
dotnet_diagnostic.RS2008.severity = none
|
||||
|
||||
# IDE0005: Remove unnecessary import
|
||||
dotnet_diagnostic.IDE0005.severity = warning
|
||||
|
||||
# IDE0007: Use `var` instead of explicit type
|
||||
dotnet_diagnostic.IDE0007.severity = warning
|
||||
|
||||
# IDE0035: Remove unreachable code
|
||||
dotnet_diagnostic.IDE0035.severity = warning
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.4.0</VersionPrefix>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<LangVersion>11</LangVersion>
|
||||
<VersionPrefix>1.8.1</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
<EnforceCodeStyleInBuild Condition="$(MSBuildProjectName)!='Hazel'">true</EnforceCodeStyleInBuild>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Impostor.Server.Config
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
public class AntiCheatConfig
|
||||
{
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
public class CompatibilityConfig
|
||||
{
|
||||
public const string Section = "Compatibility";
|
||||
|
||||
public bool AllowFutureGameVersions { get; set; } = false;
|
||||
|
||||
public bool AllowVersionMixing { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Impostor.Server.Config
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
public class DebugConfig
|
||||
{
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
public static class DisconnectMessages
|
||||
{
|
||||
public const string Error = "There was an internal server error. " +
|
||||
"Check the server console for more information. " +
|
||||
"Please report the issue on the Impostor GitHub if it keeps happening.";
|
||||
|
||||
public const string ClientOutdated = "Please update your game to play in this lobby.";
|
||||
|
||||
public const string ClientTooNew = "Your game version is too new for this lobby. " +
|
||||
"If you want to join this lobby you need to downgrade your client.";
|
||||
|
||||
public const string Destroyed = "The game you tried to join is being destroyed. " +
|
||||
"Please create a new game.";
|
||||
|
||||
public const string UsernameLength = "Your username is too long, please make it shorter.";
|
||||
|
||||
public const string UsernameIllegalCharacters = "Your username contains illegal characters, please remove them.";
|
||||
|
||||
public const string VersionClientTooOld = "Please update your game to play on this server.";
|
||||
|
||||
public const string VersionServerTooOld = "Your client is too new, please update your Impostor server to play.";
|
||||
|
||||
public const string VersionUnsupported = "Your client version is unsupported, please update your Game and/or Impostor server.";
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
using Impostor.Server.Utils;
|
||||
using Impostor.Api.Utils;
|
||||
|
||||
namespace Impostor.Server.Config
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
internal class ServerConfig
|
||||
public class ServerConfig
|
||||
{
|
||||
public const string Section = "Server";
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Events.Announcements
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public bool UseCached { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public int Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets client's language.
|
||||
/// </summary>
|
||||
public Language Language { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets plugin made response.
|
||||
/// </summary>
|
||||
public IResponse Response { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Events.Client
|
||||
{
|
||||
|
||||
@@ -2,10 +2,12 @@ using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public enum VoteType : sbyte
|
||||
public enum VoteType : byte
|
||||
{
|
||||
ForceSkip = -2,
|
||||
Skip = -1,
|
||||
HasNotVoted = 255,
|
||||
Missed = 254,
|
||||
Skipped = 253,
|
||||
Dead = 252,
|
||||
Player = 0,
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,13 @@ namespace Impostor.Api
|
||||
return original[0];
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static short ReadInt16(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
var original = Advance<short>(ref input);
|
||||
return BinaryPrimitives.ReadInt16LittleEndian(original);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ReadInt32(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
|
||||
@@ -37,6 +37,16 @@
|
||||
/// </summary>
|
||||
GameDestroyed,
|
||||
|
||||
/// <summary>
|
||||
/// The host has a newer version of the game and the client should update.
|
||||
/// </summary>
|
||||
ClientOutdated,
|
||||
|
||||
/// <summary>
|
||||
/// The host has an older version of the game and the client should downgrade.
|
||||
/// </summary>
|
||||
ClientTooNew,
|
||||
|
||||
/// <summary>
|
||||
/// Custom error by a plugin.
|
||||
/// </summary>
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Innersloth.GameOptions;
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Inner;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public interface IGame
|
||||
{
|
||||
GameOptionsData Options { get; }
|
||||
IGameOptions Options { get; }
|
||||
|
||||
GameFilterOptions FilterOptions { get; }
|
||||
|
||||
GameCode Code { get; }
|
||||
|
||||
@@ -53,7 +55,7 @@ namespace Impostor.Api.Games
|
||||
void BanIp(IPAddress ipAddress);
|
||||
|
||||
/// <summary>
|
||||
/// Syncs the internal <see cref="GameOptionsData" /> to all players.
|
||||
/// Syncs the internal <see cref="IGameOptions" /> 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>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
namespace Impostor.Api.Games.Managers
|
||||
{
|
||||
@@ -14,8 +15,9 @@ namespace Impostor.Api.Games.Managers
|
||||
/// Creates a new game.
|
||||
/// </summary>
|
||||
/// <param name="options">Game options.</param>
|
||||
/// <param name="filterOptions">Filter options.</param>
|
||||
/// <returns>Created game or null if creation was cancelled by a plugin.</returns>
|
||||
/// <exception cref="ImpostorException">Thrown when game creation failed.</exception>
|
||||
ValueTask<IGame?> CreateAsync(GameOptionsData options);
|
||||
ValueTask<IGame?> CreateAsync(IGameOptions options, GameFilterOptions filterOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
global using Impostor.Hazel.Abstractions;
|
||||
@@ -1,9 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<CodeAnalysisRuleSet>../ProjectRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>9</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
@@ -27,16 +25,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Nullable" Version="1.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
|
||||
<PackageReference Include="Impostor.Hazel.Abstractions" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public readonly struct Announcement
|
||||
{
|
||||
public readonly int Id;
|
||||
public readonly string Message;
|
||||
|
||||
public Announcement(int id, string message)
|
||||
{
|
||||
Id = id;
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Impostor.Api.Innersloth;
|
||||
|
||||
public enum CrossplayFlags
|
||||
{
|
||||
Unknown = 0,
|
||||
StandaloneEpicPC = 1 << 1,
|
||||
StandaloneSteamPC = 1 << 2,
|
||||
StandaloneMac = 1 << 3,
|
||||
StandaloneWin10 = 1 << 4,
|
||||
StandaloneItch = 1 << 5,
|
||||
IPhone = 1 << 6,
|
||||
Android = 1 << 7,
|
||||
Switch = 1 << 8,
|
||||
Xbox = 1 << 9,
|
||||
Playstation = 1 << 10,
|
||||
All = int.MaxValue,
|
||||
}
|
||||
@@ -14,5 +14,11 @@
|
||||
Brown = 9,
|
||||
Cyan = 10,
|
||||
Lime = 11,
|
||||
Maroon = 12,
|
||||
Rose = 13,
|
||||
Banana = 14,
|
||||
Gray = 15,
|
||||
Tan = 16,
|
||||
Coral = 17,
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public enum HatType : uint
|
||||
{
|
||||
NoHat = 0,
|
||||
Astronaut = 1,
|
||||
BaseballCap = 2,
|
||||
BrainSlug = 3,
|
||||
BushHat = 4,
|
||||
CaptainsHat = 5,
|
||||
DoubleTopHat = 6,
|
||||
Flowerpot = 7,
|
||||
Goggles = 8,
|
||||
HardHat = 9,
|
||||
Military = 10,
|
||||
PaperHat = 11,
|
||||
PartyHat = 12,
|
||||
Police = 13,
|
||||
Stethescope = 14,
|
||||
TopHat = 15,
|
||||
TowelWizard = 16,
|
||||
Ushanka = 17,
|
||||
Viking = 18,
|
||||
WallCap = 19,
|
||||
Snowman = 20,
|
||||
Reindeer = 21,
|
||||
Lights = 22,
|
||||
Santa = 23,
|
||||
Tree = 24,
|
||||
Present = 25,
|
||||
Candycanes = 26,
|
||||
ElfHat = 27,
|
||||
NewYears2018 = 28,
|
||||
WhiteHat = 29,
|
||||
Crown = 30,
|
||||
Eyebrows = 31,
|
||||
HaloHat = 32,
|
||||
HeroCap = 33,
|
||||
PipCap = 34,
|
||||
PlungerHat = 35,
|
||||
ScubaHat = 36,
|
||||
StickminHat = 37,
|
||||
StrawHat = 38,
|
||||
TenGallonHat = 39,
|
||||
ThirdEyeHat = 40,
|
||||
ToiletPaperHat = 41,
|
||||
Toppat = 42,
|
||||
BlackFedora = 43,
|
||||
SkiGoggles = 44,
|
||||
Headphones = 45,
|
||||
MaskHat = 46,
|
||||
PaperMask = 47,
|
||||
Security = 48,
|
||||
StrapHat = 49,
|
||||
Banana = 50,
|
||||
Beanie = 51,
|
||||
Bear = 52,
|
||||
Cheese = 53,
|
||||
Cherry = 54,
|
||||
Egg = 55,
|
||||
GreenFedora = 56,
|
||||
Flamingo = 57,
|
||||
FlowerPin = 58,
|
||||
Helmet = 59,
|
||||
Plant = 60,
|
||||
BatEyes = 61,
|
||||
BatWings = 62,
|
||||
Horns = 63,
|
||||
Mohawk = 64,
|
||||
Pumpkin = 65,
|
||||
ScaryBag = 66,
|
||||
Witch = 67,
|
||||
Wolf = 68,
|
||||
Pirate = 69,
|
||||
Plague = 70,
|
||||
Machete = 71,
|
||||
Fred = 72,
|
||||
MinerCap = 73,
|
||||
WinterHat = 74,
|
||||
Archae = 75,
|
||||
Antenna = 76,
|
||||
Balloon = 77,
|
||||
BirdNest = 78,
|
||||
BlackBelt = 79,
|
||||
Caution = 80,
|
||||
Chef = 81,
|
||||
CopHat = 82,
|
||||
DoRag = 83,
|
||||
DumSticker = 84,
|
||||
Fez = 85,
|
||||
GeneralHat = 86,
|
||||
GreyThing = 87,
|
||||
HunterCap = 88,
|
||||
JungleHat = 89,
|
||||
MiniCrewmate = 90,
|
||||
NinjaMask = 91,
|
||||
RamHorns = 92,
|
||||
SnowCrewmate = 93,
|
||||
GeoffHat = 94,
|
||||
DaveCap = 95,
|
||||
EllieRose = 96,
|
||||
SvenHat = 97,
|
||||
BurtHat = 98,
|
||||
EllryMohawk = 99,
|
||||
ThomasMonoc = 100,
|
||||
Wizard = 101,
|
||||
Fredrick = 102,
|
||||
MrMacbeth = 103,
|
||||
ToppatHenry = 104,
|
||||
ToppatEllie = 105,
|
||||
GeoffreyPlumb = 106,
|
||||
AngryEyebrows = 107,
|
||||
ChocolateIce = 108,
|
||||
HeartPin = 109,
|
||||
Ponytail = 110,
|
||||
RubberGlove = 111,
|
||||
UnicornHorn = 112,
|
||||
Zipper = 113,
|
||||
RightHandMan = 114,
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public enum PetType : uint
|
||||
{
|
||||
NoPet = 0,
|
||||
Alien = 1,
|
||||
Crewmate = 2,
|
||||
Doggy = 3,
|
||||
Stickmin = 4,
|
||||
Hamster = 5,
|
||||
Robot = 6,
|
||||
Ufo = 7,
|
||||
Ellie = 8,
|
||||
Squig = 9,
|
||||
Bedcrab = 10,
|
||||
Glitch = 11,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public class PlayerOutfit
|
||||
{
|
||||
public ColorType Color { get; internal set; } = (ColorType)(-1);
|
||||
|
||||
public string HatId { get; internal set; } = "missing";
|
||||
|
||||
public string PetId { get; internal set; } = "missing";
|
||||
|
||||
public string SkinId { get; internal set; } = "missing";
|
||||
|
||||
public string VisorId { get; internal set; } = "missing";
|
||||
|
||||
public string NamePlateId { get; internal set; } = "missing";
|
||||
|
||||
public string PlayerName { get; internal set; } = "missing";
|
||||
|
||||
public bool IsIncomplete
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PlayerName) && Color != (ColorType)(-1) && HatId != "missing" && PetId != "missing" && SkinId != "missing" && VisorId != "missing")
|
||||
{
|
||||
return NamePlateId == "missing";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(PlayerName);
|
||||
writer.WritePacked((int)Color);
|
||||
writer.Write(HatId);
|
||||
writer.Write(PetId);
|
||||
writer.Write(SkinId);
|
||||
writer.Write(VisorId);
|
||||
writer.Write(NamePlateId);
|
||||
}
|
||||
|
||||
public void Deserialize(IMessageReader reader)
|
||||
{
|
||||
PlayerName = reader.ReadString();
|
||||
Color = (ColorType)reader.ReadPackedInt32();
|
||||
HatId = reader.ReadString();
|
||||
PetId = reader.ReadString();
|
||||
SkinId = reader.ReadString();
|
||||
VisorId = reader.ReadString();
|
||||
NamePlateId = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public enum PlayerOutfitType
|
||||
{
|
||||
Default,
|
||||
Shapeshifted,
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public enum SkinType : uint
|
||||
{
|
||||
None = 0,
|
||||
Astro = 1,
|
||||
Capt = 2,
|
||||
Mech = 3,
|
||||
Military = 4,
|
||||
Police = 5,
|
||||
Science = 6,
|
||||
SuitB = 7,
|
||||
SuitW = 8,
|
||||
Wall = 9,
|
||||
Hazmat = 10,
|
||||
Security = 11,
|
||||
Tarmac = 12,
|
||||
Miner = 13,
|
||||
Winter = 14,
|
||||
Archae = 15,
|
||||
Prisoner = 16,
|
||||
CCC = 17,
|
||||
RightHandMan = 18,
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
[Flags]
|
||||
public enum FreeWeekendState : byte
|
||||
{
|
||||
NotFree,
|
||||
FreeMIRA,
|
||||
FreePolus,
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ namespace Impostor.Api.Innersloth
|
||||
|
||||
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.
|
||||
@@ -67,7 +65,7 @@ namespace Impostor.Api.Innersloth
|
||||
#else
|
||||
Span<byte> data = stackalloc byte[len];
|
||||
#endif
|
||||
Random.GetBytes(data);
|
||||
RandomNumberGenerator.Fill(data);
|
||||
|
||||
// Convert to their char representation.
|
||||
Span<char> dataChar = stackalloc char[len];
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Impostor.Api.Innersloth;
|
||||
|
||||
public class GameFilterOptions
|
||||
{
|
||||
public HashSet<string> FilterTags { get; } = new HashSet<string>();
|
||||
|
||||
public static GameFilterOptions CreateDefault()
|
||||
{
|
||||
return new GameFilterOptions
|
||||
{
|
||||
FilterTags =
|
||||
{
|
||||
"Beginner",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public static GameFilterOptions Deserialize(IMessageReader reader)
|
||||
{
|
||||
var options = new GameFilterOptions();
|
||||
|
||||
var count = reader.ReadPackedInt32();
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
options.FilterTags.Add(reader.ReadString());
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.WritePacked(FilterTags.Count);
|
||||
foreach (var filterTag in FilterTags)
|
||||
{
|
||||
writer.Write(filterTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,24 @@ namespace Impostor.Api.Innersloth
|
||||
public enum GameKeywords : uint
|
||||
{
|
||||
All = 0,
|
||||
Other = 1,
|
||||
Spanish = 2,
|
||||
English = 256,
|
||||
SpanishLA = 2,
|
||||
Brazilian = 2048,
|
||||
Portuguese = 16,
|
||||
Korean = 4,
|
||||
Russian = 8,
|
||||
Portuguese = 16,
|
||||
Dutch = 4096,
|
||||
Filipino = 64,
|
||||
French = 8192,
|
||||
German = 16384,
|
||||
Italian = 32768,
|
||||
Japanese = 512,
|
||||
SpanishEU = 1024,
|
||||
Arabic = 32,
|
||||
Filipone = 64,
|
||||
Polish = 128,
|
||||
English = 256,
|
||||
SChinese = 65536,
|
||||
TChinese = 131072,
|
||||
Irish = 262144,
|
||||
Other = 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum GameModes : byte
|
||||
{
|
||||
None,
|
||||
Normal,
|
||||
HideNSeek,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public static class GameOptionsFactory
|
||||
{
|
||||
public const byte ModularOptionsDataVersion = 7;
|
||||
|
||||
public static void Serialize(IMessageWriter writer, IGameOptions gameOptions)
|
||||
{
|
||||
if (gameOptions.Version < ModularOptionsDataVersion)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// In theory we should use WriteBytesAndSize here, but it's costly and requires computing the size
|
||||
// Base game does similar hacks and completely ignores this value for modular game options so we can just write 0 here
|
||||
writer.WritePacked(0);
|
||||
|
||||
writer.Write(gameOptions.Version);
|
||||
writer.StartMessage(0);
|
||||
writer.Write((byte)gameOptions.GameMode);
|
||||
gameOptions.Serialize(writer);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
public static IGameOptions Deserialize(IMessageReader reader)
|
||||
{
|
||||
reader.ReadPackedInt32();
|
||||
var version = reader.ReadByte();
|
||||
|
||||
if (version < ModularOptionsDataVersion)
|
||||
{
|
||||
return LegacyGameOptionsData.Deserialize(reader, version);
|
||||
}
|
||||
|
||||
var optionsReader = reader.ReadMessage();
|
||||
var gameMode = (GameModes)optionsReader.ReadByte();
|
||||
|
||||
return gameMode switch
|
||||
{
|
||||
GameModes.Normal => NormalGameOptions.Deserialize(optionsReader, version),
|
||||
GameModes.HideNSeek => HideNSeekGameOptions.Deserialize(optionsReader, version),
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
}
|
||||
|
||||
public static void DeserializeInto(IMessageReader reader, IGameOptions gameOptions)
|
||||
{
|
||||
reader.ReadPackedInt32();
|
||||
var version = reader.ReadByte();
|
||||
|
||||
if (version < ModularOptionsDataVersion)
|
||||
{
|
||||
((LegacyGameOptionsData)gameOptions).Deserialize(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
var optionsReader = reader.ReadMessage();
|
||||
var gameMode = (GameModes)optionsReader.ReadByte();
|
||||
|
||||
switch (gameMode)
|
||||
{
|
||||
case GameModes.Normal:
|
||||
((NormalGameOptions)gameOptions).Deserialize(optionsReader);
|
||||
break;
|
||||
case GameModes.HideNSeek:
|
||||
((HideNSeekGameOptions)gameOptions).Deserialize(optionsReader);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(gameMode), gameMode, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public class HideNSeekGameOptions : IGameOptions
|
||||
{
|
||||
public const int LatestVersion = 7;
|
||||
|
||||
public HideNSeekGameOptions(byte version = LatestVersion)
|
||||
{
|
||||
Version = version;
|
||||
IGameOptions.EnsureVersionIsModular<HideNSeekGameOptions>(version);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte Version { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public GameModes GameMode => GameModes.HideNSeek;
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte MaxPlayers { get; set; } = 15;
|
||||
|
||||
/// <inheritdoc />
|
||||
public GameKeywords Keywords { get; set; } = GameKeywords.English;
|
||||
|
||||
/// <inheritdoc />
|
||||
public MapTypes Map { get; set; } = MapTypes.Skeld;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int NumImpostors { get; set; } = 1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsDefaults { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float CrewLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 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 number of common tasks.
|
||||
/// </summary>
|
||||
public int NumCommonTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// </summary>
|
||||
public int NumLongTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of short tasks.
|
||||
/// </summary>
|
||||
public int NumShortTasks { get; set; } = 2;
|
||||
|
||||
public int CrewmateVentUses { get; set; } = 1;
|
||||
|
||||
public float CrewmateTimeInVent { get; set; } = 3f;
|
||||
|
||||
public float HidingTime { get; set; } = 200f;
|
||||
|
||||
public float CrewmateFlashlightSize { get; set; } = 0.35f;
|
||||
|
||||
public float ImpostorFlashlightSize { get; set; } = 0.25f;
|
||||
|
||||
public bool UseFlashlight { get; set; } = true;
|
||||
|
||||
public bool FinalHideSeekMap { get; set; } = true;
|
||||
|
||||
public float FinalHideTime { get; set; } = 50f;
|
||||
|
||||
public float FinalSeekerSpeed { get; set; } = 1.2f;
|
||||
|
||||
public bool FinalHidePings { get; set; } = true;
|
||||
|
||||
public bool ShowNames { get; set; } = true;
|
||||
|
||||
public uint SeekerPlayerId { get; set; } = 0xFFFFFFFF;
|
||||
|
||||
public float MaxPingTime { get; set; } = 6f;
|
||||
|
||||
public static HideNSeekGameOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new HideNSeekGameOptions(version);
|
||||
options.Deserialize(reader);
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Deserialize(IMessageReader reader)
|
||||
{
|
||||
MaxPlayers = reader.ReadByte();
|
||||
Keywords = (GameKeywords)reader.ReadInt32();
|
||||
Map = (MapTypes)reader.ReadByte();
|
||||
PlayerSpeedMod = reader.ReadSingle();
|
||||
CrewLightMod = reader.ReadSingle();
|
||||
ImpostorLightMod = reader.ReadSingle();
|
||||
NumCommonTasks = reader.ReadByte();
|
||||
NumLongTasks = reader.ReadByte();
|
||||
NumShortTasks = reader.ReadByte();
|
||||
IsDefaults = reader.ReadBoolean();
|
||||
|
||||
CrewmateVentUses = reader.ReadInt32();
|
||||
HidingTime = reader.ReadSingle();
|
||||
CrewmateFlashlightSize = reader.ReadSingle();
|
||||
ImpostorFlashlightSize = reader.ReadSingle();
|
||||
UseFlashlight = reader.ReadBoolean();
|
||||
FinalHideSeekMap = reader.ReadBoolean();
|
||||
FinalHideTime = reader.ReadSingle();
|
||||
FinalSeekerSpeed = reader.ReadSingle();
|
||||
FinalHidePings = reader.ReadBoolean();
|
||||
ShowNames = reader.ReadBoolean();
|
||||
SeekerPlayerId = reader.ReadUInt32();
|
||||
MaxPingTime = reader.ReadSingle();
|
||||
CrewmateTimeInVent = reader.ReadSingle();
|
||||
|
||||
if (Version > 7)
|
||||
{
|
||||
IGameOptions.ThrowUnknownVersion<HideNSeekGameOptions>(Version);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(MaxPlayers);
|
||||
writer.Write((uint)Keywords);
|
||||
writer.Write((byte)Map);
|
||||
writer.Write(PlayerSpeedMod);
|
||||
writer.Write(CrewLightMod);
|
||||
writer.Write(ImpostorLightMod);
|
||||
writer.Write((byte)NumCommonTasks);
|
||||
writer.Write((byte)NumLongTasks);
|
||||
writer.Write((byte)NumShortTasks);
|
||||
writer.Write(IsDefaults);
|
||||
|
||||
writer.Write(CrewmateVentUses);
|
||||
writer.Write(HidingTime);
|
||||
writer.Write(CrewmateFlashlightSize);
|
||||
writer.Write(ImpostorFlashlightSize);
|
||||
writer.Write(UseFlashlight);
|
||||
writer.Write(FinalHideSeekMap);
|
||||
writer.Write(FinalHideTime);
|
||||
writer.Write(FinalSeekerSpeed);
|
||||
writer.Write(FinalHidePings);
|
||||
writer.Write(ShowNames);
|
||||
writer.Write(SeekerPlayerId);
|
||||
writer.Write(MaxPingTime);
|
||||
writer.Write(CrewmateTimeInVent);
|
||||
|
||||
if (Version > 7)
|
||||
{
|
||||
IGameOptions.ThrowUnknownVersion<HideNSeekGameOptions>(Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public interface IGameOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
public byte Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently active gamemode.
|
||||
/// </summary>
|
||||
public GameModes GameMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum amount of players for this lobby.
|
||||
/// </summary>
|
||||
public byte MaxPlayers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language of the lobby as per <see cref="GameKeywords" /> enum.
|
||||
/// </summary>
|
||||
public GameKeywords Keywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Map selected for this lobby.
|
||||
/// </summary>
|
||||
public MapTypes Map { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of impostors for this lobby.
|
||||
/// </summary>
|
||||
public int NumImpostors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the GameOptions are the default ones.
|
||||
/// </summary>
|
||||
public bool IsDefaults { get; set; }
|
||||
|
||||
public void Serialize(IMessageWriter writer);
|
||||
|
||||
public static void EnsureVersionIsModular<TCaller>(byte version)
|
||||
{
|
||||
if (version < GameOptionsFactory.ModularOptionsDataVersion)
|
||||
{
|
||||
throw new ImpostorException($"{typeof(TCaller).Name} didn't exist before version 7, did you mean {nameof(LegacyGameOptionsData)}?");
|
||||
}
|
||||
}
|
||||
|
||||
[DoesNotReturn]
|
||||
public static void ThrowUnknownVersion<TCaller>(byte version)
|
||||
{
|
||||
throw new ImpostorException($"Unknown {typeof(TCaller).Name} version {version}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
using Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public class LegacyGameOptionsData : IGameOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// The latest major version of the game client.
|
||||
/// </summary>
|
||||
public const int LatestVersion = 5;
|
||||
|
||||
public LegacyGameOptionsData(byte version = LatestVersion)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets host's version of the game.
|
||||
/// </summary>
|
||||
public byte Version { get; set; }
|
||||
|
||||
public GameModes GameMode => GameModes.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public GameKeywords Keywords { get; set; } = GameKeywords.English;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public float CrewLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float KillCooldown { get; set; } = 15f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of common tasks.
|
||||
/// </summary>
|
||||
public int NumCommonTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// </summary>
|
||||
public int NumLongTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public int EmergencyCooldown { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public bool GhostsDoTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public int DiscussionTime { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </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.
|
||||
/// </remarks>
|
||||
public bool VisualTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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" />.
|
||||
/// </summary>
|
||||
public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets role options.
|
||||
/// </summary>
|
||||
public LegacyRoleOptionsData RoleOptions { get; set; } = new LegacyRoleOptionsData();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the GameOptions are the default ones.
|
||||
/// </summary>
|
||||
public bool IsDefaults { get; set; } = true;
|
||||
|
||||
public static LegacyGameOptionsData Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new LegacyGameOptionsData(version);
|
||||
options.Deserialize(reader);
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Deserialize(IMessageReader reader)
|
||||
{
|
||||
Version = reader.ReadByte();
|
||||
MaxPlayers = reader.ReadByte();
|
||||
Keywords = (GameKeywords)reader.ReadUInt32();
|
||||
Map = (MapTypes)reader.ReadByte();
|
||||
PlayerSpeedMod = reader.ReadSingle();
|
||||
|
||||
CrewLightMod = reader.ReadSingle();
|
||||
ImpostorLightMod = reader.ReadSingle();
|
||||
KillCooldown = reader.ReadSingle();
|
||||
|
||||
NumCommonTasks = reader.ReadByte();
|
||||
NumLongTasks = reader.ReadByte();
|
||||
NumShortTasks = reader.ReadByte();
|
||||
|
||||
NumEmergencyMeetings = reader.ReadInt32();
|
||||
|
||||
NumImpostors = reader.ReadByte();
|
||||
KillDistance = (KillDistances)reader.ReadByte();
|
||||
DiscussionTime = reader.ReadInt32();
|
||||
VotingTime = reader.ReadInt32();
|
||||
|
||||
IsDefaults = reader.ReadBoolean();
|
||||
|
||||
if (Version >= 2)
|
||||
{
|
||||
EmergencyCooldown = reader.ReadByte();
|
||||
}
|
||||
|
||||
if (Version >= 3)
|
||||
{
|
||||
ConfirmImpostor = reader.ReadBoolean();
|
||||
VisualTasks = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
if (Version >= 4)
|
||||
{
|
||||
AnonymousVotes = reader.ReadBoolean();
|
||||
TaskBarUpdate = (TaskBarUpdate)reader.ReadByte();
|
||||
}
|
||||
|
||||
if (Version >= 5)
|
||||
{
|
||||
RoleOptions = LegacyRoleOptionsData.Deserialize(reader);
|
||||
}
|
||||
|
||||
if (Version >= 6)
|
||||
{
|
||||
// Nothing was changed in V6
|
||||
}
|
||||
|
||||
if (Version > 6)
|
||||
{
|
||||
IGameOptions.ThrowUnknownVersion<LegacyGameOptionsData>(Version);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes this instance of GameOptionsData object to a specified BinaryWriter.
|
||||
/// </summary>
|
||||
/// <param name="writer">The stream to write the message to.</param>
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write((byte)Version);
|
||||
writer.Write((byte)MaxPlayers);
|
||||
writer.Write((uint)Keywords);
|
||||
writer.Write((byte)Map);
|
||||
writer.Write((float)PlayerSpeedMod);
|
||||
writer.Write((float)CrewLightMod);
|
||||
writer.Write((float)ImpostorLightMod);
|
||||
writer.Write((float)KillCooldown);
|
||||
writer.Write((byte)NumCommonTasks);
|
||||
writer.Write((byte)NumLongTasks);
|
||||
writer.Write((byte)NumShortTasks);
|
||||
writer.Write((int)NumEmergencyMeetings);
|
||||
writer.Write((byte)NumImpostors);
|
||||
writer.Write((byte)KillDistance);
|
||||
writer.Write((uint)DiscussionTime);
|
||||
writer.Write((uint)VotingTime);
|
||||
writer.Write((bool)IsDefaults);
|
||||
|
||||
if (Version >= 2)
|
||||
{
|
||||
writer.Write((byte)EmergencyCooldown);
|
||||
}
|
||||
|
||||
if (Version >= 3)
|
||||
{
|
||||
writer.Write((bool)ConfirmImpostor);
|
||||
writer.Write((bool)VisualTasks);
|
||||
}
|
||||
|
||||
if (Version >= 4)
|
||||
{
|
||||
writer.Write((bool)AnonymousVotes);
|
||||
writer.Write((byte)TaskBarUpdate);
|
||||
}
|
||||
|
||||
if (Version >= 5)
|
||||
{
|
||||
RoleOptions.Serialize(writer);
|
||||
}
|
||||
|
||||
if (Version >= 6)
|
||||
{
|
||||
// Nothing was changed in V6
|
||||
}
|
||||
|
||||
if (Version > 6)
|
||||
{
|
||||
throw new ImpostorException($"Unknown {nameof(LegacyGameOptionsData)} version {Version}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
using Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public class NormalGameOptions : IGameOptions
|
||||
{
|
||||
public const int LatestVersion = 7;
|
||||
|
||||
public NormalGameOptions(byte version = LatestVersion)
|
||||
{
|
||||
Version = version;
|
||||
IGameOptions.EnsureVersionIsModular<NormalGameOptions>(version);
|
||||
RoleOptions = new RoleOptionsCollection(version);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte Version { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public GameModes GameMode => GameModes.Normal;
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte MaxPlayers { get; set; } = 10;
|
||||
|
||||
/// <inheritdoc />
|
||||
public GameKeywords Keywords { get; set; } = GameKeywords.English;
|
||||
|
||||
/// <inheritdoc />
|
||||
public MapTypes Map { get; set; } = MapTypes.Skeld;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int NumImpostors { get; set; } = 1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsDefaults { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float CrewLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float KillCooldown { get; set; } = 15f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of common tasks.
|
||||
/// </summary>
|
||||
public int NumCommonTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// </summary>
|
||||
public int NumLongTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public int EmergencyCooldown { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 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" />.
|
||||
/// </summary>
|
||||
public KillDistances KillDistance { get; set; } = KillDistances.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public int VotingTime { get; set; } = 120;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </remarks>
|
||||
public bool VisualTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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" />.
|
||||
/// </summary>
|
||||
public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
|
||||
|
||||
public RoleOptionsCollection RoleOptions { get; set; }
|
||||
|
||||
public static NormalGameOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new NormalGameOptions(version);
|
||||
options.Deserialize(reader);
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Deserialize(IMessageReader reader)
|
||||
{
|
||||
MaxPlayers = reader.ReadByte();
|
||||
Keywords = (GameKeywords)reader.ReadUInt32();
|
||||
Map = (MapTypes)reader.ReadByte();
|
||||
PlayerSpeedMod = reader.ReadSingle();
|
||||
|
||||
CrewLightMod = reader.ReadSingle();
|
||||
ImpostorLightMod = reader.ReadSingle();
|
||||
KillCooldown = reader.ReadSingle();
|
||||
|
||||
NumCommonTasks = reader.ReadByte();
|
||||
NumLongTasks = reader.ReadByte();
|
||||
NumShortTasks = reader.ReadByte();
|
||||
|
||||
NumEmergencyMeetings = reader.ReadInt32();
|
||||
|
||||
NumImpostors = reader.ReadByte();
|
||||
KillDistance = (KillDistances)reader.ReadByte();
|
||||
DiscussionTime = reader.ReadInt32();
|
||||
VotingTime = reader.ReadInt32();
|
||||
|
||||
IsDefaults = reader.ReadBoolean();
|
||||
|
||||
EmergencyCooldown = reader.ReadByte();
|
||||
ConfirmImpostor = reader.ReadBoolean();
|
||||
VisualTasks = reader.ReadBoolean();
|
||||
AnonymousVotes = reader.ReadBoolean();
|
||||
TaskBarUpdate = (TaskBarUpdate)reader.ReadByte();
|
||||
|
||||
RoleOptions.Deserialize(reader);
|
||||
|
||||
if (Version > 7)
|
||||
{
|
||||
IGameOptions.ThrowUnknownVersion<NormalGameOptions>(Version);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(MaxPlayers);
|
||||
writer.Write((uint)Keywords);
|
||||
writer.Write((byte)Map);
|
||||
writer.Write(PlayerSpeedMod);
|
||||
|
||||
writer.Write(CrewLightMod);
|
||||
writer.Write(ImpostorLightMod);
|
||||
writer.Write(KillCooldown);
|
||||
|
||||
writer.Write((byte)NumCommonTasks);
|
||||
writer.Write((byte)NumLongTasks);
|
||||
writer.Write((byte)NumShortTasks);
|
||||
|
||||
writer.Write(NumEmergencyMeetings);
|
||||
|
||||
writer.Write((byte)NumImpostors);
|
||||
writer.Write((byte)KillDistance);
|
||||
writer.Write(DiscussionTime);
|
||||
writer.Write(VotingTime);
|
||||
|
||||
writer.Write(IsDefaults);
|
||||
|
||||
writer.Write((byte)EmergencyCooldown);
|
||||
writer.Write(ConfirmImpostor);
|
||||
writer.Write(VisualTasks);
|
||||
writer.Write(AnonymousVotes);
|
||||
writer.Write((byte)TaskBarUpdate);
|
||||
|
||||
RoleOptions.Serialize(writer);
|
||||
|
||||
if (Version > 7)
|
||||
{
|
||||
IGameOptions.ThrowUnknownVersion<NormalGameOptions>(Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class EngineerRoleOptions : IRoleOptions
|
||||
{
|
||||
public EngineerRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.Engineer;
|
||||
|
||||
public byte Cooldown { get; set; } = 30;
|
||||
|
||||
public byte InVentMaxTime { get; set; } = 15;
|
||||
|
||||
public static EngineerRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new EngineerRoleOptions(version);
|
||||
|
||||
options.Cooldown = reader.ReadByte();
|
||||
options.InVentMaxTime = reader.ReadByte();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(Cooldown);
|
||||
writer.Write(InVentMaxTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class GuardianAngelRoleOptions : IRoleOptions
|
||||
{
|
||||
public GuardianAngelRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.GuardianAngel;
|
||||
|
||||
public byte Cooldown { get; set; } = 60;
|
||||
|
||||
public byte ProtectionDurationSeconds { get; set; } = 10;
|
||||
|
||||
public bool ImpostorsCanSeeProtect { get; set; }
|
||||
|
||||
public static GuardianAngelRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new GuardianAngelRoleOptions(version);
|
||||
|
||||
options.Cooldown = reader.ReadByte();
|
||||
options.ProtectionDurationSeconds = reader.ReadByte();
|
||||
options.ImpostorsCanSeeProtect = reader.ReadBoolean();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(Cooldown);
|
||||
writer.Write(ProtectionDurationSeconds);
|
||||
writer.Write(ImpostorsCanSeeProtect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public interface IRoleOptions
|
||||
{
|
||||
RoleTypes Type { get; }
|
||||
|
||||
void Serialize(IMessageWriter writer);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class LegacyRoleOptionsData
|
||||
{
|
||||
public bool ShapeshifterLeaveSkin { get; set; }
|
||||
|
||||
public byte ShapeshifterCooldown { get; set; } = 10;
|
||||
|
||||
public byte ShapeshifterDuration { get; set; } = 30;
|
||||
|
||||
public byte ScientistCooldown { get; set; } = 15;
|
||||
|
||||
public byte ScientistBatteryCharge { get; set; } = 5;
|
||||
|
||||
public byte GuardianAngelCooldown { get; set; } = 60;
|
||||
|
||||
public bool ImpostorsCanSeeProtect { get; set; }
|
||||
|
||||
public byte ProtectionDurationSeconds { get; set; } = 10;
|
||||
|
||||
public byte EngineerCooldown { get; set; } = 30;
|
||||
|
||||
public byte EngineerInVentMaxTime { get; set; } = 15;
|
||||
|
||||
public Dictionary<RoleTypes, RoleRate> RoleRates { get; } = new Dictionary<RoleTypes, RoleRate>();
|
||||
|
||||
public static LegacyRoleOptionsData Deserialize(IMessageReader reader)
|
||||
{
|
||||
var roleOptionsData = new LegacyRoleOptionsData();
|
||||
var num = reader.ReadPackedInt32();
|
||||
for (var i = 0; i < num; i++)
|
||||
{
|
||||
var key = (RoleTypes)reader.ReadInt16();
|
||||
var roleRate = RoleRate.Deserialize(reader);
|
||||
roleOptionsData.RoleRates[key] = roleRate;
|
||||
}
|
||||
|
||||
roleOptionsData.ShapeshifterLeaveSkin = reader.ReadBoolean();
|
||||
roleOptionsData.ShapeshifterCooldown = reader.ReadByte();
|
||||
roleOptionsData.ShapeshifterDuration = reader.ReadByte();
|
||||
roleOptionsData.ScientistCooldown = reader.ReadByte();
|
||||
roleOptionsData.GuardianAngelCooldown = reader.ReadByte();
|
||||
roleOptionsData.EngineerCooldown = reader.ReadByte();
|
||||
roleOptionsData.EngineerInVentMaxTime = reader.ReadByte();
|
||||
roleOptionsData.ScientistBatteryCharge = reader.ReadByte();
|
||||
roleOptionsData.ProtectionDurationSeconds = reader.ReadByte();
|
||||
roleOptionsData.ImpostorsCanSeeProtect = reader.ReadBoolean();
|
||||
return roleOptionsData;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.WritePacked(RoleRates.Count);
|
||||
foreach (var roleRate in RoleRates)
|
||||
{
|
||||
writer.Write((ushort)roleRate.Key);
|
||||
roleRate.Value.Serialize(writer);
|
||||
}
|
||||
|
||||
writer.Write(ShapeshifterLeaveSkin);
|
||||
writer.Write(ShapeshifterCooldown);
|
||||
writer.Write(ShapeshifterDuration);
|
||||
writer.Write(ScientistCooldown);
|
||||
writer.Write(GuardianAngelCooldown);
|
||||
writer.Write(EngineerCooldown);
|
||||
writer.Write(EngineerInVentMaxTime);
|
||||
writer.Write(ScientistBatteryCharge);
|
||||
writer.Write(ProtectionDurationSeconds);
|
||||
writer.Write(ImpostorsCanSeeProtect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class RoleOptionsCollection
|
||||
{
|
||||
public RoleOptionsCollection(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public Dictionary<RoleTypes, RoleData> Roles { get; } = new Dictionary<RoleTypes, RoleData>();
|
||||
|
||||
public void Deserialize(IMessageReader reader)
|
||||
{
|
||||
Roles.Clear();
|
||||
|
||||
var count = reader.ReadPackedInt32();
|
||||
Roles.EnsureCapacity(count);
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var roleType = (RoleTypes)reader.ReadInt16();
|
||||
var roleRate = RoleRate.Deserialize(reader);
|
||||
var roleOptionsReader = reader.ReadMessage();
|
||||
IRoleOptions roleOptions = roleType switch
|
||||
{
|
||||
RoleTypes.Scientist => ScientistRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Engineer => EngineerRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.GuardianAngel => GuardianAngelRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Shapeshifter => ShapeshifterRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(roleType), roleType, null),
|
||||
};
|
||||
|
||||
Roles.Add(roleType, new RoleData(roleType, roleOptions, roleRate));
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.WritePacked(Roles.Count);
|
||||
foreach (var (key, roleData) in Roles)
|
||||
{
|
||||
writer.Write((ushort)key);
|
||||
roleData.Rate.Serialize(writer);
|
||||
writer.StartMessage(0);
|
||||
roleData.RoleOptions.Serialize(writer);
|
||||
writer.EndMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public readonly record struct RoleData(RoleTypes Type, IRoleOptions RoleOptions, RoleRate Rate);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public readonly record struct RoleRate(byte MaxCount, byte Chance)
|
||||
{
|
||||
public static RoleRate Deserialize(IMessageReader reader)
|
||||
{
|
||||
return new RoleRate(reader.ReadByte(), reader.ReadByte());
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(MaxCount);
|
||||
writer.Write(Chance);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class ScientistRoleOptions : IRoleOptions
|
||||
{
|
||||
public ScientistRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.Scientist;
|
||||
|
||||
public byte Cooldown { get; set; } = 15;
|
||||
|
||||
public byte BatteryCharge { get; set; } = 5;
|
||||
|
||||
public static ScientistRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new ScientistRoleOptions(version);
|
||||
|
||||
options.Cooldown = reader.ReadByte();
|
||||
options.BatteryCharge = reader.ReadByte();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(Cooldown);
|
||||
writer.Write(BatteryCharge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class ShapeshifterRoleOptions : IRoleOptions
|
||||
{
|
||||
public ShapeshifterRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.Shapeshifter;
|
||||
|
||||
public bool LeaveSkin { get; set; }
|
||||
|
||||
public byte Cooldown { get; set; } = 10;
|
||||
|
||||
public byte Duration { get; set; } = 30;
|
||||
|
||||
public static ShapeshifterRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new ShapeshifterRoleOptions(version);
|
||||
|
||||
options.LeaveSkin = reader.ReadBoolean();
|
||||
options.Cooldown = reader.ReadByte();
|
||||
options.Duration = reader.ReadByte();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write(LeaveSkin);
|
||||
writer.Write(Cooldown);
|
||||
writer.Write(Duration);
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class GameOptionsData
|
||||
{
|
||||
/// <summary>
|
||||
/// The latest major version of the game client.
|
||||
/// </summary>
|
||||
public const int LatestVersion = 4;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public byte MaxPlayers { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public MapTypes Map { get; set; } = MapTypes.Skeld;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float CrewLightMod { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public float KillCooldown { get; set; } = 15f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of common tasks.
|
||||
/// </summary>
|
||||
public int NumCommonTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of long tasks.
|
||||
/// </summary>
|
||||
public int NumLongTasks { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public int EmergencyCooldown { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public bool GhostsDoTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public int DiscussionTime { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </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.
|
||||
/// </remarks>
|
||||
public bool VisualTasks { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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" />.
|
||||
/// </summary>
|
||||
public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="reader">Message reader object containing the raw message.</param>
|
||||
/// <returns>GameOptionsData object.</returns>
|
||||
public static GameOptionsData DeserializeCreate(IMessageReader reader)
|
||||
{
|
||||
var options = new GameOptionsData();
|
||||
options.Deserialize(reader.ReadBytesAndSize());
|
||||
return options;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public void Serialize(BinaryWriter writer, byte version = LatestVersion)
|
||||
{
|
||||
writer.Write((byte)version);
|
||||
writer.Write((byte)MaxPlayers);
|
||||
writer.Write((uint)Keywords);
|
||||
writer.Write((byte)Map);
|
||||
writer.Write((float)PlayerSpeedMod);
|
||||
writer.Write((float)CrewLightMod);
|
||||
writer.Write((float)ImpostorLightMod);
|
||||
writer.Write((float)KillCooldown);
|
||||
writer.Write((byte)NumCommonTasks);
|
||||
writer.Write((byte)NumLongTasks);
|
||||
writer.Write((byte)NumShortTasks);
|
||||
writer.Write((int)NumEmergencyMeetings);
|
||||
writer.Write((byte)NumImpostors);
|
||||
writer.Write((byte)KillDistance);
|
||||
writer.Write((uint)DiscussionTime);
|
||||
writer.Write((uint)VotingTime);
|
||||
writer.Write((bool)IsDefaults);
|
||||
|
||||
if (version > 1)
|
||||
{
|
||||
writer.Write((byte)EmergencyCooldown);
|
||||
}
|
||||
|
||||
if (version > 2)
|
||||
{
|
||||
writer.Write((bool)ConfirmImpostor);
|
||||
writer.Write((bool)VisualTasks);
|
||||
}
|
||||
|
||||
if (version > 3)
|
||||
{
|
||||
writer.Write((bool)AnonymousVotes);
|
||||
writer.Write((byte)TaskBarUpdate);
|
||||
}
|
||||
|
||||
if (version > 4)
|
||||
{
|
||||
throw new ImpostorException($"Unknown GameOptionsData version {Version}.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
using var memory = new MemoryStream();
|
||||
using var writerBin = new BinaryWriter(memory);
|
||||
Serialize(writerBin);
|
||||
writer.WriteBytesAndSize(memory.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
var bytes = memory.Span;
|
||||
|
||||
Version = bytes.ReadByte();
|
||||
MaxPlayers = bytes.ReadByte();
|
||||
Keywords = (GameKeywords)bytes.ReadUInt32();
|
||||
Map = (MapTypes)bytes.ReadByte();
|
||||
PlayerSpeedMod = bytes.ReadSingle();
|
||||
|
||||
CrewLightMod = bytes.ReadSingle();
|
||||
ImpostorLightMod = bytes.ReadSingle();
|
||||
KillCooldown = bytes.ReadSingle();
|
||||
|
||||
NumCommonTasks = bytes.ReadByte();
|
||||
NumLongTasks = bytes.ReadByte();
|
||||
NumShortTasks = bytes.ReadByte();
|
||||
|
||||
NumEmergencyMeetings = bytes.ReadInt32();
|
||||
|
||||
NumImpostors = bytes.ReadByte();
|
||||
KillDistance = (KillDistances)bytes.ReadByte();
|
||||
DiscussionTime = bytes.ReadInt32();
|
||||
VotingTime = bytes.ReadInt32();
|
||||
|
||||
IsDefaults = bytes.ReadBoolean();
|
||||
|
||||
if (Version > 1)
|
||||
{
|
||||
EmergencyCooldown = bytes.ReadByte();
|
||||
}
|
||||
|
||||
if (Version > 2)
|
||||
{
|
||||
ConfirmImpostor = bytes.ReadBoolean();
|
||||
VisualTasks = bytes.ReadBoolean();
|
||||
}
|
||||
|
||||
if (Version > 3)
|
||||
{
|
||||
AnonymousVotes = bytes.ReadBoolean();
|
||||
TaskBarUpdate = (TaskBarUpdate)bytes.ReadByte();
|
||||
}
|
||||
|
||||
if (Version > 4)
|
||||
{
|
||||
throw new ImpostorException($"Unknown GameOptionsData version {Version}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,20 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class GameVersion
|
||||
public static class GameVersion
|
||||
{
|
||||
public static int GetVersion(int year, int month, int day, int rev = 0)
|
||||
public static int GetVersion(int year, int month, int day, int revision = 0)
|
||||
{
|
||||
return (year * 25000) + (month * 1800) + (day * 50) + rev;
|
||||
return (year * 25000) + (month * 1800) + (day * 50) + revision;
|
||||
}
|
||||
|
||||
public static void ParseVersion(int version, out int year, out int month, out int day, out int revision)
|
||||
{
|
||||
year = version / 25000;
|
||||
version %= 25000;
|
||||
month = version / 1800;
|
||||
version %= 1800;
|
||||
day = version / 50;
|
||||
revision = version % 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,17 @@ namespace Impostor.Api.Innersloth
|
||||
public enum Language
|
||||
{
|
||||
English,
|
||||
Spanish,
|
||||
SpanishLA,
|
||||
Brazilian,
|
||||
Portuguese,
|
||||
Korean,
|
||||
Russian,
|
||||
Dutch,
|
||||
Filipino,
|
||||
French,
|
||||
German,
|
||||
Italian,
|
||||
Japanese,
|
||||
SpanishEU,
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,8 @@ namespace Impostor.Api.Innersloth
|
||||
Skeld = 1,
|
||||
MiraHQ = 2,
|
||||
Polus = 4,
|
||||
Airship = 16,
|
||||
|
||||
// 8 is taken by Dleks
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
{
|
||||
new AirshipTask(AirshipTask.Ids.ElectricalFixWiring, TaskTypes.FixWiring, TaskCategories.CommonTask),
|
||||
new AirshipTask(AirshipTask.Ids.MeetingRoomEnterIDCode, TaskTypes.EnterIdCode, TaskCategories.CommonTask),
|
||||
new AirshipTask(AirshipTask.Ids.ElectricalCalibrateDistributor, TaskTypes.CalibrateDistributor, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.ElectricalResetBreakers, TaskTypes.ResetBreakers, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.VaultRoomDownloadData, TaskTypes.UploadData, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.BrigDownloadData, TaskTypes.UploadData, TaskCategories.LongTask),
|
||||
@@ -50,8 +51,9 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
new AirshipTask(AirshipTask.Ids.MainHallDevelopPhotos, TaskTypes.DevelopPhotos, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.CargoBayFuelEngines, TaskTypes.FuelEngines, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.SecurityRewindTapes, TaskTypes.RewindTapes, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.LoungeEmptyGarbage, TaskTypes.EmptyGarbage, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.ShowersEmptyGarbage, TaskTypes.EmptyGarbage, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.VaultRoomPolishRuby, TaskTypes.PolishRuby, TaskCategories.ShortTask),
|
||||
new AirshipTask(AirshipTask.Ids.ElectricalCalibrateDistributor, TaskTypes.CalibrateDistributor, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.CockpitStabilizeSteering, TaskTypes.StabilizeSteering, TaskCategories.ShortTask),
|
||||
new AirshipTask(AirshipTask.Ids.ArmoryDownloadData, TaskTypes.UploadData, TaskCategories.LongTask),
|
||||
new AirshipTask(AirshipTask.Ids.CockpitDownloadData, TaskTypes.UploadData, TaskCategories.LongTask),
|
||||
@@ -74,6 +76,7 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
new AirshipTask(AirshipTask.Ids.MainHallDecontaminate, TaskTypes.Decontaminate, TaskCategories.ShortTask),
|
||||
new AirshipTask(AirshipTask.Ids.KitchenMakeBurger, TaskTypes.MakeBurger, TaskCategories.ShortTask),
|
||||
new AirshipTask(AirshipTask.Ids.ShowersFixShower, TaskTypes.FixShower, TaskCategories.ShortTask),
|
||||
new AirshipTask(AirshipTask.Ids.CleanVent, TaskTypes.VentCleaning, TaskCategories.ShortTask),
|
||||
};
|
||||
|
||||
Tasks = tasks.ToDictionary(x => x.Id, x => x).AsReadOnly();
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
new MiraTask(MiraTask.Ids.OfficeProcessData, TaskTypes.ProcessData, TaskCategories.ShortTask),
|
||||
new MiraTask(MiraTask.Ids.LaunchpadRunDiagnostics, TaskTypes.RunDiagnostics, TaskCategories.LongTask),
|
||||
new MiraTask(MiraTask.Ids.ReactorUnlockManifolds, TaskTypes.UnlockManifolds, TaskCategories.ShortTask),
|
||||
new MiraTask(MiraTask.Ids.CleanVent, TaskTypes.VentCleaning, TaskCategories.ShortTask),
|
||||
};
|
||||
|
||||
Tasks = tasks.ToDictionary(x => x.Id, x => x).AsReadOnly();
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
new PolusVent(this, PolusVent.Ids.Laboratory, new Vector2(32.963f, -9.526f), right: PolusVent.Ids.Lava),
|
||||
new PolusVent(this, PolusVent.Ids.Lava, new Vector2(30.907f, -11.86f), left: PolusVent.Ids.Laboratory, right: PolusVent.Ids.Admin),
|
||||
new PolusVent(this, PolusVent.Ids.Storage, new Vector2(22f, -12.19f), left: PolusVent.Ids.Communications, right: PolusVent.Ids.Office),
|
||||
new PolusVent(this, PolusVent.Ids.RightStabilizer, new Vector2(24.02f, -8.39f), left: PolusVent.Ids.LeftStabilizer),
|
||||
new PolusVent(this, PolusVent.Ids.RightStabilizer, new Vector2(23.72f, -7.82f), left: PolusVent.Ids.LeftStabilizer),
|
||||
new PolusVent(this, PolusVent.Ids.LeftStabilizer, new Vector2(9.64f, -7.72f), left: PolusVent.Ids.RightStabilizer),
|
||||
new PolusVent(this, PolusVent.Ids.OutsideAdmin, new Vector2(18.93f, -24.85f), right: PolusVent.Ids.Admin),
|
||||
};
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace Impostor.Api.Innersloth.Maps
|
||||
new SkeldTask(SkeldTask.Ids.ElectricalDivertPowerToNavigation, TaskTypes.DivertPower, TaskCategories.ShortTask),
|
||||
new SkeldTask(SkeldTask.Ids.ElectricalDivertPowerToLowerEngine, TaskTypes.DivertPower, TaskCategories.ShortTask),
|
||||
new SkeldTask(SkeldTask.Ids.ElectricalDivertPowerToSecurity, TaskTypes.DivertPower, TaskCategories.ShortTask),
|
||||
new SkeldTask(SkeldTask.Ids.CleanVent, TaskTypes.VentCleaning, TaskCategories.ShortTask),
|
||||
};
|
||||
|
||||
Tasks = tasks.ToDictionary(x => x.Id, x => x).AsReadOnly();
|
||||
|
||||
@@ -15,44 +15,47 @@ namespace Impostor.Api.Innersloth.Maps.Tasks
|
||||
{
|
||||
ElectricalFixWiring = 0,
|
||||
MeetingRoomEnterIDCode = 1,
|
||||
ElectricalResetBreakers = 2,
|
||||
VaultRoomDownloadData = 3,
|
||||
BrigDownloadData = 4,
|
||||
CargoBayDownloadData = 5,
|
||||
GapRoomDownloadData = 6,
|
||||
RecordsDownloadData = 7,
|
||||
CargoBayUnlockSafe = 8,
|
||||
VentilationStartFans = 9,
|
||||
MainHallEmptyGarbage = 10,
|
||||
MedicalEmptyGarbage = 11,
|
||||
KitchenEmptyGarbage = 12,
|
||||
MainHallDevelopPhotos = 13,
|
||||
CargoBayFuelEngines = 14,
|
||||
SecurityRewindTapes = 15,
|
||||
VaultRoomPolishRuby = 16,
|
||||
ElectricalCalibrateDistributor = 17,
|
||||
CockpitStabilizeSteering = 18,
|
||||
ArmoryDownloadData = 19,
|
||||
CockpitDownloadData = 20,
|
||||
CommsDownloadData = 21,
|
||||
MedicalDownloadData = 22,
|
||||
ViewingDeckDownloadData = 23,
|
||||
ElectricalDivertPowerToArmory = 24,
|
||||
ElectricalDivertPowerToCockpit = 25,
|
||||
ElectricalDivertPowerToGapRoom = 26,
|
||||
ElectricalDivertPowerToMainHall = 27,
|
||||
ElectricalDivertPowerToMeetingRoom = 28,
|
||||
ElectricalDivertPowerToShowers = 29,
|
||||
ElectricalDivertPowerToEngine = 30,
|
||||
ShowersPickUpTowels = 31,
|
||||
LoungeCleanToilet = 32,
|
||||
VaultRoomDressMannequin = 33,
|
||||
RecordsSortRecords = 34,
|
||||
ArmoryPutAwayPistols = 35,
|
||||
ArmoryPutAwayRifles = 36,
|
||||
MainHallDecontaminate = 37,
|
||||
KitchenMakeBurger = 38,
|
||||
ShowersFixShower = 39,
|
||||
ElectricalCalibrateDistributor = 2,
|
||||
ElectricalResetBreakers = 3,
|
||||
VaultRoomDownloadData = 4,
|
||||
BrigDownloadData = 5,
|
||||
CargoBayDownloadData = 6,
|
||||
GapRoomDownloadData = 7,
|
||||
RecordsDownloadData = 8,
|
||||
CargoBayUnlockSafe = 9,
|
||||
VentilationStartFans = 10,
|
||||
MainHallEmptyGarbage = 11,
|
||||
MedicalEmptyGarbage = 12,
|
||||
KitchenEmptyGarbage = 13,
|
||||
MainHallDevelopPhotos = 14,
|
||||
CargoBayFuelEngines = 15,
|
||||
SecurityRewindTapes = 16,
|
||||
LoungeEmptyGarbage = 17,
|
||||
ShowersEmptyGarbage = 18,
|
||||
VaultRoomPolishRuby = 19,
|
||||
CockpitStabilizeSteering = 20,
|
||||
ArmoryDownloadData = 21,
|
||||
CockpitDownloadData = 22,
|
||||
CommsDownloadData = 23,
|
||||
MedicalDownloadData = 24,
|
||||
ViewingDeckDownloadData = 25,
|
||||
ElectricalDivertPowerToArmory = 26,
|
||||
ElectricalDivertPowerToCockpit = 27,
|
||||
ElectricalDivertPowerToGapRoom = 28,
|
||||
ElectricalDivertPowerToMainHall = 29,
|
||||
ElectricalDivertPowerToMeetingRoom = 30,
|
||||
ElectricalDivertPowerToShowers = 31,
|
||||
ElectricalDivertPowerToEngine = 32,
|
||||
ShowersPickUpTowels = 33,
|
||||
LoungeCleanToilet = 34,
|
||||
VaultRoomDressMannequin = 35,
|
||||
RecordsSortRecords = 36,
|
||||
ArmoryPutAwayPistols = 37,
|
||||
ArmoryPutAwayRifles = 38,
|
||||
MainHallDecontaminate = 39,
|
||||
KitchenMakeBurger = 40,
|
||||
ShowersFixShower = 41,
|
||||
CleanVent = 42,
|
||||
}
|
||||
|
||||
public Ids Id { get; }
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Impostor.Api.Innersloth.Maps.Tasks
|
||||
OfficeProcessData = 23,
|
||||
LaunchpadRunDiagnostics = 24,
|
||||
ReactorUnlockManifolds = 25,
|
||||
CleanVent = 26,
|
||||
}
|
||||
|
||||
public Ids Id { get; }
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Impostor.Api.Innersloth.Maps.Tasks
|
||||
ElectricalDivertPowerToNavigation = 26,
|
||||
ElectricalDivertPowerToLowerEngine = 27,
|
||||
ElectricalDivertPowerToSecurity = 28,
|
||||
CleanVent = 29,
|
||||
}
|
||||
|
||||
public Ids Id { get; }
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class PlatformSpecificData
|
||||
{
|
||||
public PlatformSpecificData(Platforms platform, string platformName, ulong? xboxPlatformId = null, ulong? psnPlatformId = null)
|
||||
{
|
||||
Platform = platform;
|
||||
PlatformName = platformName;
|
||||
XboxPlatformId = xboxPlatformId;
|
||||
PsnPlatformId = psnPlatformId;
|
||||
}
|
||||
|
||||
public PlatformSpecificData(IMessageReader reader)
|
||||
{
|
||||
Platform = (Platforms)reader.Tag;
|
||||
PlatformName = reader.ReadString();
|
||||
|
||||
XboxPlatformId = Platform == Platforms.Xbox ? reader.ReadUInt64() : null;
|
||||
PsnPlatformId = Platform == Platforms.Playstation ? reader.ReadUInt64() : null;
|
||||
}
|
||||
|
||||
public Platforms Platform { get; }
|
||||
|
||||
public string PlatformName { get; }
|
||||
|
||||
public ulong? XboxPlatformId { get; }
|
||||
|
||||
public ulong? PsnPlatformId { get; }
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.StartMessage((byte)Platform);
|
||||
writer.Write(PlatformName);
|
||||
switch (Platform)
|
||||
{
|
||||
case Platforms.Xbox:
|
||||
writer.Write(XboxPlatformId ?? throw new NullReferenceException($"{nameof(XboxPlatformId)} shouldn't be null when {nameof(Platform)} is Xbox"));
|
||||
break;
|
||||
case Platforms.Playstation:
|
||||
writer.Write(PsnPlatformId ?? throw new NullReferenceException($"{nameof(PsnPlatformId)} shouldn't be null when {nameof(Platform)} is Playstation"));
|
||||
break;
|
||||
}
|
||||
|
||||
writer.EndMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,7 @@ namespace Impostor.Api.Innersloth
|
||||
IPhone = 6,
|
||||
Android = 7,
|
||||
Switch = 8,
|
||||
Xbox = 9,
|
||||
Playstation = 10,
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class RegionInfo
|
||||
{
|
||||
public RegionInfo(string name, string ping, IReadOnlyList<ServerInfo> servers)
|
||||
{
|
||||
Name = name;
|
||||
Ping = ping;
|
||||
Servers = servers;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Ping { get; }
|
||||
|
||||
public IReadOnlyList<ServerInfo> Servers { get; }
|
||||
|
||||
public static RegionInfo Deserialize(BinaryReader reader)
|
||||
{
|
||||
var unknown = reader.ReadInt32();
|
||||
var name = reader.ReadString();
|
||||
var ping = reader.ReadString();
|
||||
var servers = new List<ServerInfo>();
|
||||
var serverCount = reader.ReadInt32();
|
||||
|
||||
for (var i = 0; i < serverCount; i++)
|
||||
{
|
||||
servers.Add(ServerInfo.Deserialize(reader));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum RoleTypes : ushort
|
||||
{
|
||||
Crewmate,
|
||||
Impostor,
|
||||
Scientist,
|
||||
Engineer,
|
||||
GuardianAngel,
|
||||
Shapeshifter,
|
||||
CrewmateGhost,
|
||||
ImpostorGhost,
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public class ServerInfo
|
||||
{
|
||||
public ServerInfo(string name, string ip, ushort port)
|
||||
{
|
||||
Name = name;
|
||||
Ip = ip;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Ip { get; }
|
||||
|
||||
public ushort Port { get; }
|
||||
|
||||
public static ServerInfo Deserialize(BinaryReader reader)
|
||||
{
|
||||
var name = reader.ReadString();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,7 @@
|
||||
|
||||
Sabotage = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Decontam on Mira and bottom decontam on Polus
|
||||
/// </summary>
|
||||
/// <remarks>The only decontamination on Mira and bottom decontamination on Polus.</remarks>
|
||||
Decontamination = 18,
|
||||
|
||||
Launchpad = 19,
|
||||
@@ -57,9 +55,7 @@
|
||||
|
||||
Dropship = 25,
|
||||
|
||||
/// <summary>
|
||||
/// Top decontam on Polus
|
||||
/// </summary>
|
||||
/// <remarks>Top decontamination on Polus.</remarks>
|
||||
Decontamination2 = 26,
|
||||
|
||||
Outside = 27,
|
||||
|
||||
@@ -62,5 +62,6 @@ namespace Impostor.Api.Innersloth
|
||||
GetBiggolSword = 57,
|
||||
PutAwayRifles = 58,
|
||||
StopCharles = 59,
|
||||
VentCleaning = 60,
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,19 @@
|
||||
{
|
||||
public static bool IsCharAllowed(char i)
|
||||
{
|
||||
return i == ' ' || (i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9') || (i >= 'À' && i <= 'ÿ') || (i >= 'Ѐ' && i <= 'џ') || (i >= 'ㄱ' && i <= 'ㆎ') || (i >= '가' && i <= '힣');
|
||||
return i == ' ' ||
|
||||
(i >= 'A' && i <= 'Z') ||
|
||||
(i >= 'a' && i <= 'z') ||
|
||||
(i >= '0' && i <= '9') ||
|
||||
|
||||
// U+00C0 to U+00FF (Latin-1 Supplement)
|
||||
(i >= 'À' && i <= 'ÿ') ||
|
||||
|
||||
// U+0400 to U+045F (Cyrillic)
|
||||
(i >= 'Ѐ' && i <= 'џ') ||
|
||||
|
||||
// U+2C61 to U+D7A3 (CJK)
|
||||
(i >= 'ⱡ' && i <= '힣');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Net.Custom
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net.Inner;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Net.Custom
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Net
|
||||
{
|
||||
@@ -27,6 +26,16 @@ namespace Impostor.Api.Net
|
||||
/// </remarks>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the language.
|
||||
/// </summary>
|
||||
Language Language { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the quick chat mode.
|
||||
/// </summary>
|
||||
QuickChatModes ChatMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the connection of the client.
|
||||
/// </summary>
|
||||
@@ -55,6 +64,16 @@ namespace Impostor.Api.Net
|
||||
/// </summary>
|
||||
IClientPlayer? Player { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the game the client is using.
|
||||
/// </summary>
|
||||
int GameVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets platform specific data of the <see cref="IClient" />.
|
||||
/// </summary>
|
||||
PlatformSpecificData PlatformSpecificData { get; }
|
||||
|
||||
ValueTask<bool> ReportCheatAsync(CheatContext context, string message);
|
||||
|
||||
ValueTask HandleMessageAsync(IMessageReader message, MessageType messageType);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Net
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
using Impostor.Api.Net.Inner.Objects.GameManager;
|
||||
using Impostor.Api.Net.Inner.Objects.ShipStatus;
|
||||
|
||||
namespace Impostor.Api.Net.Inner
|
||||
@@ -8,6 +9,8 @@ namespace Impostor.Api.Net.Inner
|
||||
/// </summary>
|
||||
public interface IGameNet
|
||||
{
|
||||
IInnerGameManager? GameManager { get; }
|
||||
|
||||
IInnerLobbyBehaviour? LobbyBehaviour { get; }
|
||||
|
||||
IInnerGameData? GameData { get; }
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Impostor.Api.Net.Inner.Objects.GameManager;
|
||||
|
||||
public interface IInnerGameManager
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Impostor.Api.Net.Inner.Objects.GameManager.Logic.HideAndSeek;
|
||||
|
||||
namespace Impostor.Api.Net.Inner.Objects.GameManager;
|
||||
|
||||
public interface IInnerHideAndSeekManager : IInnerGameManager
|
||||
{
|
||||
ILogicGameFlowHnS LogicFlowHnS { get; }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Impostor.Api.Net.Inner.Objects.GameManager;
|
||||
|
||||
public interface IInnerNormalGameManager : IInnerGameManager
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Impostor.Api.Net.Inner.Objects.GameManager.Logic.HideAndSeek;
|
||||
|
||||
public interface ILogicGameFlowHnS
|
||||
{
|
||||
float CurrentFinalHideTime { get; }
|
||||
|
||||
float CurrentHideTime { get; }
|
||||
}
|
||||
@@ -49,25 +49,25 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
/// Sets the hat of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="hatType">An hat for the player.</param>
|
||||
/// <param name="hatId">An hat for the player.</param>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
ValueTask SetHatAsync(HatType hatType);
|
||||
ValueTask SetHatAsync(string hatId);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the pet of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="petType">A pet for the player.</param>
|
||||
/// <param name="petId">A pet for the player.</param>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
ValueTask SetPetAsync(PetType petType);
|
||||
ValueTask SetPetAsync(string petId);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the skin of the current <see cref="IInnerPlayerControl" />.
|
||||
/// Visible to all players.
|
||||
/// </summary>
|
||||
/// <param name="skinType">A skin for the player.</param>
|
||||
/// <param name="skinId">A skin for the player.</param>
|
||||
/// <returns>Task that must be awaited.</returns>
|
||||
ValueTask SetSkinAsync(SkinType skinType);
|
||||
ValueTask SetSkinAsync(string skinId);
|
||||
|
||||
/// <summary>
|
||||
/// Send a chat message as the current <see cref="IInnerPlayerControl" />.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Innersloth.Customization;
|
||||
@@ -13,24 +13,9 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
string PlayerName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the player.
|
||||
/// Gets the role type of the player.
|
||||
/// </summary>
|
||||
ColorType Color { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hat of the player.
|
||||
/// </summary>
|
||||
HatType Hat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pet of the player.
|
||||
/// </summary>
|
||||
PetType Pet { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the skin of the player.
|
||||
/// </summary>
|
||||
SkinType Skin { get; }
|
||||
RoleTypes? RoleType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the player is an impostor.
|
||||
@@ -42,6 +27,12 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
/// </summary>
|
||||
bool IsDead { get; }
|
||||
|
||||
Dictionary<PlayerOutfitType, PlayerOutfit> Outfits { get; }
|
||||
|
||||
PlayerOutfitType CurrentOutfitType { get; set; }
|
||||
|
||||
PlayerOutfit CurrentOutfit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the reason why the player is dead in the current game.
|
||||
/// </summary>
|
||||
@@ -50,5 +41,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
IEnumerable<ITaskInfo> Tasks { get; }
|
||||
|
||||
DateTimeOffset LastMurder { get; }
|
||||
|
||||
uint PlayerLevel { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace Impostor.Api.Net.Inner.Objects
|
||||
{
|
||||
uint Id { get; }
|
||||
|
||||
ITask Task { get; }
|
||||
ITask? Task { get; }
|
||||
|
||||
bool Complete { get; }
|
||||
|
||||
|
||||
@@ -11,15 +11,12 @@
|
||||
SetName = 6,
|
||||
CheckColor = 7,
|
||||
SetColor = 8,
|
||||
SetHat = 9,
|
||||
SetSkin = 10,
|
||||
ReportDeadBody = 11,
|
||||
MurderPlayer = 12,
|
||||
SendChat = 13,
|
||||
StartMeeting = 14,
|
||||
SetScanner = 15,
|
||||
SendChatNote = 16,
|
||||
SetPet = 17,
|
||||
SetStartCounter = 18,
|
||||
EnterVent = 19,
|
||||
ExitVent = 20,
|
||||
@@ -34,5 +31,21 @@
|
||||
SetTasks = 29,
|
||||
ClimbLadder = 31,
|
||||
UsePlatform = 32,
|
||||
SendQuickChat = 33,
|
||||
BootFromVent = 34,
|
||||
UpdateSystem = 35,
|
||||
SetLevel = 38,
|
||||
SetHat = 39,
|
||||
SetSkin = 40,
|
||||
SetPet = 41,
|
||||
SetVisor = 42,
|
||||
SetNamePlate = 43,
|
||||
SetRole = 44,
|
||||
ProtectPlayer = 45,
|
||||
Shapeshift = 46,
|
||||
CheckMurder = 47,
|
||||
CheckProtect = 48,
|
||||
Pet = 49,
|
||||
CancelPet = 50,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Numerics;
|
||||
using Impostor.Api.Games;
|
||||
using Impostor.Api.Net.Inner;
|
||||
using Impostor.Api.Unity;
|
||||
|
||||
namespace Impostor.Api.Net;
|
||||
|
||||
public static class MessageReaderExtensions
|
||||
{
|
||||
public static T? ReadNetObject<T>(this IMessageReader reader, IGame game)
|
||||
where T : IInnerNetObject
|
||||
{
|
||||
return game.FindObjectByNetId<T>(reader.ReadPackedUInt32());
|
||||
}
|
||||
|
||||
public static Vector2 ReadVector2(this IMessageReader reader)
|
||||
{
|
||||
const float range = 50f;
|
||||
|
||||
var x = reader.ReadUInt16() / (float)ushort.MaxValue;
|
||||
var y = reader.ReadUInt16() / (float)ushort.MaxValue;
|
||||
|
||||
return new Vector2(Mathf.Lerp(-range, range, x), Mathf.Lerp(-range, range, y));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Numerics;
|
||||
using Impostor.Api.Games;
|
||||
using Impostor.Api.Net.Inner;
|
||||
using Impostor.Api.Unity;
|
||||
|
||||
namespace Impostor.Api.Net;
|
||||
|
||||
public static class MessageWriterExtensions
|
||||
{
|
||||
public static void Serialize(this GameCode gameCode, IMessageWriter writer)
|
||||
{
|
||||
writer.Write(gameCode.Value);
|
||||
}
|
||||
|
||||
public static void Write(this IMessageWriter writer, IInnerNetObject? innerNetObject)
|
||||
{
|
||||
if (innerNetObject == null)
|
||||
{
|
||||
writer.Write(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WritePacked(innerNetObject.NetId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(this IMessageWriter writer, Vector2 vector)
|
||||
{
|
||||
writer.Write((ushort)(Mathf.ReverseLerp(vector.X) * (double)ushort.MaxValue));
|
||||
writer.Write((ushort)(Mathf.ReverseLerp(vector.Y) * (double)ushort.MaxValue));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Impostor.Api.Net.Messages.Announcements
|
||||
{
|
||||
public static class Message00UseCache
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.StartMessage(AnnouncementsMessageFlags.UseCache);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace Impostor.Api.Net.Messages.Announcements
|
||||
{
|
||||
public static class Message01Update
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, int id, string message)
|
||||
{
|
||||
writer.StartMessage(AnnouncementsMessageFlags.SetUpdate);
|
||||
writer.WritePacked(id);
|
||||
writer.Write(message);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out int id, out string message)
|
||||
{
|
||||
id = reader.ReadPackedInt32();
|
||||
message = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.Announcements
|
||||
{
|
||||
public static class Message02SetFreeWeekend
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, FreeWeekendState state)
|
||||
{
|
||||
writer.StartMessage(AnnouncementsMessageFlags.SetFreeWeekend);
|
||||
writer.Write((byte)state);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out FreeWeekendState state)
|
||||
{
|
||||
state = (FreeWeekendState)reader.ReadByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.Announcements
|
||||
{
|
||||
public class MessageHello
|
||||
{
|
||||
public static void Deserialize(IMessageReader reader, out int announcementVersion, out int id, out Language language)
|
||||
{
|
||||
reader.ReadByte(); // SendOption header, probably added by accident
|
||||
announcementVersion = reader.ReadPackedInt32();
|
||||
id = reader.ReadPackedInt32();
|
||||
language = (Language)reader.ReadPackedInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Impostor.Api.Net.Messages
|
||||
{
|
||||
public class AnnouncementsMessageFlags
|
||||
{
|
||||
public const byte UseCache = 0;
|
||||
public const byte SetUpdate = 1;
|
||||
public const byte SetFreeWeekend = 2;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Impostor.Api.Net.Messages.Auth
|
||||
{
|
||||
public static class Message01Complete
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, uint nonce)
|
||||
{
|
||||
writer.WritePacked(nonce);
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out uint nonce)
|
||||
{
|
||||
nonce = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.Auth
|
||||
{
|
||||
public static class MessageHandshake
|
||||
{
|
||||
public static void Deserialize(IMessageReader reader, out int clientVersion, out Platforms platform, out string clientId)
|
||||
{
|
||||
clientVersion = reader.ReadInt32();
|
||||
platform = (Platforms)reader.ReadByte();
|
||||
clientId = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,56 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static class HandshakeC2S
|
||||
{
|
||||
public static void Deserialize(IMessageReader reader, out int clientVersion, out string name, out uint lastNonceReceived)
|
||||
public static void Deserialize(IMessageReader reader, out int clientVersion, out string name, out Language language, out QuickChatModes chatMode, out PlatformSpecificData? platformSpecificData)
|
||||
{
|
||||
clientVersion = reader.ReadInt32();
|
||||
name = reader.ReadString();
|
||||
lastNonceReceived = reader.ReadUInt32();
|
||||
|
||||
if (clientVersion >= Version.V1)
|
||||
{
|
||||
reader.ReadUInt32(); // lastNonceReceived, always 0 since 2021.11.9
|
||||
}
|
||||
|
||||
if (clientVersion >= Version.V2)
|
||||
{
|
||||
language = (Language)reader.ReadUInt32();
|
||||
chatMode = (QuickChatModes)reader.ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
language = Language.English;
|
||||
chatMode = QuickChatModes.FreeChatOrQuickChat;
|
||||
}
|
||||
|
||||
if (clientVersion >= Version.V3)
|
||||
{
|
||||
using var platformReader = reader.ReadMessage();
|
||||
platformSpecificData = new PlatformSpecificData(platformReader);
|
||||
reader.ReadInt32(); // crossplayFlags, not used yet
|
||||
}
|
||||
else
|
||||
{
|
||||
platformSpecificData = null;
|
||||
}
|
||||
|
||||
if (clientVersion >= Version.V4)
|
||||
{
|
||||
reader.ReadByte(); // purpose unknown, seems hardcoded to 0
|
||||
}
|
||||
}
|
||||
|
||||
private static class Version
|
||||
{
|
||||
public static readonly int V1 = GameVersion.GetVersion(2021, 4, 25);
|
||||
|
||||
public static readonly int V2 = GameVersion.GetVersion(2021, 6, 30);
|
||||
|
||||
public static readonly int V3 = GameVersion.GetVersion(2021, 11, 9);
|
||||
|
||||
public static readonly int V4 = GameVersion.GetVersion(2021, 12, 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,24 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
namespace Impostor.Api.Net.Messages.C2S
|
||||
{
|
||||
public static class Message00HostGameC2S
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, GameOptionsData gameOptionsData)
|
||||
public static void Serialize(IMessageWriter writer, IGameOptions gameOptions, CrossplayFlags crossplayFlags, GameFilterOptions gameFilterOptions)
|
||||
{
|
||||
writer.StartMessage(MessageFlags.HostGame);
|
||||
gameOptionsData.Serialize(writer);
|
||||
GameOptionsFactory.Serialize(writer, gameOptions);
|
||||
writer.Write((int)crossplayFlags);
|
||||
gameFilterOptions.Serialize(writer);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a packet.
|
||||
/// </summary>
|
||||
/// <param name="reader"><see cref="IMessageReader" /> with <see cref="IMessageReader.Tag" /> 0.</param>
|
||||
/// <param name="chatMode">The chat type selected in the client of the player.</param>
|
||||
/// <returns>Deserialized <see cref="GameOptionsData" />.</returns>
|
||||
public static GameOptionsData Deserialize(IMessageReader reader, out QuickChatModes chatMode)
|
||||
public static void Deserialize(IMessageReader reader, out IGameOptions gameOptions, out CrossplayFlags crossplayFlags, out GameFilterOptions gameFilterOptions)
|
||||
{
|
||||
var gameOptionsData = GameOptionsData.DeserializeCreate(reader);
|
||||
chatMode = (QuickChatModes)reader.ReadByte();
|
||||
|
||||
return gameOptionsData;
|
||||
gameOptions = GameOptionsFactory.Deserialize(reader);
|
||||
crossplayFlags = (CrossplayFlags)reader.ReadInt32();
|
||||
gameFilterOptions = GameFilterOptions.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 297 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user