mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-21 05:37:28 +00:00
Compare commits
370
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e857ed555 | ||
|
|
9d31752bf0 | ||
|
|
ced530b83a | ||
|
|
8f1cba8429 | ||
|
|
9009bac883 | ||
|
|
f3460f05bc | ||
|
|
a13fee108f | ||
|
|
adc0e6fe9b | ||
|
|
ce62815dc5 | ||
|
|
b1a0adaa28 | ||
|
|
fe697b1b63 | ||
|
|
55e6d38f9f | ||
|
|
b73a46ff56 | ||
|
|
901deeff59 | ||
|
|
f2126fd4c6 | ||
|
|
9aa6109b3a | ||
|
|
e1a6fdda98 | ||
|
|
283f59b51f | ||
|
|
d47343df08 | ||
|
|
0bb5442a3a | ||
|
|
7ac6c32b5d | ||
|
|
fbd9f12f9e | ||
|
|
f43577b745 | ||
|
|
a56eed2680 | ||
|
|
f0434f071c | ||
|
|
8d27016cb7 | ||
|
|
e941796a4c | ||
|
|
1d66f07906 | ||
|
|
7764987f91 | ||
|
|
bfba4385fd | ||
|
|
f03e72206e | ||
|
|
304b4bb7bf | ||
|
|
970f826dc8 | ||
|
|
0a30fe5a3e | ||
|
|
4866a350f8 | ||
|
|
13bddeb7bd | ||
|
|
225b56e71f | ||
|
|
60bf6b5f58 | ||
|
|
b5cee48242 | ||
|
|
c750c65481 | ||
|
|
d801a36af8 | ||
|
|
441d9c300c | ||
|
|
7fd68e31e6 | ||
|
|
47aebe7b7b | ||
|
|
66c2434320 | ||
|
|
c01062ed65 | ||
|
|
d5ae007d1c | ||
|
|
16a2b0aac6 | ||
|
|
4c1bd4a578 | ||
|
|
d311150967 | ||
|
|
92e3506f51 | ||
|
|
a63fc40099 | ||
|
|
4f53d3f4e6 | ||
|
|
a39fae3325 | ||
|
|
7c34836d50 | ||
|
|
989b06d04c | ||
|
|
11e87e51db | ||
|
|
b90e5b2c88 | ||
|
|
a0627bbc87 | ||
|
|
40a41f3573 | ||
|
|
8621f09761 | ||
|
|
3321e3049f | ||
|
|
a90bbebab9 | ||
|
|
f4dc0cd403 | ||
|
|
fbed06bf81 | ||
|
|
ef5320c820 | ||
|
|
bc85ef6810 | ||
|
|
e90ba734ab | ||
|
|
0f6bfb3597 | ||
|
|
dc759b1d57 | ||
|
|
be332e21d1 | ||
|
|
fe7a641bad | ||
|
|
e0041e89d8 | ||
|
|
f04bacf0de | ||
|
|
7e16b5595a | ||
|
|
a1c59363a1 | ||
|
|
ea1085406a | ||
|
|
e359f0a15d | ||
|
|
72f1e81c5f | ||
|
|
443168ef71 | ||
|
|
20d5284a7a | ||
|
|
9915f8b0cf | ||
|
|
0901be56f5 | ||
|
|
3090cea768 | ||
|
|
1059a4da16 | ||
|
|
acd2a56898 | ||
|
|
575ad25fb6 | ||
|
|
781ba34e1b | ||
|
|
9bd43b4629 | ||
|
|
e769b874c8 | ||
|
|
be19b1524b | ||
|
|
020a1b6447 | ||
|
|
bbbf368a6f | ||
|
|
d4bffd20ad | ||
|
|
87a062c1b3 | ||
|
|
f2d6531063 | ||
|
|
2ebd804d28 | ||
|
|
72c923f266 | ||
|
|
d9c9dcd533 | ||
|
|
7edd7dfecc | ||
|
|
35fab473ca | ||
|
|
e8f51f6b68 | ||
|
|
a136c67671 | ||
|
|
a653fe57fd | ||
|
|
d847b5c708 | ||
|
|
ccedd77162 | ||
|
|
703db71858 | ||
|
|
8f9ed83678 | ||
|
|
c74b6e83ba | ||
|
|
4461ab2066 | ||
|
|
4ebba13076 | ||
|
|
d590da0d27 | ||
|
|
ad0408d0de | ||
|
|
7bb4d88e76 | ||
|
|
7ec5bc1fdc | ||
|
|
024d49e739 | ||
|
|
dd2d749993 | ||
|
|
312fa43bac | ||
|
|
d6c5f1bdd4 | ||
|
|
266738705b | ||
|
|
15de342cc5 | ||
|
|
2d78e008ac | ||
|
|
cef3605c56 | ||
|
|
a6ca856859 | ||
|
|
8afb4aa3a6 | ||
|
|
62aa0ff832 | ||
|
|
2ea270d577 | ||
|
|
03b0dd4da5 | ||
|
|
bbc48e0df2 | ||
|
|
b4380bc07a | ||
|
|
502da518cb | ||
|
|
58efba6435 | ||
|
|
32bfabddd0 | ||
|
|
b7c9a03ca2 | ||
|
|
9da5b42c1f | ||
|
|
2b0459e209 | ||
|
|
d6c620ea7c | ||
|
|
b3fa60f798 | ||
|
|
57cce72df5 | ||
|
|
bde577db75 | ||
|
|
c1c6311c87 | ||
|
|
dc2304c92c | ||
|
|
b7bbcfdc2c | ||
|
|
0cd558b98c | ||
|
|
6a65b77c4b | ||
|
|
9f364cc082 | ||
|
|
fbe996b0c3 | ||
|
|
f73d7d37a2 | ||
|
|
587b0bf3b7 | ||
|
|
e694b6fac9 | ||
|
|
6bd7186074 | ||
|
|
130978577e | ||
|
|
2f9fd239dc | ||
|
|
4fb95fd85b | ||
|
|
272230e4ff | ||
|
|
ed05574954 | ||
|
|
c15b638bcd | ||
|
|
ca9cd5d818 | ||
|
|
ed2de507ad | ||
|
|
14fc2bc503 | ||
|
|
e8c18f2cab | ||
|
|
f33a184d10 | ||
|
|
cef7064d5f | ||
|
|
ea14a417b9 | ||
|
|
b783e6bcb3 | ||
|
|
e5ae03eb0d | ||
|
|
f1fecfd258 | ||
|
|
66ec384712 | ||
|
|
fccb542631 | ||
|
|
3faf1ebe13 | ||
|
|
c788118901 | ||
|
|
4d220a0cf7 | ||
|
|
32a829a975 | ||
|
|
65ea903c93 | ||
|
|
1fcd479bc1 | ||
|
|
454f486f29 | ||
|
|
e308b7e3e6 | ||
|
|
dcc4da25de | ||
|
|
8526ce43b2 | ||
|
|
b670800c54 | ||
|
|
d399207d57 | ||
|
|
9e55a9738b | ||
|
|
39bfc139f8 | ||
|
|
bc3a45d818 | ||
|
|
1a53f9e710 | ||
|
|
5229bb3681 | ||
|
|
dc6a8fcfc3 | ||
|
|
9d520bf9a3 | ||
|
|
19cfad8132 | ||
|
|
961bd90ef6 | ||
|
|
d1daf1623a | ||
|
|
c749a84910 | ||
|
|
e2ae918596 | ||
|
|
c6b5390844 | ||
|
|
b527c251bd | ||
|
|
89e2d2e172 | ||
|
|
5c0ce03c57 | ||
|
|
93394e7e77 | ||
|
|
a6b3cd10f4 | ||
|
|
80c68c1a94 | ||
|
|
4d87bfb11e | ||
|
|
4c3d822fb7 | ||
|
|
6c18531f62 | ||
|
|
bbf1aa851e | ||
|
|
57f8aa0772 | ||
|
|
61e33564d9 | ||
|
|
8577692364 | ||
|
|
45fcc03fbd | ||
|
|
37a3a56f9b | ||
|
|
9702de6478 | ||
|
|
a879061921 | ||
|
|
222ea1fe81 | ||
|
|
e188972770 | ||
|
|
55f513c071 | ||
|
|
49284a587c | ||
|
|
b8d1c6bac5 | ||
|
|
d504f1e87f | ||
|
|
9b32dc2629 | ||
|
|
27d4dad383 | ||
|
|
71596d4430 | ||
|
|
110af2b88f | ||
|
|
0887bad5d8 | ||
|
|
49269c33c9 | ||
|
|
57c1978212 | ||
|
|
7ecd7f4ec8 | ||
|
|
055366fed8 | ||
|
|
ec64b0148c | ||
|
|
6340177f30 | ||
|
|
94f19a38c5 | ||
|
|
58d00dc657 | ||
|
|
f5e454856a | ||
|
|
9b5249cbb3 | ||
|
|
a36396fb48 | ||
|
|
150dbdefaa | ||
|
|
173f6d088d | ||
|
|
2ff01c599a | ||
|
|
880826bc20 | ||
|
|
c33da59c5e | ||
|
|
198cd7911b | ||
|
|
e0481833d4 | ||
|
|
61eeb3b5c0 | ||
|
|
b55d09de71 | ||
|
|
96c2647193 | ||
|
|
6fc0fbb074 | ||
|
|
1cb7077772 | ||
|
|
ab0858a2c9 | ||
|
|
7d803e76f4 | ||
|
|
4dc12ceff5 | ||
|
|
553c8b9b1b | ||
|
|
8aaa4f8b3b | ||
|
|
67e302798f | ||
|
|
fcd54e0c63 | ||
|
|
ee707a502c | ||
|
|
923d9b7766 | ||
|
|
dcb903b272 | ||
|
|
7c946525fc | ||
|
|
a5cf97e85a | ||
|
|
1b776bfce9 | ||
|
|
35792a1641 | ||
|
|
9e1292ce1f | ||
|
|
fd41caff0b | ||
|
|
fe3bd658a1 | ||
|
|
dc7ba92fd5 | ||
|
|
be5a876113 | ||
|
|
93230823b4 | ||
|
|
579eacc521 | ||
|
|
e78329b9b1 | ||
|
|
574b7e23b4 | ||
|
|
9e76535a37 | ||
|
|
22703588e7 | ||
|
|
8100eff301 | ||
|
|
602fe821f2 | ||
|
|
b56a55ae1a | ||
|
|
3827b6a627 | ||
|
|
8ff4e7708b | ||
|
|
f2a31655a3 | ||
|
|
77e7581272 | ||
|
|
678ea36ccd | ||
|
|
7a210393ee | ||
|
|
647672c40e | ||
|
|
d6eb6bc54a | ||
|
|
3b873d8209 | ||
|
|
7e01a20fed | ||
|
|
f145746772 | ||
|
|
eb0434fd01 | ||
|
|
ef4d548bda | ||
|
|
f906b010db | ||
|
|
503cd221d5 | ||
|
|
e630863e72 | ||
|
|
61f50c6d41 | ||
|
|
f31d0b0772 | ||
|
|
4be31d8708 | ||
|
|
988cdfb480 | ||
|
|
dc63d7fa25 | ||
|
|
d44224a91c | ||
|
|
93b3b06e54 | ||
|
|
852badb48e | ||
|
|
1517a4a6be | ||
|
|
0acc2f3bc5 | ||
|
|
588af7fc3e | ||
|
|
00a9e2fde7 | ||
|
|
cbf905c4ba | ||
|
|
ee220d326c | ||
|
|
64f043767a | ||
|
|
6c075a4827 | ||
|
|
daae9b9e4e | ||
|
|
c3a2d6ecfd | ||
|
|
5f922f5f83 | ||
|
|
8392fe4237 | ||
|
|
33519a1ead | ||
|
|
078fb026ad | ||
|
|
7a033a1900 | ||
|
|
7946399e7b | ||
|
|
ab6cbb8ee9 | ||
|
|
299bb3915a | ||
|
|
cb0866dbe5 | ||
|
|
8e0c43d386 | ||
|
|
e624f69176 | ||
|
|
057fe87739 | ||
|
|
4f3365ee60 | ||
|
|
5f0ba88afa | ||
|
|
ec6ccfaf4e | ||
|
|
94b1d38b9c | ||
|
|
d65e40e863 | ||
|
|
7d083c7757 | ||
|
|
2cd63a95bc | ||
|
|
4e15d1e596 | ||
|
|
790e563d08 | ||
|
|
0c6d3e4f4a | ||
|
|
58eb0ebfa5 | ||
|
|
35313a1cd2 | ||
|
|
a6f895cc14 | ||
|
|
2dc24a5027 | ||
|
|
c5f3c63421 | ||
|
|
9d88b5b440 | ||
|
|
484e0176aa | ||
|
|
b11abc066d | ||
|
|
a33798d220 | ||
|
|
e6ad6aeb23 | ||
|
|
eca347cd5e | ||
|
|
a8a933769d | ||
|
|
f25d1308fe | ||
|
|
870384a84e | ||
|
|
7027ba0e7e | ||
|
|
4a91e532e8 | ||
|
|
a4da76e910 | ||
|
|
281341cad2 | ||
|
|
41cdc1de69 | ||
|
|
0427cf78e8 | ||
|
|
bf99198682 | ||
|
|
ef21cf0445 | ||
|
|
565c42cef8 | ||
|
|
bef7f6b587 | ||
|
|
cdf8ea870a | ||
|
|
9714318878 | ||
|
|
1f71144611 | ||
|
|
eb40fdfd66 | ||
|
|
d91c9d33b6 | ||
|
|
7de9b71b92 | ||
|
|
99b49cf741 | ||
|
|
67f74f7d1a | ||
|
|
4932584315 | ||
|
|
c856da1621 | ||
|
|
7db311fdff | ||
|
|
21e7aca353 | ||
|
|
47e2e3a06a | ||
|
|
3d74e0e93f | ||
|
|
1705ac3d87 | ||
|
|
dc0fbd7e07 | ||
|
|
e45ae2c42a |
No files matched your search
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "1.1.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
---
|
||||
name: Bug Reporting
|
||||
about: Bugs within Imposter
|
||||
name: 1. Bug reporting
|
||||
about: Bugs within Impostor
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Bug Report
|
||||
|
||||
## Base Information
|
||||
- Operating System
|
||||
- Imposter Version
|
||||
- Impostor Version
|
||||
- Among Us Version
|
||||
|
||||
## I confirm:
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
---
|
||||
name: Feature Request
|
||||
name: 2. Feature request
|
||||
about: To ask and request new features with Impostor
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Feature Request
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: 3. Api suggestion
|
||||
about: To make suggestions for the plugin api
|
||||
title: ''
|
||||
labels: api
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Api Suggestion
|
||||
|
||||
## Suggestion
|
||||
<!--
|
||||
Describe your suggestion as detailed as possible.
|
||||
-->
|
||||
|
||||
## Use case
|
||||
<!--
|
||||
Describe what you need it for.
|
||||
-->
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: 4. Api invalid data
|
||||
about: To let us know about invalid data in the api
|
||||
title: ''
|
||||
labels: api
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Api missing data
|
||||
|
||||
## Data
|
||||
<!--
|
||||
Describe about the missing data that you need.
|
||||
-->
|
||||
|
||||
## Expectations
|
||||
<!--
|
||||
Describe what the api gave you and what you expected.
|
||||
-->
|
||||
|
||||
## Reproduce
|
||||
<!--
|
||||
Describe how to reproduce the issue.
|
||||
-->
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: 5. Api unavailable data
|
||||
about: To let us know about unavailable data from the api that you would like to use
|
||||
title: ''
|
||||
labels: api
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Api missing data
|
||||
|
||||
## Data
|
||||
<!--
|
||||
Describe about the unavailable data that you need.
|
||||
-->
|
||||
|
||||
## Use-case
|
||||
<!--
|
||||
Describe what you need it for.
|
||||
-->
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: 6. Api other
|
||||
about: For anything about the api that does not fit in the other issues
|
||||
title: ''
|
||||
labels: api
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
### Description
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
If your pull request closes any issues, add them below with the `closes` keyword before them
|
||||
|
||||
Example: closes #101
|
||||
|
||||
See the following article for more information: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
|
||||
|
||||
-->
|
||||
|
||||
### Closes issues
|
||||
|
||||
- closes #
|
||||
@@ -1,156 +0,0 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.1
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.100-rc.1.20452.10
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ./src
|
||||
# - name: Build Impostor.Client
|
||||
# run: msbuild ./src/Impostor.Client/Impostor.Client.csproj /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None
|
||||
- name: Build Impostor.Server
|
||||
run: dotnet build --no-restore -c Release -f net5.0 ./src/Impostor.Server/Impostor.Server.csproj
|
||||
- name: Test
|
||||
run: dotnet test --no-restore -v normal -f net5.0 ./src
|
||||
# - name: Zip Impostor.Client
|
||||
# shell: bash
|
||||
# run: |
|
||||
# cd ./src/Impostor.Client/bin/Release/net452/win-x64
|
||||
# 7z a -r $GITHUB_WORKSPACE/build/win-x64-client.zip *
|
||||
# cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Publish Impostor.Server (win-x64)
|
||||
run: dotnet publish -c release -o ./build/win-x64 -f net5.0 -r win-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
|
||||
- name: Zip Impostor.Server (win-x64)
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./build/win-x64
|
||||
7z a -r ../win-x64.zip *
|
||||
cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Publish Impostor.Server (linux-x64)
|
||||
run: dotnet publish -c release -o ./build/linux-x64 -f net5.0 -r linux-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
|
||||
- name: Zip Impostor.Server (linux-x64)
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./build/linux-x64
|
||||
7z a -r ../linux-x64.zip *
|
||||
cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Publish Impostor.Server (linux-arm)
|
||||
run: dotnet publish -c release -o ./build/linux-arm -f net5.0 -r linux-arm --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
|
||||
- name: Zip Impostor.Server (linux-arm)
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./build/linux-arm
|
||||
7z a -r ../linux-arm.zip *
|
||||
cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Publish Impostor.Server (linux-arm64)
|
||||
run: dotnet publish -c release -o ./build/linux-arm64 -f net5.0 -r linux-arm64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
|
||||
- name: Zip Impostor.Server (linux-arm64)
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./build/linux-arm64
|
||||
7z a -r ../linux-arm64.zip *
|
||||
cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Publish Impostor.Server (osx-x64)
|
||||
run: dotnet publish -c release -o ./build/osx-x64 -f net5.0 -r osx-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
|
||||
- name: Zip Impostor.Server (osx-x64)
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./build/osx-x64
|
||||
7z a -r ../osx-x64.zip *
|
||||
cd $GITHUB_WORKSPACE
|
||||
-
|
||||
name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
body: |
|
||||
Changes in this Release
|
||||
- First Change
|
||||
- Second Change
|
||||
draft: true
|
||||
prerelease: false
|
||||
# -
|
||||
# name: Upload Release Asset (win-x64) Client
|
||||
# uses: actions/upload-release-asset@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# with:
|
||||
# upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
# asset_path: ./build/win-x64-client.zip
|
||||
# asset_name: Impostor-Client-win-x64.zip
|
||||
# asset_content_type: application/zip
|
||||
-
|
||||
name: Upload Release Asset (win-x64) Server
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build/win-x64.zip
|
||||
asset_name: Impostor-Server-win-x64.zip
|
||||
asset_content_type: application/zip
|
||||
-
|
||||
name: Upload Release Asset (linux-x64) Server
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build/linux-x64.zip
|
||||
asset_name: Impostor-Server-linux-x64.zip
|
||||
asset_content_type: application/zip
|
||||
-
|
||||
name: Upload Release Asset (linux-arm) Server
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build/linux-arm.zip
|
||||
asset_name: Impostor-Server-linux-arm.zip
|
||||
asset_content_type: application/zip
|
||||
-
|
||||
name: Upload Release Asset (linux-arm64) Server
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build/linux-arm64.zip
|
||||
asset_name: Impostor-Server-linux-arm64.zip
|
||||
asset_content_type: application/zip
|
||||
-
|
||||
name: Upload Release Asset (osx-x64) Server
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build/osx-x64.zip
|
||||
asset_name: Impostor-Server-osx-x64.zip
|
||||
asset_content_type: application/zip
|
||||
@@ -2,7 +2,7 @@ name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: dev
|
||||
branches: master
|
||||
paths:
|
||||
- 'src/Impostor.Server/**'
|
||||
- 'src/Impostor.Shared/**'
|
||||
@@ -33,24 +33,24 @@ jobs:
|
||||
run: |
|
||||
DOCKER_IMAGE=aeonlucid/impostor
|
||||
VERSION=noop
|
||||
VERSIONSUFFIX=docker
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
VERSIONSUFFIX=none
|
||||
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
|
||||
if [ "${{ github.event.repository.default_branch }}" = "dev" ]; then
|
||||
VERSION=nightly
|
||||
fi
|
||||
VERSION=nightly
|
||||
VERSIONSUFFIX=docker.${{ github.run_number }}
|
||||
elif [[ $GITHUB_REF == refs/pull/* ]]; then
|
||||
VERSION=pr-${{ github.event.number }}
|
||||
VERSIONSUFFIX=pr.${{ github.event.number }}
|
||||
fi
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
MINOR=${VERSION%.*}
|
||||
MAJOR=${MINOR%.*}
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
||||
fi
|
||||
echo ::set-output name=version::${VERSION}
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=versionsuffix::${VERSIONSUFFIX}
|
||||
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@@ -70,3 +70,5 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
build-args: |
|
||||
VERSIONSUFFIX=${{ steps.prep.outputs.versionsuffix }}
|
||||
@@ -1,53 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- '.gitmodules'
|
||||
- '.github/workflows/main.yml'
|
||||
pull_request:
|
||||
branches: [ master, dev ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- '.gitmodules'
|
||||
- '.github/workflows/main.yml'
|
||||
|
||||
jobs:
|
||||
build-client:
|
||||
name: Build Client
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.1
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.402
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ./src
|
||||
- name: Build Impostor.Client
|
||||
run: msbuild ./src/Impostor.Client/Impostor.Client.csproj /p:Configuration=Release
|
||||
build-server:
|
||||
name: Build Server
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.100-rc.1.20452.10
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ./src
|
||||
- name: Build Impostor.Server
|
||||
run: dotnet build --no-restore -c Release -f net5.0 ./src/Impostor.Server/Impostor.Server.csproj /p:PublishTrimmed=false
|
||||
- name: Test
|
||||
run: dotnet test --no-restore -v normal -f net5.0 ./src
|
||||
+7
-1
@@ -1 +1,7 @@
|
||||
/.vscode
|
||||
/.vscode
|
||||
/build
|
||||
/.vs
|
||||
/src/Impostor.Plugins.Debugger/Properties/launchSettings.json
|
||||
/tools
|
||||
|
||||
.local/
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
[submodule "submodules/Hazel-Networking"]
|
||||
path = submodules/Hazel-Networking
|
||||
url = https://github.com/AeonLucid/Hazel-Networking.git
|
||||
[submodule "src/Impostor.Hazel"]
|
||||
path = src/Impostor.Hazel
|
||||
url = https://github.com/Impostor/Impostor.Hazel
|
||||
@@ -0,0 +1,22 @@
|
||||
# Contribute guidelines
|
||||
|
||||
We are always looking for people to help improve Impostor.
|
||||
|
||||
## Code
|
||||
|
||||
- If you are implementing or fixing an issue, please comment on the issue so work is not duplicated.
|
||||
- If you want to implementing a new feature, create an issue first describing the issue so we know about it. We are always open for discussion or questions on [Discord](https://discord.gg/Mk3w6Tb).
|
||||
- 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.
|
||||
|
||||
## 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.
|
||||
- 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.
|
||||
+9
-7
@@ -4,12 +4,14 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||
# https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17
|
||||
ARG TARGETARCH
|
||||
|
||||
ARG VERSIONSUFFIX="docker"
|
||||
|
||||
WORKDIR /source
|
||||
|
||||
# Copy csproj and restore.
|
||||
COPY src/Impostor.Server/Impostor.Server.csproj ./src/Impostor.Server/Impostor.Server.csproj
|
||||
COPY src/Impostor.Shared/Impostor.Shared.csproj ./src/Impostor.Shared/Impostor.Shared.csproj
|
||||
COPY submodules/Hazel-Networking/Hazel/Hazel.csproj ./submodules/Hazel-Networking/Hazel/Hazel.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
|
||||
|
||||
RUN case "$TARGETARCH" in \
|
||||
amd64) NETCORE_PLATFORM='linux-x64';; \
|
||||
@@ -18,11 +20,10 @@ 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.Shared/Impostor.Shared.csproj && \
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./submodules/Hazel-Networking/Hazel/Hazel.csproj
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj && \
|
||||
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Hazel/Hazel/Hazel.csproj
|
||||
|
||||
# Copy everything else.
|
||||
COPY submodules/. ./submodules/
|
||||
COPY src/. ./src/
|
||||
RUN case "$TARGETARCH" in \
|
||||
amd64) NETCORE_PLATFORM='linux-x64';; \
|
||||
@@ -30,10 +31,11 @@ RUN case "$TARGETARCH" in \
|
||||
arm) NETCORE_PLATFORM='linux-arm';; \
|
||||
*) echo "unsupported architecture"; exit 1 ;; \
|
||||
esac && \
|
||||
dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" --no-restore ./src/Impostor.Server/Impostor.Server.csproj
|
||||
[[ $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-deps:5.0
|
||||
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:5.0
|
||||
WORKDIR /app
|
||||
COPY --from=build /app ./
|
||||
EXPOSE 22023/udp
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
# Impostor
|
||||
|
||||
Impostor is one of the first **Among Us** private servers, written in C#.
|
||||
[](https://discord.gg/Mk3w6Tb)
|
||||
[](https://ci.appveyor.com/project/Impostor/Impostor/branch/master)
|
||||
|
||||
The latest version supported is `2020.9.22`, both desktop and mobile.
|
||||
Impostor is one of the first **Among Us** private servers, written in C#.
|
||||
|
||||
There are no special features at this moment, the goal is aiming to be as close as possible to the real server, for now. In a later stage, making modifications to game logic by modifying `GameData` packets can be looked at.
|
||||
|
||||
[Discord server for Impostor](https://discord.gg/Mk3w6Tb)
|
||||
| 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) |
|
||||
|
||||
## Features
|
||||
|
||||
All Among Us features are implemented. It is a full replacement for the official server.
|
||||
|
||||
- [x] Create game
|
||||
- [x] Join game
|
||||
- [x] Start game
|
||||
- [x] Game listing
|
||||
- [x] V1 GameCodes (AAAA)
|
||||
- [x] V2 GameCodes (AAAAAA)
|
||||
- [x] Kick player
|
||||
- [x] Ban player
|
||||
- [x] Server redirection
|
||||
- [ ] Multiple master servers
|
||||
- All Among Us features are implemented. It is a full replacement for the official server.
|
||||
- Plugin support.
|
||||
- Server-sided anticheat.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -29,21 +24,44 @@ All Among Us features are implemented. It is a full replacement for the official
|
||||
|
||||
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-Client-win-x64.zip`.
|
||||
2. Download `Impostor-Patcher-win-x64.zip`.
|
||||
3. Extract the zip.
|
||||
4. Run `Impostor.Client.exe`.
|
||||
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.
|
||||
|
||||
### Server
|
||||
|
||||
See the [wiki](https://github.com/AeonLucid/Impostor/wiki/Running-the-server) for instructions on how to set it up.
|
||||
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.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you want to contribute to Impostor, make sure you work on and target the `dev` branch. That is where the latest changes will be.
|
||||
See [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
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
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
#addin "nuget:?package=SharpZipLib&Version=1.3.1"
|
||||
#addin "nuget:?package=Cake.Compression&Version=0.2.6"
|
||||
#addin "nuget:?package=Cake.FileHelpers&Version=4.0.1"
|
||||
|
||||
var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER") ?? EnvironmentVariable("APPVEYOR_BUILD_VERSION");
|
||||
var buildRelease = EnvironmentVariable("APPVEYOR_REPO_TAG") == "true";
|
||||
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 configuration = Argument("configuration", "Release");
|
||||
|
||||
var msbuildSettings = new DotNetCoreMSBuildSettings();
|
||||
|
||||
if (buildRelease)
|
||||
{
|
||||
msbuildSettings.Properties["Version"] = new[] { buildVersion };
|
||||
}
|
||||
else if (buildId != null)
|
||||
{
|
||||
msbuildSettings.Properties["VersionSuffix"] = new[] { "ci." + buildId };
|
||||
buildVersion += "-ci." + buildId;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// UTILS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Remove unnecessary files for packaging.
|
||||
private void ImpostorPublish(string name, string project, string runtime, bool isServer = false) {
|
||||
var projBuildDir = buildDir.Combine(name + "_" + runtime);
|
||||
var projBuildName = name + "_" + buildVersion + "_" + runtime;
|
||||
|
||||
DotNetCorePublish(project, new DotNetCorePublishSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net5.0",
|
||||
Runtime = runtime,
|
||||
SelfContained = false,
|
||||
PublishSingleFile = true,
|
||||
PublishTrimmed = false,
|
||||
OutputDirectory = projBuildDir,
|
||||
MSBuildSettings = msbuildSettings
|
||||
});
|
||||
|
||||
if (isServer) {
|
||||
CreateDirectory(projBuildDir.Combine("plugins"));
|
||||
CreateDirectory(projBuildDir.Combine("libraries"));
|
||||
|
||||
if (runtime == "win-x64") {
|
||||
FileWriteText(projBuildDir.CombineWithFilePath("run.bat"), "@echo off\r\nImpostor.Server.exe\r\npause");
|
||||
}
|
||||
}
|
||||
|
||||
if (runtime == "win-x64") {
|
||||
Zip(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".zip"));
|
||||
} else {
|
||||
GZipCompress(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".tar.gz"));
|
||||
}
|
||||
}
|
||||
|
||||
private void ImpostorPublishNF(string name, string project) {
|
||||
var runtime = "win-x64";
|
||||
var projBuildDir = buildDir.Combine(name + "_" + runtime);
|
||||
var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
|
||||
|
||||
DotNetCorePublish(project, new DotNetCorePublishSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net472",
|
||||
OutputDirectory = projBuildDir,
|
||||
MSBuildSettings = msbuildSettings
|
||||
});
|
||||
|
||||
Zip(projBuildDir, projBuildZip);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TASKS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Clean")
|
||||
.Does(() => {
|
||||
if (DirectoryExists(buildDir)) {
|
||||
DeleteDirectory(buildDir, new DeleteDirectorySettings {
|
||||
Recursive = true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Task("Restore")
|
||||
.Does(() => {
|
||||
DotNetCoreRestore("./src/Impostor.sln");
|
||||
});
|
||||
|
||||
Task("Replay")
|
||||
.Does(() => {
|
||||
// D:\Projects\GitHub\Impostor\Impostor\src\Impostor.Tools.ServerReplay\sessions
|
||||
DotNetCoreRun(
|
||||
"./src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj",
|
||||
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetCoreRunSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
Framework = "net5.0"
|
||||
});
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("Restore")
|
||||
.IsDependentOn("Replay")
|
||||
.Does(() => {
|
||||
// Tests.
|
||||
DotNetCoreBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreBuildSettings {
|
||||
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);
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "osx-x64", true);
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-x64", true);
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm", true);
|
||||
ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64", true);
|
||||
|
||||
// API.
|
||||
DotNetCorePack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetCorePackSettings {
|
||||
Configuration = configuration,
|
||||
OutputDirectory = buildDir,
|
||||
IncludeSource = true,
|
||||
IncludeSymbols = true,
|
||||
MSBuildSettings = msbuildSettings
|
||||
});
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.IsDependentOn("Build")
|
||||
.Does(() => {
|
||||
DotNetCoreTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreTestSettings {
|
||||
Configuration = configuration,
|
||||
NoBuild = true
|
||||
});
|
||||
});
|
||||
|
||||
Task("Deploy")
|
||||
.IsDependentOn("Test")
|
||||
.Does(() => {
|
||||
Information("Finished.");
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EXECUTION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
RunTarget(target);
|
||||
@@ -0,0 +1,36 @@
|
||||
# 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).
|
||||
|
||||
## Cloning Impostor
|
||||
|
||||
You need to clone Impostor using git.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/AeonLucid/Impostor.git
|
||||
```
|
||||
|
||||
## Building the server
|
||||
|
||||
### Dependencies
|
||||
- [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.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
|
||||
|
||||
```bash
|
||||
cd src/Impostor.Server/
|
||||
dotnet build
|
||||
```
|
||||
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
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# 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.
|
||||
|
||||
## 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.
|
||||
|
||||
## 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!
|
||||
@@ -0,0 +1,7 @@
|
||||
# Impostor Documentation
|
||||
|
||||
1. [Running the server](Running-the-server.md)
|
||||
2. [Server configuration](Server-configuration.md)
|
||||
3. [Building from source](Building-from-source.md)
|
||||
4. [Writing a plugin](Writing-a-plugin.md)
|
||||
5. [Frequently answered questions](FAQ.md)
|
||||
@@ -0,0 +1,101 @@
|
||||
# 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.
|
||||
|
||||
## Single server
|
||||
|
||||
### 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)
|
||||
|
||||
### Using docker
|
||||
|
||||
[](https://hub.docker.com/repository/docker/aeonlucid/impostor)
|
||||
[](https://hub.docker.com/repository/docker/aeonlucid/impostor)
|
||||
|
||||
```
|
||||
docker run -p 22023:22023/udp aeonlucid/impostor:nightly
|
||||
```
|
||||
|
||||
### Using docker-compose
|
||||
```
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
impostor:
|
||||
image: aeonlucid/impostor:nightly
|
||||
container_name: impostor
|
||||
ports:
|
||||
- 22023:22023/udp
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,80 @@
|
||||
# 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.
|
||||
|
||||
## 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`. |
|
||||
|
||||
### 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!)** |
|
||||
|
||||
### 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. |
|
||||
|
||||
## Config providers
|
||||
|
||||
### File
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
IMPOSTOR_Server__PublicIp=127.0.0.1
|
||||
IMPOSTOR_Server__PublicPort=22023
|
||||
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
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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.
|
||||
|
||||
## `./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).
|
||||
|
||||
## `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`**
|
||||
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.
|
||||
This error can be caused by non-plugin files or plugins that are not working correctly.
|
||||
@@ -0,0 +1,343 @@
|
||||
# Writing a plugin
|
||||
|
||||
Impostor has support for plugins. This document will help you to setup a development environment for writing a plugin.
|
||||
|
||||
- [1. Install .NET Core SDK](#1-install-net-core-sdk)
|
||||
- [2. Create a C# project](#2-create-a-c-project)
|
||||
- [3. Add the Impostor.Api library](#3-add-the-impostorapi-library)
|
||||
- [Quick](#quick)
|
||||
- [Visual Studio](#visual-studio)
|
||||
- [4. The plugin class](#4-the-plugin-class)
|
||||
- [5. Adding an event listener](#5-adding-an-event-listener)
|
||||
- [6. Registering the event listener](#6-registering-the-event-listener)
|
||||
- [7. Build and run your plugin](#7-build-and-run-your-plugin)
|
||||
- [8. Extra](#8-extra)
|
||||
- [Event listeners](#event-listeners)
|
||||
- [Dependency injection](#dependency-injection)
|
||||
- [Server configuration](#server-configuration)
|
||||
- [Using other libraries](#using-other-libraries)
|
||||
- [Impostor versions](#impostor-versions)
|
||||
- [9. Missing/invalid data or want more functions?](#9-missinginvalid-data-or-want-more-functions)
|
||||
|
||||
## 1. Install .NET Core SDK
|
||||
|
||||
Download and install the latest .NET Core 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:
|
||||
|
||||
- .NET Standard 2.0
|
||||
- .NET Standard 2.1
|
||||
- .NET Core 3.1
|
||||
- .NET 5
|
||||
|
||||
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.
|
||||
|
||||
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>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
```
|
||||
|
||||
## 3. Add the Impostor.Api library
|
||||
|
||||
You only have to follow the instructions of one below.
|
||||
|
||||
### Quick
|
||||
|
||||
Install the `Impostor.Api` NuGet package.
|
||||
Make sure to get a prerelease if you are writing a plugin for a dev release of the server.
|
||||
|
||||
### Visual Studio
|
||||
|
||||
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.
|
||||
|
||||
### 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"`.
|
||||
|
||||
## 4. The plugin class
|
||||
|
||||
Now the `Impostor.Api` is installed, you need to create a class for your plugin. A plugin **must** contain exactly one. See the code below for an example.
|
||||
|
||||
```csharp
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Events.Managers;
|
||||
using Impostor.Api.Plugins;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Impostor.Plugins.Example
|
||||
{
|
||||
/// <summary>
|
||||
/// The metadata information of your plugin, this is required.
|
||||
/// </summary>
|
||||
[ImpostorPlugin(
|
||||
package: "gg.impostor.example",
|
||||
name: "Example",
|
||||
author: "AeonLucid",
|
||||
version: "1.0.0")]
|
||||
public class ExamplePlugin : PluginBase // This is also required ": PluginBase".
|
||||
{
|
||||
/// <summary>
|
||||
/// A logger that works seamlessly with the server.
|
||||
/// </summary>
|
||||
private readonly ILogger<ExamplePlugin> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The constructor of the plugin. There are a few parameters you can add here and they
|
||||
/// will be injected automatically by the server, two examples are used here.
|
||||
///
|
||||
/// They are not necessary but very recommended.
|
||||
/// </summary>
|
||||
/// <param name="logger">
|
||||
/// A logger to write messages in the console.
|
||||
/// </param>
|
||||
/// <param name="eventManager">
|
||||
/// An event manager to register event listeners.
|
||||
/// Useful if you want your plugin to interact with the game.
|
||||
/// </param>
|
||||
public ExamplePlugin(ILogger<ExamplePlugin> logger, IEventManager eventManager)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called when your plugin is enabled by the server.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override ValueTask EnableAsync()
|
||||
{
|
||||
_logger.LogInformation("Example is being enabled.");
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called when your plugin is disabled by the server.
|
||||
/// Most likely because it is shutting down, this is the place to clean up any managed resources.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override ValueTask DisableAsync()
|
||||
{
|
||||
_logger.LogInformation("Example is being disabled.");
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 5. Adding an event listener
|
||||
|
||||
Currently you should have a plugin that loads and does nothing. In order to get some actual functionality, you need to add an event listener.
|
||||
|
||||
Create a new class called `GameEventListener`. Example code:
|
||||
|
||||
```csharp
|
||||
using Impostor.Api.Events;
|
||||
using Impostor.Api.Events.Player;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Impostor.Plugins.Example.Handlers
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that listens for two events.
|
||||
/// It may be more but this is just an example.
|
||||
///
|
||||
/// Make sure your class implements <see cref="IEventListener"/>.
|
||||
/// </summary>
|
||||
public class GameEventListener : IEventListener
|
||||
{
|
||||
private readonly ILogger<ExamplePlugin> _logger;
|
||||
|
||||
public GameEventListener(ILogger<ExamplePlugin> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An example event listener.
|
||||
/// </summary>
|
||||
/// <param name="e">
|
||||
/// The event you want to listen for.
|
||||
/// </param>
|
||||
[EventListener]
|
||||
public void OnGameStarted(IGameStartedEvent e)
|
||||
{
|
||||
_logger.LogInformation($"Game is starting.");
|
||||
|
||||
// This prints out for all players if they are impostor or crewmate.
|
||||
foreach (var player in e.Game.Players)
|
||||
{
|
||||
var info = player.Character.PlayerInfo;
|
||||
var isImpostor = info.IsImpostor;
|
||||
if (isImpostor)
|
||||
{
|
||||
_logger.LogInformation($"- {info.PlayerName} is an impostor.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"- {info.PlayerName} is a crewmate.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[EventListener]
|
||||
public void OnGameEnded(IGameEndedEvent e)
|
||||
{
|
||||
_logger.LogInformation($"Game has ended.");
|
||||
}
|
||||
|
||||
[EventListener]
|
||||
public void OnPlayerChat(IPlayerChatEvent e)
|
||||
{
|
||||
_logger.LogInformation($"{e.PlayerControl.PlayerInfo.PlayerName} said {e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 6. Registering the event listener
|
||||
|
||||
The last step to get your plugin working is to register the event listener, so the server knows about it. Go back to your plugin class and modify it as below.
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Events.Managers;
|
||||
using Impostor.Api.Plugins;
|
||||
using Impostor.Plugins.Example.Handlers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Impostor.Plugins.Example
|
||||
{
|
||||
[ImpostorPlugin(
|
||||
package: "gg.impostor.example",
|
||||
name: "Example",
|
||||
author: "AeonLucid",
|
||||
version: "1.0.0")]
|
||||
public class ExamplePlugin : PluginBase
|
||||
{
|
||||
private readonly ILogger<ExamplePlugin> _logger;
|
||||
// Add the line below!
|
||||
private readonly IEventManager _eventManager;
|
||||
// Add the line below!
|
||||
private IDisposable _unregister;
|
||||
|
||||
public ExamplePlugin(ILogger<ExamplePlugin> logger, IEventManager eventManager)
|
||||
{
|
||||
_logger = logger;
|
||||
// Add the line below!
|
||||
_eventManager = eventManager;
|
||||
}
|
||||
|
||||
public override ValueTask EnableAsync()
|
||||
{
|
||||
_logger.LogInformation("Example is being enabled.");
|
||||
// Add the line below!
|
||||
_unregister = _eventManager.RegisterListener(new GameEventListener(_logger));
|
||||
return default;
|
||||
}
|
||||
|
||||
public override ValueTask DisableAsync()
|
||||
{
|
||||
_logger.LogInformation("Example is being disabled.");
|
||||
// Add the line below!
|
||||
_unregister.Dispose();
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## 7. Build and run your plugin
|
||||
|
||||
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/`.
|
||||
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.
|
||||
7. Open Among Us, create a game and send a chat message. In the console you should see your plugin being loaded and the messages from the example.
|
||||
|
||||
## 8. Extra
|
||||
|
||||
Some extra information that might be useful for those developing plugins.
|
||||
|
||||
### Event listeners
|
||||
|
||||
- You can have multiple event listener on the same event.
|
||||
- An event listener can be given a priority `[EventListener(EventPriority.Normal)]` and is called in order.
|
||||
- It is not recommended to block for a long time inside `EventListener` because the events are called from inside the packet handlers. Blocking too long causes the client to time out. You should create a new `Task` for operations that will take a lot of time.
|
||||
|
||||
### Dependency injection
|
||||
|
||||
- The main plugin class is constructed by the `IServiceProvider` of the server and can inject everything the server uses. A few examples are:
|
||||
- `ILogger<T>`
|
||||
- `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
|
||||
|
||||
Constantly copying the plugin dll to your server directory can be pretty annoying. Luckily we have a solution for that. In your Impostor server open the `config.json` and add the `PluginLoader` from the example below, replace the path with the build destination of your plugin.
|
||||
|
||||
```json
|
||||
{
|
||||
"Server": {
|
||||
"PublicIp": "127.0.0.1",
|
||||
"PublicPort": 22023,
|
||||
"ListenIp": "0.0.0.0",
|
||||
"ListenPort": 22023
|
||||
},
|
||||
"PluginLoader": {
|
||||
"Paths": [
|
||||
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\netstandard2.1"
|
||||
],
|
||||
"LibraryPaths": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Using other libraries
|
||||
|
||||
Sometimes you need to use libraries that the original Impostor server does not provide. The dll files of these libraries must be placed in the `libraries` folder next to the server executable. You could also provide them by modifying the `PluginLoader.LibraryPaths` option in the `config.json`, similarly to the `PluginLoader.Paths` option.
|
||||
|
||||
### Impostor versions
|
||||
|
||||
It is important to use the correct versions when working with `Impostor.Api` prereleases and the `Impostor` dev builds to reduce the chances of mismatching assemblies.
|
||||
|
||||
**Example**
|
||||
|
||||
The prerelease `Impostor.Api` package `1.2.0-ci.54` belongs to build `54` on AppVeyor, which can be found here https://ci.appveyor.com/project/Impostor/Impostor/build/54. Notice the `54` on the end of the url.
|
||||
|
||||
## 9. Missing/invalid data or want more functions?
|
||||
|
||||
The `Impostor.Api` is currently in beta. There are a lot of things still missing and we would like to hear from you what you need to develop a plugin.
|
||||
|
||||
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)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
@@ -0,0 +1,233 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Don't use tabs for indentation.
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
|
||||
# Code files
|
||||
[*.{cs,csx,vb,vbx}]
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
|
||||
# XML project files
|
||||
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
|
||||
indent_size = 2
|
||||
|
||||
# XML config files
|
||||
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
|
||||
indent_size = 2
|
||||
|
||||
# JSON files
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
# Dotnet code style settings:
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Sort using and Import directives with System.* appearing first
|
||||
dotnet_sort_system_directives_first = true
|
||||
dotnet_separate_import_directive_groups = false
|
||||
# Avoid "this." and "Me." if not necessary
|
||||
dotnet_style_qualification_for_field = false:refactoring
|
||||
dotnet_style_qualification_for_property = false:refactoring
|
||||
dotnet_style_qualification_for_method = false:refactoring
|
||||
dotnet_style_qualification_for_event = false:refactoring
|
||||
|
||||
# Use language keywords instead of framework type names for type references
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
|
||||
# Suggest more modern language features when available
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
|
||||
# Non-private static fields are PascalCase
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
|
||||
|
||||
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
|
||||
|
||||
# Non-private readonly fields are PascalCase
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
|
||||
|
||||
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
|
||||
|
||||
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
|
||||
|
||||
# Constants are PascalCase
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
|
||||
|
||||
dotnet_naming_symbols.constants.applicable_kinds = field, local
|
||||
dotnet_naming_symbols.constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_style.constant_style.capitalization = pascal_case
|
||||
|
||||
# Static readonly fields are PascalCase
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
|
||||
|
||||
dotnet_naming_symbols.static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_fields.required_modifiers = static, readonly
|
||||
|
||||
dotnet_naming_style.static_field_style.capitalization = pascal_case
|
||||
|
||||
# Instance fields are camelCase and start with _
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
|
||||
|
||||
dotnet_naming_symbols.instance_fields.applicable_kinds = field
|
||||
|
||||
dotnet_naming_style.instance_field_style.capitalization = camel_case
|
||||
dotnet_naming_style.instance_field_style.required_prefix = _
|
||||
|
||||
# Locals and parameters are camelCase
|
||||
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
|
||||
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
|
||||
|
||||
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
|
||||
|
||||
dotnet_naming_style.camel_case_style.capitalization = camel_case
|
||||
|
||||
# Local functions are PascalCase
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
|
||||
dotnet_naming_style.local_function_style.capitalization = pascal_case
|
||||
|
||||
# By default, name items with PascalCase
|
||||
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
|
||||
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
|
||||
|
||||
dotnet_naming_symbols.all_members.applicable_kinds = *
|
||||
|
||||
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
|
||||
|
||||
# Async methods should have "Async" suffix
|
||||
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
|
||||
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
|
||||
dotnet_naming_rule.async_methods_end_in_async.severity = warning
|
||||
|
||||
dotnet_naming_symbols.any_async_methods.applicable_kinds = method
|
||||
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.any_async_methods.required_modifiers = async
|
||||
|
||||
dotnet_naming_style.end_in_async.required_prefix =
|
||||
dotnet_naming_style.end_in_async.required_suffix = Async
|
||||
dotnet_naming_style.end_in_async.capitalization = pascal_case
|
||||
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
|
||||
|
||||
# IDE0035: Remove unreachable code
|
||||
dotnet_diagnostic.IDE0035.severity = warning
|
||||
|
||||
# IDE0036: Order modifiers
|
||||
dotnet_diagnostic.IDE0036.severity = warning
|
||||
|
||||
# IDE0043: Format string contains invalid placeholder
|
||||
dotnet_diagnostic.IDE0043.severity = warning
|
||||
|
||||
# IDE0044: Make field readonly
|
||||
dotnet_diagnostic.IDE0044.severity = warning
|
||||
|
||||
# CSharp code style settings:
|
||||
[*.cs]
|
||||
# Newline settings
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_finally = true
|
||||
# csharp_new_line_before_members_in_object_initializers = true TODO seems like Rider/ReSharper has the value inverted, uncomment when its fixed
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = false
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_indent_labels = flush_left
|
||||
|
||||
# Prefer "var" everywhere
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
|
||||
# Prefer method-like constructs to have a block body
|
||||
csharp_style_expression_bodied_methods = false:none
|
||||
csharp_style_expression_bodied_constructors = false:none
|
||||
csharp_style_expression_bodied_operators = false:none
|
||||
|
||||
# Prefer property-like constructs to have an expression-body
|
||||
csharp_style_expression_bodied_properties = true:none
|
||||
csharp_style_expression_bodied_indexers = true:none
|
||||
csharp_style_expression_bodied_accessors = true:none
|
||||
|
||||
# Suggest more modern language features when available
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = do_not_ignore
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Blocks are allowed
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
# warning RS0037: PublicAPI.txt is missing '#nullable enable'
|
||||
dotnet_diagnostic.RS0037.severity = none
|
||||
|
||||
# ReSharper properties
|
||||
resharper_trailing_comma_in_multiline_lists = true
|
||||
-149
@@ -26,21 +26,6 @@ bld/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
@@ -72,32 +57,12 @@ artifacts/
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
@@ -112,72 +77,11 @@ _TeamCity*
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
@@ -197,13 +101,6 @@ ClientBin/
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
@@ -212,52 +109,6 @@ Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.4.0</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using Impostor.Api.Net.Inner;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public class CheatContext
|
||||
{
|
||||
public CheatContext(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public static CheatContext Deserialize { get; } = new CheatContext(nameof(Deserialize));
|
||||
|
||||
public static CheatContext Serialize { get; } = new CheatContext(nameof(Serialize));
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public static implicit operator CheatContext(RpcCalls rpcCalls) => new CheatContext(rpcCalls.ToString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class EventListenerAttribute : Attribute
|
||||
{
|
||||
public EventListenerAttribute(EventPriority priority = EventPriority.Normal)
|
||||
{
|
||||
Priority = priority;
|
||||
}
|
||||
|
||||
public EventListenerAttribute(Type @event, EventPriority priority = EventPriority.Normal)
|
||||
{
|
||||
Priority = priority;
|
||||
Event = @event;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the priority of the event listener.
|
||||
/// </summary>
|
||||
public EventPriority Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the event that the listener is listening to.
|
||||
/// </summary>
|
||||
public Type? Event { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled" />.
|
||||
/// </summary>
|
||||
public bool IgnoreCancelled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Called just after a <see cref="IClient"/> is created and connected.
|
||||
/// </summary>
|
||||
public interface IClientConnectedEvent : IClientEvent
|
||||
{
|
||||
IClient Client { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Events.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Called just before a <see cref="IHazelConnection"/> is registered.
|
||||
/// </summary>
|
||||
public interface IClientConnectionEvent : IClientEvent
|
||||
{
|
||||
IMessageReader HandshakeData { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events.Client
|
||||
{
|
||||
public interface IClientEvent : IEvent
|
||||
{
|
||||
IHazelConnection Connection { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public enum EventPriority
|
||||
{
|
||||
Lowest = 0,
|
||||
Low = 1,
|
||||
Normal = 2,
|
||||
High = 3,
|
||||
Highest = 4,
|
||||
Monitor = 5,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGameAlterEvent : IGameEvent
|
||||
{
|
||||
bool IsPublic { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Impostor.Api.Games;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a new <see cref="IGame" /> is created.
|
||||
/// </summary>
|
||||
public interface IGameCreatedEvent : IGameEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Impostor.Api.Games;
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called just before a new <see cref="IGame"/> is created.
|
||||
/// </summary>
|
||||
public interface IGameCreationEvent : IEventCancelable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the client that requested creation of the game.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will be null if game creation was requested by a plugin.
|
||||
/// </remarks>
|
||||
IClient? Client { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the desired <see cref="Games.GameCode"/>.
|
||||
/// </summary>
|
||||
/// <exception cref="ImpostorException">If the GameCode is invalid or already used in another game.</exception>
|
||||
GameCode? GameCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Impostor.Api.Games;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a new <see cref="IGame" /> is destroyed.
|
||||
/// </summary>
|
||||
public interface IGameDestroyedEvent : IGameEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGameEndedEvent : IGameEvent
|
||||
{
|
||||
public GameOverReason GameOverReason { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Impostor.Api.Games;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGameEvent : IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IGame" /> this event belongs to.
|
||||
/// </summary>
|
||||
IGame Game { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGameHostChangedEvent : IGameEvent
|
||||
{
|
||||
IClientPlayer PreviousHost { get; }
|
||||
|
||||
IClientPlayer? NewHost { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGamePlayerJoinedEvent : IGameEvent
|
||||
{
|
||||
IClientPlayer Player { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Impostor.Api.Games;
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called just before a <see cref="IClientPlayer"/> joins a game.
|
||||
/// </summary>
|
||||
public interface IGamePlayerJoiningEvent : IGameEvent
|
||||
{
|
||||
IClientPlayer Player { get; }
|
||||
|
||||
GameJoinResult? JoinResult { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IGamePlayerLeftEvent : IGameEvent
|
||||
{
|
||||
IClientPlayer Player { get; }
|
||||
|
||||
bool IsBan { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// The game is started here and players have been initialized.
|
||||
/// </summary>
|
||||
public interface IGameStartedEvent : IGameEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when the game is going to start.
|
||||
/// When this is called, not all players are initialized properly yet.
|
||||
/// If you want to get correct player states, use <see cref="IGameStartedEvent" />.
|
||||
/// </summary>
|
||||
public interface IGameStartingEvent : IGameEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Meeting
|
||||
{
|
||||
public interface IMeetingEndedEvent : IMeetingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the exiled player.
|
||||
/// </summary>
|
||||
IInnerPlayerControl? Exiled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether meeting result is a tie.
|
||||
/// </summary>
|
||||
bool IsTie { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Meeting
|
||||
{
|
||||
public interface IMeetingEvent : IGameEvent
|
||||
{
|
||||
IInnerMeetingHud MeetingHud { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events.Meeting
|
||||
{
|
||||
public interface IMeetingStartedEvent : IMeetingEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerChatEvent : IPlayerEvent, IEventCancelable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the message sent by the player.
|
||||
/// </summary>
|
||||
string Message { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerCompletedTaskEvent : IPlayerEvent
|
||||
{
|
||||
ITaskInfo Task { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerDestroyedEvent : IPlayerEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a player enters a vent.
|
||||
/// </summary>
|
||||
public interface IPlayerEnterVentEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the entered vent.
|
||||
/// </summary>
|
||||
public IVent Vent { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerEvent : IGameEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IClientPlayer" /> that triggered this <see cref="IPlayerEvent" />.
|
||||
/// </summary>
|
||||
IClientPlayer ClientPlayer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the networked <see cref="IInnerPlayerControl" /> that triggered this <see cref="IPlayerEvent" />.
|
||||
/// This <see cref="IInnerPlayerControl" /> belongs to the <see cref="IClientPlayer" />.
|
||||
/// </summary>
|
||||
IInnerPlayerControl PlayerControl { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a player gets exiled (voted out).
|
||||
/// </summary>
|
||||
public interface IPlayerExileEvent : IPlayerEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a player exits a vent.
|
||||
/// </summary>
|
||||
public interface IPlayerExitVentEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the exited vent.
|
||||
/// </summary>
|
||||
public IVent Vent { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerMovementEvent : IPlayerEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerMurderEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the player who got murdered.
|
||||
/// </summary>
|
||||
IInnerPlayerControl Victim { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerSetStartCounterEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current time of the start counter.
|
||||
/// </summary>
|
||||
byte SecondsLeft { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerSpawnedEvent : IPlayerEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public interface IPlayerStartMeetingEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button.
|
||||
/// </summary>
|
||||
IInnerPlayerControl? Body { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever a player moves to another vent.
|
||||
/// </summary>
|
||||
public interface IPlayerVentEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the vent player moved to.
|
||||
/// </summary>
|
||||
public IVent NewVent { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Impostor.Api.Net.Inner.Objects;
|
||||
|
||||
namespace Impostor.Api.Events.Player
|
||||
{
|
||||
public enum VoteType : sbyte
|
||||
{
|
||||
ForceSkip = -2,
|
||||
Skip = -1,
|
||||
Player = 0,
|
||||
}
|
||||
|
||||
public interface IPlayerVotedEvent : IPlayerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the player he voted for.
|
||||
/// </summary>
|
||||
IInnerPlayerControl? VotedFor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Vote type.
|
||||
/// </summary>
|
||||
VoteType VoteType { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IEventCancelable : IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the event was cancelled.
|
||||
/// </summary>
|
||||
bool IsCancelled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IEventListener
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
public interface IManualEventListener : IEventListener
|
||||
{
|
||||
EventPriority Priority { get; set; }
|
||||
|
||||
public bool CanExecute<T>();
|
||||
|
||||
public ValueTask Execute(IEvent @event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Impostor.Api.Events.Managers
|
||||
{
|
||||
public interface IEventManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Register a temporary event listener.
|
||||
/// </summary>
|
||||
/// <param name="listener">Event listener.</param>
|
||||
/// <param name="invoker">Middleware between the events, which can be used to swap to the correct thread dispatcher.</param>
|
||||
/// <returns>Disposable that unregisters the callback from the event manager.</returns>
|
||||
/// <typeparam name="TListener">Type of the event listener.</typeparam>
|
||||
IDisposable RegisterListener<TListener>(TListener listener, Func<Func<Task>, Task>? invoker = null)
|
||||
where TListener : IEventListener;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if an event with the type <typeparamref name="TEvent" /> is registered.
|
||||
/// </summary>
|
||||
/// <returns>True if the <typeparamref name="TEvent" /> is registered.</returns>
|
||||
/// <typeparam name="TEvent">Type of the event.</typeparam>
|
||||
bool IsRegistered<TEvent>()
|
||||
where TEvent : IEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Call all the event listeners for the type <typeparamref name="TEvent" />.
|
||||
/// </summary>
|
||||
/// <param name="event">The event argument.</param>
|
||||
/// <typeparam name="TEvent">Type of the event.</typeparam>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask CallAsync<TEvent>(TEvent @event)
|
||||
where TEvent : IEvent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Impostor.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Disposes multiple <see cref="IDisposable" />.
|
||||
/// </summary>
|
||||
public class MultiDisposable : IDisposable
|
||||
{
|
||||
private readonly IEnumerable<IDisposable> _disposables;
|
||||
|
||||
public MultiDisposable(IEnumerable<IDisposable> disposables)
|
||||
{
|
||||
_disposables = disposables;
|
||||
}
|
||||
|
||||
public MultiDisposable(params IDisposable[] disposables) : this(disposables.AsEnumerable())
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var disposable in _disposables)
|
||||
{
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public class ImpostorConfigException : ImpostorException
|
||||
{
|
||||
public ImpostorConfigException()
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorConfigException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorConfigException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorConfigException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public class ImpostorException : Exception
|
||||
{
|
||||
public ImpostorException()
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public class ImpostorProtocolException : ImpostorException
|
||||
{
|
||||
public ImpostorProtocolException()
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorProtocolException(string? message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ImpostorProtocolException(string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImpostorProtocolException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public static class DictionaryExtensions
|
||||
{
|
||||
/// <summary>Returns a read-only <see cref="ReadOnlyDictionary{TKey,TValue}" /> wrapper for the dictionary.</summary>
|
||||
/// <param name="dictionary">An <see cref="IDictionary{TKey,TValue}" /> to create a <see cref="ReadOnlyDictionary{TKey,TValue}" /> from.</param>
|
||||
/// <typeparam name="TKey">The type of the keys of <paramref name="dictionary" />.</typeparam>
|
||||
/// <typeparam name="TValue">The type of the values of <paramref name="dictionary" />.</typeparam>
|
||||
/// <returns>An object that acts as a read-only wrapper around the <see cref="IDictionary{TKey,TValue}" />.</returns>
|
||||
public static ReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
|
||||
where TKey : notnull
|
||||
{
|
||||
return new ReadOnlyDictionary<TKey, TValue>(dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Priovides a StreamReader-like api throught extensions.
|
||||
/// </summary>
|
||||
public static class SpanReaderExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte ReadByte(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
var original = Advance<byte>(ref input);
|
||||
return original[0];
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ReadInt32(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
var original = Advance<int>(ref input);
|
||||
return BinaryPrimitives.ReadInt32LittleEndian(original);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint ReadUInt32(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
var original = Advance<uint>(ref input);
|
||||
return BinaryPrimitives.ReadUInt32LittleEndian(original);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float ReadSingle(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
var original = Advance<float>(ref input);
|
||||
|
||||
return BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool ReadBoolean(this ref ReadOnlySpan<byte> input)
|
||||
{
|
||||
return input.ReadByte() != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the position of <paramref name="input" /> by the size of <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type that will be read.</typeparam>
|
||||
/// <param name="input">input "stream"/span.</param>
|
||||
/// <returns>The original input.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static unsafe ReadOnlySpan<byte> Advance<T>(ref ReadOnlySpan<byte> input)
|
||||
where T : unmanaged
|
||||
{
|
||||
var original = input;
|
||||
input = input.Slice(sizeof(T));
|
||||
return original;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api
|
||||
{
|
||||
public static class SystemTypesExtensions
|
||||
{
|
||||
public static string GetFriendlyName(this SystemTypes type)
|
||||
{
|
||||
return SystemTypeHelpers.Names[(int)type];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public static class GameExtensions
|
||||
{
|
||||
public static ValueTask SendToAllExceptAsync(this IGame game, IMessageWriter writer, LimboStates states, int? id)
|
||||
{
|
||||
return id.HasValue
|
||||
? game.SendToAllExceptAsync(writer, id.Value, states)
|
||||
: game.SendToAllAsync(writer, states);
|
||||
}
|
||||
|
||||
public static ValueTask SendToAllExceptAsync(this IGame game, IMessageWriter writer, LimboStates states, IClient client)
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(client));
|
||||
}
|
||||
|
||||
return game.SendToAllExceptAsync(writer, client.Id, states);
|
||||
}
|
||||
|
||||
public static ValueTask SendToAsync(this IGame game, IMessageWriter writer, IClient client)
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(client));
|
||||
}
|
||||
|
||||
return game.SendToAsync(writer, client.Id);
|
||||
}
|
||||
|
||||
public static ValueTask SendToAsync(this IGame game, IMessageWriter writer, IClientPlayer player)
|
||||
{
|
||||
return game.SendToAsync(writer, player.Client);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Linq;
|
||||
using Impostor.Api.Games.Managers;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public static class GameManagerExtensions
|
||||
{
|
||||
public static int GetGameCount(this IGameManager manager, MapFlags map)
|
||||
{
|
||||
return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << (byte)game.Options.Map)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public readonly struct GameCode : IEquatable<GameCode>
|
||||
{
|
||||
public GameCode(int value)
|
||||
{
|
||||
Value = value;
|
||||
Code = GameCodeParser.IntToGameName(value);
|
||||
}
|
||||
|
||||
public GameCode(string code)
|
||||
{
|
||||
Value = GameCodeParser.GameNameToInt(code);
|
||||
Code = code.ToUpperInvariant();
|
||||
}
|
||||
|
||||
public string Code { get; }
|
||||
|
||||
public int Value { get; }
|
||||
|
||||
public bool IsInvalid => Value == -1;
|
||||
|
||||
public static implicit operator string(GameCode code) => code.Code;
|
||||
|
||||
public static implicit operator int(GameCode code) => code.Value;
|
||||
|
||||
public static implicit operator GameCode(string code) => From(code);
|
||||
|
||||
public static implicit operator GameCode(int value) => From(value);
|
||||
|
||||
public static bool operator ==(GameCode left, GameCode right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(GameCode left, GameCode right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
public static GameCode Create()
|
||||
{
|
||||
return new GameCode(GameCodeParser.GenerateCode(6));
|
||||
}
|
||||
|
||||
public static GameCode From(int value) => new GameCode(value);
|
||||
|
||||
public static GameCode From(string value) => new GameCode(value);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Equals(GameCode other)
|
||||
{
|
||||
return Code == other.Code && Value == other.Value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is GameCode other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Code, Value);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public enum GameJoinError
|
||||
{
|
||||
/// <summary>
|
||||
/// No error occured while joining the game.
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// The client is not registered in the client manager.
|
||||
/// </summary>
|
||||
InvalidClient,
|
||||
|
||||
/// <summary>
|
||||
/// The client has been banned from the game.
|
||||
/// </summary>
|
||||
Banned,
|
||||
|
||||
/// <summary>
|
||||
/// The game is full.
|
||||
/// </summary>
|
||||
GameFull,
|
||||
|
||||
/// <summary>
|
||||
/// The limbo state of the player is incorrect.
|
||||
/// </summary>
|
||||
InvalidLimbo,
|
||||
|
||||
/// <summary>
|
||||
/// The game is already started.
|
||||
/// </summary>
|
||||
GameStarted,
|
||||
|
||||
/// <summary>
|
||||
/// The game has been destroyed.
|
||||
/// </summary>
|
||||
GameDestroyed,
|
||||
|
||||
/// <summary>
|
||||
/// Custom error by a plugin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A custom message can be set in <see cref="GameJoinResult.Message" />.
|
||||
/// </remarks>
|
||||
Custom,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Impostor.Api.Net;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public readonly struct GameJoinResult
|
||||
{
|
||||
private GameJoinResult(GameJoinError error, string? message = null, IClientPlayer? player = null)
|
||||
{
|
||||
Error = error;
|
||||
Message = message;
|
||||
Player = player;
|
||||
}
|
||||
|
||||
public GameJoinError Error { get; }
|
||||
|
||||
public bool IsSuccess => Error == GameJoinError.None;
|
||||
|
||||
public bool IsCustomError => Error == GameJoinError.Custom;
|
||||
|
||||
[MemberNotNullWhen(true, nameof(IsCustomError))]
|
||||
public string? Message { get; }
|
||||
|
||||
[MemberNotNullWhen(true, nameof(IsSuccess))]
|
||||
public IClientPlayer? Player { get; }
|
||||
|
||||
public static GameJoinResult CreateCustomError(string message)
|
||||
{
|
||||
return new GameJoinResult(GameJoinError.Custom, message);
|
||||
}
|
||||
|
||||
public static GameJoinResult CreateSuccess(IClientPlayer player)
|
||||
{
|
||||
return new GameJoinResult(GameJoinError.None, player: player);
|
||||
}
|
||||
|
||||
public static GameJoinResult FromError(GameJoinError error)
|
||||
{
|
||||
if (error == GameJoinError.Custom)
|
||||
{
|
||||
throw new InvalidOperationException($"Custom errors should provide a message, use {nameof(CreateCustomError)} instead.");
|
||||
}
|
||||
|
||||
return new GameJoinResult(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Innersloth;
|
||||
using Impostor.Api.Net;
|
||||
using Impostor.Api.Net.Inner;
|
||||
using Impostor.Api.Net.Messages;
|
||||
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public interface IGame
|
||||
{
|
||||
GameOptionsData Options { get; }
|
||||
|
||||
GameCode Code { get; }
|
||||
|
||||
GameStates GameState { get; }
|
||||
|
||||
IGameNet GameNet { get; }
|
||||
|
||||
IEnumerable<IClientPlayer> Players { get; }
|
||||
|
||||
IPEndPoint PublicIp { get; }
|
||||
|
||||
int PlayerCount { get; }
|
||||
|
||||
IClientPlayer? Host { get; }
|
||||
|
||||
bool IsPublic { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets display name on game list.
|
||||
/// </summary>
|
||||
string? DisplayName { get; set; }
|
||||
|
||||
IDictionary<object, object> Items { get; }
|
||||
|
||||
int HostId { get; }
|
||||
|
||||
IClientPlayer? GetClientPlayer(int clientId);
|
||||
|
||||
T? FindObjectByNetId<T>(uint netId)
|
||||
where T : IInnerNetObject;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an <see cref="IPAddress" /> to the ban list of this game.
|
||||
/// Prevents all future joins from this <see cref="IPAddress" />.
|
||||
/// This does not kick the player with that <see cref="IPAddress" /> from the lobby.
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">
|
||||
/// The <see cref="IPAddress" /> to ban.
|
||||
/// </param>
|
||||
void BanIp(IPAddress ipAddress);
|
||||
|
||||
/// <summary>
|
||||
/// Syncs the internal <see cref="GameOptionsData" /> to all players.
|
||||
/// Necessary to do if you modified it, otherwise it won't be used.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SyncSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Sets game's privacy.
|
||||
/// </summary>
|
||||
/// <param name="isPublic">Privacy to set.</param>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SetPrivacyAsync(bool isPublic);
|
||||
|
||||
/// <summary>
|
||||
/// Send the message to all players.
|
||||
/// </summary>
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="states">Required limbo state of the player.</param>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAllAsync(IMessageWriter writer, LimboStates states = LimboStates.NotLimbo);
|
||||
|
||||
/// <summary>
|
||||
/// Send the message to all players except one.
|
||||
/// </summary>
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="senderId">The player to exclude from sending the message.</param>
|
||||
/// <param name="states">Required limbo state of the player.</param>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAllExceptAsync(IMessageWriter writer, int senderId, LimboStates states = LimboStates.NotLimbo);
|
||||
|
||||
/// <summary>
|
||||
/// Send a message to a specific player.
|
||||
/// </summary>
|
||||
/// <param name="writer">Message to send.</param>
|
||||
/// <param name="id">ID of the client.</param>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask SendToAsync(IMessageWriter writer, int id);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a MessageWriter with GameData header.
|
||||
/// </summary>
|
||||
/// <remarks>Use with caution, recommended only for advanced developers.</remarks>
|
||||
/// <param name="targetNetId">Net id of the InnerNetObject.</param>
|
||||
/// <param name="callId">Rpc id of the message.</param>
|
||||
/// <param name="targetClientId">Client id of GameDataTo's target.</param>
|
||||
/// <param name="type">Message type of the message.</param>
|
||||
/// <returns>A <see cref="IMessageWriter" /> that you can fill with rpc data and send using <see cref="FinishRpcAsync"/>.</returns>
|
||||
IMessageWriter StartRpc(uint targetNetId, RpcCalls callId, int? targetClientId, MessageType type = MessageType.Reliable);
|
||||
|
||||
/// <summary>
|
||||
/// Finishes rpc message and sends it to the target.
|
||||
/// </summary>
|
||||
/// <param name="writer">Message writer of the rpc.</param>
|
||||
/// <param name="targetClientId">Id of the receiving client.</param>
|
||||
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
|
||||
ValueTask FinishRpcAsync(IMessageWriter writer, int? targetClientId = null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Impostor.Api.Games
|
||||
{
|
||||
public interface IGameCodeFactory
|
||||
{
|
||||
GameCode Create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Innersloth;
|
||||
|
||||
namespace Impostor.Api.Games.Managers
|
||||
{
|
||||
public interface IGameManager
|
||||
{
|
||||
IEnumerable<IGame> Games { get; }
|
||||
|
||||
IGame? Find(GameCode code);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new game.
|
||||
/// </summary>
|
||||
/// <param name="options">Game 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<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>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<AssemblyName>Impostor.Api</AssemblyName>
|
||||
<AssemblyTitle>Impostor.Api</AssemblyTitle>
|
||||
<Authors>AeonLucid</Authors>
|
||||
<Description>An api library for Impostor, an Among Us private server. You need this package to write plugins for Impostor.</Description>
|
||||
<PackageId>Impostor.Api</PackageId>
|
||||
<PackageTags>Among Us;Impostor;Impostor Plugin</PackageTags>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/Impostor/Impostor/dev/docs/images/logo_64.png</PackageIconUrl>
|
||||
<PackageIcon>logo_64.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/Impostor/Impostor</PackageProjectUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Impostor/Impostor</RepositoryUrl>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="../../docs/images/logo_64.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
||||
<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>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=attributes/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=events_005Cattributes/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=events_005Cgame/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=exceptions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=extensions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=games_005Cextensions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=net_005Cextensions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum AlterGameTags : byte
|
||||
{
|
||||
ChangePrivacy = 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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,7 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum ChatNoteType : byte
|
||||
{
|
||||
DidVote = 0,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Impostor.Api.Innersloth.Customization
|
||||
{
|
||||
public enum ColorType
|
||||
{
|
||||
Red = 0,
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Pink = 3,
|
||||
Orange = 4,
|
||||
Yellow = 5,
|
||||
Black = 6,
|
||||
White = 7,
|
||||
Purple = 8,
|
||||
Brown = 9,
|
||||
Cyan = 10,
|
||||
Lime = 11,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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,25 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum DeathReason
|
||||
{
|
||||
Exile = 0,
|
||||
Kill = 1,
|
||||
Disconnect = 2,
|
||||
}
|
||||
}
|
||||
+28
-16
@@ -1,56 +1,68 @@
|
||||
namespace Impostor.Shared.Innersloth.Data
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public enum DisconnectReason
|
||||
{
|
||||
ExitGame = 0,
|
||||
Destroy = 16,
|
||||
|
||||
// The game you tried to join is full.
|
||||
// Check with the host to see if you can join next round.
|
||||
GameFull = 1,
|
||||
|
||||
// The game you tried to join already started.
|
||||
// Check with the host to see if you can join next round.
|
||||
GameStarted = 2,
|
||||
// Could not find the game you're looking for.
|
||||
|
||||
// Could not find the game you're looking for..
|
||||
GameMissing = 3,
|
||||
IncorrectGame = 18,
|
||||
// For these a message can be given, specifying an empty message shows
|
||||
|
||||
// For this a message can be given, specifying an empty message shows
|
||||
// "An unknown error disconnected you from the server."
|
||||
CustomMessage1 = 4,
|
||||
// 4, 12, 13, 14, 15 also count as Custom
|
||||
Custom = 8,
|
||||
// CustomMessage3 = 11,
|
||||
// CustomMessage4 = 12,
|
||||
// CustomMessage5 = 13,
|
||||
// CustomMessage6 = 14,
|
||||
// CustomMessage7 = 15,
|
||||
|
||||
// You are running an older version of the game.
|
||||
// Please update to play with others.
|
||||
IncorrectVersion = 5,
|
||||
|
||||
// You were banned from { GameCode ?? "the room" }
|
||||
// You cannot rejoin that room.
|
||||
// You were banned
|
||||
Banned = 6,
|
||||
// You can rejoin if the room hasn't started
|
||||
// You were kicked
|
||||
|
||||
// You were kicked from { GameCode ?? "the room" }
|
||||
// You can rejoin if the room hasn't started.
|
||||
Kicked = 7,
|
||||
// Server refused username: %USERNAME%
|
||||
InvalidName = 9,
|
||||
|
||||
// You were banned for hacking.
|
||||
// Please stop.
|
||||
Hacking = 10,
|
||||
|
||||
// GameModes.LocalGame:
|
||||
// You disconnected from the host.
|
||||
// If this happens often, check your WiFi strength.
|
||||
//
|
||||
// GameModes.OnlineGame:
|
||||
// You disconnected from the server.
|
||||
// If this happens often, check your network strength.
|
||||
// This may also be a server issue.
|
||||
Error = 17,
|
||||
|
||||
// The server stopped this game. Possibly due to inactivity.
|
||||
ServerRequest = 19,
|
||||
|
||||
// The Among Us servers are overloaded.
|
||||
// Sorry! Please try again later!
|
||||
ServerFull = 20,
|
||||
|
||||
FocusLostBackground = 207,
|
||||
|
||||
// You may not join another game for another { BanMinutesLeft } minutes after intentionally disconnecting.
|
||||
IntentionalLeaving = 208,
|
||||
|
||||
// You were disconnected because Among Us was suspended by another app.
|
||||
FocusLost = 209,
|
||||
NewConnection = 210
|
||||
|
||||
NewConnection = 210,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
[Flags]
|
||||
public enum FreeWeekendState : byte
|
||||
{
|
||||
NotFree,
|
||||
FreeMIRA,
|
||||
FreePolus,
|
||||
}
|
||||
}
|
||||
+59
-84
@@ -4,41 +4,16 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Impostor.Shared.Innersloth
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
public static class GameCode
|
||||
public static class GameCodeParser
|
||||
{
|
||||
private const string V2 = "QWXRTYLPESDFGHUJKZOCVBINMA";
|
||||
private static readonly int[] V2Map = {
|
||||
25,
|
||||
21,
|
||||
19,
|
||||
10,
|
||||
8,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
22,
|
||||
15,
|
||||
16,
|
||||
6,
|
||||
24,
|
||||
23,
|
||||
18,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
9,
|
||||
4,
|
||||
14,
|
||||
20,
|
||||
1,
|
||||
2,
|
||||
5,
|
||||
17
|
||||
};
|
||||
|
||||
private static readonly int[] V2Map = Enumerable.Range(65, 26).Select(v => V2.IndexOf((char)v)).ToArray();
|
||||
|
||||
private static readonly RNGCryptoServiceProvider Random = new RNGCryptoServiceProvider();
|
||||
|
||||
|
||||
public static string IntToGameName(int input)
|
||||
{
|
||||
// V2.
|
||||
@@ -50,29 +25,13 @@ namespace Impostor.Shared.Innersloth
|
||||
// V1.
|
||||
Span<byte> code = stackalloc byte[4];
|
||||
BinaryPrimitives.WriteInt32LittleEndian(code, input);
|
||||
#if NET452
|
||||
#if NETSTANDARD2_0
|
||||
return Encoding.UTF8.GetString(code.Slice(0, 4).ToArray());
|
||||
#else
|
||||
return Encoding.UTF8.GetString(code.Slice(0, 4));
|
||||
#endif
|
||||
}
|
||||
|
||||
private static string IntToGameNameV2(int input)
|
||||
{
|
||||
var a = input & 0x3FF;
|
||||
var b = (input >> 10) & 0xFFFFF;
|
||||
|
||||
return new string(new []
|
||||
{
|
||||
V2[a % 26],
|
||||
V2[a / 26],
|
||||
V2[b % 26],
|
||||
V2[b / 26 % 26],
|
||||
V2[b / (26 * 26) % 26],
|
||||
V2[b / (26 * 26 * 26) % 26]
|
||||
});
|
||||
}
|
||||
|
||||
public static int GameNameToInt(string code)
|
||||
{
|
||||
var upper = code.ToUpperInvariant();
|
||||
@@ -80,7 +39,7 @@ namespace Impostor.Shared.Innersloth
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
var len = code.Length;
|
||||
if (len == 6)
|
||||
{
|
||||
@@ -91,10 +50,55 @@ namespace Impostor.Shared.Innersloth
|
||||
{
|
||||
return code[0] | ((code[1] | ((code[2] | (code[3] << 8)) << 8)) << 8);
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public static int GenerateCode(int len)
|
||||
{
|
||||
if (len != 4 && len != 6)
|
||||
{
|
||||
throw new ArgumentException("should be 4 or 6", nameof(len));
|
||||
}
|
||||
|
||||
// Generate random bytes.
|
||||
#if NETSTANDARD2_0
|
||||
var data = new byte[len];
|
||||
#else
|
||||
Span<byte> data = stackalloc byte[len];
|
||||
#endif
|
||||
Random.GetBytes(data);
|
||||
|
||||
// Convert to their char representation.
|
||||
Span<char> dataChar = stackalloc char[len];
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
dataChar[i] = V2[V2Map[data[i] % 26]];
|
||||
}
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
return GameNameToInt(new string(dataChar.ToArray()));
|
||||
#else
|
||||
return GameNameToInt(new string(dataChar));
|
||||
#endif
|
||||
}
|
||||
|
||||
private static string IntToGameNameV2(int input)
|
||||
{
|
||||
var a = input & 0x3FF;
|
||||
var b = (input >> 10) & 0xFFFFF;
|
||||
|
||||
return new string(new[]
|
||||
{
|
||||
V2[a % 26],
|
||||
V2[a / 26],
|
||||
V2[b % 26],
|
||||
V2[(b / 26) % 26],
|
||||
V2[(b / (26 * 26)) % 26],
|
||||
V2[(b / (26 * 26 * 26)) % 26],
|
||||
});
|
||||
}
|
||||
|
||||
private static int GameNameToIntV2(string code)
|
||||
{
|
||||
var a = V2Map[code[0] - 65];
|
||||
@@ -104,39 +108,10 @@ namespace Impostor.Shared.Innersloth
|
||||
var e = V2Map[code[4] - 65];
|
||||
var f = V2Map[code[5] - 65];
|
||||
|
||||
var one = (a + 26 * b) & 0x3FF;
|
||||
var two = (c + 26 * (d + 26 * (e + 26 * f)));
|
||||
var one = (a + (26 * b)) & 0x3FF;
|
||||
var two = c + (26 * (d + (26 * (e + (26 * f)))));
|
||||
|
||||
return (int) (one | ((two << 10) & 0x3FFFFC00) | 0x80000000);
|
||||
}
|
||||
|
||||
public static int GenerateCode(int len)
|
||||
{
|
||||
if (len != 4 && len != 6)
|
||||
{
|
||||
throw new ArgumentException("should be 4 or 6", nameof(len));
|
||||
}
|
||||
|
||||
// Generate random bytes.
|
||||
#if NET452
|
||||
var data = new byte[len];
|
||||
#else
|
||||
Span<byte> data = stackalloc byte[len];
|
||||
#endif
|
||||
Random.GetBytes(data);
|
||||
|
||||
// Convert to their char representation.
|
||||
Span<char> dataChar = stackalloc char[len];
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
dataChar[i] = V2[V2Map[data[i] % 26]];
|
||||
}
|
||||
|
||||
#if NET452
|
||||
return GameNameToInt(new string(dataChar.ToArray()));
|
||||
#else
|
||||
return GameNameToInt(new string(dataChar));
|
||||
#endif
|
||||
return (int)(one | ((two << 10) & 0x3FFFFC00) | 0x80000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Impostor.Shared.Innersloth.Data
|
||||
namespace Impostor.Api.Innersloth
|
||||
{
|
||||
[Flags]
|
||||
public enum GameKeywords : uint
|
||||
@@ -14,6 +14,6 @@ namespace Impostor.Shared.Innersloth.Data
|
||||
Arabic = 32,
|
||||
Filipone = 64,
|
||||
Polish = 128,
|
||||
English = 256
|
||||
English = 256,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 478 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user