Compare commits

...
Author SHA1 Message Date
miniduikboot 4452621cd3 Reset PlayerInfo on PlayerControl spawn
When (re)spawning players get a new player control netobject, which is
the perfect moment to discharge them from their former duties and reset
their PlayerInfo to a default state: no role, no tasks and not dead.
2024-08-13 21:18:22 +02:00
miniduikboot 53209aa78f Make PlayerInfo as dirty when setting role/death 2024-08-13 21:16:54 +02:00
miniduikboot c729d26ff6 Sync dirty objects 2024-08-13 21:16:54 +02:00
miniduikboot e2157b0a6f Clean up owned playerinfo's when disconnecting 2024-08-13 21:16:13 +02:00
miniduikboot ad18eda32f Bump to 2024.8.13
Network side seems unchanged and officials allow crossplay
2024-08-13 21:00:51 +02:00
miniduikboot efda5bcef2 Spawn PlayerInfo's if host is not authoritive
This PlayerInfo also needs to be synced over if it is server owned
2024-08-13 21:00:51 +02:00
miniduikboot 6a947457a5 Add NetId to SetName and SetColor
2024.6.18 adds a NetId field *in front* of the existing fields to help link back to the PlayerInfo. We don't actually need this NetId and assume it's called on the correct PlayerControl, so we ignore it.
2024-08-13 21:00:51 +02:00
miniduikboot a3c6ca77c1 Set RoleWhenAlive when set to a Ghost role 2024-08-13 21:00:51 +02:00
miniduikboot 9f3f826b17 Serialize Color -1 as 0 in PlayerOutfit
Official servers send 0 instead of -1 when the outfit is still
incomplete to prevent some client issues.
2024-08-13 21:00:51 +02:00
miniduikboot 36671ba1ba Demote InnerGameData, promote InnerPlayerInfo
In 2024.6.18 Innersloth promoted PlayerInfo to its own network object, and gave it to the server. InnerGameData is now a container that holds these players. This commit implements the changes necessary to handle these separate PlayerInfo network objects.
2024-08-13 21:00:51 +02:00
miniduikboot ace97ddc1d Add dirty tracking to PlayerOutfit
To prevent excessive modifications in the codebase, which is prone to
issues if a callsite is missed, automatically do this using properties.

Keep the access modifiers intact for now.
2024-08-13 21:00:51 +02:00
miniduikboot 4dc4c90e8b Add sequence id's to playeroutfit 2024-08-13 21:00:51 +02:00
miniduikboot 9379c05676 Add canOverrideRole param to SetRole
This is currently unused by Innersloth
2024-08-13 21:00:51 +02:00
miniduikboot ef98f4d20e Implement GameOptions V8
This adds a field for RulesPresets and SpecialGameModes, as well as
RoleOptions for the new roles.
2024-08-13 21:00:51 +02:00
miniduikboot 9f6947b484 VoteBanSystem now contains itself as a component
This makes it consistent with the other spawnables.
2024-08-13 21:00:51 +02:00
miniduikboot 76ae1a3385 Update Dumpostor to v1.0.1 and run for 6.18
Add the RulesPresets and SpecialGamemodes enums
2024-08-13 21:00:51 +02:00
miniduikboot 3c8a002d6e Prepare for 2024.6.18 update
Major changes are incoming, this doesn't yet work.
2024-08-13 21:00:51 +02:00
miniduikboot 35c66cda5f Change default ListenIp to match with config
The default ListenIp for the base game server has been set to 0.0.0.0 in
config.json for as long as I remember, and a different value is only
sporadically used. I remember a case where someone was fancy with Split
DNS. 0 is better as a default than localhost, so change the code
accordingly to aligh with config.json
2024-08-10 18:50:57 +02:00
Bilibili_MengChu 5d4b3d34f5 Modify config.json GameRecorderEnabled Default Value 2024-08-10 18:50:57 +02:00
Bilibili_MengChu d94cf78a98 Update docs/Server-configuration.md File Description 2024-08-10 18:50:57 +02:00
Bilibili_MengChu cfa66fa5cb Delete full-config-example.json and merge it into config.json 2024-08-10 18:50:57 +02:00
miniduikboot 2d82e1af19 Bump System.Text.Json to 8.0.4
Fixes CVE-2024-30105 (High 7.5/10)
https://github.com/advisories/GHSA-hh2w-p6rv-4g7w

Impostor doesn't use the affected
JsonSerializer.DeserializeAsyncEnumerable method as it doesn't accept
JSON formatted payloads, but the NU1903 warning is shown on all builds,
leading to warning fatigue.
2024-07-29 19:59:24 +02:00
miniduikboot c6bad15346 Let hosts handle exiles
Previously Impostor liked to kill exiled players server side to raise an
event. This is quite early, as the host will SetRole them to a ghost
role later.

However as PlayerInfo is server-owned by default in 2024.6.18, it starts
killing players client side. This caused meetings to immediately
conclude if the final impostor was voted out, ruining the cutscene.

So this commit makes Impostor wait for hosts to actually kill the player
using SetRole. Do set the LastDeathReason property though for players
using the API.
2024-07-29 19:58:33 +02:00
miniduikboot b26f451a07 Make Start/Finish GameData API public 2024-07-29 19:57:52 +02:00
miniduikboot 4f7ef58b00 Refactor Start/FinishRpc to add GameData methods
Rpc's are a specific sort of GameData packets, so it makes sense to
split and extract a method for sending GameData packets from these functions.
2024-07-29 19:57:52 +02:00
miniduikbootandjs6pak fe3ea67510 Don't DC the client if they send an unknown flag
This item is only used in a LogTrace call, so it seems excessive to kick
a player on servers just for a log statement

Co-Authored-By: js6pak <me@6pak.dev>
2024-07-27 19:13:42 +02:00
miniduikboot c522dd9f88 Add compatibility option to allow host authority
There are various bugs in the 2024.6.18 implementation of host-authoritive
multiplayer such that I can't recommend players to use it. Fixing these
issues on the server side is impossible, and I can't smell remotely if
clients have applied the necessary fixes. The currently known bugs
include at least:

- Unable to join more than 8 players in a room
- Unable for new players to join if host switched from host authoritive
  to server authoritive
- Host is unable to kill if it is in a host authoritive game while it
  thinks it is in server authoritive mode

If Innersloth fixes this mode in future game patches, this option may be
reconsidered.
2024-07-27 18:49:04 +02:00
miniduikboot 46caeb76c2 Add new option to full config example
Some people were confused by config-full.json, thinking that this file
should be edited too. This is not the case and the values in this file
don't apply as it was only meant as an example, so rename the file to
make that more clear.

Also update this file to add the options from the Modular Anticheat
2024-07-27 17:05:34 +02:00
miniduikboot b218079f9e Merge pull request #599 from miniduikboot/fix/compatman-no-invalid-clients
Improve CompatMgr behaviour for unknown versions
2024-07-19 20:11:44 +02:00
miniduikboot a61524842f Improve CompatMgr behaviour for unknown versions
Currently, Impostor will show an "Client is in an invalid state."
message if a player tries to join a match where the host or the joining
player is using a version unknown to Impostor.

This message confused a *lot* of people, so this PR changes the API such
that if the version is not registered, the version itself is put in a
compatibility group and compared, assuming no other game versions are
compatible with it. This works fine in most cases, as Among Us network
versions generally increase over time.

Failure on 2222.2.2 (which is ancient at this point, so likely no longer
used) and future cases where Innersloth messes up (which is unlikely) is
an acceptable consequence to me.
2024-06-14 21:49:12 +02:00
miniduikboot 34c14f69a4 Merge pull request #598 from miniduikboot/fix/custom-rpc-gamelogic
Accept RPC's called on GameManager
2024-06-14 07:13:20 +02:00
miniduikboot da0ee81b5d Accept RPC's called on GameManager
Previously Impostor would just throw when a method was called on a
GameManager, but this caused issues with client mods that did just this,
even through vanilla never calls an RPC on GameManager.

This commit changes that throw statement to pass the exception to the
custom message handler/anticheat instead, which is also how it works for
the other NetObjects
2024-06-13 20:52:25 +02:00
miniduikboot 468a71d01e Merge pull request #597 from Impostor/feature/2024.6.4
Add 2024.6.4 game version
2024-06-05 19:43:03 +02:00
miniduikboot 6f05946689 Bump Impostor version 2024-06-05 19:16:59 +02:00
miniduikboot b2a9bab125 Add 2024.6.4 game version
Officials allow crossplay and after inspecting the Mono I don't see any
major changes, so I'm following officials here
2024-06-04 20:42:18 +02:00
miniduikboot 9f55fe205d Prepare release 1.9.2 2024-06-01 16:12:10 +02:00
miniduikboot 734643c8c9 Merge pull request #596 from miniduikboot/fix/cleanup-disposed-clients
Clean up clients that refuse to quit properly
2024-05-30 21:47:31 +02:00
miniduikboot 661421da5a Clean up clients that refuse to quit properly
When a player is kicked or banned from a game, the client is expected to
disconnect in response. When they decide not to *or* the disconnect
packet is lost, Impostor just silently disposes of the connection.
This does not remove them from ClientManager, which is how I tracked
this bug down.

By sending them a proper disconnect message, clients should have
received *a* disconnection message before dropping their connection.

Future work should split this entire method in removing players from a
game and processing kick/bans because the latter feature is not relevant
for other callers of this method.
2024-05-26 22:05:21 +02:00
miniduikboot ff2e80d939 Merge pull request #594 from miniduikboot/feature/refine-modular-ac
Change some anticheat checks categories
2024-05-11 13:54:49 +02:00
miniduikboot ddd701320d Add similar AC check to HandleSetName 2024-04-28 20:55:50 +02:00
miniduikboot be39c9facf Move Name checks to NameLimits 2024-04-28 20:55:50 +02:00
miniduikboot 6f56e1acaf Move remaining Color checks to ColorLimits
Some mods add custom colors and still use the standard vanilla SetColor
RPC, which leads to issues with this check.
2024-04-28 20:50:41 +02:00
miniduikboot f1f5185f10 Merge pull request #593 from Pietrodjaowjao/master
Patch game-breaking exploits
2024-04-28 20:44:40 +02:00
miniduikboot 414303b2c1 Documentation: Update .NET 7 to .NET 8 2024-04-28 18:31:34 +02:00
Pietrodjaowjao 0ba700ef68 Forgot to actually return 2024-04-28 05:12:29 -03:00
Pietrodjaowjao c2b5a3e9df gamedata 2024-04-28 04:28:09 -03:00
miniduikboot ac12bacb00 Merge pull request #591 from NikoCat233/add-broadcast-check-to-most-of-calls
[AntiCheat] Add ValidateBroadCast check to most of the rpc calls
2024-04-28 08:22:55 +02:00
miniduikboot 2f3e1a620b Fix embarrassing bugs 2024-04-27 20:20:04 +02:00
miniduikboot d391b24aad Remove use of SetInfected RPC
Client no longer sends the RPC nor does anything with it when receiving it
2024-04-27 16:55:50 +02:00
miniduikboot 5854000220 Refactor if statements to be more vertically dense
Multiple guard clauses make the file harder to navigate, so put them in
a single guard clause with one validation rule per line. Some statements
in the file were already set up like this, so this commit makes it consistent
2024-04-27 16:45:15 +02:00
miniduikboot ef022b04e4 Add Broadcast checks to remaining RPC's 2024-04-27 16:43:50 +02:00
miniduikboot 155c3e69d9 Merge pull request #589 from miniduikboot/feature/game-created-event-add-host
Add Host property to IGameCreatedEvent
2024-04-21 21:44:24 +02:00
Niko233 3c9b0c305c Add broadcast 2024-04-21 14:48:54 +08:00
miniduikboot 2c0f45c5d1 Add Host property to IGameCreatedEvent
When a game has just been created, it does not yet have any players in
them, and as a result you can't get the host or its connection id when
this event is called. This makes it annoying to link between this event
and the IGameCreationEvent that came just before it.

Having this link is useful for the usecase of a game code allocation
plugin that allocates codes from a pool, and needs to return codes to
a pool if these codes weren't picked.
2024-04-12 22:53:01 +02:00
miniduikboot 9b7b1e8b26 Merge pull request #571 from Impostor/bugfix/misc-ac
Miscellaneous Anticheat fixes
2024-04-04 20:17:44 +02:00
miniduikboot 1a11b5f43e Rework Color calculation loop to always terminate 2024-04-04 20:12:44 +02:00
miniduikboot bdd65e9e9f Don't dequeue a color when none are available 2024-04-04 20:10:23 +02:00
miniduikboot ba9eeb5bb4 Check AC config in SetName/Color checks
Previously this was not done causing these checks to be unconditionally enabled
2024-04-04 20:10:23 +02:00
miniduikboot 5dafd9fe5b Allow host-only mods to desync kill timeouts 2024-04-04 20:10:23 +02:00
miniduikboot 7f943e6b2e Allow host-only mods to desync murder roles 2024-04-04 20:10:23 +02:00
miniduikboot 28f3cb3b2e Make Impostor's AC modular (#559)
* Add extra configuration options for the anticheat

* Implement option to exempt hosts from AC checks

* Add AntiCheatConfig to InnerNetObject and friends

* Categorize calls in InnerNetObject.Anticheat

* Categorize other calls to ReportCheatAsync

* Update cosmetics AC handling

When Innersloth changed SetHat etc to SetHatStr as part of the cosmicube
update we accidentally created a few dead methods. Restore and update
the code.

* Push up cheat category to ReportCheatAsync

This makes it possible to log failed checks for diagnosis. Also much
cleaner now that we don't have to push AntiCheatConfig everywhere.
Should've done this immediately q.q

* Add back old version of ReportCheatAsync

some plugins used this method. affected plugins should rebuild after the
next impostor release

* Add documentation for modular anticheat

* Address comments

* Sort AntiCheatConfig keys

* Rework the option to allow cheating hosts

This option should actually be tristate: to not break host-only mods we
should disable the anticheat for hosts running host-only mods.

* Document CheatingHostMode

* Split Limits category in Color and Name Limits
2024-04-04 20:09:59 +02:00
miniduikboot 7a49d2d917 Prepare release 1.9.1 2024-04-03 19:59:30 +02:00
miniduikboot 092504f2f1 Merge pull request #573 from ykundesu/fix/AprilFools2024
fixed AprilFools2024 Deserialize error
2024-04-01 13:30:35 +02:00
miniduikboot 453d12171e Fix compile warning 2024-04-01 13:23:18 +02:00
ykundesu b2e220a738 fixed AprilFools2024 Deserialize error 2024-04-01 17:33:38 +09:00
miniduikboot 2be1d68eeb Merge pull request #569 from Impostor/feature/2024.3.5
Feature/2024.3.5
2024-03-30 16:25:41 +01:00
miniduikboot c7ea59fed9 Run Dumpostor on 2024.3.5 2024-03-06 21:07:09 +01:00
miniduikboot 6cc2185915 Add new game version for 2024.3.5
Officials don't allow crosplay either, so neither should we
2024-03-06 21:06:16 +01:00
miniduikboot 7b23d80978 Merge pull request #563 from Impostor/feature/net8
Upgrade to net8.0
2024-01-25 12:31:07 +01:00
miniduikboot 1582b2c65a Merge pull request #564 from Impostor/hotfix/docker-actions
Migrate to environment files correctly
2024-01-25 12:26:35 +01:00
miniduikboot 81753a53e0 Migrate to environment files correctly
See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2024-01-25 12:21:56 +01:00
miniduikboot a9fdd82345 Merge pull request #562 from Impostor/fix/http2-warning
Don't set HTTP protocols explicitly
2024-01-25 12:15:43 +01:00
miniduikboot d06b21b066 Merge pull request #561 from miniduikboot/chore/update-gh-actions
Update Github actions
2024-01-25 12:15:26 +01:00
miniduikboot c1fb4336df Merge pull request #560 from Impostor/fix/dleks
Allow spawning in the Dleks map
2024-01-25 12:14:59 +01:00
miniduikboot 9c02a912b4 Merge pull request #557 from miniduikboot/fix/http-default-listenip
Change default ListenIp of Http server to 0.0.0.0
2024-01-25 12:14:31 +01:00
miniduikboot 3143c67eb4 Merge pull request #552 from Impostor/feature/options-changed-event
Implement event to detect game option changes
2024-01-25 12:14:02 +01:00
js6pak 9f93e0955b Update ReadFrom.Configuration call 2024-01-25 12:13:12 +01:00
js6pak d74d7fcecc Drop BinaryFormatter override in ImpostorException 2024-01-25 12:10:36 +01:00
miniduikboot 012e45c6a9 Remove unnecessary using directive 2024-01-25 12:05:09 +01:00
js6pak 2cbfe159be Upgrade to net8.0 2024-01-25 00:51:06 +01:00
js6pak e142fc7c73 Don't set HTTP protocols explicitly 2024-01-25 00:44:41 +01:00
miniduikboot 165621a8cc Update Github actions
- Update versions to the latest one
- Get rid of .gitmodules as we dumped that years ago
- Change ::set-output to output files as the former is slated for removal
2024-01-24 21:37:37 +01:00
miniduikboot 83fe5814ab Only throw warning outside of docker containers 2024-01-24 21:21:07 +01:00
miniduikboot d640f90d88 Allow spawning in the Dleks map
Now with 100% less crash cascades on spawn attempts and it even includes
working map data!
2024-01-24 20:45:21 +01:00
miniduikboot f4f10269b2 Show both warnings 2024-01-24 19:55:35 +01:00
miniduikboot 880951c5b8 Add warning message for direct configuration 2024-01-24 18:13:02 +01:00
miniduikboot 3b514f82f2 Change default ListenIp of Http server to 0.0.0.0
We see that a lot of support tickets are caused by this default setting,
as it is one of the things that blocks connections to the server with no
obvious indication that this is happening. To make it easier for first
time users to set up Impostor, it is important that this setting is
changed.

Previously we also recommended against direct exposing due to security
reasons, but I believe this fear to be unfounded: Microsoft claims that
the Kestrel server is hardened against web server vulnerabilities and
supports its use both with and without a reverse proxy.[1]

We still recommend using reverse proxies if HTTPS support is needed, so
that section of documentation still remains. Setting the ListenIp to
127.0.0.1 is still recommended when using a reverse proxy to remove the
ability for people to connect directly, so we add it there as a recommendation.

[1]: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/when-to-use-a-reverse-proxy?view=aspnetcore-8.0
2024-01-10 19:17:38 +01:00
js6pak 16d3f1c651 Merge branch 'master' into feature/options-changed-event 2023-12-17 20:23:01 +01:00
miniduikbootandjs6pak b5ea1d8864 Update docs to reflect http plugin merge (#546)
Co-authored-by: js6pak <me@6pak.dev>
2023-12-17 20:22:36 +01:00
js6pak 5325a81cb6 Merge Impostor.Http into core (#533) 2023-12-17 20:19:27 +01:00
js6pak c6121eed49 Implement MushroomMixupSabotage 2023-12-16 23:55:58 +01:00
js6pak 389b7dfc0a Drop the RpcSnapTo anticheat 2023-12-16 23:55:58 +01:00
js6pak 5b14c7b64e Implement fungle rpcs 2023-12-16 23:55:58 +01:00
js6pak 9b58f2b36d Source generate map data and enums (#548) 2023-12-16 23:36:02 +01:00
miniduikboot 6e03e90bd0 Merge pull request #553 from Impostor/feature/2023.11.28
Add new network version for 2023.11.28
2023-12-03 23:27:05 +01:00
js6pak f281639763 Make GameLogicComponent methods async 2023-12-03 22:59:05 +01:00
miniduikboot 87fd177e39 more comments sent over discord pm's 2023-12-03 22:55:05 +01:00
miniduikboot fa024b70c5 Process comments 2023-12-03 22:49:13 +01:00
miniduikboot 2c12623a65 Get rid of Rpc02 SyncSettings
This RPC is still sent by clients, but no longer used by clients. As the
server can get the info it wants from LogicOptions instead, remove this
RPC to prevent people from using it accidentally
2023-11-29 22:14:59 +01:00
miniduikboot e303065688 Process comments 2023-11-28 23:09:39 +01:00
miniduikboot 92920357f8 Add new network version for 2023.11.28
Did a quick run through, didn't seem too broken
2023-11-28 20:25:38 +01:00
miniduikboot 5edb409388 Implement event to detect game option changes
This can be triggered by both RPC 02 and a(nother) plugin calling
SyncSettings to force certain settings on the host. Users of this API
could cause this event to recurse by calling SyncSettingsAsync inside an
event handler, so we prevent such reasonable foreseeable misuse.
2023-11-26 23:16:11 +01:00
miniduikboot 66763a4066 Merge pull request #549 from Impostor/feature/2023.10.24
Feature/2023.10.24
2023-11-17 22:08:18 +01:00
js6pak 132b7f0b87 Revert the rpc debug log 2023-11-17 20:05:50 +01:00
miniduikboot c592bd1a9e Debounce CheckMurder calls
In games where players have a high ping, they can get disconnected if
they try and murder a player twice. If a player tries to kill a player
again while they are still under a cooldown from their previous kill,
cancel their request if the game is server authoritive and don't process
it anymore if the game is host authoritive
2023-11-16 17:55:50 +01:00
js6pak 104237b439 Fix host authoritive murder 2023-11-12 21:33:54 +01:00
miniduikboot acb923e3a3 Fix SA1629 violations 2023-11-10 19:11:46 +01:00
miniduikboot d4342dee35 Actually implement CNT serialization 2023-11-10 19:11:46 +01:00
miniduikbootandjs6pak 86423a0b3c Update src/Impostor.Server/Net/State/Game.cs
Co-authored-by: js6pak <kubastaron@hotmail.com>
2023-11-10 16:13:10 +01:00
miniduikboot 21d1333b08 Make API remarks show up in the documentation
Some xmldoc processors don't process stuff that is not inside a remarks
tag, so we add them here.
2023-11-10 15:41:48 +01:00
js6pak f34a90d20c Remove RepairSystem 2023-11-10 15:29:31 +01:00
miniduikboot b65f139eff Bump priority of the unsupported version logging
Currently this only gives an error message on the client but doesn't
send extra details to the server log in the default setup
2023-11-10 14:43:55 +01:00
js6pak 87c7e3922a Fix InnerNetObject writing in rpcs 2023-11-10 12:33:26 +01:00
miniduikboot b67ca158ea Refresh Murder Event API
- IPlayerCheckMurderEvent now exists
- You can see if a kill was successful with IPlayerMurderEvent
- You can now see if host authority was requested with Game.IsHostAuthoritive
2023-10-29 00:37:30 +02:00
miniduikboot 946d7e2164 Implement server side guardian angel 2023-10-28 23:05:28 +02:00
miniduikboot b038d0e098 Cleanup previous commit 2023-10-27 00:00:21 +02:00
miniduikboot 821a2248a7 Fix MurderPlayer for vanilla clients
In 2023.10.24, vanilla started expecting that CheckMurder is handled on
the server. That is, unless the host is modded, then CheckMurder calls
are handled by the host as before
2023-10-26 23:14:09 +02:00
miniduikboot 3d60cf58a9 Skip deserializing the UpdateSystem RPC for now
Innersloth merged RepairSystem and UpdateSystem into one RPC and the
decoding now depends on *which* system is being deserialized.
2023-10-25 22:29:39 +02:00
miniduikboot fd2d457e6b Clean up stuff for old versions 2023-10-25 21:37:38 +02:00
miniduikboot 5c31df8c05 Cleanup code 2023-10-25 21:37:29 +02:00
miniduikboot b0901507f7 Rework CustomNetworkTransform
Innersloth has changed CNT from position/velocity to a queue of
positions. As a result, drop the velocity as well.

We're currently not tracking the current position of the player, so
we're just storing the last one
2023-10-25 21:28:03 +02:00
miniduikboot 29a55d704b Add 10.24 and drop the rest
We had a nice year of backwards compatibility, but the changes in Fungle
are large enough that dropping support for old versions is the only
logical path forward
2023-10-25 21:26:40 +02:00
miniduikbootandjs6pak 2129725744 Improve cross-compatibility (#534)
Co-authored-by: js6pak <me@6pak.dev>
2023-10-06 14:52:16 +02:00
miniduikboot 7b341bea14 Update docker container to I.Http 0.5
Also update the documentation to deal with the new default port and
clarify some stuff
2023-07-15 13:46:58 +02:00
miniduikboot af371c92ef add another version code to the pile 2023-07-15 12:34:29 +02:00
miniduikboot ff49e895ec make stylecop happy 2023-06-15 22:38:03 +02:00
miniduikboot 0e9fb4b41c Bump version to 1.8.3 2023-06-15 22:38:03 +02:00
miniduikboot 4f00bf1ee7 Add GameVersion for 2023.6.13
There seem to be no functional changes
2023-06-15 22:38:03 +02:00
miniduikboot a519c0daed Allow multiple SetName commands per CheckName
Some mods use SetName to set player-specific names, for example to set
player-specific roles. When Anticheat is disabled, this should be
allowed for feature-parity with officials.
2023-06-01 19:39:46 +02:00
yukieiji 1f98102e5a update:config 2023-05-23 21:39:09 +02:00
yukieiji 93fdc83ce7 refactor:ConnectionTimeout 2023-05-23 21:39:09 +02:00
yukieiji e29552ca28 refactor:SpawnInTime to config 2023-05-23 21:39:09 +02:00
yukieiji 8eee7f888f feat:timeout config 2023-05-23 21:39:09 +02:00
miniduikboot a77e4e17c2 Bump version to 1.8.2 2023-04-09 16:54:38 +02:00
danbudworthmead 9ebf5cd8e9 Adding missing 2023.3.13 version for android 2023-03-30 21:29:37 +02:00
miniduikboot 4ffca69714 Update to 2023.3.28 2023-03-28 20:15:11 +02:00
miniduikboot dede1c5b09 Reorder GameFull and GameStarted join errors
If a game is in progress, a player can't join it anyway and spam-joining
to see if a spot becomes available is useless. So the GameFull error is
more important than the GameStarted error, therefore reorder them.

Closes: #518
2023-03-08 20:46:29 +01:00
miniduikboot b31e3bf1e3 Add network version for 2023.2.28 2023-03-02 20:04:40 +01:00
miniduikboot c9bb8323f4 Add missing game keywords
These have been added in 2021.6.30, but this has only now been
problematic because Impostor.Http requires this array to be accurate
2023-02-14 23:29:25 +01:00
miniduikboot 1521410e79 Add a warning for using the default PublicIp
This is a misconfiguration in most cases and it breaks Impostor.Http.
Throw a warning so that people know that they should return to the
install instructions.
2023-02-14 23:26:32 +01:00
miniduikboot be8e4a49f0 Merge pull request #512 from Impostor/fix/docs-n-docker
Various improvements to the Dockerfile and the docs
2023-02-14 23:26:09 +01:00
miniduikboot 631e994759 Prepare for 1.8.1
This will be a release focused on setup convenience
2023-01-30 00:06:18 +01:00
miniduikboot c06916084e Rewrite Running-the-server.md
- Multi-server is removed from the intro
- Add Impostor.Http stuff
- Stress the importance of public ip
2023-01-30 00:04:55 +01:00
miniduikboot c9c044365a Dockerfile: install Http plugin in separate folder
Some people mount a folder on the plugin directory. This is fine, but
our sneaky Impostor.Http install method won't work here. So put it in a
different folder and prepend our folder to the plugin search path.

The number 76 has been randomly picked using dice
2023-01-29 22:58:30 +01:00
miniduikboot 5ab4bf70da Dockerfile: [[ -> [
[[ is a bash extension and is not supported by posix sh, throwing an
error. [ is supported and does enough
2023-01-29 22:57:05 +01:00
bkloosterboer 58c8bdec26 systemd template and instructions (#508)
* systemd template and instructions

* clarify some intsructions, change a few systemd paramters

* change targets
2023-01-22 23:29:22 +01:00
miniduikboot 5e080b290b Add Impostor.Http to the Docker image (#509)
Adding plugins to the docker image is pretty hard as you need to install
ASP.Net Core and add the plugin. As Impostor.Http has become pretty much
mandatory, install the plugin by default.
2023-01-20 15:25:22 +01:00
miniduikbootandjs6pak 97390a0882 Automatically add ASP.NET Core to the library path (#507)
Currently Impostor.Http is becoming an almost mandatory plugin. Because
it depends on ASP.Net, many people who fail to add the required path to
their config will run into an error. Help them by automatically adding
ASP.NET Core.

Also .NET updates every now and then and updating the version number in
the config.json is annoying me.

This commit uses the fact that ASP.NET Core DLL's are in a sibling folder
to the .NET runtime and should therefore work on most setups unless
they've installed ASP.NET Core in a very weird way.

* Fix casing

Co-authored-by: js6pak <kubastaron@hotmail.com>
2023-01-20 15:23:33 +01:00
js6pak 23499929fb Merge pull request #504 from Impostor/fix/dead-impostor-sabotage 2023-01-07 15:47:41 +01:00
js6pak 579f618ac6 Merge pull request #503 from Impostor/fix-game-start 2023-01-07 15:47:28 +01:00
miniduikboot 6962d01dbd Allow sabotages by dead impostors
2021.12.8+ sets the role of dead players to {Crewmate,Impostor}Ghost, so
relax the anticheat to allow sabotages by ImpostorGhosts
2023-01-07 14:11:06 +01:00
js6pak 0fb6556365 Ignore the role in InnerPlayerInfo.Deserialize 2023-01-06 19:52:07 +01:00
js6pak 9cd5de6a36 Expose RoleType in api 2023-01-06 19:38:33 +01:00
js6pak 94015d475d Mark the game as started only after all players get their role 2023-01-06 19:38:19 +01:00
js6pak 11bb2dec47 Merge pull request #501 from Impostor/feature/2022.12.8 2022-12-29 18:02:15 +01:00
js6pak e7d745608e Fix xmldoc warnings 2022-12-29 17:49:15 +01:00
js6pak a1120f8468 Fix CrossplayFlags 2022-12-20 15:25:19 +01:00
js6pak 1fa684d843 Fix formatting 2022-12-20 14:36:31 +01:00
js6pak fac4103d70 Fix Message00HostGameS2C signature 2022-12-20 14:35:34 +01:00
AeonLucid 3b5b538b39 Correct api game manager interfaces 2022-12-19 22:44:36 +01:00
AeonLucid 62f8a7099d Lowercase rpc 2022-12-19 16:01:24 +01:00
AeonLucid f8b3bf7295 Log of correct reader 2022-12-19 15:59:14 +01:00
AeonLucid 4e5edcee49 Add warning when not consuming all bytes of a logic component 2022-12-19 15:55:27 +01:00
AeonLucid 5a8927e4c9 Clean up unused serialization and expose two HideAndSeek floats in api 2022-12-19 15:34:55 +01:00
AeonLucid 752b155152 Packages lock 2022-12-19 02:55:41 +01:00
AeonLucid 5a1f1c9d86 Add FilterOptions to Game and use in FindListings 2022-12-19 02:39:03 +01:00
AeonLucid adb74f628c Fix SyncSettingsAsync 2022-12-19 02:24:51 +01:00
AeonLucid c106695707 Fix incorrect data types for NormalGameOptions 2022-12-19 02:24:33 +01:00
AeonLucid a7fb2b8b19 Use DeserializeInto over Deserialize 2022-12-19 01:12:52 +01:00
AeonLucid d4ac24ae17 Added game manager net object and logic classes 2022-12-19 00:56:03 +01:00
AeonLucid e0b85c959b Log MessageFlag name instead of numbers 2022-12-18 23:52:01 +01:00
miniduikboot 980d172d4f Add Pet and CancelPet RPC's 2022-12-18 22:45:56 +01:00
js6pakandminiduikboot 8dfa38b4b5 Implement new GameOptions system
Co-authored-by: miniduikboot <mini@duikbo.at>
2022-12-18 22:45:56 +01:00
miniduikboot d1ac9301be Bump to 1.8.0 and drop backwards compatibility 2022-12-18 22:45:56 +01:00
js6pak d667f99c9f Remove redirector (#502) 2022-12-18 22:44:25 +01:00
AeonLucid 679bfecb42 Merge pull request #500 from Impostor/net7-nugethazel
Upgrade to net7.0 and move hazel to nuget
2022-12-18 21:55:41 +01:00
AeonLucid 519bae28b5 Update hazel package references to 1.0.0 2022-12-18 21:49:10 +01:00
js6pak e5db56317a Fix imports 2022-12-18 20:34:46 +01:00
js6pak ed89e00f3a Switch hazel from submodule to nuget 2022-12-18 20:34:45 +01:00
js6pak d5165a79f1 Upgrade to net7.0 2022-12-18 20:34:45 +01:00
miniduikboot 7bb7d2178b Correct location of Right Stabilizer vent on Polus
I've checked all game vents and this seems to be the only one that
changed.

Fixes: #495
2022-12-07 19:33:50 +01:00
miniduikboot 39b7d626dc Remove anticheat log when anticheat is disabled
Fixes #456
2022-11-01 08:03:53 +01:00
miniduikboot 116bb3cda4 Bump to 1.7.3
Because we can keep compatibility, only do a minor version bump
2022-10-23 16:53:02 +02:00
miniduikboot 8fe5c2205e Add 2022.10.25 2022-10-23 16:53:02 +02:00
miniduikboot a418e1f15a Add version id for 2022.10.18 2022-10-23 16:53:02 +02:00
miniduikboot a7cff4aef1 Add Airship to MapFlags
CC https://github.com/Impostor/Impostor.Http/pull/3
2022-09-14 21:30:05 +02:00
js6pak b9e8def90d Switch to github actions (#492) 2022-09-01 19:28:41 +00:00
miniduikboot dc530406c6 Move config files to API
This makes it possible to access these from a plugin
2022-08-29 20:57:16 +02:00
miniduikboot 2de08da14d Add documentation for the compatibility options 2022-08-29 20:57:16 +02:00
miniduikboot 7a89e963dd Add unsupported option to allow future versions 2022-08-29 20:57:16 +02:00
miniduikboot 8aaf75e381 Make version mixing configurable 2022-08-29 20:57:16 +02:00
miniduikboot 59cb4a18e8 Prevent players joining game on different versions
Now that our game version compatibility list is growing longer with
every game patch, we need a way to make sure people in a game run the
same version of the game. Mismatching game version can lead to weird
issues, especially if mods are involved.
2022-08-29 20:57:16 +02:00
miniduikboot a0b5228e71 Improve setup documentation (#485)
- .NET download link was broken
- They also renamed their packages slightly, so update wording
- Add a note on port forwarding
- Add a note on setting up the region file
2022-08-29 20:56:34 +02:00
miniduikboot 78351c1dbe Add Chat Language to game listings (#491)
This was added to the in 6.23 patch
2022-08-28 17:04:35 +02:00
miniduikboot 45e0162c1a Add new client version (#489) 2022-08-23 20:59:45 +02:00
miniduikboot fcf8d66266 Allow spawning fake players (#488)
This is used by some mods to implement roles for unmodded clients
2022-07-24 19:25:13 +02:00
miniduikboot 6b6fa08125 Version bump for 2022.6.21 (#486)
Mostly untested, ran through a few games and seems to work fine
2022-06-22 21:36:58 +02:00
AeonLucid cea3d8980f Update appveyor.yml, replace NuGet auth token 2022-06-12 02:33:43 +03:00
js6pak d1ffdb95e1 Update appveyor.yml
crappveyor
2022-06-11 15:41:48 +00:00
miniduikboot 4d11cf91ad Remove Auth- and AnnouncementsServer sections (#484) 2022-06-03 18:58:00 +00:00
miniduikboot 84aba52198 Remove 75% of the question marks of PR #481 (#482) 2022-06-03 18:57:47 +00:00
js6pakandminiduikboot 6e4bb71289 Add Serilog.Settings.Configuration (#468)
* Add Serilog.Settings.Configuration

* Add docs section for logging

* Elaborate Serilog documentation

Co-authored-by: miniduikboot <mini@duikbo.at>
2022-06-03 20:31:52 +02:00
js6pak 8fec1a211e Merge pull request #483 from js6pak/fix-disconnect-reason
Fix non custom disconnect reasons
2022-06-03 20:31:10 +02:00
js6pak 85a2fce6c1 Fix non custom disconnect reasons 2022-06-03 20:17:59 +02:00
miniduikboot 224fdd1d5b Allow adding custom tasks on standard maps (#481)
This is needed for mods that add tasks to standard maps, but also mods
that add custom maps: because their custom netobjects don't get
registered Impostor thinks people are still on the old map when people
switch to the custom map after playing a game.
2022-05-25 19:53:32 +02:00
miniduikboot 380ba46f11 Upgrade to .NET 6 (#479)
* Upgrade to .NET 6

.NET 5 has gone EOL, so move to a supported version.

* Upgrade Docker container as well
* Update docs for .NET 6
* Re-add hack for System.IO.Pipelines
* Bump dependency versions
* Update the deps of the other projects too
* Only declare TargetFramework once
* Dockerfile: also copy over Directory.Build.props
* Cake: pick up target framework automatically
* Upgrade Cake as well
2022-05-25 19:52:22 +02:00
miniduikboot aeefc40ef1 Merge pull request #474 from SubmergedAmongUs/master
Add handling for null ShipStatus
2022-04-20 18:49:37 +02:00
AlexejheroYTB 743b8ed5cb Remove null check for ShipStatus known to not be null 2022-04-20 08:07:59 +03:00
AlexejheroYTB ed008872f6 Add handling for null ShipStatus 2022-04-16 17:11:58 +03:00
js6pak 4797d899af Merge pull request #471 from Impostor/feature/2022.3.29 2022-04-09 12:42:51 +00:00
js6pak c834013bd3 Simplify Message07JoinedGameS2CPre20220202 2022-04-07 16:58:33 +02:00
js6pak 70c180fb19 Make GameOptionsData de/serialization less confusing 2022-04-07 11:58:16 +02:00
miniduikboot 729368d777 Do not add ProductUserId/Friendcode on <2.24
Because it is fine to add data to the end of messages the new fields
could be added to Message 1 just fine, but because Message 7 contains a
loop, we need to send a different message to old clients there.
2022-04-05 20:05:06 +02:00
miniduikboot 5c06d1dd4d fixup! Add empty ProductUserId and FriendCode to packets 2022-04-05 19:52:25 +02:00
miniduikboot 446e5b8705 Add empty ProductUserId and FriendCode to packets
They are not sent to the server and no clue how to retrieve them out of band.
2022-04-05 19:52:25 +02:00
miniduikboot ae00ff9295 Barebones port 2022-04-05 19:52:25 +02:00
miniduikboot 400592b99c Merge pull request #467 from miniduikboot/fix/race-dc-send-all-except
Do not broadcast messages to disconnected clients
2022-03-26 10:35:54 +01:00
miniduikboot 9906c409da Do not broadcast messages to disconnected clients
This method is used when players have disconnected. If multiple players
disconnect at once, this method leads to exceptions.
2022-03-17 21:35:08 +01:00
miniduikboot c26d03a8bc Merge pull request #464 from miniduikboot/fix/custom-dc-msg
Fix/custom dc msg
2022-02-28 18:04:47 +01:00
miniduikboot ca48d672d5 Reword obsoletion message 2022-02-26 20:33:02 +01:00
miniduikboot 0b431dc5fa Change DisconnectAsync to use extension instead 2022-02-26 20:31:45 +01:00
miniduikboot 0b0c8274aa Turn DisconnectConnection into an extension 2022-02-26 20:31:23 +01:00
miniduikboot 36f8255e26 Fixup 608414326d
Oops, I accidentally forgot to remove the previous line when adding the
file to my commit
2022-02-26 19:08:57 +01:00
miniduikboot 919b094018 Deprecate JoinGame errors
Starting from version 2021.11.9, join errors no longer exist, instead a
client will show the message "An unknown error disconnected you from the
server". As a workaround, the connection is disconnected entirely when
an error occurs, which allows us to show a custom message.
2022-02-26 19:08:57 +01:00
js6pak 6125fd7006 Merge pull request #465 from miniduikboot/fix/2-28-bump 2022-02-26 17:26:54 +01:00
miniduikboot a3c0c8cacf Bump network version 2022-02-25 07:05:22 +01:00
miniduikboot b252bf2ee7 Merge pull request #460 from miniduikboot/feature/queryplatformids
Add QueryPlatformIds
2022-02-14 22:12:47 +01:00
miniduikboot 9b5a63e030 Add QueryPlatformIds
Some platforms (notable the Microsoft Store version) ask for this before connecting.
2022-02-02 22:17:47 +01:00
miniduikboot 6a8f089576 Merge pull request #455 from miniduikboot/fix/i18n-nicknames
Fix/i18n nicknames
2022-01-27 19:23:30 +01:00
miniduikboot d994323083 Merge pull request #458 from miniduikboot/fix/ac-engineer-snapto
AC: Allow engineers to move to a different vent.
2022-01-27 19:22:59 +01:00
miniduikboot 3f374da44b Partial revert of cc8d5d2: Readd length check
Oversized nicknames can cause bigger issues, so it is desireable to
still block them. .Length counts codepoints, not bytes, which means
that 10 character Japanese nicknames, which are configurable ingame,
should still be allowed.
2022-01-27 18:24:02 +01:00
miniduikboot bfd2efa716 AC: Allow engineers to move to a different vent. 2022-01-27 18:10:46 +01:00
miniduikboot 6867dec7ee Merge pull request #453 from miniduikboot/fix/ga-half-cooldown
AC CheckMurder: Require half of cooldown
2022-01-14 23:06:28 +01:00
miniduikboot 7132dc2d38 Add comment to clarify why this exists 2022-01-14 19:47:58 +01:00
miniduikboot 682bfac558 Merge pull request #452 from miniduikboot/fix/host-migrate
Before this commit, when the host of a game disconnects, the InnerPlayerInfo from the player is removed, which causes the new host to disconnect because of a deserialization error. This PR fixes this issue
2022-01-14 18:21:16 +01:00
miniduikboot cc8d5d2a45 Remove name length/validity checks from JoinGame
Length and validity are checked also checked by the anticheat. In case
Impostor goes out of sync with the allowed characters again, this can
just be fixed by disabling the Anticheat.

Check for NullOrWhiteSpace is kept because an empty username could be annoying
2022-01-10 20:54:45 +01:00
miniduikboot e6a35344c3 Sync IsCharAllowed with Innersloth implementation 2022-01-10 20:54:45 +01:00
miniduikboot db52b48cd6 AC CheckMurder: Require half of cooldown
When the Guardian Angel protects a player, the impostor that just missed
their kill gets back half of their cooldown. Keeping track of whether or
not the player was protected is more difficult due to how the Guardian
Angel is implemented, so instead we halve the minimum time between kill
in order to minimize false positives.
2022-01-08 19:20:11 +01:00
miniduikboot 50a526a02d Clamp taskCount to the length of the task list
New tasks cannot be created at this point because we don't know the
underlying tasks. So we try to maintain the tasks we do know of.
2022-01-08 17:42:05 +01:00
miniduikboot 608414326d Do not destroy PlayerControl if game is starting
This player may still get assigned tasks, which could lead to
deserialization problems.
2022-01-08 17:41:52 +01:00
miniduikboot d8bcb52c90 Mark game as started when RPC SetRole is called
This used to be done when SetInfected was called, but this RPC is no
longer used since 2021.11.9 in favor of this RPC.
2022-01-08 17:41:14 +01:00
miniduikboot d7d7547182 Merge pull request #442 from Impostor/2021.11.9
2021.11.9 and 2021.12.14 support
2021-12-21 23:27:38 +01:00
js6pak 64e27c3e21 Set RoleType in PlayerInfo.Deserialize 2021-12-15 15:36:01 +01:00
js6pak a0b433500c Don't do public methods in interfaces 2021-12-15 15:35:46 +01:00
js6pak c51a1f9c1f Readd HandleSet{Pet/Hat/Skin} 2021-12-15 15:33:01 +01:00
js6pak e15ac51dcf Implement cosmetic rpc methods 2021-12-15 15:22:18 +01:00
js6pak bde3a22f6e Document IClient.PlatformSpecificData 2021-12-15 14:52:22 +01:00
js6pak 6118e6b7b8 Change RoleOptionsData floats to be bytes as they can't ever be floats anyway 2021-12-15 14:51:07 +01:00
miniduikboot 32ecfedfba Add initial support for 2021.12.14 2021-12-14 21:38:26 +01:00
miniduikboot b6fe79cc8b Add RPC's for CheckProtect and ProtectPlayer 2021-11-22 23:04:56 +01:00
miniduikboot aeaffc849a Implement new MurderPlayer logic
In 2021.11.9, the host now uses MurderPlayer instead of impostors.
Impostor now use CheckMurder to request the host to kill a player. This
allows the host to prevent the target of the Guardian Angel from dying.

However, if the impostor that is checking the kill is also the host, AU
internally processes the CheckMurder RPC and sends the MurderPlayer RPC
first, *then* it sends the CheckMurder RPC.
2021-11-22 22:12:34 +01:00
miniduikboot a15f1b6a4c Add platform data to GameList 2021-11-15 22:55:57 +01:00
js6pak afb7051218 Fix ServerReplay 2021-11-13 19:51:52 +01:00
miniduikboot 8a0e9e876e Bump to 1.7 2021-11-12 23:12:47 +01:00
miniduikboot 22f1d74cdf Allow Shapeshifters to use RPC Shapeshift 2021-11-12 23:12:47 +01:00
miniduikboot e6d38f4b72 Allow Engineers to vent 2021-11-12 22:57:29 +01:00
miniduikboot 93c80c1412 Implement Rpc 44: SetRole 2021-11-12 22:56:35 +01:00
miniduikboot c3e0157209 Add name/psd/level to JoinGame- and JoinedGameS2C
Two players can now connect to the same lobby
2021-11-12 21:11:48 +01:00
miniduikboot 0769752407 Remove initial state flag from InnerGameData 2021-11-10 23:04:21 +01:00
miniduikboot fba1a894cc Implement SetActivePodType 2021-11-10 21:23:00 +01:00
js6pak 4d1aec9070 WIP 2021-11-10 20:46:56 +01:00
js6pak e0c7086973 RIP AnnouncementsServer 2021-11-10 13:52:15 +01:00
js6pak 125da11d61 [skip ci] Auto deploy github releases 2021-08-05 14:24:51 +02:00
js6pak d86efc1345 Merge pull request #431 from miniduikboot/feature/2021.6.30 2021-07-30 20:41:57 +02:00
js6pak 301a851ec3 Handle all handshake versions 2021-07-27 17:42:11 +02:00
js6pak 86c27402e2 Language and chat mode api 2021-07-27 16:59:09 +02:00
miniduikboot c63eb3b2d1 Improve docs (#435) 2021-07-25 19:53:43 +00:00
miniduikboot a1dac9f8b7 Address feedback 2021-07-25 20:22:02 +02:00
miniduikboot 3065e8df48 Check client version when parsing C2S handshake
2021.6.30 added new fields, which aren't present on old clients.

This commit makes sure players on old versions are disconnected properly
instead of the server erroring internally.
2021-07-21 21:53:22 +02:00
miniduikboot dc52e478dc Disable ownership check for BootFromVent 2021-07-21 20:46:33 +02:00
miniduikboot eb86c3c683 Implement RPC 35: Update System 2021-07-21 20:46:33 +02:00
miniduikboot e7c83769ef Implement RPC 34: Boot from vent 2021-07-21 20:46:33 +02:00
miniduikboot c6b8066794 Bump to 1.6 because new net version 2021-07-21 20:46:33 +02:00
miniduikboot 1ec5a050ad Add Vent Cleaning task
As these spawn in various rooms under the same task id the name of this
task does not include a room name
2021-07-21 20:46:33 +02:00
miniduikboot 1e7d132f31 Add Airship Lounge/Showers Empty Garbage tasks
Also Calibrate Distributor moved up
2021-07-21 20:46:33 +02:00
miniduikboot 9543134ef3 Add two extra fields to handshake 2021-07-21 20:46:33 +02:00
miniduikboot 389c72caa6 Bump client version 2021-07-21 20:46:33 +02:00
miniduikbootandjs6pak 66b4d860a9 Improve error when client version is unsupported (#432)
* Improve error when client version is unsupported

In the default message that was used previously the user is asked to
upgrade his game. This is not always correct, as sometimes the Impostor
server is too old and should be updated instead. Therefore custom
disconnect messages are used that blames either the user or the server
operator, which is hopefully more accurate.

I've chosen not to include the game version that is supported by the
server in this message because the network version rarely matches the
advertised version in the main menu.

* Rewrite versionCompare switch case

Co-authored-by: js6pak <kubastaron@hotmail.com>

Co-authored-by: js6pak <kubastaron@hotmail.com>
2021-07-13 22:48:24 +02:00
js6pak dca26cff59 Log unsupported version 2021-07-07 19:01:48 +02:00
js6pak 3437c86bff Merge pull request #430 from Bramux/fix-hat-mismatch
Fix mismatched hats
2021-07-05 23:19:30 +02:00
Bramux 66fb8426a6 Correct hat mismatches 2021-07-05 22:26:28 +02:00
js6pak 4c839e2dd8 Merge pull request #429 from miniduikboot/fix/style 2021-07-05 21:22:28 +02:00
js6pak c6aa596e3b Fix warnings in Impostor.Benchmarks 2021-07-05 21:13:56 +02:00
miniduikboot d8843db3eb Use var instead of explicit type
Also prevent future issues
2021-07-05 20:36:56 +02:00
miniduikboot b918f25443 Remove unnecessary imports
And add rule to prevent future issues
2021-07-05 20:36:56 +02:00
js6pak 824359f93b Merge pull request #428 from miniduikboot/fix/colortype
Correct ColorType array
2021-07-05 20:33:11 +02:00
js6pak 046d09b5fa Merge pull request #427 from miniduikboot/fix/airship-spawn
Stop cancelling initial Airship spawn SnapTo RPC
2021-07-05 20:30:12 +02:00
miniduikboot 5410c71280 Correct ColorType array
When creating this array for the update, I used the wrong array. Oops!
Turns out 5 of these colors aren't actually in the game.
2021-07-05 20:06:21 +02:00
miniduikboot 241e867343 Stop cancelling initial Airship spawn SnapTo RPC
This is used to hide players that are still selecting their spawn
location. If this is cancelled, players are left standing at the
location they were at when the last meeting was called, which is undesirable.
2021-07-05 20:01:20 +02:00
js6pak 11f2ffd24d Remove legacy regionInfo patcher 2021-07-05 18:27:59 +02:00
js6pak 9df01d2cf7 Merge pull request #423 from miniduikboot/feature/2021.6.15 2021-06-26 20:26:07 +00:00
miniduikboot d2720442e9 Turn derived properties into getters
There is no significant performance difference: while accessing the
getters is slightly slower, this can be balanced against the cost of
setting the property. As this is also cleaner, switch to getters.
2021-06-25 18:46:28 +02:00
miniduikboot ddedffd121 Refactor Polus meeting room spawning logic
Also adjust the constants to the new constants used in game
2021-06-25 18:46:28 +02:00
miniduikboot 2f04f6ea98 Stub implementation of SendQuickChat
Proper API will follow later
2021-06-25 18:46:28 +02:00
miniduikboot 5f4c40bf36 Remove the table from the Readme
As Among Us is getting a lot of small network-compatible bugfix releases
nowadays, it doesn't seem necessary to maintain the table anymore.
Release notes state clearly which network version is supported and there
is limited support for old versions anyway.
2021-06-25 18:46:28 +02:00
miniduikboot ef4cc5646b Simplify the setup instructions
The patcher has not been updated to support the new JSON format and is
less necessary now that JSON is used for the region file format.

The website also now has deeplinking support, so we point Android/iOS
people to the website now too as that is more convenient compared to the
previous methods.
2021-06-25 18:46:28 +02:00
js6pak d894e9adc3 Meeting changes 2021-06-25 18:46:28 +02:00
js6pak c086cf80b1 Announcements protocol changes 2021-06-25 18:46:28 +02:00
js6pak 1118a59167 Update GameKeywords 2021-06-25 18:46:28 +02:00
miniduikboot 5154dd9aa5 Adjust Polus Meeting table spawn locations 2021-06-25 18:46:28 +02:00
miniduikboot a621225fcd Add new colors 2021-06-25 18:46:28 +02:00
miniduikboot 73a5463848 Update supported GameVersions 2021-06-25 18:46:28 +02:00
miniduikboot 02d25a290f Bump version because new net version 2021-06-15 22:20:07 +02:00
ced530b83a Added player voted event (#181)
Co-authored-by: AeonLucid <aeonlucid@outlook.com>
Co-authored-by: js6pak <kubastaron@hotmail.com>
2021-06-11 12:33:38 +00:00
8f1cba8429 Using MapData for Tasks (#395)
Co-authored-by: John Tran <john.tran.84@live.com.au>
Co-authored-by: js6pak <kubastaron@hotmail.com>
2021-06-10 18:54:34 +00:00
js6pak 9009bac883 Merge pull request #417 from miniduikboot/fix/initialize-color 2021-06-10 18:38:17 +00:00
miniduikboot f3460f05bc Initialize Color to -1 instead of Red
This could lead to an AC disconnect if the host picked red and waited
for other players to rejoin before joining back himself. Before this
commit, the host would SetColor himself to Red, but this would be
flagged as all other players would have been set to Red as enums
initialize to 0 (= Red) by default.

After the host SetColor'd himself, the host will send over the color
array, which initializes player colors to -1. This commit follows AU by
also initializing the color to -1, preventing the AC from flagging the
duplicate colors.
2021-05-30 18:30:47 +02:00
miniduikboot a13fee108f Fix KeyNotFoundException for nonexistent vents (#413)
Some mods add extra vents that don't yet exist, this commit checks if a
given vent exists and if it doesn't, throw an AC violation instead of
disconnecting the player

One downside is that the Enter/ExitVent events are no longer called, but
this would require the vent in that event to become nullable
2021-05-17 17:13:54 +00:00
js6pak adc0e6fe9b Don't broadcast packets of kicked players 2021-05-12 18:49:20 +02:00
js6pak ce62815dc5 Add custom message support (#404) 2021-05-10 11:08:26 +00:00
js6pak b1a0adaa28 Merge pull request #389 from Impostor/plugin-info-from-csproj 2021-04-27 17:54:53 +00:00
js6pak fe697b1b63 Deprecate old ImpostorPluginAttribute constructor 2021-04-27 14:58:16 +02:00
js6pak 55e6d38f9f Merge pull request #400 from HarmHoog/skin-hat-types 2021-04-26 12:48:16 +00:00
cchudant b73a46ff56 [skip ci] Rename dev branch in Running-the-server.md (#402) 2021-04-26 12:47:03 +00:00
js6pak 901deeff59 Remove ownership check from InnerVoteBanSystem 2021-04-21 22:01:01 +02:00
Harm Hoogeveen f2126fd4c6 Add new skin types 2021-04-20 14:24:06 +02:00
Harm Hoogeveen 9aa6109b3a Add new hat types 2021-04-20 14:23:02 +02:00
js6pak e1a6fdda98 Make it possible to read plugin information from csproj attributes 2021-04-13 23:13:52 +02:00
Harm Hoogeveenandjs6pak 283f59b51f Allow plugins to set dependencies, softdependencies and loadbefores to determine the load order of plugins (#385)
Co-authored-by: js6pak <kubastaron@hotmail.com>
2021-04-13 20:28:24 +00:00
Minorusamaandjs6pak d47343df08 BeforeGameCreatedEvent (#266)
Co-authored-by: js6pak <kubastaron@hotmail.com>
2021-04-13 16:29:44 +00:00
js6pak 0bb5442a3a Merge pull request #387 from Impostor/murder-check-ping
Add simple ping toleration to murder player check
2021-04-13 15:17:20 +00:00
js6pak 7ac6c32b5d Set configuration's BasePath to CurrentDirectory 2021-04-13 11:29:08 +02:00
112batman fbd9f12f9e Add GameHostChange event (#277) 2021-04-12 20:53:14 +00:00
js6pak f43577b745 Add simple ping toleration to murder player check 2021-04-11 16:05:08 +02:00
js6pak a56eed2680 Use actual disconnect message in ClientBase#DisconnectAsync 2021-04-11 14:57:29 +02:00
js6pak f0434f071c Merge pull request #377 from Impostor/airship 2021-04-11 12:04:31 +00:00
js6pak 8d27016cb7 Fix xmldoc warnings 2021-04-10 23:00:34 +02:00
js6pak e941796a4c Bump version 2021-04-10 22:55:40 +02:00
js6pak 1d66f07906 Make vent data initialization much cleaner 2021-04-10 17:14:17 +02:00
js6pak 7764987f91 Specify enum values for Platforms 2021-04-09 23:51:50 +02:00
js6pak bfba4385fd Make PlayerVentEvent an actual PlayerVentEvent 2021-04-06 21:10:53 +02:00
js6pak f03e72206e Update example plugin 2021-04-06 20:51:06 +02:00
js6pak 304b4bb7bf Rework vent api 2021-04-06 20:51:06 +02:00
970f826dc8 Allow Android Versions (#375)
Co-authored-by: js6pak <kubastaron@hotmail.com>
Co-authored-by: John Tran <john.tran.84@live.com.au>
2021-04-06 18:50:50 +00:00
js6pak 0a30fe5a3e Bring back tar.gz for unix builds 2021-04-05 15:27:25 +02:00
js6pak 4866a350f8 Implement airship spawning, closes #376 2021-04-04 23:27:39 +02:00
js6pak 13bddeb7bd Split ShipStatus to multiple classes, implement new door types 2021-04-04 23:27:39 +02:00
js6pak 225b56e71f Fix cheatcontext in ValidateImpostor calls 2021-04-04 23:27:39 +02:00
js6pak 60bf6b5f58 Fix namespaces 2021-04-04 23:27:39 +02:00
b5cee48242 Airship Vent Enums (#373)
Co-authored-by: miniduikboot <5243971+miniduikboot@users.noreply.github.com>
Co-authored-by: John Tran <john.tran.84@live.com.au>
2021-04-04 10:31:28 +00:00
js6pak c750c65481 Merge pull request #372 from miniduikboot/2021.3.31 2021-04-04 10:26:07 +00:00
miniduikboot d801a36af8 Rename things for 6pak 2021-04-04 10:35:00 +02:00
miniduikboot 441d9c300c Move PlayerVentEvent call to applicable RPC's 2021-04-03 00:46:34 +02:00
miniduikboot 7fd68e31e6 Fix Docker container build 2021-04-03 00:37:12 +02:00
miniduikboot 47aebe7b7b Fix InnerShipStatus deserializing
3.31 now distributes them as multiple messages

This also explains the two weird bytes in HeliSabotage, so these can be
removed too
2021-04-03 00:29:05 +02:00
miniduikboot 66c2434320 Implement HeliSabotageSystemType
It works, although I'm not completely sure why.
2021-04-03 00:29:05 +02:00
miniduikboot c01062ed65 implement rpc 32: use platform 2021-04-03 00:29:05 +02:00
miniduikboot d5ae007d1c implement rpc 31: climb ladder 2021-04-03 00:29:05 +02:00
miniduikboot 16a2b0aac6 I counted the doors on Airship
and I hope I counted correctly
2021-04-03 00:29:05 +02:00
miniduikboot 4c1bd4a578 editorconfig: Don't indent blocks in case contents
This is more in line with the existing codebase
2021-04-03 00:29:05 +02:00
miniduikboot d311150967 API: update enums for airship 2021-04-03 00:29:05 +02:00
miniduikboot 92e3506f51 First attempt at getting some airship stuff online 2021-04-03 00:29:05 +02:00
miniduikboot a63fc40099 Gamedata packets are now have initial state false
I managed to get into a lobby with this
2021-04-03 00:29:05 +02:00
js6pak 4f53d3f4e6 Hopefully fix the submodule 2021-04-03 00:14:33 +02:00
js6pak a39fae3325 Initial auth implementation 2021-04-03 00:12:15 +02:00
js6pak 7c34836d50 Remove reactor stuff 2021-04-03 00:12:15 +02:00
js6pak 989b06d04c Use BitConverter.Int32BitsToSingle in SpanReaderExtensions 2021-04-03 00:12:15 +02:00
js6pak 11e87e51db Update airship constants 2021-04-03 00:12:15 +02:00
js6pak b90e5b2c88 Switch back hazel to submodule 2021-04-03 00:11:55 +02:00
js6pak a0627bbc87 Always hook control with playerInfo 2021-03-28 20:46:31 +02:00
js6pak 40a41f3573 Fix a bug causing InnerPlayerInfo.Controller to be always null 2021-03-28 19:27:49 +02:00
js6pak 8621f09761 Merge pull request #333 from Impostor/fix/style-warnings
Fix warnings
2021-03-25 20:37:47 +00:00
js6pak 3321e3049f Make configs actually work with dependency injection 2021-03-24 20:05:26 +01:00
js6pak a90bbebab9 Update appveyor.yml for the ultimate yellow-less experience 2021-03-24 20:04:40 +01:00
js6pak f4dc0cd403 Revert hazel changes for easier merging with its upstream 2021-03-24 19:53:01 +01:00
js6pak fbed06bf81 Add icon to nuspec 2021-03-24 19:08:23 +01:00
js6pak ef5320c820 Update cake 2021-03-24 19:04:11 +01:00
js6pak bc85ef6810 Fix xmldoc warnings 2021-03-24 17:55:15 +01:00
js6pak e90ba734ab Code cleanup 2021-03-24 16:57:11 +01:00
js6pak 0f6bfb3597 Fix warnings 2021-03-24 16:38:23 +01:00
js6pak dc759b1d57 Fix FloatRange ranges 2021-03-23 21:21:11 +01:00
Minorusama be332e21d1 Add IInnerPlayerControl#ExileAsync (#271) 2021-03-23 20:12:39 +00:00
js6pak fe7a641bad Set VERSIONSUFFIX to docker by default 2021-03-16 22:12:56 +01:00
js6pak e0041e89d8 Update docker CI 2021-03-16 21:40:54 +01:00
js6pak f04bacf0de Update Server-configuration.md 2021-03-14 22:30:01 +00:00
js6pak 7e16b5595a Include AntiCheat.Enabled in default config.json 2021-03-14 23:25:56 +01:00
js6pak a1c59363a1 Merge remote-tracking branch 'origin/2021.3.5' 2021-03-14 23:19:35 +01:00
js6pak ea1085406a Fix typo in README.md 2021-03-14 21:23:10 +00:00
js6pak e359f0a15d Update README.md 2021-03-14 22:19:48 +01:00
js6pak 72f1e81c5f Merge branch '2021.3.5' 2021-03-14 22:04:44 +01:00
js6pak 443168ef71 Add DateTime to server replays (#349) 2021-03-14 20:50:55 +00:00
Galster-dev 20d5284a7a minor README.md changes (#342) 2021-03-10 23:06:12 +01:00
js6pak 9915f8b0cf Expose IsCancelled to IPlayerChatEvent 2021-03-07 16:49:57 +01:00
js6pak 0901be56f5 Implement GameData 205 2021-03-07 16:41:19 +01:00
miniduikboot 3090cea768 Remove fake player joining (#341) 2021-03-07 16:36:37 +01:00
js6pak 1059a4da16 Add debug logs in AnnouncementsService 2021-03-06 18:13:16 +01:00
js6pak acd2a56898 Simplify Message01JoinGameC2S 2021-03-06 17:20:36 +01:00
js6pak 575ad25fb6 New GameDataTags 2021-03-06 17:15:12 +01:00
AeonLucid 781ba34e1b Fix Impostor.Tools.ServerReplay compilation 2021-03-06 17:07:35 +01:00
js6pak 9bd43b4629 2021.3.5 2021-03-06 00:45:46 +01:00
js6pak e769b874c8 Add create game api (#241) 2021-03-04 09:11:50 +00:00
miniduikboot be19b1524b Warn if plugin loader paths don't exist (#330) 2021-03-03 14:36:17 +00:00
112batman 020a1b6447 Implement IInnerNetObject in IInnerMeetingHud (#256) 2021-03-03 09:23:38 +00:00
js6pak bbbf368a6f Bump version 2021-03-03 10:15:48 +01:00
js6pak d4bffd20ad [skip ci] Update Building-from-source.md 2021-03-03 09:05:33 +00:00
87a062c1b3 Sync Impostor with 6pak fork (#327)
Co-authored-by: DatGuy1 <datguysteam@gmail.com>
Co-authored-by: miniduikboot <5243971+miniduikboot@users.noreply.github.com>
2021-03-03 08:53:53 +00:00
js6pak f2d6531063 Add CheckName/SetName/CheckColor/SetColor anticheat checks (#278)
* Add CheckName/SetName/CheckColor/SetColor anticheat checks

* Disable expected checks for the host
2021-01-08 18:42:41 +01:00
573 changed files with 21730 additions and 12777 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.5",
"version": "2.2.0",
"commands": [
"dotnet-cake"
]
-17
View File
@@ -1,17 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+53
View File
@@ -0,0 +1,53 @@
name: CI
on:
push:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- 'build.cake'
pull_request:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- 'build.cake'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.x
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
verbosity: Diagnostic
- uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
draft: true
files: |
./build/*.zip
./build/*.tar.gz
./build/*.nupkg
./build/*.snupkg
- name: Push NuGet package
if: github.ref_type == 'tag'
run: |
dotnet nuget push ./build/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_IMPOSTOR }}
+16 -16
View File
@@ -2,11 +2,10 @@ name: Docker
on:
push:
branches: dev
branches: master
paths:
- 'src/Impostor.Server/**'
- 'src/Impostor.Shared/**'
- '.gitmodules'
- '.github/workflows/docker.yml'
- 'Dockerfile'
tags:
@@ -15,7 +14,6 @@ on:
paths:
- 'src/Impostor.Server/**'
- 'src/Impostor.Shared/**'
- '.gitmodules'
- '.github/workflows/docker.yml'
- 'Dockerfile'
@@ -25,35 +23,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
uses: actions/checkout@v4
- name: Prepare
id: prep
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
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo version=${VERSION} >> $GITHUB_OUTPUT
echo tags=${TAGS} >> $GITHUB_OUTPUT
echo versionsuffix=${VERSIONSUFFIX} >> $GITHUB_OUTPUT
echo created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
@@ -61,10 +59,12 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
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 }}
+3 -3
View File
@@ -9,14 +9,14 @@ We are always looking for people to help improve Impostor.
- Don't commit unnecessary changes to the codebase or debugging code.
- Write meaningful commits or squash them.
- Please try to follow the code style of the rest of the codebase. An `.editorconfig` file has been provided to keep consistency.
- Stylecop is also enabled: please make sure your PR compiles without warnings.
## Pull requests
- Only make pull requests to the `dev` branch.
- Only implement one feature per pull request to keep it easy to understand.
- Expect comments or questions on your pull request from the project maintainers. We try to keep the code as consistent and maintainable as possible.
- Each pull request should come from a new branch in your fork, it should have a meaningful name.
- Each pull request should come from a new branch in your fork, it should have a meaningful name.
- We try to respond to pull requests as fast as possible. If you think we might have missed it, let us know on [Discord](https://discord.gg/Mk3w6Tb).
If you have any questions, let us know.
If you have any questions, let us know.
+16 -8
View File
@@ -1,15 +1,18 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# See for all possible platforms
# 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.Api.Innersloth.Generator/Impostor.Api.Innersloth.Generator.csproj ./src/Impostor.Api.Innersloth.Generator/Impostor.Api.Innersloth.Generator.csproj
COPY src/Impostor.Api/Impostor.Api.csproj ./src/Impostor.Api/Impostor.Api.csproj
COPY src/Impostor.Hazel/Impostor.Hazel.csproj ./src/Impostor.Hazel/Impostor.Hazel.csproj
COPY src/Directory.Build.props ./src/Directory.Build.props
RUN case "$TARGETARCH" in \
amd64) NETCORE_PLATFORM='linux-x64';; \
@@ -18,8 +21,8 @@ RUN case "$TARGETARCH" in \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Server/Impostor.Server.csproj && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Hazel/Impostor.Hazel.csproj
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api.Innersloth.Generator/Impostor.Api.Innersloth.Generator.csproj && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj
# Copy everything else.
COPY src/. ./src/
@@ -29,11 +32,16 @@ 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:5.0
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app ./
EXPOSE 22023/udp
ENTRYPOINT ["./Impostor.Server"]
# Override ASPNETCORE_URLS to stop warning.
ENV ASPNETCORE_URLS=
EXPOSE 22023/tcp 22023/udp
ENTRYPOINT ["./Impostor.Server"]
+6 -36
View File
@@ -1,16 +1,13 @@
# Impostor
[![Discord](https://img.shields.io/badge/Discord-chat-blue?style=flat-square)](https://discord.gg/Mk3w6Tb)
[![AppVeyor](https://img.shields.io/appveyor/build/Impostor/Impostor/dev?style=flat-square)](https://ci.appveyor.com/project/Impostor/Impostor/branch/dev)
[![CI](https://github.com/Impostor/Impostor/workflows/CI/badge.svg)](https://github.com/Impostor/Impostor/actions)
Impostor is one of the first **Among Us** private servers, written in C#.
Impostor is the first working **Among Us** private server, written in C#.
We support Steam, Itch, Android and iOS. The latest version supported is `2020.9.22`, the `dev` build currently supports `2020.11.17`.
As Among Us is actively updated, you may want to use the latest build from the master branch if you want to play on the latest version of Among Us that supported by Impostor.
| Impostor version | Among Us version | Experimental | Download |
|-|-|-|-|
| 1.1.0 | 2020.09.07 - 2020.09.22 | No | [![Download](https://img.shields.io/badge/Download-v1.1.0-blue?style=flat-square)](https://github.com/Impostor/Impostor/releases/tag/v1.1.0) |
| 1.2.2 | 2020.09.22 - 2020.11.17 | Yes | [![Download](https://img.shields.io/badge/Download-v1.2.2-blue?style=flat-square)](https://ci.appveyor.com/project/Impostor/Impostor/branch/dev/artifacts) |
If you want to play on an older version of Among Us, you can download old releases from [here](https://github.com/Impostor/Impostor/releases/), however these versions are less supported.
## Features
@@ -22,34 +19,7 @@ We support Steam, Itch, Android and iOS. The latest version supported is `2020.9
### Client
If you just want to play on a server hosted by someone else, you need to follow these instructions.
#### Windows
1. Find the [latest release](https://github.com/AeonLucid/Impostor/releases/latest).
2. Download `Impostor-Client-win-x64.zip`.
3. Extract the zip.
4. Run `Impostor.Client.exe`.
5. Follow the instructions inside the application.
![Client](docs/images/client.jpg)
If you do not wish to execute any programs. Follow the instructions in [this website](https://impostor.github.io/Impostor)
#### Android
##### Android 10 and below.
1. Go to [this website](https://impostor.github.io/Impostor) **(ON YOUR MOBILE DEVICE)**
2. Follow the instructions listed there.
##### Android 11.
1. Connect your phone to a computer. Go to [this website](https://impostor.github.io/Impostor) on the computer and follow the steps 1 and 2 to generate a `regionInfo.dat` file.
2. Instead of following the next steps, open the phone's internal storage on your computer and navigate to `/sdcard/Android/data/com.innersloth.spacemafia/files`.
3. Copy the generated `regionInfo.dat` file into the `files` folder you just navigated to.
#### iOS
iOS devices need to be jailbroken in order to connect to Impostor servers.
If you just want to play on a server hosted by someone else, you need to configure your client to connect to an Impostor server. Please go to [this website](https://impostor.github.io/Impostor) to set up your client by following the instructions for your OS there.
### Server
@@ -57,7 +27,7 @@ See the [docs](docs/Running-the-server.md) for instructions on how to set it up.
## Troubleshooting
See [TROUBLESHOOTING](docs/TROUBLESHOOTING.md) to solve issues the Impostor client or the server.
See [TROUBLESHOOTING](docs/TROUBLESHOOTING.md) to solve issues with the Impostor client or the server.
## Contributing
-51
View File
@@ -1,51 +0,0 @@
version: '{build}'
environment:
IMPOSTOR_VERSION: '1.2.2'
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: Visual Studio 2019 Preview
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
+59 -72
View File
@@ -1,20 +1,33 @@
#addin "nuget:?package=SharpZipLib&Version=1.3.0"
#addin "nuget:?package=Cake.Compression&Version=0.2.4"
#addin "nuget:?package=Cake.FileHelpers&Version=3.3.0"
#addin "nuget:?package=SharpZipLib&Version=1.3.3"
#addin "nuget:?package=Cake.Compression&Version=0.3.0"
#addin "nuget:?package=Cake.FileHelpers&Version=5.0.0"
var workflow = BuildSystem.GitHubActions.Environment.Workflow;
var buildId = workflow.RunNumber;
var tag = workflow.RefType == GitHubActionsRefType.Tag ? workflow.RefName : null;
var buildId = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "0";
var buildVersion = EnvironmentVariable("IMPOSTOR_VERSION") ?? "1.0.0";
var buildBranch = EnvironmentVariable("APPVEYOR_REPO_BRANCH") ?? "dev";
var buildVersion = FindRegexMatchGroupInFile("./src/Directory.Build.props", @"\<VersionPrefix\>(.*?)\<\/VersionPrefix\>", 1, System.Text.RegularExpressions.RegexOptions.None).Value;
var buildDir = MakeAbsolute(Directory("./build"));
var prNumber = EnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER");
var target = Argument("target", "Deploy");
var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");
// On any branch that is not master, we need to tag the version as prerelease.
if (buildBranch != "master") {
buildVersion = buildVersion + "-ci." + buildId;
var msbuildSettings = new DotNetMSBuildSettings();
if (tag != null)
{
if (tag[1..] != buildVersion) throw new Exception("Tag version has to be the same as VersionPrefix in Directory.Build.props");
msbuildSettings.Version = buildVersion;
}
else if (buildId != 0)
{
buildId += 500;
msbuildSettings.VersionSuffix = "ci." + buildId;
buildVersion += "-ci." + buildId;
}
else
{
buildVersion += "-dev";
}
//////////////////////////////////////////////////////////////////////
@@ -26,15 +39,15 @@ private void ImpostorPublish(string name, string project, string runtime, bool i
var projBuildDir = buildDir.Combine(name + "_" + runtime);
var projBuildName = name + "_" + buildVersion + "_" + runtime;
DotNetCorePublish(project, new DotNetCorePublishSettings {
DotNetPublish(project, new DotNetPublishSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net5.0",
Runtime = runtime,
SelfContained = false,
PublishSingleFile = true,
PublishTrimmed = false,
OutputDirectory = projBuildDir
OutputDirectory = projBuildDir,
MSBuildSettings = msbuildSettings
});
if (isServer) {
@@ -51,6 +64,10 @@ private void ImpostorPublish(string name, string project, string runtime, bool i
} else {
GZipCompress(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".tar.gz"));
}
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
BuildSystem.GitHubActions.Commands.UploadArtifact(projBuildDir, projBuildName);
}
}
private void ImpostorPublishNF(string name, string project) {
@@ -58,11 +75,12 @@ private void ImpostorPublishNF(string name, string project) {
var projBuildDir = buildDir.Combine(name + "_" + runtime);
var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
DotNetCorePublish(project, new DotNetCorePublishSettings {
DotNetPublish(project, new DotNetPublishSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net472",
OutputDirectory = projBuildDir
OutputDirectory = projBuildDir,
MSBuildSettings = msbuildSettings
});
Zip(projBuildDir, projBuildZip);
@@ -83,96 +101,65 @@ Task("Clean")
Task("Restore")
.Does(() => {
DotNetCoreRestore("./src/Impostor.sln");
});
Task("Patch")
.WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor)
.Does(() => {
ReplaceRegexInFiles("./src/**/*.csproj", @"<Version>.*?<\/Version>", "<Version>" + buildVersion + "</Version>");
ReplaceRegexInFiles("./src/**/*.props", @"<Version>.*?<\/Version>", "<Version>" + buildVersion + "</Version>");
DotNetRestore("./src/Impostor.sln");
});
Task("Replay")
.Does(() => {
// D:\Projects\GitHub\Impostor\Impostor\src\Impostor.Tools.ServerReplay\sessions
DotNetCoreRun(
DotNetRun(
"./src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj",
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetCoreRunSettings {
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetRunSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net5.0"
});
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Patch")
.IsDependentOn("Restore")
.IsDependentOn("Replay")
.Does(() => {
// Tests.
DotNetCoreBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreBuildSettings {
DotNetBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetBuildSettings {
Configuration = configuration,
});
// Only build artifacts if;
// - buildBranch is master/dev
// - it is not a pull request
if ((buildBranch == "master" || buildBranch == "dev") && string.IsNullOrEmpty(prNumber)) {
// 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);
// 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
});
} else {
DotNetCoreBuild("./src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj", new DotNetCoreBuildSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net472"
});
// API.
DotNetPack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetPackSettings {
Configuration = configuration,
OutputDirectory = buildDir,
IncludeSource = true,
IncludeSymbols = true,
MSBuildSettings = msbuildSettings
});
DotNetCoreBuild("./src/Impostor.Server/Impostor.Server.csproj", new DotNetCoreBuildSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net5.0"
});
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
foreach (var file in GetFiles(buildDir + "/*.{nupkg,snupkg}"))
{
BuildSystem.GitHubActions.Commands.UploadArtifact(file, "Impostor.Api");
}
}
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetCoreTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreTestSettings {
DotNetTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetTestSettings {
Configuration = configuration,
NoBuild = true
});
});
Task("Deploy")
.IsDependentOn("Test")
.Does(() => {
Information("Finished.");
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
RunTarget(target);
+9 -25
View File
@@ -1,45 +1,29 @@
# Building from source
The solution contains two main projects, the Impostor client and server. The client is built using [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) and the server with [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0).
Currently .NET 5 is not yet officially released, so in order to build using Visual Studio, you should have Visual Studio 2019 **Preview** installed.
This documentation will go over building both the [Server](#building-the-server) and the [Client](#building-the-client) and their requirements.
The solution contains the Impostor server and its dependencies, like Hazel and the plugin API. The server is built using [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0).
## Cloning Impostor
You need to clone Impostor with all submodules.
You need to clone Impostor using git:
```bash
git clone --recursive https://github.com/AeonLucid/Impostor.git
```
If you already have cloned Impostor but have errors related to Hazel, run the following.
```bash
git submodule update --init
git clone https://github.com/Impostor/Impostor.git
```
## Building the server
### Dependencies
- [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)
- [Visual Studio Preview](https://visualstudio.microsoft.com/vs/preview/) (Optional, only if you want the full IDE experience)
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.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
# Or if you want a single file, ready for production: (change linux-x64 to win-x64 if you use Windows)
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true
```
To setup the server, please look at [Running the server](Running-the-server.md).
## Building the client
### Dependencies
* [.NET Framework 4.7.2 Developer Pack](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net472-developer-pack-offline-installer)
### Build using the CLI
```bash
cd src/Impostor.Client/Impostor.Client.WinForms
dotnet build
```
+7 -3
View File
@@ -1,11 +1,15 @@
# Frequently Answered Questions
## What is this?
The Impostor project is a reverse engineered and open sourced server for the game Among Us. The game itself is developed by [InnerSloth](http://www.innersloth.com/) while this project is maintained by the community. This project was built out of frustration for the lack of server availability in certain regions and the inability for the core developer, [AeonLucid](https://github.com/AeonLucid), to join a public game. As of this time, it has not been officially endorsed by the studio.
The Impostor project is a reverse engineered and open source server for the game Among Us. The game itself is developed by [Innersloth](http://www.innersloth.com/) while this project is maintained by the community. This project was built out of frustration for the lack of server availability in certain regions and the inability for the core developer, [AeonLucid](https://github.com/AeonLucid), to join a public game. As of this time, it has not been officially endorsed by the studio.
## Can this be used with the mobile version of the game?
Yes, Impostor can be used with both the Android and iOS\* versions of the game.
###### \* In order to play on an Impostor server with iOS, you _must_ have a jailbroken device.
Yes, Impostor can be used with both the Android and iOS versions of the game. You can add a custom server via a link, you can do this using the [site](https://impostor.github.io/Impostor)
## How can I get started?
See [Setting up your Server](Running-the-server.md) for more information on running the server and [Client Setup](https://impostor.github.io/Impostor/) for helping your friends join in!
If you're having issues with the server software, check the [Troubleshooting page](TROUBLESHOOTING.md).
+67
View File
@@ -0,0 +1,67 @@
# HTTP Server
Since Impostor 1.9.0 a HTTP service is included for matchmaking. Recent versions of Among Us require this service in order to connect correctly and not kick players after a round.
Depending on whether you want to support mobile players, you can set up the HTTP server in one of two ways:
- Directly expose the HTTP server. Simpler, but only works if you don't want to support mobile players.
- Use a reverse proxy to expose the HTTP server. More complex, but allows mobile players to connect.
## Directly expose the HTTP server.
In config.json, set "ListenIp" to "0.0.0.0" in the "HttpServer" section. If you don't have this section, look in the example [config.json](https://github.com/Impostor/Impostor/blob/master/src/Impostor.Server/config.json)
## Use a reverse proxy
A reverse proxy allows you to forward HTTP requests from users to multiple services. If you already have one, you should configure it to add Impostor. This page contains an Nginx configuration you can use for reference.
If you have never set up a reverse proxy before, we recommend you to set up [Caddy](https://caddyserver.com/). It is easy to set up and comes with support for requesting SSL certificates out of the box.
To prevent people from connecting directly to Impostor, we recommend changing the "ListenIp" in the "HttpServer" section to "127.0.0.1". This makes sure people can't connect to your HTTP server other than via your reverse proxy. Keep the "ListenIp" in the "Server" section at "0.0.0.0" though, running the normal game traffic through a proxy is not supported.
### Caddy
To install Caddy, follow the [official installation guide](https://caddyserver.com/docs/install). Then use the following lines as your `Caddyfile` configuration file:
```
example.com # replace example.com with your domain name
reverse_proxy :22023
```
Now run `caddy run` in the folder with this Caddyfile and it should set up a server for you with a free SSL certificate.
If this works, you should set up [Caddy to run in the background](https://caddyserver.com/docs/running)
### Nginx
Nginx is an alternative to Caddy that is a bit harder to set up. If you already use Nginx, you can use our snippet to add Impostor:
<details><summary>Nginx configuration</summary>
```nginx
server {
listen 443 ssl http2;
server_name example.com; # replace example.com with your domain name
# Assuming you're using Certbot, replace example.com with your domain name
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
location / {
proxy_pass http://localhost:22023; # Change the port to your HttpServer's ListenPort
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# Redirect all traffic to HTTPS
server {
listen 80 default_server;
location / {
return 307 https://$host$request_uri;
}
}
```
</details>
+40 -77
View File
@@ -1,30 +1,50 @@
# Running the server
There are currently two modes to run the Impostor server in. The first way is the simplest one and is the one you should probably use. The other way will distribute players across other servers and is a more advanced configuration.
There are currently two install methods for Impostor: You can install it normally or inside of a Docker container. If you do not have a particular preference, we recommend the normal installation over the Docker container method.
## Single server
## General remarks for both install methods
### Without docker
1. Install the **.NET 5.0 runtime**.
- [Windows x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-5.0.0-windows-x64-installer)
- [Linux x64](https://docs.microsoft.com/en-us/dotnet/core/install/linux)
- [macOS x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-5.0.0-macos-x64-installer)
2. Find the [latest dev release](https://ci.appveyor.com/project/Impostor/Impostor/branch/dev/artifacts).
3. Download either the Windows or the Linux version.
4. Extract the zip.
5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md) *(this step is mandatory if you want to expose this server to other devices)*
6. Run `Impostor.Server.exe` (Windows) / `Impostor.Server` (Linux)
This section applies to both the normal installation as well as the Docker (Compose) installation
### Using docker
To connect to the server, you need to configure and install a region file on https://impostor.github.io/Impostor/
[![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor?sort=semver)](https://hub.docker.com/repository/docker/aeonlucid/impostor)
[![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor/nightly)](https://hub.docker.com/repository/docker/aeonlucid/impostor)
Among Us connects to the server using two network services: the (TCP) HTTP service points Among Us to the UDP service, then the UDP service hosts the actual game traffic. Because of this, Impostor uses port 22023 using **both** the TCP and UDP protocols.
As the phone version of Among Us requires this HTTP connection to be secure, we recommend using a HTTP reverse proxy to terminate SSL on the HTTP service. Setup instructions for this are in the [Http Server documentation](Http-server.md).
Depending on your host you may also need to port forward Impostor to the internet or pass Impostor traffic by your firewall. Port 22023 UDP needs to be accessible for everyone that wants to play on the server, then you also need to portforward your HTTP reverse proxy or port 22023 TCP if you don't use a reverse proxy. As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
## Normal installation
1. Install [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0). We recommend either the ASP.NET Core Runtime or the SDK. The SDK is necessary in case you want to develop Impostor or Impostor plugins.
2. Download the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master). Note that Impostor is built for multiple CPU-architectures and operating systems, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device/VPS with an Arm processor.
3. Extract the zip.
4. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md). You need to at least change `PublicIp` to the address people will connect to your server to.
5. Run `Impostor.Server` (Linux/macOS) or `Impostor.Server.exe` (Windows)
6. (OPTIONAL - Linux) Configure a systemd definition file and enable the service to start on boot, see [systemd configuration](Server-configuration.md#systemd)
7. (OPTIONAL) Set up a reverse proxy to support HTTPS, so mobile phones can connect, see [reverse proxy configuration](Http-server.md)
## Using Docker
[![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor?sort=semver)](https://hub.docker.com/r/aeonlucid/impostor)
[![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor/nightly)](https://hub.docker.com/r/aeonlucid/impostor)
Docker is a program that allows you to run programs like Impostor in a container.
After installing Docker, you can just start a Docker container with `docker run`:
```
docker run -p 22023:22023/udp aeonlucid/impostor:nightly
docker run -p 22023:22023/tcp -p 22023:22023/udp -e IMPOSTOR_Server__PublicIp=your.public.ip.here aeonlucid/impostor:nightly
```
### Using docker-compose
Please replace `your.public.ip.here` with the public IP address of your server. This is the address Among Us will try to reach your server at.
To configure the docker container, either use environment variables or mount config.json in your container.
## Using Docker Compose
Docker Compose allows you to start a Docker container using a prefined configuration. This is an example configuration you can continue on:
```
version: '3.4'
@@ -33,69 +53,12 @@ services:
image: aeonlucid/impostor:nightly
container_name: impostor
ports:
- 22023:22023/tcp # Add "127.0.0.1:" if you're using a reverse proxy to terminate HTTPS
- 22023:22023/udp
environment: # Either configure Impostor using environment variables or mount a copy of config.json
- IMPOSTOR_Server__PublicIp=your.public.ip.here
volumes:
- /path/to/local/config.json:/app/config.json # For easy editing of the config
- /path/to/local/plugins:/app/plugins # Only needed if using plugins
- /path/to/local/libraries:/app/libraries # Only needed if using external libraries
```
## Multiple servers
Follow the steps from the single server on two or more servers.
### Master server
The master server will accept client connections and redirect them to the other servers listed in the configuration. It will not host any games itself.
Example configuration:
```json
{
"Server": {
"PublicIp": "127.0.0.1",
"PublicPort": 22023,
"ListenIp": "0.0.0.0",
"ListenPort": 22023
},
"ServerRedirector": {
"Enabled": true,
"Master": true,
"Locator": {
"Redis": "",
"UdpMasterEndpoint": "127.0.0.1:22024"
},
"Nodes": [
{
"Ip": "127.0.0.1",
"Port": 22025
}
]
}
}
```
### Node servers
The node server should have `ServerRedirector` enabled too, but `Master` **must be disabled**. Nodes do not need to be aware of each other.
Example configuration:
```json
{
"Server": {
"PublicIp": "127.0.0.1",
"PublicPort": 22025,
"ListenIp": "0.0.0.0",
"ListenPort": 22025
},
"ServerRedirector": {
"Enabled": true,
"Master": false,
"Locator": {
"Redis": "",
"UdpMasterEndpoint": "127.0.0.1:22024"
}
}
}
```
+153 -51
View File
@@ -1,77 +1,179 @@
# 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`. |
| 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`. For port forwarding purposes: this is an UDP port |
### HttpServer
Impostor has an Http Server that is used by recent versions of Among Us to connect to. See [the Http Server page](Http-server.md) for more details on how to set this up.
| Key | Default | Description |
|----------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Enabled** | `true` | Whether the http server should be enabled. |
| **ListenIp** | `0.0.0.0` | The network interface to listen on. Use `127.0.0.1` if you use a reverse proxy or just run locally. Use `0.0.0.0` if you are directly exposing this server to the internet |
| **ListenPort** | `22023` | The listen port of this server. For port forwarding purposes, this is an TCP port. |
### AntiCheat
| Key | Default | Value |
|-|-|-|
| **BanIpFromGame** | `true` | When a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. **(Setting this to false does not disable the anti-cheat!)** |
Impostor has an Anticheat that makes it possible to kick cheaters from games automatically. Note that the anticheat is tuned on the vanilla version of the game, so client-side modifications could trigger the Anticheat if you're playing with them.
### ServerRedirector
In a multi-node setup these need to be specified.
| Key | Default | Value |
|-|-|-|
| **Enabled** | `false` | Whether the server runs in multi-node setup. If this is `false`, all other options in this section do not have any effect. |
| **Master** | `false` | Whether the current server is a master. A master is responsible for redirecting clients to nodes |
| **Locator** | | Fill in either `Redis` or `UdpMasterEndpoint` to choose which method to use for locating other nodes. This must be the same across all servers. |
| **>Redis** | | Format `127.0.0.1.6379`, you can also use a password like so: `127.0.0.1.6379,password=value`. |
| **>UdpMasterEndpoint** | | On the master, this value acts as a listen ip and port. On a node, this should be the public ip and port of the master. Format `127.0.0.1:32320`. |
| **Nodes** | | An array containing public ips and ports of nodes. Only needs to be set on the master. See above for an example. |
| Key | Default | Value |
|----------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Enabled** | `true` | Whether the anticheat should be enabled. |
| **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. |
| **AllowCheatingHosts** | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set. |
| **EnableGameFlowChecks** | `true` | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast. |
| **EnableMustBeHostChecks** | `true` | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects. |
| **EnableColorLimitChecks** | `true` | Enables checks that checks if players request colors that are already in use. |
| **EnableNameLimitChecks** | `true` | Enables checks that checks if player names have a length that is possible to set using the user interface. |
| **EnableOwnershipChecks** | `true` | Enables checks that check if players are allowed to perform a certain action on themself or another player. |
| **EnableRoleChecks** | `true` | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering. |
| **EnableTargetChecks** | `true` | Enables checks that check if certain packets to everyone that should only have been sent to certain players or vice versa. This includes sending votes or network objects. |
| **ForbidProtocolExtensions** | `true` | If disabled allows players to send network packets that go beyond the network packets sent by the vanilla game. This is necessary for most mods that need all players to install it. |
### Compatibility
Impostor has some compatibility options which allow some extra flexibility but may not work properly. Enabling any of these options is not recommended. When contacting support, please mention which of these options are enabled.
| Key | Default | Value |
|-----------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **AllowFutureGameVersions** | `false` | Warning: Setting this option to `true` is unsupported and may cause issues when large updates to Among Us are released, but can be useful when a small patch is released. Allows future versions of Among Us to join your server. |
| **AllowHostAuthority** | `false` | Certain Among Us mods allow disabling some server-authoritative features, which also changes some code paths in the client. These code paths have not undergone as much testing and contain bugs, which can't be fixed from the Impostor side. Use with caution. |
| **AllowVersionMixing** | `false` | Allows players using different game versions to play in one lobby that have not been marked by the Impostor developers as compatible. |
### Debug
The Debug configuration is used to enable the game recorder. This is mostly useful when developing Impostor.
| Key | Default | Value |
| ----------------------- | ------- | -------------------------------------------- |
| **GameRecorderEnabled** | `false` | Enables the Game Recorder. |
| **GameRecorderPath** | _empty_ | Path where the recorded games will be saved. |
### Serilog (Logging)
Impostor's log framework, Serilog, can be configured in the config file. You can change its default log level and you can add additional sinks.
| Key | Default | Value |
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **MinimumLevel** | `Information` | Minimum log level for a message to be printed. If a log entry is as severe or more severe than this level, it will be printed. From most severe to least severe: `Fatal`,`Error`, `Warning`, `Information`, `Debug`, `Verbose` |
| **Using** | `[]` | List of additional Serilog Sinks assemblies to load. |
| **WriteTo** | `[]` | Additional logging sinks. See the Serilog documentation or the example in this section. Serilog |
For more information, check the [Serilog.Settings.Configuration](https://github.com/serilog/serilog-settings-configuration) documentation.
For example, to add logging to a file, you should add the following snippet to your configuration:
```json
"Serilog": {
"Using": [
"Serilog.Sinks.File"
],
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "logs/log.txt",
"rollingInterval": "Day"
}
}
]
}
```
Next to that, you also need to copy over Serilog.Sinks.File.dll from [NuGet](https://www.nuget.org/packages/Serilog.Sinks.File/). See the [Serilog.Sinks.File documentation](https://github.com/serilog/serilog-sinks-file#json-appsettingsjson-configuration) for a list of parameters that can be configured.
Other Serilog sinks are also supported, but are out of scope for this documentation.
## Config providers
### 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: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
```
The `config.json` file contains all the configurable options.
### Environment variables
TODO
If you're unable to edit the `config.json` file, you can instead set Environment variables to configure Impostor. The general pattern for each variable is `IMPOSTOR_SectionName__VariableName`. For example, to disable the anticheat, you can set the environment variable `IMPOSTOR_AntiCheat__Enabled=false`. Here are some more examples:
```
IMPOSTOR_Server__PublicIp=127.0.0.1
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
```
# systemd
Linux users will likely want to create a systemd service definition to manage running the Impostor application. Benefits to using a systemd service include the following:
- The server process can automatically restart if the process dies
- Impostor can be set to start on boot (handy if you do system updates regularly)
- You can use systemd targets to ensure the process doesn't start until the system dependencies are met
Using your favorite text editor, create the following service file:
```
sudoedit /etc/systemd/system/impostor.service
```
Modify the following template to your needs and populate the service file.
```
[Unit]
Description=Impostor private Among Us server - https://github.com/Impostor/Impostor
[Service]
# Directory where Impostor is installed
WorkingDirectory=/opt/impostor
# Path to Impostor binary
ExecStart=/opt/impostor/Impostor.Server
Restart=always
# Restart service after 10 seconds if the dotnet service crashes
RestartSec=10
KillSignal=SIGTERM
SyslogIdentifier=impostor
# User and group that will run the Impostor server process -- ensure that user is allowed to execute the binary
User=impostor
Group=impostor
TimeoutStopSec=10
[Install]
# Wait until most system services have started before starting Impostor
After=multi-user.target
WantedBy=multi-user.target
```
Reload all systemd unit files to source in the new file you've created.
```
sudo systemctl daemon-reload
```
Start the service.
```
sudo systemctl start impostor.service
```
Check the log for the service and verify it has started correctly -- Hint: Use the Q key to quit out of journalctl.
```
sudo journalctl -u impostor.service
```
If everything has started correctly, ensure the service is set to start on boot.
```
sudo systemctl enable impostor.service
```
+38 -9
View File
@@ -1,28 +1,57 @@
# Troubleshooting
If you're reading this, something went wrong.
Don't worry though, as this is the most thorough guide to help you!
## `./Impostor.Server: line 1: ELF: not found` (plus other errors)
No idea where you got that system. But we clearly do **NOT** support it.
## `cannot execute binary file: Exec format error`
Please check that you have downloaded the right version of Impostor, as we mantain two CPU architectures (x64 and ARM).
Unless you are running Impostor on a SBC (Single-Board Computer), like the Raspberry Pi, you most likely want to use the x64 version.
Please check that you have downloaded the right version of Impostor, as we mantain two CPU architectures (x64 and ARM).
Unless you are running Impostor on a computer like the Raspberry Pi, you most likely want to use the x64 version.
## `./Impostor.Server: Permission denied`
This is an error related to Linux file permissions.
Some files do not hold their executable bit (the permission that allows them to run) during a download.
You can solve this by doing: `chmod +x Impostor.Server`
## `You are using an older version of the game`
You are using an older version of Impostor. The game does not really check who is outdated and blames it on the user.
Make sure you got the latest working version of Impostor (probably in AppVeyor, not Github).
## Disconnected with `Your client is too new, please update your Impostor to play`
## `You disconnected from the server. Reliable Packet 1 ...`
Please double-check that you have followed the [Server Configuration](Server-configuration.md) correctly.
**NOTE: Your public ip does not start with `127` nor `192`**
This happens when your game is too new for your copy of Impostor to support.
If you're using an Impostor release, check if there is a newer release available that supports your version. If this doesn't exist, you can try the [latest build from CI](https://nightly.link/Impostor/Impostor/workflows/ci/master).
If even that build doesn't work, you can try looking through the Pull Requests to see if there is a pending pull request that aims to update it to the next version, but note these may be unstable and may contain malicious code, as they haven't been vetted by the Impostor development team yet.
## Disconnected with `Please update your game to play on this server`
This happens when you're using a version of Impostor that is too new for your game version. You can download an older version from [the GitHub release page](https://github.com/Impostor/Impostor/releases). We however don't support older versions of Impostor with new API's and bugfixes so we recommend to update your game instead.
## Disconnected with `You are using an older version of the game`
You are using a version of Impostor that is not designed for the version of the game you're playing. The game does not really check who is outdated and blames it on the user. Newer versions (v1.5.0+) do warn correctly and send the correct message.
Look at which version of the game you're playing, which you can see in the top left corner of the main menu, then download an Impostor version for that game. Every [release on the release page](https://github.com/Impostor/Impostor/releases) shows which version of the game it is compatible with. If your game version is newer than the latest release, check if the [latest build from CI works](https://nightly.link/Impostor/Impostor/workflows/ci/master).
## Disconnected with `You disconnected from the server. Reliable Packet 1 ...`
Please double-check that you have followed the [Server Configuration](Server-configuration.md) correctly.
**NOTE: Your public ip does not start with `10`, `127` or `192`**
Also check if the port Impostor (ListenPort) is listening on is correctly port-forwarded for UDP (or TCP/UDP).
## `Could not load file or assembly...`
Please check that you only have **working** plugins in the `plugins` folder.
Please check that you only have **working** plugins in the `plugins` folder.
This error can be caused by non-plugin files or plugins that are not working correctly.
## My question is not yet answered and I'm still having problems!
That's unfortunate. Join the [Impostor Discord](https://discord.gg/Mk3w6Tb), ask your question there and we'll try to help you out. Note that we're not always available, so it may take some time to get an answer. To make answering your question easier, please add the following details:
- Which version of Impostor are you using?
- Which version or Among Us are you using?
- Which operating system are you running Impostor on?
- If you have console logs, attaching these will also help.
+12
View File
@@ -0,0 +1,12 @@
# Upgrading Impostor
Sometimes we make incompatible changes to existing code. This document lists these changes and which changes you should make as a server administrator.
## Impostor 1.9.0
Previously we recommended using the Impostor.Http plugin for HTTP matchmaking. Because Among Us now relies on HTTP matchmaking, this plugin is now part of the default installation. As a result, you should change your server as follows:
- If you have Impostor.Http installed, you should remove that plugin. If you have changed the default settings, you need to move these changes to the [HttpServer section in config.json](Server-configuration.md#HttpServer).
- If you have plugins that required Impostor.Http's API (like Reactor.Impostor.Http), you should check that plugin for updates
- It is no longer necessary to add the ASP.NET Core folder to the PluginLoader's LibraryPaths
+10 -21
View File
@@ -19,31 +19,24 @@ Impostor has support for plugins. This document will help you to setup a develop
- [Impostor versions](#impostor-versions)
- [9. Missing/invalid data or want more functions?](#9-missinginvalid-data-or-want-more-functions)
## 1. Install .NET Core SDK
## 1. Install .NET SDK
Download and install the latest .NET Core SDK.
Download and install the latest .NET SDK.
https://dotnet.microsoft.com/download
## 2. Create a C# project
The first step is creating a new C# project, it must be a **Class Library (.NET Standard)**. The target framework can be any of those compatible with .NET 5, which includes:
- .NET Standard 2.0
- .NET Standard 2.1
- .NET Core 3.1
- .NET 5
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 8, but we recommend sticking with **.NET 8.0**.
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>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
```
@@ -62,16 +55,13 @@ Make sure to get a prerelease if you are writing a plugin for a dev release of t
1. Right click your project.
2. Click `Manage NuGet Packages`.
3. Click `Browse`.
4. Next to the search bar, enable `Include prerelease`.
5. Search for `Impostor.Api`.
6. Click the `Impostor.Api` result and press install on the right side.
4. Search for `Impostor.Api`.
5. Click the `Impostor.Api` result and press install on the right side.
### Dotnet CLI
> Make sure to grab the latest (pre-)release version from NuGet [here](https://www.nuget.org/packages/Impostor.Api).
1. Open your project folder in command prompt / bash.
2. Run `dotnet add package Impostor.Api -v "1.2.0-ci.58"`.
2. Run `dotnet add package Impostor.Api`.
## 4. The plugin class
@@ -272,7 +262,7 @@ Now your plugin is ready to be tested.
1. Right click your project and press `Build`.
2. Right click your project and press `Open Folder in File Explorer`.
3. Go to `bin/Debug/netstandard2.1/`.
3. Go to `bin/Debug/net8.0/`.
4. In this directory, you should find your plugin named `Project.dll`.
5. Copy the `Project.dll` to the `plugins` directory in your Impostor server directory.
6. (Re)start your Impostor server.
@@ -295,7 +285,6 @@ Some extra information that might be useful for those developing plugins.
- `IEventManager`
- `IClientManager`
- `IOptions<ServerConfig>`
- `IOptions<ServerRedirectorConfig>`
- You can add your own classes and `EventListener` implementation to the `IServiceProvider` by creating a new class and implementing `IPluginStartup`. Make sure to register them as a singleton `services.AddSingleton<IEventListener, GameEventListener>();`.
### Server configuration
@@ -312,7 +301,7 @@ Constantly copying the plugin dll to your server directory can be pretty annoyin
},
"PluginLoader": {
"Paths": [
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\netstandard2.1"
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\net8.0"
],
"LibraryPaths": []
}
@@ -340,4 +329,4 @@ Create an issue:
- [Suggest a function](https://github.com/Impostor/Impostor/issues/new?template=3--api-suggestion.md)
- [Data is invalid](https://github.com/Impostor/Impostor/issues/new?template=4--api-invalid.md)
- [Data is unavailable](https://github.com/Impostor/Impostor/issues/new?template=5--api-missing.md)
- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
+13 -4
View File
@@ -4,8 +4,8 @@ root = true
# Don't use tabs for indentation.
[*]
charset = utf-8
end_of_line = crlf
insert_final_newline = false
end_of_line = lf
insert_final_newline = true
indent_style = space
# Code files
@@ -144,6 +144,12 @@ dotnet_naming_style.end_in_async.word_separator =
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
dotnet_diagnostic.RS2008.severity = none
# IDE0005: Remove unnecessary import
dotnet_diagnostic.IDE0005.severity = warning
# IDE0007: Use `var` instead of explicit type
dotnet_diagnostic.IDE0007.severity = warning
# IDE0035: Remove unreachable code
dotnet_diagnostic.IDE0035.severity = warning
@@ -163,7 +169,7 @@ 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
# 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
@@ -171,7 +177,7 @@ csharp_new_line_between_query_expression_clauses = true
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
@@ -228,3 +234,6 @@ 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
View File
@@ -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
+15
View File
@@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>11</LangVersion>
<VersionPrefix>1.10.0</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<EnforceCodeStyleInBuild Condition="$(MSBuildProjectName)!='Hazel'">true</EnforceCodeStyleInBuild>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
</ItemGroup>
</Project>
@@ -0,0 +1,30 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Numerics;
namespace Impostor.Api.Innersloth.Generator;
internal static class Extensions
{
public static string NormalizePath(this string path)
{
return path.Replace("\\", "/");
}
public static bool TryTrimStart(this string text, string value, [NotNullWhen(true)] out string? result)
{
if (text.StartsWith(value))
{
result = text[value.Length..];
return true;
}
result = null;
return false;
}
public static string ToCSharpString(this Vector2 value)
{
return $"new Vector2({value.X.ToString(CultureInfo.InvariantCulture)}f, {value.Y.ToString(CultureInfo.InvariantCulture)}f)";
}
}
@@ -0,0 +1,22 @@
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Impostor.Api.Innersloth.Generator.Generators;
public abstract class BaseGenerator
{
protected SourceProductionContext _sourceProductionContext;
protected ImmutableArray<(string RelativePath, string Content)> _files;
protected BaseGenerator(SourceProductionContext sourceProductionContext, ImmutableArray<(string RelativePath, string Content)> files)
{
_sourceProductionContext = sourceProductionContext;
_files = files;
}
protected string GetFileContent(string path)
{
return _files.Single(x => x.RelativePath == path).Content;
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Text.Json;
using CSharpPoet;
using Microsoft.CodeAnalysis;
namespace Impostor.Api.Innersloth.Generator.Generators;
public sealed class EnumGenerator : BaseGenerator
{
public EnumGenerator(SourceProductionContext sourceProductionContext, ImmutableArray<(string RelativePath, string Content)> files) : base(sourceProductionContext, files)
{
}
public void Generate(string name, string? @namespace = null, string? sourceName = null, bool flags = false, CSharpEnumUnderlyingType underlyingType = CSharpEnumUnderlyingType.Int)
{
var dictionary = JsonSerializer.Deserialize<Dictionary<string, long>>(GetFileContent($"enums/{sourceName ?? name}.json"))!;
var @enum = new CSharpEnum(name, underlyingType);
foreach (var pair in dictionary)
{
var value = flags && pair.Value > 0
? $"1 << {Math.Log(pair.Value, 2)}"
: pair.Value.ToString();
@enum.Members.Add(new CSharpEnum.Member(pair.Key, value));
}
if (flags)
{
@enum.Attributes.Add(new CSharpAttribute("System.FlagsAttribute"));
}
var source = new CSharpFile(@namespace ?? "Impostor.Api.Innersloth") { @enum }.ToString();
_sourceProductionContext.AddSource(name, source);
}
}
@@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Numerics;
using System.Text.Json;
using CSharpPoet;
using Microsoft.CodeAnalysis;
namespace Impostor.Api.Innersloth.Generator.Generators;
public sealed class MapDataGenerator : BaseGenerator
{
public MapDataGenerator(SourceProductionContext sourceProductionContext, ImmutableArray<(string RelativePath, string Content)> files) : base(sourceProductionContext, files)
{
}
private T? Deserialize<T>(string name, string fileName)
{
return JsonSerializer.Deserialize<T>(
GetFileContent($"maps/{name}/{fileName}.json"),
new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters =
{
new Vector2Converter(),
},
}
);
}
public void Generate(string name)
{
var className = name + "Data";
var spawnInfo = Deserialize<SpawnInfo>(name, "spawn")!;
var tasks = Deserialize<Dictionary<int, TaskInfo>>(name, "tasks")!;
var vents = Deserialize<Dictionary<int, VentInfo>>(name, "vents")!;
var doors = Deserialize<Dictionary<int, DoorInfo>>(name, "doors")!;
var ventsData = new DictionaryData("VentData", "Vents", writer =>
{
foreach (var pair in vents)
{
var id = pair.Key;
var vent = pair.Value;
var connections = "";
if (vent.Left != null) connections += ", left: " + vent.Left.Value;
if (vent.Center != null) connections += ", center: " + vent.Center.Value;
if (vent.Right != null) connections += ", right: " + vent.Right.Value;
writer.WriteLine($"[{id}] = new(this, {id}, \"{vent.Name}\", {vent.Position.ToCSharpString()}{connections}),");
}
});
var tasksData = new DictionaryData("TaskData", "Tasks", writer =>
{
foreach (var pair in tasks)
{
var id = pair.Key;
var task = pair.Value;
writer.WriteLine($"[{id}] = new({id}, TaskTypes.{task.TaskType}, TaskCategories.{task.Length}Task),");
}
});
var doorsData = new DictionaryData("DoorData", "Doors", writer =>
{
foreach (var pair in doors)
{
var id = pair.Key;
var door = pair.Value;
writer.WriteLine($"[{id}] = new({id}, SystemTypes.{door.Room}, {door.Position.ToCSharpString()}),");
}
});
var constructor = new CSharpMethod(Visibility.Internal, className, ".ctor")
{
Body = writer =>
{
ventsData.WriteInitializer(writer);
writer.WriteLine();
tasksData.WriteInitializer(writer);
writer.WriteLine();
doorsData.WriteInitializer(writer);
},
};
var @class = new CSharpClass(className)
{
IsSealed = true,
Extends = { "MapData" },
Members =
{
constructor,
ventsData.CreateProperty(),
tasksData.CreateProperty(),
doorsData.CreateProperty(),
new CSharpBlankLine(),
CreateSimpleProperty("float", "SpawnRadius", spawnInfo.SpawnRadius.ToString(CultureInfo.InvariantCulture) + "f"),
CreateSimpleProperty("Vector2", "InitialSpawnCenter", spawnInfo.InitialSpawnCenter.ToCSharpString()),
CreateSimpleProperty("Vector2", "MeetingSpawnCenter", spawnInfo.MeetingSpawnCenter.ToCSharpString()),
CreateSimpleProperty("Vector2", "MeetingSpawnCenter2", spawnInfo.MeetingSpawnCenter2.ToCSharpString()),
},
};
var source = new CSharpFile("Impostor.Api.Innersloth.Maps")
{
Usings = { "System.Collections.Generic", "System.Numerics" },
Members = { @class },
}.ToString();
_sourceProductionContext.AddSource(className, source);
}
private static CSharpProperty CreateSimpleProperty(string type, string name, string value)
{
return new CSharpProperty(type, name)
{
Getter = new CSharpProperty.Accessor { Body = writer => writer.Write(value + ";") },
IsOverride = true,
};
}
private sealed class DictionaryData
{
private readonly string _keyType;
private readonly string _valueType;
private readonly string _name;
private readonly Action<CodeWriter> _body;
public DictionaryData(string keyType, string valueType, string name, Action<CodeWriter> body)
{
_keyType = keyType;
_valueType = valueType;
_name = name;
_body = body;
}
public DictionaryData(string valueType, string name, Action<CodeWriter> body) : this("int", valueType, name, body)
{
}
public void WriteInitializer(CodeWriter writer)
{
writer.WriteLine($"{_name} = new Dictionary<{_keyType}, {_valueType}>");
writer.WriteLine("{");
using (writer.Indent())
{
_body(writer);
}
writer.WriteLine("}.AsReadOnly();");
}
public CSharpProperty CreateProperty()
{
return new CSharpProperty($"IReadOnlyDictionary<{_keyType}, {_valueType}>", _name)
{
Getter = new CSharpProperty.Accessor(),
IsOverride = true,
};
}
}
public sealed class SpawnInfo
{
public required Vector2 InitialSpawnCenter { get; init; }
public required Vector2 MeetingSpawnCenter { get; init; }
public required Vector2 MeetingSpawnCenter2 { get; init; }
public required float SpawnRadius { get; init; }
}
public sealed class TaskInfo
{
public required string Type { get; init; }
public required string TaskType { get; init; }
public required string Length { get; init; }
public required TaskConsole[] Consoles { get; init; }
}
public sealed class TaskConsole
{
public required int Id { get; init; }
public required string Room { get; init; }
public required Vector2 Position { get; init; }
public required float UsableDistance { get; init; }
}
public sealed class VentInfo
{
public required string Name { get; init; }
public required Vector2 Position { get; init; }
public required int? Left { get; init; }
public required int? Center { get; init; }
public required int? Right { get; init; }
}
public sealed class DoorInfo
{
public required string Room { get; init; }
public required Vector2 Position { get; init; }
}
}
@@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<DebugType>embedded</DebugType>
<Nullable>enable</Nullable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="8.0.4" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="CSharpPoet" Version="0.3.0" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>
<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
</PropertyGroup>
<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PkgSystem_Text_Encodings_Web)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGMicrosoft_Bcl_AsyncInterfaces)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PkgCSharpPoet)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"Generator": {
"commandName": "DebugRoslynComponent",
"targetProject": "../Impostor.Api/Impostor.Api.csproj"
}
}
}
@@ -0,0 +1,100 @@
using System;
using System.Diagnostics.CodeAnalysis;
using CSharpPoet;
using Impostor.Api.Innersloth.Generator.Generators;
using Microsoft.CodeAnalysis;
namespace Impostor.Api.Innersloth.Generator;
[Generator(LanguageNames.CSharp)]
public sealed class SourceGenerator : IIncrementalGenerator
{
private const string DataPath = "Innersloth/Data/";
private readonly record struct Options(string ProjectDirectory)
{
public bool TryGetRelativePath(string path, [NotNullWhen(true)] out string? relativePath)
{
if (
path.NormalizePath().TryTrimStart(ProjectDirectory, out relativePath) &&
relativePath.TryTrimStart(DataPath, out relativePath)
)
{
return true;
}
relativePath = null;
return false;
}
}
public void Initialize(IncrementalGeneratorInitializationContext context)
{
var optionsProvider = context.AnalyzerConfigOptionsProvider
.Select((analyzerConfigOptions, _) =>
{
if (!analyzerConfigOptions.GlobalOptions.TryGetValue("build_property.projectdir", out var projectDirectory))
{
throw new Exception("Couldn't get project directory");
}
return new Options(projectDirectory.NormalizePath());
});
var filesProvider = context.AdditionalTextsProvider.Combine(optionsProvider)
.Where(static pair =>
{
var (file, options) = pair;
return options.TryGetRelativePath(file.Path, out var relativePath) && relativePath.EndsWith(".json");
})
.Select(static (pair, cancellationToken) =>
{
var (file, options) = pair;
if (!options.TryGetRelativePath(file.Path, out var relativePath))
{
throw new InvalidOperationException();
}
return (
RelativePath: relativePath,
Content: file.GetText(cancellationToken)!.ToString()
);
})
.Collect();
context.RegisterSourceOutput(filesProvider, (spc, files) =>
{
if (files.IsEmpty)
{
throw new InvalidOperationException($"No json files found in Impostor.Api/{DataPath}");
}
var enumGenerator = new EnumGenerator(spc, files);
enumGenerator.Generate("ColorType", "Impostor.Api.Innersloth.Customization");
enumGenerator.Generate("DisconnectReason", sourceName: "DisconnectReasons");
enumGenerator.Generate("GameKeywords", flags: true, underlyingType: CSharpEnumUnderlyingType.UnsignedInt);
enumGenerator.Generate("GameOverReason", underlyingType: CSharpEnumUnderlyingType.Byte);
enumGenerator.Generate("Platforms");
enumGenerator.Generate("RoleTypes", underlyingType: CSharpEnumUnderlyingType.UnsignedShort);
enumGenerator.Generate("RulesPresets", underlyingType: CSharpEnumUnderlyingType.Byte);
enumGenerator.Generate("SpecialGameModes", underlyingType: CSharpEnumUnderlyingType.Byte);
enumGenerator.Generate("StringNames");
enumGenerator.Generate("SystemTypes", underlyingType: CSharpEnumUnderlyingType.Byte);
enumGenerator.Generate("Language", sourceName: "SupportedLangs");
enumGenerator.Generate("TaskTypes");
enumGenerator.Generate("RpcCalls", "Impostor.Api.Net.Inner", underlyingType: CSharpEnumUnderlyingType.Byte);
var mapDataGenerator = new MapDataGenerator(spc, files);
var mapNames = new[] { "Skeld", "Mira", "April", "Polus", "Airship", "Fungle" };
foreach (var mapName in mapNames)
{
mapDataGenerator.Generate(mapName);
}
});
}
}
@@ -0,0 +1,42 @@
using System;
using System.Numerics;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Impostor.Api.Innersloth.Generator;
public class Vector2Converter : JsonConverter<Vector2>
{
public override Vector2 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException();
float x = 0;
float y = 0;
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject) break;
switch (reader.GetString())
{
case "x":
reader.Read();
x = reader.GetSingle();
break;
case "y":
reader.Read();
y = reader.GetSingle();
break;
}
}
return new Vector2(x, y);
}
public override void Write(Utf8JsonWriter writer, Vector2 value, JsonSerializerOptions options)
{
throw new NotSupportedException();
}
}
@@ -0,0 +1,156 @@
{
"version": 1,
"dependencies": {
".NETStandard,Version=v2.0": {
"CSharpPoet": {
"type": "Direct",
"requested": "[0.3.0, )",
"resolved": "0.3.0",
"contentHash": "3QDh9rMuiNhMtNWOLj0FItiZruON7lj3zD0CXC9IHq4JWpF5OjbaZ2s1X0u6gftE73KCoTezXIgKvxacps78Fw=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Direct",
"requested": "[3.3.4, )",
"resolved": "3.3.4",
"contentHash": "AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g=="
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Direct",
"requested": "[4.7.0, )",
"resolved": "4.7.0",
"contentHash": "JHCP2L6lB0oJ3tQoHkC67SFZxW+KbJVOnAo+6L01K5r/NlBlSUhTk5nUAldWhTVwGdzqNeHqGtnEqpsCmGSwQA==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[4.7.0]"
}
},
"NETStandard.Library": {
"type": "Direct",
"requested": "[2.0.3, )",
"resolved": "2.0.3",
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"PolySharp": {
"type": "Direct",
"requested": "[1.14.1, )",
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"System.Text.Encodings.Web": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==",
"dependencies": {
"System.Buffers": "4.5.1",
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Text.Json": {
"type": "Direct",
"requested": "[8.0.4, )",
"resolved": "8.0.4",
"contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "8.0.0",
"System.Buffers": "4.5.1",
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "8.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "4.7.0",
"contentHash": "pD5S14xMUebSGYe75kt0q/aaS/ftvktSo/pEv7aX7hNPHfdZS+SZeXvkvcffGxWkunYOyRF9m1oN7zzSdYj9dQ==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
"System.Collections.Immutable": "7.0.0",
"System.Memory": "4.5.5",
"System.Reflection.Metadata": "7.0.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encoding.CodePages": "7.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.5",
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
},
"System.Numerics.Vectors": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ=="
},
"System.Reflection.Metadata": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
"dependencies": {
"System.Collections.Immutable": "7.0.0",
"System.Memory": "4.5.5"
}
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Text.Encoding.CodePages": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "LSyCblMpvOe0N3E+8e0skHcrIhgV2huaNcjUUEa8hRtgEAm36aGkRoC8Jxlb6Ra6GSfF29ftduPNywin8XolzQ==",
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.5.4",
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
}
}
}
}
+31
View File
@@ -0,0 +1,31 @@
namespace Impostor.Api;
public enum CheatCategory
{
/// <summary>A packet used a part of the network protocol that is unknown to Impostor, like a custom RPC.</summary>
ProtocolExtension,
/// <summary>A packet was sent at an inappropriate moment.</summary>
GameFlow,
/// <summary>A packet was sent by a non-host player that should normally only be sent by the host.</summary>
MustBeHost,
/// <summary>A packet was sent that violated limits on the selection of player colors.</summary>
ColorLimits,
/// <summary>A packet was sent that exceeded the limits of possible nicknames to enter ingame.</summary>
NameLimits,
/// <summary>A packet was sent on behalf of another player.</summary>
Ownership,
/// <summary>An ability was used that the current role cannot access.</summary>
Role,
/// <summary>A packet was sent to a player that should be broadcasted, or vice versa.</summary>
Target,
/// <summary>Legacy category for unsorted anticheat checks.</summary>
Other,
}
+20
View File
@@ -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,29 @@
namespace Impostor.Api.Config
{
public class AntiCheatConfig
{
public const string Section = "AntiCheat";
public bool Enabled { get; set; } = true;
public bool BanIpFromGame { get; set; } = true;
public CheatingHostMode AllowCheatingHosts { get; set; } = CheatingHostMode.Never;
public bool EnableGameFlowChecks { get; set; } = true;
public bool EnableMustBeHostChecks { get; set; } = true;
public bool EnableColorLimitChecks { get; set; } = true;
public bool EnableNameLimitChecks { get; set; } = true;
public bool EnableOwnershipChecks { get; set; } = true;
public bool EnableRoleChecks { get; set; } = true;
public bool EnableTargetChecks { get; set; } = true;
public bool ForbidProtocolExtensions { get; set; } = true;
}
}
@@ -0,0 +1,29 @@
namespace Impostor.Api.Config
{
/// <summary>
/// Details if exceptions are made for hosts that are cheating.
/// </summary>
public enum CheatingHostMode
{
/// <summary>
/// Hosts follow the same policies as other players.
/// </summary>
Never,
/// <summary>
/// Hosts are allowed to cheat if they request HostAuthority. If they
/// do not request this, the same policies as for other players applies.
/// </summary>
/// <para>
/// HostAuthority can be requested by hosts by adding 25 to their patch
/// version when connecting. This flag is used by a lot of (host-only)
/// mods and also disable server authority over MurderPlayer packets.
/// </para>
IfRequested,
/// <summary>
/// Hosts are always allowed to cheat.
/// </summary>
Always,
}
}
@@ -0,0 +1,13 @@
namespace Impostor.Api.Config
{
public class CompatibilityConfig
{
public const string Section = "Compatibility";
public bool AllowFutureGameVersions { get; set; } = false;
public bool AllowHostAuthority { get; set; } = false;
public bool AllowVersionMixing { get; set; } = false;
}
}
@@ -1,4 +1,4 @@
namespace Impostor.Server.Config
namespace Impostor.Api.Config
{
public class DebugConfig
{
@@ -6,6 +6,6 @@
public bool GameRecorderEnabled { get; set; }
public string GameRecorderPath { get; set; }
public string GameRecorderPath { get; set; } = string.Empty;
}
}
}
@@ -0,0 +1,36 @@
namespace Impostor.Api.Config
{
public static class DisconnectMessages
{
public const string Error = "There was an internal server error. " +
"Check the server console for more information. " +
"Please report the issue on the Impostor GitHub if it keeps happening.";
public const string ClientOutdated = "Please update your game to play in this lobby.";
public const string ClientTooNew = "Your game version is too new for this lobby. " +
"If you want to join this lobby you need to downgrade your client.";
public const string Destroyed = "The game you tried to join is being destroyed. " +
"Please create a new game.";
public const string UsernameLength = "Your username is too long, please make it shorter.";
public const string UsernameIllegalCharacters = "Your username contains illegal characters, please remove them.";
public const string VersionClientTooOld = "Please update your game to play on this server.";
public const string VersionServerTooOld = "Your client is too new, please update your Impostor server to play.";
public const string VersionUnsupported = "Your client version is unsupported, please update your Game and/or Impostor server.";
private const string UpgradingDocsLink = "https://github.com/Impostor/Impostor/blob/master/docs/Upgrading.md";
public const string UdpMatchmakingUnsupported = $"""
Sorry, UDP Matchmaking is no longer supported.
See <link={UpgradingDocsLink}#impostor-190>Impostor documentation</link> on how to migrate to HTTP Matchmaking
""";
public const string HostAuthorityUnsupported = "Your client is requesting host authority, which is not enabled on this Impostor server.";
}
}
@@ -0,0 +1,27 @@
namespace Impostor.Api.Config;
/// <summary>
/// Configuration for HttpServer.
/// </summary>
public class HttpServerConfig
{
/// <summary>
/// Gets the name of this config section.
/// </summary>
public const string Section = "HttpServer";
public bool Enabled { get; set; } = true;
/// <summary>
/// Gets or sets the IP address the HTTP Matchmaking server will listen on.
/// </summary>
/// Use "127.0.0.1" if you are running behind a reverse proxy or just testing locally.
/// Use "0.0.0.0" if you are directly exposing this server to the internet.
public string ListenIp { get; set; } = "0.0.0.0";
/// <summary>
/// Gets or sets the port the HTTP Matchmaking server will listen on.
/// </summary>
/// For port forwarding purposes, this is a TCP port.
public ushort ListenPort { get; set; } = 22023;
}
@@ -1,19 +1,19 @@
using Impostor.Server.Utils;
using Impostor.Api.Utils;
namespace Impostor.Server.Config
namespace Impostor.Api.Config
{
internal class ServerConfig
public class ServerConfig
{
public const string Section = "Server";
private string? _resolvedPublicIp;
private string? _resolvedListenIp;
public const string Section = "Server";
public string PublicIp { get; set; } = "127.0.0.1";
public ushort PublicPort { get; set; } = 22023;
public string ListenIp { get; set; } = "127.0.0.1";
public string ListenIp { get; set; } = "0.0.0.0";
public ushort ListenPort { get; set; } = 22023;
+11
View File
@@ -0,0 +1,11 @@
namespace Impostor.Api.Config
{
public class TimeoutConfig
{
public const string Section = "Timeout";
public int SpawnTimeout { get; set; } = 2500;
public int ConnectionTimeout { get; set; } = 2500;
}
}
@@ -17,18 +17,18 @@ namespace Impostor.Api.Events
}
/// <summary>
/// The priority of the event listener.
/// Gets or sets the priority of the event listener.
/// </summary>
public EventPriority Priority { get; set; }
/// <summary>
/// The events that the listener is listening to.
/// Gets or sets the event that the listener is listening to.
/// </summary>
public Type? Event { get; set; }
/// <summary>
/// If set to true, the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled"/>.
/// Gets or sets a value indicating whether the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled" />.
/// </summary>
public bool IgnoreCancelled { get; set; }
}
}
}
@@ -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,12 @@
using Impostor.Api.Net;
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; }
}
}
@@ -1,11 +1,24 @@
using Impostor.Api.Games;
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
/// <summary>
/// Called whenever a new <see cref="IGame"/> is created.
/// Called whenever a new <see cref="IGame" /> is created.
/// </summary>
/// <remarks>
/// Note that the game just has been created, so no players have joined
/// it yet. If you want to know the future host of this game, use the
/// <see cref="Host"/> property.
/// </remarks>
public interface IGameCreatedEvent : IGameEvent
{
/// <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? Host { get; }
}
}
@@ -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; }
}
}
@@ -3,7 +3,7 @@
namespace Impostor.Api.Events
{
/// <summary>
/// Called whenever a new <see cref="IGame"/> is destroyed.
/// Called whenever a new <see cref="IGame" /> is destroyed.
/// </summary>
public interface IGameDestroyedEvent : IGameEvent
{
+1 -1
View File
@@ -5,7 +5,7 @@ namespace Impostor.Api.Events
public interface IGameEvent : IEvent
{
/// <summary>
/// Gets the <see cref="IGame"/> this event belongs to.
/// Gets the <see cref="IGame" /> this event belongs to.
/// </summary>
IGame Game { get; }
}
@@ -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,49 @@
using Impostor.Api.Games;
namespace Impostor.Api.Events
{
/// <summary>
/// This event is triggered when game options are going to be changed.
/// </summary>
/// <remarks>
/// Be careful when calling SyncSettingsAsync while handling this event,
/// as it may call this event again in some cases.
/// </remarks>
public interface IGameOptionsChangedEvent : IGameEvent
{
/// <summary>
/// Lists the possible reasons that the game options may have changed.
/// </summary>
public enum ChangeReason
{
/// <summary>
/// The options were changed by the host using LogicOptions deserialization.
/// </summary>
/// <remarks>
/// This event does not change the message sent to other players,
/// so changes made to Game.Options are not synced until
/// SyncSettingsAsync is called afterwards.
/// </remarks>
Host,
/// <summary>
/// The options were changed by a plugin using the
/// SyncSettingsAsync method in <see cref="IGame"/>.
/// </summary>
/// <remarks>
/// This event is called after serializing the settings, which
/// means that changes made by event handlers will not be synced
/// over.
///
/// We strongly recommend against calling SyncSettingsAsync while
/// handling this event.
/// </remarks>
Api,
}
/// <summary>
/// Gets the reason that the game options have changed.
/// </summary>
public ChangeReason ChangedBy { get; }
}
}
@@ -1,6 +1,9 @@
namespace Impostor.Api.Events
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; }
}
}
@@ -1,6 +1,11 @@
namespace Impostor.Api.Events
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
public interface IGamePlayerLeftEvent : IGameEvent
{
IClientPlayer Player { get; }
bool IsBan { get; }
}
}
@@ -3,7 +3,7 @@
/// <summary>
/// Called when the game is going to start.
/// When this is called, not all players are initialized properly yet.
/// If you want to get correct player states, use <see cref="IGameStartedEvent"/>.
/// If you want to get correct player states, use <see cref="IGameStartedEvent" />.
/// </summary>
public interface IGameStartingEvent : IGameEvent
{
@@ -1,6 +1,17 @@
namespace Impostor.Api.Events.Meeting
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; }
}
}
@@ -1,6 +1,6 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerChatEvent : IPlayerEvent
public interface IPlayerChatEvent : IPlayerEvent, IEventCancelable
{
/// <summary>
/// Gets the message sent by the player.
@@ -0,0 +1,31 @@
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Event that allows changing or canceling an upcoming player murder.
/// </summary>
/// <remarks>
/// Note that this event only triggers if the Host of the Game did not disable server authority.
///
/// If you want to get an event after the murder took place, listen to <see cref="IPlayerMurderEvent"/>.
/// </remarks>
public interface IPlayerCheckMurderEvent : IPlayerEvent, IEventCancelable
{
/// <summary>
/// Gets the player who will be murdered.
/// </summary>
IInnerPlayerControl Victim { get; }
/// <summary>
/// Gets or sets the result of this event.
/// </summary>
/// <remarks>
/// Its initial value is what would have happened in the normal game flow.
/// - If set to Succeeded, the Victim will die.
/// - If set to FailedProtected, the Victim will be protected with a shield animation and the attacker will have a cooldown set.
/// </remarks>
MurderResultFlags Result { get; set; }
}
}
@@ -1,5 +1,4 @@
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Inner.Objects;
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
@@ -0,0 +1,15 @@
using Impostor.Api.Innersloth.Maps;
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 VentData Vent { get; }
}
}
@@ -6,14 +6,14 @@ namespace Impostor.Api.Events.Player
public interface IPlayerEvent : IGameEvent
{
/// <summary>
/// Gets the <see cref="IClientPlayer"/> that triggered this <see cref="IPlayerEvent"/>.
/// Gets the <see cref="IClientPlayer" /> that triggered this <see cref="IPlayerEvent" />.
/// </summary>
IClientPlayer ClientPlayer { get; }
/// <summary>
/// Gets the networked <see cref="IInnerPlayerControl"/> that triggered this <see cref="IPlayerEvent"/>.
/// This <see cref="IInnerPlayerControl"/> belongs to the <see cref="IClientPlayer"/>.
/// Gets the networked <see cref="IInnerPlayerControl" /> that triggered this <see cref="IPlayerEvent" />.
/// This <see cref="IInnerPlayerControl" /> belongs to the <see cref="IClientPlayer" />.
/// </summary>
IInnerPlayerControl PlayerControl { get; }
}
}
}
@@ -0,0 +1,15 @@
using Impostor.Api.Innersloth.Maps;
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 VentData Vent { get; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerMovementEvent : IPlayerEvent
{
}
}
@@ -1,12 +1,30 @@
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Event that is called when a player is killed by another player.
/// </summary>
/// <remarks>
/// This event works regardless of server authority is enabled or not.
///
/// If you want to cancel this kill, listen to <see cref="IPlayerCheckMurderEvent"/>.
/// If you want to know about players that were voted out, listed to <see cref="IPlayerExileEvent"/>.
/// </remarks>
public interface IPlayerMurderEvent : IPlayerEvent
{
/// <summary>
/// Gets the player who got murdered.
/// </summary>
IInnerPlayerControl Victim { get; }
/// <summary>
/// Gets the result of the event.
/// </summary>
/// <remarks>
/// Note that if FailedError or FailedProtected is set, the kill did not take place.
/// </remarks>
MurderResultFlags Result { get; }
}
}
@@ -5,7 +5,7 @@ namespace Impostor.Api.Events.Player
public interface IPlayerStartMeetingEvent : IPlayerEvent
{
/// <summary>
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button.
/// </summary>
IInnerPlayerControl? Body { get; }
}
@@ -1,17 +1,15 @@
using Impostor.Api.Innersloth;
using Impostor.Api.Innersloth.Maps;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Called whenever a player moves to another vent.
/// </summary>
public interface IPlayerVentEvent : IPlayerEvent
{
/// <summary>
/// Gets get the id of the used vent.
/// Gets the vent player moved to.
/// </summary>
public VentLocation VentId { get; }
/// <summary>
/// Gets a value indicating whether the vent was entered or exited.
/// </summary>
public bool VentEnter { get; }
public VentData NewVent { get; }
}
}
@@ -0,0 +1,26 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
public enum VoteType : byte
{
HasNotVoted = 255,
Missed = 254,
Skipped = 253,
Dead = 252,
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; }
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
public interface IEvent
{
}
}
}
+2 -2
View File
@@ -3,8 +3,8 @@
public interface IEventCancelable : IEvent
{
/// <summary>
/// True if the event was cancelled.
/// Gets or sets a value indicating whether the event was cancelled.
/// </summary>
bool IsCancelled { get; set; }
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
public interface IEventListener
{
}
}
}
@@ -4,10 +4,10 @@ namespace Impostor.Api.Events
{
public interface IManualEventListener : IEventListener
{
EventPriority Priority { get; set; }
public bool CanExecute<T>();
public ValueTask Execute(IEvent @event);
EventPriority Priority { get; set; }
}
}
}
@@ -16,20 +16,20 @@ namespace Impostor.Api.Events.Managers
where TListener : IEventListener;
/// <summary>
/// Returns true if an event with the type <see cref="TEvent"/> is registered.
/// Returns true if an event with the type <typeparamref name="TEvent" /> is registered.
/// </summary>
/// <returns>True if the <see cref="TEvent"/> is registered.</returns>
/// <returns>True if the <typeparamref name="TEvent" /> is registered.</returns>
/// <typeparam name="TEvent">Type of the event.</typeparam>
bool IsRegistered<TEvent>()
where TEvent : IEvent;
/// <summary>
/// Call all the event listeners for the type <see cref="TEvent"/>.
/// Call all the event listeners for the type <typeparamref name="TEvent" />.
/// </summary>
/// <param name="event">The event argument.</param>
/// <typeparam name="TEvent">Type of the event.</typeparam>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask CallAsync<TEvent>(TEvent @event)
where TEvent : IEvent;
}
}
}
@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Impostor.Server.Events
namespace Impostor.Api.Events
{
/// <summary>
/// Disposes multiple <see cref="IDisposable"/>.
/// Disposes multiple <see cref="IDisposable" />.
/// </summary>
internal class MultiDisposable : IDisposable
public class MultiDisposable : IDisposable
{
private readonly IEnumerable<IDisposable> _disposables;
@@ -15,6 +16,10 @@ namespace Impostor.Server.Events
_disposables = disposables;
}
public MultiDisposable(params IDisposable[] disposables) : this(disposables.AsEnumerable())
{
}
public void Dispose()
{
foreach (var disposable in _disposables)
@@ -1,24 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
public class ImpostorCheatException : ImpostorException
{
public ImpostorCheatException()
{
}
protected ImpostorCheatException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ImpostorCheatException(string? message) : base(message)
{
}
public ImpostorCheatException(string? message, Exception? innerException) : base(message, innerException)
{
}
}
}
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
@@ -9,10 +8,6 @@ namespace Impostor.Api
{
}
protected ImpostorConfigException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ImpostorConfigException(string? message) : base(message)
{
}
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
@@ -9,10 +8,6 @@ namespace Impostor.Api
{
}
protected ImpostorException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ImpostorException(string? message) : base(message)
{
}
@@ -21,4 +16,4 @@ namespace Impostor.Api
{
}
}
}
}
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
@@ -9,10 +8,6 @@ namespace Impostor.Api
{
}
protected ImpostorProtocolException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ImpostorProtocolException(string? message) : base(message)
{
}
@@ -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,11 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api;
public static class MurderResultFlagsExtensions
{
public static bool IsFailed(this MurderResultFlags value)
{
return (value & (MurderResultFlags.FailedError | MurderResultFlags.FailedProtected)) != 0;
}
}
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
namespace Impostor.Api
{
/// <summary>
/// Priovides a StreamReader-like api throught extensions
/// Priovides a StreamReader-like api throught extensions.
/// </summary>
public static class SpanReaderExtensions
{
@@ -16,6 +16,13 @@ namespace Impostor.Api
return original[0];
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static short ReadInt16(this ref ReadOnlySpan<byte> input)
{
var original = Advance<short>(ref input);
return BinaryPrimitives.ReadInt16LittleEndian(original);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ReadInt32(this ref ReadOnlySpan<byte> input)
{
@@ -35,9 +42,7 @@ namespace Impostor.Api
{
var original = Advance<float>(ref input);
// BitConverter.Int32BitsToSingle
// Doesn't exist in net 2.0 for some reason
return Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
return BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -46,18 +51,12 @@ namespace Impostor.Api
return input.ReadByte() != 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe float Int32BitsToSingle(int value)
{
return *((float*)&value);
}
/// <summary>
/// Advances the position of <see cref="input"/> by the size of <see cref="T"/>.
/// Advances the position of <paramref name="input" /> by the size of <typeparamref name="T" />.
/// </summary>
/// <typeparam name="T">Type that will be read.</typeparam>
/// <param name="input">input "stream"/span.</param>
/// <returns>The original input</returns>
/// <returns>The original input.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe ReadOnlySpan<byte> Advance<T>(ref ReadOnlySpan<byte> input)
where T : unmanaged
@@ -67,4 +66,4 @@ namespace Impostor.Api
return original;
}
}
}
}
@@ -9,4 +9,4 @@ namespace Impostor.Api
return SystemTypeHelpers.Names[(int)type];
}
}
}
}
@@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
namespace Impostor.Api.Games
{
@@ -39,4 +38,4 @@ namespace Impostor.Api.Games
return game.SendToAsync(writer, player.Client);
}
}
}
}
@@ -8,7 +8,7 @@ namespace Impostor.Api.Games
{
public static int GetGameCount(this IGameManager manager, MapFlags map)
{
return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << game.Options.MapId)));
return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << (byte)game.Options.Map)));
}
}
}
}
+8 -6
View File
@@ -1,4 +1,4 @@
using System;
using System;
using Impostor.Api.Innersloth;
namespace Impostor.Api.Games
@@ -14,13 +14,15 @@ namespace Impostor.Api.Games
public GameCode(string code)
{
Value = GameCodeParser.GameNameToInt(code);
Code = 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;
@@ -48,19 +50,19 @@ namespace Impostor.Api.Games
public static GameCode From(string value) => new GameCode(value);
/// <inheritdoc/>
/// <inheritdoc />
public bool Equals(GameCode other)
{
return Code == other.Code && Value == other.Value;
}
/// <inheritdoc/>
/// <inheritdoc />
public override bool Equals(object? obj)
{
return obj is GameCode other && Equals(other);
}
/// <inheritdoc/>
/// <inheritdoc />
public override int GetHashCode()
{
return HashCode.Combine(Code, Value);
@@ -71,4 +73,4 @@ namespace Impostor.Api.Games
return Code;
}
}
}
}
+12 -2
View File
@@ -37,12 +37,22 @@
/// </summary>
GameDestroyed,
/// <summary>
/// The host has a newer version of the game and the client should update.
/// </summary>
ClientOutdated,
/// <summary>
/// The host has an older version of the game and the client should downgrade.
/// </summary>
ClientTooNew,
/// <summary>
/// Custom error by a plugin.
/// </summary>
/// <remarks>
/// A custom message can be set in <see cref="GameJoinResult.Message"/>.
/// A custom message can be set in <see cref="GameJoinResult.Message" />.
/// </remarks>
Custom,
}
}
}
+1 -1
View File
@@ -45,4 +45,4 @@ namespace Impostor.Api.Games
return new GameJoinResult(error);
}
}
}
}
+73 -19
View File
@@ -2,16 +2,17 @@
using System.Net;
using System.Threading.Tasks;
using Impostor.Api.Innersloth;
using Impostor.Api.Innersloth.GameOptions;
using Impostor.Api.Net;
using Impostor.Api.Net.Inner;
using Impostor.Api.Net.Inner.Objects;
using Impostor.Api.Net.Messages;
namespace Impostor.Api.Games
{
public interface IGame
{
GameOptionsData Options { get; }
IGameOptions Options { get; }
GameFilterOptions FilterOptions { get; }
GameCode Code { get; }
@@ -25,47 +26,62 @@ namespace Impostor.Api.Games
int PlayerCount { get; }
IClientPlayer Host { 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);
/// <summary>
/// Gets a value indicating whether the Host of the game has requested host authority.
/// </summary>
/// <remarks>
/// Vanilla Among Us does not request this, but certain client-side mods will.
/// </remarks>
bool IsHostAuthoritive { 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.
/// Adds an <see cref="IPAddress" /> to the ban list of this game.
/// Prevents all future joins from this <see cref="IPAddress" />.
/// This does not kick the player with that <see cref="IPAddress" /> from the lobby.
/// </summary>
/// <param name="ipAddress">
/// The <see cref="IPAddress"/> to ban.
/// The <see cref="IPAddress" /> to ban.
/// </param>
void BanIp(IPAddress ipAddress);
/// <summary>
/// Syncs the internal <see cref="GameOptionsData"/> to all players.
/// Syncs the internal <see cref="IGameOptions" /> to all players.
/// Necessary to do if you modified it, otherwise it won't be used.
/// </summary>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SyncSettingsAsync();
/// <summary>
/// Sets the specified list as Impostor on all connected players.
/// Sets game's privacy.
/// </summary>
/// <param name="players">List of players to be Impostor.</param>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
ValueTask SetInfectedAsync(IEnumerable<IInnerPlayerControl> players);
/// <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>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAllAsync(IMessageWriter writer, LimboStates states = LimboStates.NotLimbo);
/// <summary>
@@ -74,7 +90,7 @@ namespace Impostor.Api.Games
/// <param name="writer">Message to send.</param>
/// <param name="senderId">The player to exclude from sending the message.</param>
/// <param name="states">Required limbo state of the player.</param>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAllExceptAsync(IMessageWriter writer, int senderId, LimboStates states = LimboStates.NotLimbo);
/// <summary>
@@ -82,7 +98,45 @@ namespace Impostor.Api.Games
/// </summary>
/// <param name="writer">Message to send.</param>
/// <param name="id">ID of the client.</param>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAsync(IMessageWriter writer, int id);
/// <summary>
/// Start a GameData(To) message.
/// </summary>
/// <remarks>Use with caution, recommended only for advanced developers.</remarks>
/// <param name="targetClientId">The client to target if needed, `null` if the message should be sent to all players.</param>
/// <param name="type">Message type of the message.</param>
/// <returns>A <see cref="IMessageWriter" /> that you can fill and send using <see cref="FinishGameDataAsync"/>.</returns>
IMessageWriter StartGameData(int? targetClientId = null, MessageType type = MessageType.Reliable);
/// <summary>
/// Finishes GameData message and sends it to either the target or all players.
/// </summary>
/// <remarks>Use with caution, recommended only for advanced developers.</remarks>
/// <param name="writer">MessageWriter received from <see cref="StartGameData"/>.</param>
/// <param name="targetClientId">Same target ClientId passed to StartGameData.</param>
/// <returns>Task that sends the packet.</returns>
ValueTask FinishGameDataAsync(IMessageWriter writer, int? targetClientId = null);
/// <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">The client to target if needed, `null` if the message should be sent to all players.</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 = null, MessageType type = MessageType.Reliable);
/// <summary>
/// Finishes rpc message and sends it to either the target or all players.
/// </summary>
/// <remarks>Use with caution, recommended only for advanced developers.</remarks>
/// <param name="writer">Message writer of the rpc.</param>
/// <param name="targetClientId">Same target client id passed to <see cref="StartRpc"/>.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask FinishRpcAsync(IMessageWriter writer, int? targetClientId = null);
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
{
GameCode Create();
}
}
}
@@ -1,4 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Impostor.Api.Innersloth;
using Impostor.Api.Innersloth.GameOptions;
namespace Impostor.Api.Games.Managers
{
@@ -7,5 +10,14 @@ namespace Impostor.Api.Games.Managers
IEnumerable<IGame> Games { get; }
IGame? Find(GameCode code);
/// <summary>
/// Creates a new game.
/// </summary>
/// <param name="options">Game options.</param>
/// <param name="filterOptions">Filter options.</param>
/// <returns>Created game or null if creation was cancelled by a plugin.</returns>
/// <exception cref="ImpostorException">Thrown when game creation failed.</exception>
ValueTask<IGame?> CreateAsync(IGameOptions options, GameFilterOptions filterOptions);
}
}
}
+1
View File
@@ -0,0 +1 @@
global using Impostor.Hazel.Abstractions;
+18
View File
@@ -0,0 +1,18 @@
using System;
using Impostor.Api.Games;
using Microsoft.AspNetCore.Http;
namespace Impostor.Api.Http;
/// <summary>
/// Register a method to filter listings on.
/// </summary>
public interface IListingFilter
{
/// <summary>
/// Return a filter to filter listings on.
/// </summary>
/// <param name="context">HTTP Context of this request.</param>
/// <returns>A function that looks at a game and returns true iff the connecting player is compatible with this game.</returns>
Func<IGame, bool> GetFilter(HttpContext context);
}
+16 -16
View File
@@ -1,12 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<CodeAnalysisRuleSet>ProjectRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>9</LangVersion>
<CodeAnalysisRuleSet>../ProjectRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<Version>1.0.0</Version>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyName>Impostor.Api</AssemblyName>
@@ -16,23 +13,26 @@
<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>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.0" />
<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>
<None Include="../../docs/images/logo_64.png" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Impostor.Hazel.Abstractions" Version="1.0.0" />
<ProjectReference Include="..\Impostor.Api.Innersloth.Generator\Impostor.Api.Innersloth.Generator.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<AdditionalFiles Include="Innersloth/Data/**/*.json" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -4,4 +4,4 @@
{
ChangePrivacy = 1,
}
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
{
DidVote = 0,
}
}
}
@@ -0,0 +1,17 @@
namespace Impostor.Api.Innersloth;
public enum CrossplayFlags
{
Unknown = 0,
StandaloneEpicPC = 1 << 1,
StandaloneSteamPC = 1 << 2,
StandaloneMac = 1 << 3,
StandaloneWin10 = 1 << 4,
StandaloneItch = 1 << 5,
IPhone = 1 << 6,
Android = 1 << 7,
Switch = 1 << 8,
Xbox = 1 << 9,
Playstation = 1 << 10,
All = int.MaxValue,
}
@@ -1,18 +0,0 @@
namespace Impostor.Api.Innersloth.Customization
{
public enum ColorType : byte
{
Red = 0,
Blue = 1,
Green = 2,
Pink = 3,
Orange = 4,
Yellow = 5,
Black = 6,
White = 7,
Purple = 8,
Brown = 9,
Cyan = 10,
Lime = 11,
}
}
@@ -1,100 +0,0 @@
namespace Impostor.Api.Innersloth.Customization
{
public enum HatType
{
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,
Fedora = 43,
Goggles2 = 44,
Headphones = 45,
MaskHat = 46,
PaperMask = 47,
Security = 48,
StrapHat = 49,
Banana = 50,
Beanie = 51,
Bear = 52,
Cheese = 53,
Cherry = 54,
Egg = 55,
Fedora2 = 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,
Snowman2 = 93,
}
}
@@ -1,18 +0,0 @@
namespace Impostor.Api.Innersloth.Customization
{
public enum PetType
{
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,125 @@
namespace Impostor.Api.Innersloth.Customization
{
public class PlayerOutfit
{
// Magic value that is assigned by default when the outfit is initially created. This is not
// `null` because existing API already exposed this magic value. It's also not 0 (which is
// the value exposed when serializing) because SetColor anticheat checks exist.
private const ColorType UnknownColor = (ColorType)(-1);
private string _playerName = string.Empty;
private ColorType _color = UnknownColor;
private string _hatId = "missing";
private string _petId = "missing";
private string _skinId = "missing";
private string _visorId = "missing";
private string _namePlateId = "missing";
public bool IsDirty { get; internal set; }
public string PlayerName
{
get => _playerName;
internal set => SetField(ref _playerName, value);
}
public ColorType Color
{
get => _color;
internal set => SetField(ref _color, value);
}
public string HatId
{
get => _hatId;
internal set => SetField(ref _hatId, value);
}
public string PetId
{
get => _petId;
internal set => SetField(ref _petId, value);
}
public string SkinId
{
get => _skinId;
internal set => SetField(ref _skinId, value);
}
public string VisorId
{
get => _visorId;
internal set => SetField(ref _visorId, value);
}
public string NamePlateId
{
get => _namePlateId;
internal set => SetField(ref _namePlateId, value);
}
private byte HatSequenceId { get; set; } = 0;
private byte PetSequenceId { get; set; } = 0;
private byte SkinSequenceId { get; set; } = 0;
private byte VisorSequenceId { get; set; } = 0;
private byte NamePlateSequenceId { get; set; } = 0;
/// <summary>
/// Gets a value indicating whether a player outfit is complete or whether it needs to receive additional cosmetics.
/// </summary>
/// <returns>true if the outfit is incomplete, false if the outfit is complete.</returns>
public bool IsIncomplete => string.IsNullOrEmpty(PlayerName)
|| Color == UnknownColor
|| HatId == "missing"
|| PetId == "missing"
|| SkinId == "missing"
|| VisorId == "missing"
|| NamePlateId == "missing";
public void Serialize(IMessageWriter writer)
{
writer.Write(PlayerName);
// Follow officials by not sending a color value that is out of range. Sending -1 can cause exceptions on the client side.
writer.WritePacked(Color == UnknownColor ? 0 : (int)Color);
writer.Write(HatId);
writer.Write(PetId);
writer.Write(SkinId);
writer.Write(VisorId);
writer.Write(NamePlateId);
writer.Write(HatSequenceId);
writer.Write(PetSequenceId);
writer.Write(SkinSequenceId);
writer.Write(VisorSequenceId);
writer.Write(NamePlateSequenceId);
}
public void Deserialize(IMessageReader reader)
{
PlayerName = reader.ReadString();
Color = (ColorType)reader.ReadPackedInt32();
HatId = reader.ReadString();
PetId = reader.ReadString();
SkinId = reader.ReadString();
VisorId = reader.ReadString();
NamePlateId = reader.ReadString();
HatSequenceId = reader.ReadByte();
PetSequenceId = reader.ReadByte();
SkinSequenceId = reader.ReadByte();
VisorSequenceId = reader.ReadByte();
NamePlateSequenceId = reader.ReadByte();
}
private void SetField<T>(ref T field, T value)
{
field = value;
IsDirty = true;
}
}
}
@@ -0,0 +1,10 @@
namespace Impostor.Api.Innersloth.Customization
{
public enum PlayerOutfitType
{
Default,
Shapeshifted,
HorseWrangler,
MushroomMixup,
}
}
@@ -1,22 +0,0 @@
namespace Impostor.Api.Innersloth.Customization
{
public enum SkinType : byte
{
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,
}
}
@@ -0,0 +1,15 @@
{
"0": "SkeldShipStatus",
"1": "MeetingHud",
"2": "LobbyBehaviour",
"4": "PlayerControl",
"5": "MiraShipStatus",
"6": "PolusShipStatus",
"7": "ShipStatus",
"8": "AirshipStatus",
"9": "HideAndSeekManager",
"10": "NormalGameManager",
"11": "NetworkedPlayerInfo",
"12": "VoteBanSystem",
"13": "FungleShipStatus"
}
Loaded 100 of 573 files, more files were not shown because too many files have changed in this diff. Show more