Compare commits

...
552 Commits
Author SHA1 Message Date
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
svennergrandSven Großmann 2ebd804d28 fixed wrong key to paths of libaries in markdownfile (#223)
Signed-off-by: Sven Großmann <svennergr@gmail.com>

Co-authored-by: Sven Großmann <git@grossmann.dev>
2020-12-31 02:31:03 +01:00
Hiumee 72c923f266 Feature/add player vent event (#237)
* Added VentLocation enum

* Added PlayerVentEvent
2020-12-16 19:32:52 +01:00
AeonLucid d9c9dcd533 Create stale.yml 2020-12-16 18:53:13 +01:00
Gavin 7edd7dfecc Added glitch pet (#221) 2020-12-11 09:47:49 +01:00
AeonLucid 35fab473ca Update Running-the-server.md 2020-12-10 15:59:32 +01:00
e8f51f6b68 Fix set murdered (#192)
Co-authored-by: Ziad Montaser <ZiadMontaser@users.noreply.github.com>
Co-authored-by: AeonLucid <aeonlucid@outlook.com>
2020-11-30 20:41:46 +01:00
cybershardandAeonLucid a136c67671 Fix [API Bug] Task indices being cast to TaskTypes #159 (#164)
Co-authored-by: AeonLucid <aeonlucid@outlook.com>
2020-11-30 20:24:39 +01:00
a653fe57fd Improving Documentation (#175)
* Update README.md

Removed outdated information
Added instructions for other devices

* Updated README to add Android 11 instructions

* Formatting

* Update Running-the-server.md

* Formatting

* Formatting

* Adding a more verbose explanation on configs

* Create TROUBLESHOOTING.md

* Option for windows users to use the website instead of the client

* Small tweaks to make docs more professional

* Fixing grammatical errors(Part 1)

* Fixing grammatical errors(Part 2)

* Fixing grammatical errors (Part 3)

* Update README.md

* Update README.md

* Fixing formatting

* Update README.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update README.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update README.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/Running-the-server.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/Server-configuration.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/Server-configuration.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/Server-configuration.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/TROUBLESHOOTING.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/TROUBLESHOOTING.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/TROUBLESHOOTING.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update docs/TROUBLESHOOTING.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update README.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>

* Update README.md

* Update Server-configuration.md

* Update TROUBLESHOOTING.md

* Update TROUBLESHOOTING.md

* Update Server-configuration.md

* Update TROUBLESHOOTING.md

* Update TROUBLESHOOTING.md

* Update Server-configuration.md

Co-authored-by: AlexejheroYTB <alexejhero@gmail.com>
Co-authored-by: AeonLucid <aeonlucid@outlook.com>
2020-11-30 20:04:23 +01:00
Mr-VIT d847b5c708 Upgrade OnPlayerReportedBodyEvent to OnPlayerStartMeetingEvent (#184)
* upgrade PlayerReportedBodyEvent to PlayerStartMeetingEvent

now triggers on host player actions as well

* update OnPlayerReportedBodyEvent in plugin example
2020-11-30 19:36:24 +01:00
Hmmbob ccedd77162 [Docs] Add docker-compose instructions (#180)
* Add docker-compose instructions

* Remove unused badge

* Add volume mapping

* Add some more volume mappings

* Restore badge
2020-11-25 07:16:13 +01:00
Reece Benson 703db71858 Update README (again) for verison support text (#191) 2020-11-24 18:43:39 +01:00
danbudworthmead 8f9ed83678 Added --errors-only (#190) 2020-11-24 17:14:17 +01:00
Reece Benson c74b6e83ba Update README support version (#189) 2020-11-24 17:12:57 +01:00
danbudworthmead 4461ab2066 Added support for 2020.11.17 (#185)
* Added support for 2020.11.17

* Fix  :(
2020-11-24 02:14:17 +01:00
Jakub Staroń 4ebba13076 Fix Impostor.Patcher.Cli not working after packing (#174) 2020-11-20 16:26:00 +01:00
AlexejheroYTB d590da0d27 Add TaskTypes enum, PlayerCompletedTaskEvent, and updated ITaskInfo to use TaskTypes (#144) 2020-11-15 23:40:38 +01:00
AeonLucid ad0408d0de Fixes #151 - Program argument to enable with verbose logging 2020-11-15 04:17:16 +01:00
AeonLucid 7bb4d88e76 Fixes #154 - Used wrong version for serialization 2020-11-15 04:14:28 +01:00
AeonLucid 7ec5bc1fdc Merge pull request #146 from AlexejheroYTB/add-task-to-player
Add task info to player info
2020-11-15 02:18:54 +01:00
AeonLucid 024d49e739 Merge pull request #143 from AlexejheroYTB/ENUMS
Add MapTypes and update SystemTypes
2020-11-15 02:10:47 +01:00
AlexejheroYTB dd2d749993 Fix compilation error 2020-11-15 02:24:18 +02:00
AlexejheroYTB 312fa43bac Remove Serialize and Deserialize from ITaskInfo 2020-11-15 02:11:30 +02:00
AlexejheroYTB d6c5f1bdd4 Make MapId internal 2020-11-15 02:09:58 +02:00
AlexejheroYTB 266738705b Update InnerGameData.cs 2020-11-15 01:49:21 +02:00
Reece Benson 15de342cc5 Resolves 'Operation Not Supported' SocketException (#149) 2020-11-12 22:38:58 +01:00
AlexejheroYTB 2d78e008ac Add task info to player info 2020-11-12 13:37:40 +02:00
AlexejheroYTB cef3605c56 Add MapTypes 2020-11-12 09:49:36 +02:00
AlexejheroYTB a6ca856859 Update SystemTypes.cs 2020-11-12 09:13:02 +02:00
AeonLucid 8afb4aa3a6 Update docs 2020-11-12 04:51:59 +01:00
AeonLucid 62aa0ff832 Fix leaking MessageWriters 2020-11-12 04:34:07 +01:00
AeonLucid 2ea270d577 Fixes #115 and #118 - Proper SetInfected packet body 2020-11-12 04:32:30 +01:00
AlexejheroYTB 03b0dd4da5 Add GameOverReason (#129)
* Add GameOverReason

* Remove showAd from deserialization

* Update GameEventListener.cs
2020-11-12 04:07:20 +01:00
AeonLucid bbc48e0df2 Add obvious check to CanMurder 2020-11-12 04:04:45 +01:00
Jakub Staroń b4380bc07a Ban kill cooldown bypass (#123)
* Ban kill cooldown bypass

* Fix typo
2020-11-12 04:04:05 +01:00
AeonLucid 502da518cb Improve PlayerSetStartCounterEvent readability 2020-11-12 04:02:50 +01:00
danbudworthmead 58efba6435 PlayerSetStartCounterEvent (#113) 2020-11-12 04:01:32 +01:00
AeonLucid 32bfabddd0 Update and fix SnapTo 2020-11-12 03:58:43 +01:00
danbudworthmead b7c9a03ca2 Snap player to position (#109)
* Snap player to position

* Update IInnerCustomNetworkTransform.cs
2020-11-12 03:44:37 +01:00
AeonLucid 9da5b42c1f Fixes NullReferenceException inside MultiDisposable 2020-11-12 03:42:06 +01:00
Reece Benson 2b0459e209 Fix typo in GitHub Bug Issue template (#137) 2020-11-12 03:40:33 +01:00
AlexejheroYTB d6c620ea7c Update pull request template to use github "closes" keyword (#130)
* Update pull request template to use github "closese" keyword

* Add article link
2020-11-12 03:33:23 +01:00
AeonLucid b3fa60f798 Fixes #128 - MacOS does not support "DontFragment" 2020-11-12 03:05:37 +01:00
AeonLucid 57cce72df5 Print out version on startup 2020-11-12 02:59:50 +01:00
AeonLucid bde577db75 Update dependencies to 5.0.0 2020-11-11 19:57:12 +01:00
tuxinal c1c6311c87 fix player exile (#112) 2020-11-08 01:40:24 +01:00
AeonLucid dc2304c92c Update program.cs 2020-11-05 08:23:22 +01:00
AeonLucid b7bbcfdc2c Fix path issue 2020-11-05 04:38:06 +01:00
AeonLucid 0cd558b98c Workaround for broken config / plugins path 2020-11-05 02:50:56 +01:00
AeonLucid 6a65b77c4b Preserve parent while copying 2020-11-03 02:37:08 +01:00
Gerard Smit 9f364cc082 Fixed IsCancelled on interface events (#110) 2020-11-03 02:21:19 +01:00
AeonLucid fbe996b0c3 Send chat message to self by default 2020-11-02 19:55:05 +01:00
AeonLucid f73d7d37a2 Add CustomNetworkTransform and PlayerPhysics interfaces 2020-11-02 19:39:53 +01:00
AeonLucid 587b0bf3b7 Merge pull request #107 from danbudworthmead/InnerPlayerControl-API-Functionallity-Additions
Inner player control API functionality additions
2020-11-02 19:28:31 +01:00
AeonLucid e694b6fac9 Small changes 2020-11-02 19:27:58 +01:00
AeonLucid 6bd7186074 Dispose message readers 2020-11-02 01:26:37 +01:00
danbudworthmead 130978577e Update IInnerPlayerControl.cs 2020-11-01 23:46:10 +00:00
danbudworthmead 2f9fd239dc Update InnerPlayerControl.Api.cs 2020-11-01 23:43:46 +00:00
AeonLucid 4fb95fd85b Merge branch 'feature/message-reader-optimize' into dev 2020-11-01 23:58:02 +01:00
AeonLucid 272230e4ff Add extra protection to removing messages 2020-11-01 23:57:50 +01:00
AeonLucid ed05574954 Make RemoveMessage work 2020-11-01 23:52:56 +01:00
AeonLucid c15b638bcd Swap try/catch scope 2020-11-01 23:22:01 +01:00
AeonLucid ca9cd5d818 Use channel for recorder to fix lagg issue caused by locking 2020-11-01 23:21:18 +01:00
AeonLucid ed2de507ad Fix packet recorder and re-enable RemoveMessage test 2020-11-01 23:07:48 +01:00
AeonLucid 14fc2bc503 RemoveMessage progress 2020-11-01 23:02:50 +01:00
AeonLucid e8c18f2cab Fix recorder 2020-11-01 23:02:07 +01:00
AeonLucid f33a184d10 Use a normal byte array for MessageReader 2020-11-01 23:02:07 +01:00
AeonLucid cef7064d5f Modify docker workflow 2020-11-01 22:45:55 +01:00
AeonLucid ea14a417b9 Don't remove pdb files 2020-11-01 22:00:14 +01:00
AeonLucid b783e6bcb3 Packet recorder add disconnect reason 2020-11-01 21:08:54 +01:00
AeonLucid e5ae03eb0d This code is in the wrong branch 2020-11-01 20:59:34 +01:00
AeonLucid f1fecfd258 Fixes #105 - Use correct method to retrieve PlayerControl 2020-11-01 20:53:54 +01:00
AeonLucid 66ec384712 Fix stack overflow on CTRL+C 2020-11-01 20:26:19 +01:00
AeonLucid fccb542631 Add replay to build script 2020-11-01 19:59:11 +01:00
AeonLucid 3faf1ebe13 Pooling 2020-10-31 23:23:26 +01:00
AeonLucid c788118901 MessageReader benchmark stuff 2020-10-31 22:04:31 +01:00
AeonLucid 4d220a0cf7 Fixed #94 - Allows plugins to get a IMessageWriter 2020-10-30 19:37:13 +01:00
AeonLucid 32a829a975 Fixes #95 - Ignores GameData for the fake client 2020-10-30 19:19:51 +01:00
AeonLucid 65ea903c93 Always flush recorder 2020-10-29 23:21:48 +01:00
danbudworthmead 1fcd479bc1 Add PlayerReportedBodyEvent (#96) 2020-10-28 18:55:06 +01:00
Saghetti0 454f486f29 Add PlayerExileEvent and PlayerMurderEvent (#93) 2020-10-28 01:00:47 +01:00
AeonLucid e308b7e3e6 Add enums to set Color/Hat/Pet/Skin 2020-10-27 01:28:28 +01:00
AeonLucid dcc4da25de Remove EventManager CallAsync memory allocation 2020-10-27 00:40:10 +01:00
AeonLucid 8526ce43b2 Rethrow cheat exceptions thrown by plugins 2020-10-26 22:33:04 +01:00
AeonLucid b670800c54 Expose DisconnectAsync in the api 2020-10-26 22:20:14 +01:00
AeonLucid d399207d57 Add more API methods to InnerPlayerControl 2020-10-26 20:31:05 +01:00
AeonLucid 9e55a9738b Fixes #81 - Adds hostname support to the config file 2020-10-26 19:43:20 +01:00
AeonLucid 39bfc139f8 Fixes #87 - Adds support for IEvent / IGameEvent type of EventListeners 2020-10-26 19:20:56 +01:00
AeonLucid bc3a45d818 Disable automatic NuGet uploads 2020-10-26 19:13:12 +01:00
AeonLucid 1a53f9e710 Update README 2020-10-26 04:56:14 +01:00
Saghetti0andAeonLucid 5229bb3681 Add GameAlterEvent (#86)
* Create GameAlterEvent

* Fire GameAlterEvent from HandleAlterGame

* Rename GameAlterEvent to GameAlterEvent.cs

* Update GameAlterEvent

Co-authored-by: AeonLucid <aeonlucid@outlook.com>
2020-10-26 04:52:57 +01:00
AeonLucid dc6a8fcfc3 Version 1.2.1 2020-10-26 04:40:23 +01:00
AeonLucid 9d520bf9a3 Move options to the top 2020-10-26 04:39:18 +01:00
AeonLucid 19cfad8132 Merge branch 'fix-issues' into dev 2020-10-26 04:37:57 +01:00
AeonLucid 961bd90ef6 Change all events to use interfaces and move them to a better namespace 2020-10-26 04:37:42 +01:00
AeonLucid d1daf1623a Fixes #82 - Expose IClientPlayer in relevant events 2020-10-26 00:53:20 +01:00
AeonLucid c749a84910 Move events to better directories 2020-10-26 00:17:47 +01:00
AeonLucid e2ae918596 Clean up client manager 2020-10-26 00:10:06 +01:00
AeonLucid c6b5390844 Merge branch 'dev' into fix-issues 2020-10-25 23:43:10 +01:00
AeonLucid b527c251bd Fixes #71, improved configuration documentation 2020-10-25 23:42:51 +01:00
AeonLucid 89e2d2e172 Update Running-the-server.md 2020-10-25 23:28:21 +01:00
AeonLucid 5c0ce03c57 Update Running-the-server.md 2020-10-25 23:22:38 +01:00
AeonLucid 93394e7e77 Make ban for cheating configurable 2020-10-25 23:13:09 +01:00
AeonLucid a6b3cd10f4 Fixes issue #84, ban ips caught cheating 2020-10-25 23:05:23 +01:00
Sombrio 80c68c1a94 Xml documentation for the GameOptionsData class. (#85) 2020-10-25 22:40:34 +01:00
AeonLucid 4d87bfb11e PluginLoader warning instead of exception 2020-10-25 22:28:40 +01:00
AeonLucid 4c3d822fb7 Remove trimming and self contained to fix plugins, fixes #83 2020-10-25 22:01:28 +01:00
AeonLucid 6c18531f62 Fixes incorrect anticheat detection #77 2020-10-25 21:25:21 +01:00
AeonLucid bbf1aa851e Fix recorder bug 2020-10-25 21:25:00 +01:00
AeonLucid 57f8aa0772 Update plugin documentation 2020-10-25 20:18:51 +01:00
Jakub Staroń 61e33564d9 Ban characters not supported by Among Us text renderer (#78) 2020-10-25 16:33:34 +01:00
AeonLucid 8577692364 Update README 2020-10-25 07:14:43 +01:00
AeonLucid 45fcc03fbd Update plugin documentation 2020-10-25 07:11:35 +01:00
AeonLucid 37a3a56f9b Update documentation and Impostor version 2020-10-25 07:02:37 +01:00
AeonLucid 9702de6478 Update editorconfig 2020-10-25 06:11:24 +01:00
AeonLucid a879061921 Update documentation 2020-10-25 05:48:31 +01:00
AeonLucid 222ea1fe81 Update issue templates 2020-10-25 05:32:39 +01:00
AeonLucid e188972770 Update issue templates 2020-10-25 05:31:25 +01:00
AeonLucid 55f513c071 Added plugin documentation 2020-10-25 05:27:04 +01:00
AeonLucid 49284a587c Make PluginLoader less strict 2020-10-25 03:40:04 +02:00
AeonLucid b8d1c6bac5 Support latest Among Us beta 2020-10-25 03:23:37 +02:00
AeonLucid d504f1e87f Publish (s)nupkg on dev branch automatically 2020-10-25 03:00:00 +02:00
AeonLucid 9b32dc2629 Publish correct nupkg for Api 2020-10-25 02:47:24 +02:00
AeonLucid 27d4dad383 Merge pull request #75 from Impostor/feature/gamedata
Gamedata
2020-10-25 02:27:04 +02:00
AeonLucid 71596d4430 Merge branch 'dev' into feature/gamedata 2020-10-25 02:23:11 +02:00
AeonLucid 110af2b88f Add sync options method 2020-10-25 02:16:19 +02:00
AeonLucid 0887bad5d8 Add meeting events 2020-10-25 01:29:58 +02:00
AeonLucid 49269c33c9 Add more events and missing SnapTo check 2020-10-25 01:07:36 +02:00
AeonLucid 57c1978212 Remove scoping for event listeners 2020-10-24 23:10:07 +02:00
7ecd7f4ec8 Giving plugin more control over when it should be executed (#74)
This pr should give the plugin dev the option to receive all events to his liking without constraining it to a specific type at compile time

Co-authored-by: Weirdo <git.jonas@kamsker.at>
Co-authored-by: AeonLucid <aeonlucid@outlook.com>
2020-10-24 23:06:12 +02:00
AeonLucid 055366fed8 Add disconnect reason when reason is null 2020-10-24 22:51:22 +02:00
AeonLucid ec64b0148c Update editorconfig 2020-10-24 22:28:56 +02:00
AeonLucid 6340177f30 Add editorconfig for consistent code 2020-10-24 22:24:33 +02:00
AeonLucid 94f19a38c5 Expose PlayerName again to fix example plugin 2020-10-24 22:12:04 +02:00
AeonLucid 58d00dc657 Remove login from Impostor.Api assembly 2020-10-24 21:56:51 +02:00
AeonLucid f5e454856a Update Data namespace 2020-10-24 21:08:45 +02:00
AeonLucid 9b5249cbb3 Pack Impostor.Api in build process 2020-10-24 21:02:10 +02:00
AeonLucid a36396fb48 Update more project files 2020-10-24 20:33:42 +02:00
AeonLucid 150dbdefaa Fix AppVeyor and pluginloader issue 2020-10-24 20:18:40 +02:00
AeonLucid 173f6d088d Remove pdb files from builds 2020-10-24 20:08:40 +02:00
AeonLucid 2ff01c599a Imrpove AppVeyor versioning 2020-10-24 20:05:23 +02:00
AeonLucid 880826bc20 Fix tests 2020-10-24 19:39:06 +02:00
AeonLucid c33da59c5e Fix AppVeyor 2020-10-24 07:25:45 +02:00
AeonLucid 198cd7911b HandleRpc async for sending events 2020-10-24 07:00:36 +02:00
AeonLucid e0481833d4 Add PlayerSpawned / PlayerDestroyed 2020-10-24 06:45:51 +02:00
AeonLucid 61eeb3b5c0 Improve PluginLoader and Enable/Disable plugins 2020-10-24 06:02:52 +02:00
AeonLucid b55d09de71 Add useful method 2020-10-24 05:02:24 +02:00
AeonLucid 96c2647193 Use LongRunning tasks for the server and client 2020-10-24 04:38:14 +02:00
AeonLucid 6fc0fbb074 Fix recorder order after game creation 2020-10-24 04:03:21 +02:00
AeonLucid 1cb7077772 Fix ServerReplay error 2020-10-24 03:51:18 +02:00
AeonLucid ab0858a2c9 Despawn log message on trace level 2020-10-24 02:40:07 +02:00
AeonLucid 7d803e76f4 Remove period from exception messages 2020-10-24 02:37:59 +02:00
AeonLucid 4dc12ceff5 Disconnect client when caught hacking 2020-10-24 02:36:11 +02:00
AeonLucid 553c8b9b1b Basic Hazel connection rate limiting 2020-10-24 02:13:56 +02:00
AeonLucid 8aaa4f8b3b Fix bug 2020-10-24 01:24:52 +02:00
AeonLucid 67e302798f Add spawn and leave timeout 2020-10-24 01:18:25 +02:00
AeonLucid fcd54e0c63 Set player to death when disconnected 2020-10-24 00:35:54 +02:00
AeonLucid ee707a502c Added deserialization checks 2020-10-24 00:28:02 +02:00
AeonLucid 923d9b7766 Add target to Deserialize of InnerNetObject 2020-10-24 00:07:34 +02:00
AeonLucid dcb903b272 Added missing checks in InnerShipStatus 2020-10-24 00:04:43 +02:00
AeonLucid 7c946525fc Add PlayAnimation checks 2020-10-23 23:47:08 +02:00
AeonLucid a5cf97e85a Almost all RPC calls 2020-10-23 23:42:59 +02:00
AeonLucid 1b776bfce9 Finish up PlayerControl RPCs 2020-10-23 22:27:57 +02:00
AeonLucid 35792a1641 Anonymize PacketRecorder 2020-10-23 20:13:06 +02:00
AeonLucid 9e1292ce1f API Improvement and RpcCalls enum 2020-10-23 20:02:18 +02:00
AeonLucid fd41caff0b Ensure thread safety for joining a game 2020-10-23 19:18:01 +02:00
AeonLucid fe3bd658a1 Expose all global InnerNet objects 2020-10-23 19:13:28 +02:00
AeonLucid dc7ba92fd5 Link player classes internally 2020-10-23 07:19:45 +02:00
AeonLucid be5a876113 Implement deserialization for most GameData objects 2020-10-23 05:38:32 +02:00
AeonLucid 93230823b4 Add checks on DespawnFlag and SceneChangeFlag 2020-10-23 03:27:40 +02:00
AeonLucid 579eacc521 Workaround for early spawn of host player components 2020-10-23 02:54:32 +02:00
AeonLucid e78329b9b1 Proper logging in game class 2020-10-23 00:28:29 +02:00
AeonLucid 574b7e23b4 Add stopwatch 2020-10-22 23:58:20 +02:00
AeonLucid 9e76535a37 Update build.cake 2020-10-22 22:44:19 +02:00
AeonLucid 22703588e7 Disable recorder by default 2020-10-22 22:38:42 +02:00
AeonLucid 8100eff301 Update cake in dev 2020-10-22 22:32:10 +02:00
AeonLucid 602fe821f2 Fix appveyor and don't flush to disk 2020-10-22 22:29:13 +02:00
AeonLucid b56a55ae1a Fix cake 2020-10-22 22:25:55 +02:00
AeonLucid 3827b6a627 Remove unnecessary if def 2020-10-22 22:19:18 +02:00
AeonLucid 8ff4e7708b Update recorder and add replayer 2020-10-22 22:15:34 +02:00
AeonLucid f2a31655a3 Add client packet recorder 2020-10-22 16:09:20 +02:00
AeonLucid 77e7581272 Clean up after merged PRs 2020-10-22 14:04:49 +02:00
678ea36ccd Update doc links (#66)
* Add docs to master

* correct link (#63)

* correct link

* change to https://

* Update doc links

Co-authored-by: AeonLucid <aeonlucid@gmail.com>
Co-authored-by: tuxinal <ebrahim.amiri.k@gmail.com>
2020-10-22 02:36:08 +02:00
Jonas KamskerandWeirdo 7a210393ee Solved GameOptionsData TODO (#64)
* Ignoring .Vs folder

* GameOptionsData deserialization requires x16 less time & no extra alloc

* Super-micro optimisation (variable localization)

* JoinGame probably faster

* Added Tests

* Renamed swap -> advance

* Removed submodule Hazel

* Removed launchsettings

Co-authored-by: Weirdo <git.jonas@kamsker.at>
2020-10-22 00:08:14 +02:00
Jonas KamskerandWeirdo 647672c40e Feature/gamemanager improvement (#65)
* Ignoring .Vs folder

* Improved Gamemanager
- Retry code creation
- Async Node Lookup

* Switched back to old using order

* Removed IAsyncNodeLocator

* Found one more use of find

* deleted submodule

Co-authored-by: Weirdo <git.jonas@kamsker.at>
2020-10-22 00:02:27 +02:00
Gerard Smit d6eb6bc54a Implemented EventListener priorities (#62)
* Improved EventManager

Now it actually will order the event listeners on their priority. Also I've cleaned up the registering of temporary event listeners.

* Ignore new Impostor.Api library while loading plugins

* Fixed Dockerfile
2020-10-21 14:55:03 +02:00
AeonLucid 3b873d8209 Fix tests 2020-10-19 16:59:03 +02:00
AeonLucid 7e01a20fed Fix namespaces and missing await 2020-10-19 16:34:48 +02:00
AeonLucid f145746772 Final touches for client 2020-10-19 16:26:35 +02:00
AeonLucid eb0434fd01 Impostor.Api to netstandard2.0 2020-10-19 16:25:40 +02:00
AeonLucid ef4d548bda Update Hazel namespace to Impostor.Hazel 2020-10-19 16:19:28 +02:00
AeonLucid f906b010db Re-add Hazel client 2020-10-19 16:18:49 +02:00
AeonLucid 503cd221d5 Adapt C2S / S2C for messages and move to Api namespace 2020-10-19 15:05:44 +02:00
AeonLucid e630863e72 Refactor messages 2020-10-19 14:39:36 +02:00
AeonLucid 61f50c6d41 Remove Impostor.Shared 2020-10-19 12:55:26 +02:00
AeonLucid f31d0b0772 Fix plugin loader issue 2020-10-19 12:25:16 +02:00
AeonLucid 4be31d8708 Rename Impostor.Server.Api to Impostor.Api 2020-10-19 12:22:45 +02:00
AeonLucid 988cdfb480 Move Hazel submodule into Impostor.Hazel 2020-10-19 12:22:06 +02:00
AeonLucid dc63d7fa25 Remove AmongUsException 2020-10-19 12:16:36 +02:00
AeonLucid d44224a91c Move Api classes and remove unused imports 2020-10-19 12:15:27 +02:00
AeonLucid 93b3b06e54 Update cake script 2020-10-19 11:57:10 +02:00
Gerard SmitandAeonLucid 852badb48e Plugin loader (#59)
* Parse GameData headers

* Added GameData spawn

* GameData playerinfo parsing

* Added BufferMessageReader tests

* Fix InnerGameData

* Added CustomNetworkTransform and VoteBanSystem

* Revert changes

* Finish CustomNetworkTransform

* Implemented a simple plugin loader

* Replaced Reference with PackageReference

Note to myself: don't trust Rider auto-add reference

* Use classes and moved all API-related stuff to one folder

* Added PlayerJoinedGameEvent and PlayerLeftGameEvent

* Removed Impostor.Server.Hazel

* Moved more API-specific stuff

Co-authored-by: AeonLucid <aeonlucid@gmail.com>
2020-10-19 11:31:25 +02:00
AeonLucid 1517a4a6be Fix namespaces 2020-10-18 21:39:52 +02:00
AeonLucid 0acc2f3bc5 Rename Client to Patcher 2020-10-18 21:35:07 +02:00
AeonLucid 588af7fc3e Rebase and fix tests 2020-10-18 21:29:52 +02:00
AeonLucid 00a9e2fde7 Recorder start 2020-10-18 21:17:41 +02:00
AeonLucid cbf905c4ba Finish CustomNetworkTransform 2020-10-18 21:17:41 +02:00
AeonLucid ee220d326c Revert changes 2020-10-18 21:17:41 +02:00
AeonLucid 64f043767a Added CustomNetworkTransform and VoteBanSystem 2020-10-18 21:17:41 +02:00
AeonLucid 6c075a4827 Fix InnerGameData 2020-10-18 21:17:41 +02:00
AeonLucid daae9b9e4e Added BufferMessageReader tests 2020-10-18 21:17:41 +02:00
AeonLucid c3a2d6ecfd GameData playerinfo parsing 2020-10-18 21:17:41 +02:00
AeonLucid 5f922f5f83 Added GameData spawn 2020-10-18 21:17:41 +02:00
AeonLucid 8392fe4237 Parse GameData headers 2020-10-18 21:17:41 +02:00
AeonLucid 33519a1ead Pass on exceptions to Hazel 2020-10-18 04:53:14 +02:00
AeonLucid 078fb026ad Add username check 2020-10-18 04:21:52 +02:00
AeonLucid 7a033a1900 Send packets async too 2020-10-17 04:52:50 +02:00
AeonLucid 7946399e7b Update Hazel to async 2020-10-17 04:49:36 +02:00
AeonLucid ab6cbb8ee9 Ditch net452 for the proxy 2020-10-17 00:36:18 +02:00
hplewis 299bb3915a Fix AlterGame message flag (#56) 2020-10-16 05:34:13 +02:00
AeonLucid cb0866dbe5 AppVeyor 2020-10-15 05:29:25 +02:00
AeonLucid 8e0c43d386 Switch to BinaryPrimitives 2020-10-15 05:22:31 +02:00
AeonLucid e624f69176 Improve BufferMessageReader, reduce complexity and slicing 2020-10-15 05:15:07 +02:00
AeonLucid 057fe87739 Docs are hard ok 2020-10-14 16:40:14 +02:00
AeonLucid 4f3365ee60 Docs menu 2020-10-14 16:39:27 +02:00
AeonLucid 5f0ba88afa Fix up docs 2020-10-14 16:37:23 +02:00
AeonLucid ec6ccfaf4e Merge pull request #51 from joaosombrio/build-source-docs
Moving docs and added 'Building from source' doc
2020-10-14 16:27:59 +02:00
AeonLucid 94b1d38b9c Merge branch 'appveyor' into dev 2020-10-14 16:21:33 +02:00
AeonLucid d65e40e863 AppVeyor - force client restore 2020-10-14 16:10:50 +02:00
AeonLucid 7d083c7757 AppVeyor 2020-10-14 16:07:17 +02:00
AeonLucid 2cd63a95bc Smaller client 2020-10-14 16:05:31 +02:00
AeonLucid 4e15d1e596 AppVeyor and cake 2020-10-14 16:02:25 +02:00
AeonLucid 790e563d08 AppVeyor 2020-10-14 14:57:02 +02:00
AeonLucid 0c6d3e4f4a AppVeyor 2020-10-14 14:48:27 +02:00
AeonLucid 58eb0ebfa5 AppVeyor 2020-10-14 14:44:43 +02:00
AeonLucid 35313a1cd2 AppVeyor 2020-10-14 14:31:37 +02:00
AeonLucid a6f895cc14 AppVeyor 2020-10-14 14:30:51 +02:00
AeonLucid 2dc24a5027 pls 2020-10-14 14:27:19 +02:00
AeonLucid c5f3c63421 AppVeyor 2020-10-14 14:24:25 +02:00
AeonLucid 9d88b5b440 AppVeyor 2020-10-14 14:23:50 +02:00
AeonLucid 484e0176aa AppVeyor plz 2020-10-14 14:20:45 +02:00
AeonLucid b11abc066d Merge pull request #52 from js6pak/appveyor
Add SupportedVersions
2020-10-14 14:17:58 +02:00
AeonLucid a33798d220 AppVeyor 2020-10-14 14:14:55 +02:00
js6pak e6ad6aeb23 Add SupportedVersions 2020-10-14 14:13:36 +02:00
AeonLucid eca347cd5e AppVeyor 2020-10-14 14:12:09 +02:00
AeonLucid a8a933769d AppVeyor 2020-10-14 14:09:18 +02:00
AeonLucid f25d1308fe AppVeyor 2020-10-14 14:05:20 +02:00
AeonLucid 870384a84e Shared client props 2020-10-14 13:51:33 +02:00
AeonLucid 7027ba0e7e Update csproj 2020-10-14 13:45:52 +02:00
AeonLucid 4a91e532e8 appveyor 2020-10-14 13:14:07 +02:00
AeonLucid a4da76e910 Fix WinForms 2020-10-14 13:06:46 +02:00
AeonLucid 281341cad2 AppVeyor 2020-10-14 13:04:19 +02:00
AeonLucid 41cdc1de69 AppVeyor 2020-10-14 13:02:29 +02:00
AeonLucid 0427cf78e8 Update winforms client csproj 2020-10-14 12:54:07 +02:00
AeonLucid bf99198682 Merge pull request #50 from js6pak/cli-client
Add cli client
2020-10-14 12:33:50 +02:00
AeonLucid ef21cf0445 Support Among Us beta 2020.10.08 2020-10-14 12:16:16 +02:00
Sombrio 565c42cef8 fixed link 2020-10-13 18:43:59 -03:00
Sombrio bef7f6b587 added building the source doc 2020-10-13 18:38:41 -03:00
Sombrio cdf8ea870a moved all wiki pages to main repo 2020-10-13 18:38:26 -03:00
js6pak 9714318878 Fix CI? 2020-10-12 23:27:22 +02:00
js6pak 1f71144611 Add cli client 2020-10-12 23:19:55 +02:00
js6pak eb40fdfd66 Merge branch 'fix/proton' of github.com:js6pak/Impostor into dev 2020-10-12 21:32:32 +02:00
AeonLucid d91c9d33b6 Update Hazel 2020-10-11 02:37:13 +02:00
AeonLucid 7de9b71b92 Fix public/private when joining a game 2020-10-11 02:30:36 +02:00
AeonLucid 99b49cf741 Merge pull request #46 from GerardSmit/feature/plugins
Plugin system start
2020-10-11 02:19:40 +02:00
AeonLucid 67f74f7d1a Update Dockerfile 2020-10-11 01:17:39 +02:00
AeonLucid 4932584315 Update namespaces v2 2020-10-11 01:12:58 +02:00
AeonLucid c856da1621 Update namespaces 2020-10-11 01:11:32 +02:00
Gerard Smit 7db311fdff Disabled SA1633 2020-10-11 00:58:49 +02:00
Gerard Smit 21e7aca353 More abstractions, event manager and docs 2020-10-11 00:45:38 +02:00
Gerard Smit 47e2e3a06a Created Impostor.Server.Api 2020-10-09 02:00:08 +02:00
BrightSkyz 3d74e0e93f Add total game counts for maps (#41) 2020-10-05 03:13:50 +02:00
js6pak 1705ac3d87 Fix CI build 2020-10-04 16:27:15 +02:00
js6pak dc0fbd7e07 Fix steam proton path detection 2020-10-04 16:13:26 +02:00
AeonLucid e45ae2c42a Client csproj changes 2020-10-01 02:55:56 +02:00
AeonLucid fc79c15b0f Second attempt at building 1.1.0 2020-10-01 02:07:21 +02:00
AeonLucid dfc2deff04 Merge branch 'dev' 2020-10-01 01:58:25 +02:00
AeonLucid b1726c501a Bump server version 2020-10-01 01:58:10 +02:00
AeonLucid 9eaf0feaea Yes 2020-10-01 01:53:39 +02:00
AeonLucid f51a57995a Fix build 2020-10-01 01:49:15 +02:00
AeonLucid 1cc6b5f31f Fix build 2020-10-01 01:48:45 +02:00
AeonLucid f34216b51b Fix build 2020-10-01 01:48:18 +02:00
AeonLucid 7e11820363 Hack 2020-10-01 01:36:31 +02:00
AeonLucid f56c0d2a24 Switch to msbuild csproj for client 2020-10-01 01:30:57 +02:00
AeonLucid 51e7faf196 Fix client build 2020-10-01 01:14:14 +02:00
AeonLucid 68e3deb682 Fix client build 2020-10-01 01:12:46 +02:00
AeonLucid 5c8adb8e4f Fix docker build 2020-10-01 01:05:33 +02:00
AeonLucid 0f44001a30 Fix up csproj 2020-10-01 01:00:58 +02:00
AeonLucid 2daf0cc243 Environment changes 2020-10-01 00:53:12 +02:00
AeonLucid 89da149697 Switch to .NET 5.0 2020-10-01 00:48:59 +02:00
AeonLucid 96549af414 Add config.json to publish output 2020-10-01 00:04:30 +02:00
AeonLucid 5350191d40 Add port support to the client 2020-09-30 23:56:17 +02:00
AeonLucid 72be33ddcd Add arm builds for releases 2020-09-30 23:48:14 +02:00
AeonLucid 5caf72898d Not sure if necessary but lets do it anyways 2020-09-30 23:37:20 +02:00
AeonLucid d7da885a8f Multiarch dockerfile 2020-09-30 23:34:12 +02:00
AeonLucid c00ca2a3d6 Docker 2020-09-30 22:12:06 +02:00
AeonLucid 357039ea4c Docker 2020-09-30 22:10:55 +02:00
AeonLucid 8c69469e32 Attempt to add docker arm builds 2020-09-30 22:05:28 +02:00
AeonLucid 11f8207cf1 Change UDPMasterEndpoint to UdpMasterEndpoint 2020-09-30 21:57:02 +02:00
AeonLucid ebdbbe0e3e Merge branch 'dev-2' into dev 2020-09-30 21:54:25 +02:00
AeonLucid 3be4088844 Use a BackgroundService for receiving node updates 2020-09-30 21:53:42 +02:00
Mm2PL 5f631a5a36 Add serialization for GameOptionsData (#31) 2020-09-30 19:18:46 +02:00
AeonLucid 175757805f Merge branch 'master' into dev 2020-09-29 06:17:53 +02:00
AeonLucid f5fea3962d Improve README 2020-09-29 06:17:28 +02:00
AeonLucid cc99ad4ed9 Possible client fix for linux mono issues 2020-09-29 06:04:42 +02:00
SombrioandAeonLucid 192a390dbc ✨ added list of recent used ips in the client (#7)
* Update README

* Update README

* ✨ added list of recent used ips in the client

* rollbacked client version bump

* added combo clearing before loading new items

* Rewrite configuration

Co-authored-by: AeonLucid <aeonlucid@gmail.com>
2020-09-29 06:02:51 +02:00
AeonLucid 23e0a1ed5e Change client id generation 2020-09-29 05:37:39 +02:00
AeonLucid b884d5a669 Fixes host migration (#5) and proper player count checks 2020-09-29 05:31:17 +02:00
Michael Biggins daa1f8ee02 Undo more changes because I hate git 2020-09-28 20:38:30 +01:00
Michael Biggins 7fbdbf7362 Undo previous changes 2020-09-28 20:37:38 +01:00
Michael Biggins 95d8e0f0fb Its impostor, not imposter. 2020-09-28 20:05:53 +01:00
Michael Biggins 4c5b5f361e Implement scheme handler, passing imposter://hostname as an argument to the Client will make it silently apply the change and launch the game. 2020-09-28 20:05:15 +01:00
Michael Biggins 16241457ab Changed visibility of settings and sorted out dep resolution. 2020-09-28 16:33:48 +01:00
Michael Biggins 2f58fc0671 Add an alternative NodeLocator that doesn't rely on Redis for smaller multi-server setups with a single Master. 2020-09-28 16:29:21 +01:00
Michael Biggins 5284f0c2fe Add an alternative NodeLocator that doesn't rely on Redis for smaller multi-server setups with a single Master. 2020-09-28 16:27:57 +01:00
AeonLucid e428383ebe Move recycle to the application 2020-09-27 02:40:07 +02:00
AeonLucid cf19e7fcc5 Add try/catch 2020-09-26 23:35:44 +02:00
AeonLucid 55a40ec2e4 Revert 2020-09-26 23:34:56 +02:00
AeonLucid 1dfebfaa60 Force a build 2020-09-26 23:00:49 +02:00
Gerard Smit 427319282b Updated Hazel submodule (#22) 2020-09-26 22:59:30 +02:00
AeonLucid cd26a7284a Fix game list filter 2020-09-26 20:37:09 +02:00
AeonLucid 287c13f117 Fix game list data 2020-09-26 20:04:09 +02:00
AeonLucid fb33b5b5b3 Split up the NodeProvider into two interfaces 2020-09-26 19:28:46 +02:00
AeonLucid ec7b56e2d5 Merge branch 'master' into dev 2020-09-26 06:15:22 +02:00
Miguel Rodriguez b5d06d0f37 Add issue templates (#15)
* Create config.yml

* Create bug.md

* Create feature-request.md

* Allow blank issues to be made
2020-09-26 06:08:45 +02:00
AeonLucid 38435c9add Fix automated builds 2020-09-26 06:04:58 +02:00
AeonLucid 3c4c69cb19 Fix crash when no nodes are specified 2020-09-26 05:54:49 +02:00
AeonLucid f2a23d5bbb Added server redirection using redis 2020-09-26 05:43:37 +02:00
AeonLucid 7b6c55c78e Only public games in the game listing 2020-09-26 01:59:29 +02:00
AeonLucid 3a29778740 Allow no config and set default values 2020-09-26 01:19:32 +02:00
AeonLucid 7974e333d2 Added .NET generic host, configuration and gamelist packets 2020-09-26 01:10:30 +02:00
AeonLucid 7276e5692f More refactoring 2020-09-25 22:15:16 +02:00
AeonLucid 27062c9281 Unused code 2020-09-25 22:03:04 +02:00
AeonLucid 3f3f545760 Refactor code 2020-09-25 22:02:03 +02:00
AeonLucid 642af7eaa4 Switch to fewerThreads2 branch of Hazel-Networking 2020-09-25 19:18:57 +02:00
AeonLucid f0e838be72 Add OSX build for the server and publish single files 2020-09-25 18:52:15 +02:00
AeonLucid c1458c0943 Remove unused Agent project 2020-09-25 18:40:18 +02:00
AeonLucid ed2af5c0d2 Merge branch 'master' into dev 2020-09-25 18:39:41 +02:00
Daegyeom Ha 418ff08923 docs: fix typo of README.md (#13) 2020-09-25 18:06:25 +02:00
Gerard Smit 7926368fb9 Added PublishTrimmed to Impostor.Server (#3)
* Added PublishTrimmed to Impostor.Server
* Disabled trimming in CI
* Fixed Dockerfile for trimming
2020-09-21 23:43:02 +02:00
AeonLucid 61c47d8ddc Update README 2020-09-21 20:16:06 +02:00
AeonLucid a1b5ba2819 Update README 2020-09-21 20:08:48 +02:00
476 changed files with 23737 additions and 4884 deletions

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.2.0",
"commands": [
"dotnet-cake"
]
}
}
}
@@ -0,0 +1,35 @@
---
name: 1. Bug reporting
about: Bugs within Impostor
title: ''
labels: ''
assignees: ''
---
# Bug Report
## Base Information
- Operating System
- Impostor Version
- Among Us Version
## I confirm:
- [ ] that I have searched for an existing bug report for this issue.
## Symptoms
<!--
Write symptoms here.
-->
Enter Symptoms on this line.
## Reproduction
<!--
How do you reproduce the bug you have here.
-->
Enter reproductions steps here.
@@ -0,0 +1,19 @@
---
name: 2. Feature request
about: To ask and request new features with Impostor
title: ''
labels: ''
assignees: ''
---
# Feature Request
## Feature Information:
<!--
- One issue per post! Do not try and bring up multiple requests in a single post.
- What should it do?
-->
## I confirm:
- [ ] that I have searched for an existing feature request matching the description.
@@ -0,0 +1,20 @@
---
name: 3. Api suggestion
about: To make suggestions for the plugin api
title: ''
labels: api
assignees: ''
---
# Api Suggestion
## Suggestion
<!--
Describe your suggestion as detailed as possible.
-->
## Use case
<!--
Describe what you need it for.
-->
@@ -0,0 +1,25 @@
---
name: 4. Api invalid data
about: To let us know about invalid data in the api
title: ''
labels: api
assignees: ''
---
# Api missing data
## Data
<!--
Describe about the missing data that you need.
-->
## Expectations
<!--
Describe what the api gave you and what you expected.
-->
## Reproduce
<!--
Describe how to reproduce the issue.
-->
@@ -0,0 +1,20 @@
---
name: 5. Api unavailable data
about: To let us know about unavailable data from the api that you would like to use
title: ''
labels: api
assignees: ''
---
# Api missing data
## Data
<!--
Describe about the unavailable data that you need.
-->
## Use-case
<!--
Describe what you need it for.
-->
+10
View File
@@ -0,0 +1,10 @@
---
name: 6. Api other
about: For anything about the api that does not fit in the other issues
title: ''
labels: api
assignees: ''
---
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: true
+16
View File
@@ -0,0 +1,16 @@
### Description
<!--
If your pull request closes any issues, add them below with the `closes` keyword before them
Example: closes #101
See the following article for more information: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
### Closes issues
- closes #
+57
View File
@@ -0,0 +1,57 @@
name: CI
on:
push:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- '.gitmodules'
- 'build.cake'
pull_request:
paths:
- '.github/workflows/ci.yml'
- 'src/**/**'
- '.gitmodules'
- 'build.cake'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.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 }}
-93
View File
@@ -1,93 +0,0 @@
name: Deploy
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Setup MSBuild.exe
uses: warrenbuckley/Setup-MSBuild@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install dependencies
run: dotnet restore ./src
- name: Build Impostor.Client
run: msbuild ./src/Impostor.Client/Impostor.Client.csproj /p:Configuration=Release
- name: Build Impostor.Server
run: dotnet build --no-restore -c Release -f netcoreapp3.1 ./src/Impostor.Server/Impostor.Server.csproj
- name: Test
run: dotnet test --no-restore -v normal -f netcoreapp3.1 ./src
- name: Zip Impostor.Client
shell: bash
run: |
cd ./src/Impostor.Client/bin/Release/net452/win-x64
7z a -r $GITHUB_WORKSPACE/build/win-x64-client.zip *
cd $GITHUB_WORKSPACE
- name: Publish Impostor.Server (win-x64)
run: dotnet publish -c release -o ./build/win-x64 -f netcoreapp3.1 -r win-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj
- name: Zip Impostor.Server (win-x64)
shell: bash
run: |
cd ./build/win-x64
7z a -r ../win-x64.zip *
cd $GITHUB_WORKSPACE
- name: Publish Impostor.Server (linux-x64)
run: dotnet publish -c release -o ./build/linux-x64 -f netcoreapp3.1 -r linux-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj
- name: Zip Impostor.Server (linux-x64)
shell: bash
run: |
cd ./build/linux-x64
7z a -r ../linux-x64.zip *
cd $GITHUB_WORKSPACE
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: true
prerelease: false
- name: Upload Release Asset (win-x64) Client
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/win-x64-client.zip
asset_name: Impostor-Client-win-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset (win-x64) Server
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/win-x64.zip
asset_name: Impostor-Server-win-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset (linux-x64) Server
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/linux-x64.zip
asset_name: Impostor-Server-linux-x64.zip
asset_content_type: application/zip
+15 -9
View File
@@ -2,11 +2,13 @@ name: Docker
on:
push:
branches: dev
branches: master
paths:
- 'src/Impostor.Server/**'
- 'src/Impostor.Shared/**'
- '.gitmodules'
- '.github/workflows/docker.yml'
- 'Dockerfile'
tags:
- 'v*.*.*'
pull_request:
@@ -14,6 +16,8 @@ on:
- 'src/Impostor.Server/**'
- 'src/Impostor.Shared/**'
- '.gitmodules'
- '.github/workflows/docker.yml'
- 'Dockerfile'
jobs:
push_to_registry:
@@ -29,24 +33,24 @@ jobs:
run: |
DOCKER_IMAGE=aeonlucid/impostor
VERSION=noop
VERSIONSUFFIX=docker
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
VERSIONSUFFIX=none
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "dev" ]; then
VERSION=nightly
fi
VERSION=nightly
VERSIONSUFFIX=docker.${{ github.run_number }}
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
VERSIONSUFFIX=pr.${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=versionsuffix::${VERSIONSUFFIX}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@@ -63,6 +67,8 @@ jobs:
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
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 }}
-47
View File
@@ -1,47 +0,0 @@
name: Build
on:
push:
branches: [ master, dev ]
paths:
- 'src/**'
- '.gitmodules'
pull_request:
branches: [ master, dev ]
paths:
- 'src/**'
- '.gitmodules'
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Setup MSBuild.exe
uses: warrenbuckley/Setup-MSBuild@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install dependencies
run: dotnet restore ./src
- name: Build Impostor.Client
run: msbuild ./src/Impostor.Client/Impostor.Client.csproj /p:Configuration=Release
- name: Build Impostor.Server
run: dotnet build --no-restore -c Release -f netcoreapp3.1 ./src/Impostor.Server/Impostor.Server.csproj
- name: Test
run: dotnet test --no-restore -v normal -f netcoreapp3.1 ./src
deploy:
name: Deploy
runs-on: windows-latest
needs: build
if: github.event_name == 'release'
steps:
- name: Publish Impostor.Server (win-x64)
run: dotnet publish -c release -o /build/linux-x64 -f netcoreapp3.1 -r win-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj
- name: Publish Impostor.Server (linux-x64)
run: dotnet publish -c release -o /build/linux-x64 -f netcoreapp3.1 -r linux-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj
+7
View File
@@ -0,0 +1,7 @@
/.vscode
/build
/.vs
/src/Impostor.Plugins.Debugger/Properties/launchSettings.json
/tools
.local/
+3 -3
View File
@@ -1,3 +1,3 @@
[submodule "submodules/Hazel-Networking"]
path = submodules/Hazel-Networking
url = https://github.com/AeonLucid/Hazel-Networking.git
[submodule "src/Impostor.Hazel"]
path = src/Impostor.Hazel
url = https://github.com/Impostor/Impostor.Hazel
+22
View File
@@ -0,0 +1,22 @@
# Contribute guidelines
We are always looking for people to help improve Impostor.
## Code
- If you are implementing or fixing an issue, please comment on the issue so work is not duplicated.
- If you want to implementing a new feature, create an issue first describing the issue so we know about it. We are always open for discussion or questions on [Discord](https://discord.gg/Mk3w6Tb).
- Don't commit unnecessary changes to the codebase or debugging code.
- Write meaningful commits or squash them.
- Please try to follow the code style of the rest of the codebase. An `.editorconfig` file has been provided to keep consistency.
- 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.
- 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.
+30 -10
View File
@@ -1,23 +1,43 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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.Shared/Impostor.Shared.csproj ./src/Impostor.Shared/Impostor.Shared.csproj
COPY submodules/Hazel-Networking/Hazel/Hazel.csproj ./submodules/Hazel-Networking/Hazel/Hazel.csproj
COPY src/Impostor.Api/Impostor.Api.csproj ./src/Impostor.Api/Impostor.Api.csproj
COPY src/Impostor.Hazel/Hazel/Hazel.csproj ./src/Impostor.Hazel/Hazel/Hazel.csproj
COPY src/Directory.Build.props ./src/Directory.Build.props
RUN dotnet restore -r linux-musl-x64 ./src/Impostor.Server/Impostor.Server.csproj && \
dotnet restore -r linux-musl-x64 ./src/Impostor.Shared/Impostor.Shared.csproj && \
dotnet restore -r linux-musl-x64 ./submodules/Hazel-Networking/Hazel/Hazel.csproj
RUN case "$TARGETARCH" in \
amd64) NETCORE_PLATFORM='linux-x64';; \
arm64) NETCORE_PLATFORM='linux-arm64';; \
arm) NETCORE_PLATFORM='linux-arm';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Server/Impostor.Server.csproj && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Api/Impostor.Api.csproj && \
dotnet restore -r "$NETCORE_PLATFORM" ./src/Impostor.Hazel/Hazel/Hazel.csproj
# Copy everything else.
COPY submodules/. ./submodules/
COPY src/. ./src/
RUN dotnet publish -c release -o /app -f netcoreapp3.1 -r linux-musl-x64 --self-contained false --no-restore ./src/Impostor.Server/Impostor.Server.csproj
RUN case "$TARGETARCH" in \
amd64) NETCORE_PLATFORM='linux-x64';; \
arm64) NETCORE_PLATFORM='linux-arm64';; \
arm) NETCORE_PLATFORM='linux-arm';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
[[ $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 mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:6.0
WORKDIR /app
COPY --from=build /app ./
EXPOSE 22023/udp
ENTRYPOINT ["./Impostor.Server"]
ENTRYPOINT ["./Impostor.Server"]
+17 -33
View File
@@ -1,58 +1,42 @@
# Impostor
Impostor is one of the first **Among Us** private servers, written in C#.
[![Discord](https://img.shields.io/badge/Discord-chat-blue?style=flat-square)](https://discord.gg/Mk3w6Tb)
[![CI](https://github.com/Impostor/Impostor/workflows/CI/badge.svg)](https://github.com/Impostor/Impostor/actions)
The latest version supported is `2020.9.9`, both desktop and mobile.
Impostor is the first working **Among Us** private server, written in C#.
There are no special features at this moment, the goal is aiming to be as close as possible to the real server, for now. In a later stage, making modifications to game logic by modifying `GameData` can be looked at.
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.
[Discord server for Impostor](https://discord.gg/Mk3w6Tb)
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
Almost all standard features are implemented at this moment, except for public games. It is already possible to host and play private games.
- [x] Create game
- [x] Join game
- [x] Start game
- [ ] Find game
- [x] V1 GameCodes (AAAA)
- [x] V2 GameCodes (AAAAAA)
- [x] Kick player
- [x] Ban player
- [ ] Server redirection
- [ ] Server reselect
- All Among Us features are implemented. It is a full replacement for the official server.
- Plugin support.
- Server-sided anticheat.
## Installation
When hosting a server, make sure port **22023** is open and forwarded for **UDP**. It is not possible to use a different port because Among Us seems to have hardcoded 22023, even though the functionality for setting a port exists.
### Client
If you just want to play on a server hosted by someone else, you need to follow these instructions.
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.
> W.I.P
### Server
### Server (Docker)
See the [docs](docs/Running-the-server.md) for instructions on how to set it up.
![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor?sort=semver)
![Docker Image](https://img.shields.io/docker/v/aeonlucid/impostor/edge)
## Troubleshooting
```
docker run -p 22023:22023/udp aeonlucid/impostor
```
See [TROUBLESHOOTING](docs/TROUBLESHOOTING.md) to solve issues with the Impostor client or the server.
### Server (Windows / Linux)
## Contributing
1. Find the [latest release](https://github.com/AeonLucid/Impostor/releases/latest)
2. Download either the Windows or the Linux version.
3. Extract the zip.
4. Run `Impostor.Server.exe` (Windows) / `Impostor.Server` (Linux)
See [CONTRIBUTING](CONTRIBUTING.md).
## License
This software is distributed under the **GNU GLPv3** License.
This software is distributed under the **GNU GPLv3** License.
## Credits
- [willardf/Hazel-Networking](https://github.com/willardf/Hazel-Networking)
- [willardf/Hazel-Networking](https://github.com/willardf/Hazel-Networking)
+165
View File
@@ -0,0 +1,165 @@
#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 buildVersion = FindRegexMatchGroupInFile("./src/Directory.Build.props", @"\<VersionPrefix\>(.*?)\<\/VersionPrefix\>", 1, System.Text.RegularExpressions.RegexOptions.None).Value;
var buildDir = MakeAbsolute(Directory("./build"));
var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");
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";
}
//////////////////////////////////////////////////////////////////////
// UTILS
//////////////////////////////////////////////////////////////////////
// Remove unnecessary files for packaging.
private void ImpostorPublish(string name, string project, string runtime, bool isServer = false) {
var projBuildDir = buildDir.Combine(name + "_" + runtime);
var projBuildName = name + "_" + buildVersion + "_" + runtime;
DotNetPublish(project, new DotNetPublishSettings {
Configuration = configuration,
NoRestore = true,
Runtime = runtime,
SelfContained = false,
PublishSingleFile = true,
PublishTrimmed = false,
OutputDirectory = projBuildDir,
MSBuildSettings = msbuildSettings
});
if (isServer) {
CreateDirectory(projBuildDir.Combine("plugins"));
CreateDirectory(projBuildDir.Combine("libraries"));
if (runtime == "win-x64") {
FileWriteText(projBuildDir.CombineWithFilePath("run.bat"), "@echo off\r\nImpostor.Server.exe\r\npause");
}
}
if (runtime == "win-x64") {
Zip(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".zip"));
} else {
GZipCompress(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".tar.gz"));
}
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
BuildSystem.GitHubActions.Commands.UploadArtifact(projBuildDir, projBuildName);
}
}
private void ImpostorPublishNF(string name, string project) {
var runtime = "win-x64";
var projBuildDir = buildDir.Combine(name + "_" + runtime);
var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
DotNetPublish(project, new DotNetPublishSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net472",
OutputDirectory = projBuildDir,
MSBuildSettings = msbuildSettings
});
Zip(projBuildDir, projBuildZip);
}
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() => {
if (DirectoryExists(buildDir)) {
DeleteDirectory(buildDir, new DeleteDirectorySettings {
Recursive = true
});
}
});
Task("Restore")
.Does(() => {
DotNetRestore("./src/Impostor.sln");
});
Task("Replay")
.Does(() => {
// D:\Projects\GitHub\Impostor\Impostor\src\Impostor.Tools.ServerReplay\sessions
DotNetRun(
"./src/Impostor.Tools.ServerReplay/Impostor.Tools.ServerReplay.csproj",
"./src/Impostor.Tools.ServerReplay/sessions", new DotNetRunSettings {
Configuration = configuration,
NoRestore = true,
});
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Replay")
.Does(() => {
// Tests.
DotNetBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetBuildSettings {
Configuration = configuration,
});
// 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.
DotNetPack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetPackSettings {
Configuration = configuration,
OutputDirectory = buildDir,
IncludeSource = true,
IncludeSymbols = true,
MSBuildSettings = msbuildSettings
});
if (BuildSystem.GitHubActions.IsRunningOnGitHubActions) {
foreach (var file in GetFiles(buildDir + "/*.{nupkg,snupkg}"))
{
BuildSystem.GitHubActions.Commands.UploadArtifact(file, "Impostor.Api");
}
}
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetTestSettings {
Configuration = configuration,
NoBuild = true
});
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
+29
View File
@@ -0,0 +1,29 @@
# Building from source
The solution contains the Impostor server and its dependencies, like Hazel and the plugin API. The server is built using [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0).
## Cloning Impostor
You need to clone Impostor using git:
```bash
git clone https://github.com/Impostor/Impostor.git
```
## Building the server
### Dependencies
- [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.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).
+15
View File
@@ -0,0 +1,15 @@
# Frequently Answered Questions
## What is this?
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. 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).
+7
View File
@@ -0,0 +1,7 @@
# Impostor Documentation
1. [Running the server](Running-the-server.md)
2. [Server configuration](Server-configuration.md)
3. [Building from source](Building-from-source.md)
4. [Writing a plugin](Writing-a-plugin.md)
5. [Frequently answered questions](FAQ.md)
+106
View File
@@ -0,0 +1,106 @@
# Running the server
There are currently two modes to run the Impostor server. The first way, Single Server, is the simplest one, can handle up to a few hundred simultaneous players, and is the one you should probably use. Multi-Server mode will distribute players across other servers and is intended for advanced users.
## Single server
### Without Docker
1. Install the [.NET 6.0 runtime](https://dotnet.microsoft.com/download/dotnet/6.0). Installing the SDK also works, but is not necessary unless you plan on developing Impostor or Impostor plugins. If you're asked to pick between the normal, desktop or server runtime, the normal runtime is enough, but some plugins may require the ASP.NET Core Runtime as well.
2. Find the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master).
3. Download the version for your OS (linux/win/osx). Impostor is built for multiple CPU-architectures, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device with an ARM processor.
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` (Linux/macOS) or `Impostor.Server.exe` (Windows)
Depending on your host you may also need to port forward Impostor to the internet. By default Impostor uses port **22023** and the **UDP** protocol. As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
To connect to the server, you need to configure a region file on https://impostor.github.io/Impostor/
### 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)
After installing Docker, you can just start a Docker container with `docker run`:
```
docker run -p 22023:22023/udp aeonlucid/impostor:nightly
```
### Using Docker Compose
```
version: '3.4'
services:
impostor:
image: aeonlucid/impostor:nightly
container_name: impostor
ports:
- 22023:22023/udp
volumes:
- /path/to/local/config.json:/app/config.json # For easy editing of the config
- /path/to/local/plugins:/app/plugins # Only needed if using plugins
- /path/to/local/libraries:/app/libraries # Only needed if using external libraries
```
## Multiple servers
Follow the steps from the single server on two or more servers. You should only need to set this up if you have a very large server and can no longer fit everyone on one server: if this is your first time installing Impostor, use a single server.
### 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"
}
}
}
```
+116
View File
@@ -0,0 +1,116 @@
# Server configuration
Some information about all the possible configurations. Click [here](https://github.com/Impostor/Impostor/blob/master/src/Impostor.Server/config-full.json) to see all the possible config options.
## Options
### Required Server Configuration
| Key | Default | Description |
| -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **PublicIp** | `127.0.0.1` | This needs to the public IPv4 address of the server which you give to others to connect. You can find your IPv4 address [on this website](http://whatismyip.host/). Unless you are only planning to use Impostor privately, on your local network, you should change this to your public ip. It is also possible to use hostnames instead of IPv4 addresses, which will be resolved to IPv4 addresses. |
| **PublicPort** | `22023` | The public port of the server which you give to others to connect. (**This is the external port you configure on your router when port forwarding.**) Usually `22023`. |
| **ListenIp** | `0.0.0.0` | The network interface to listen on. If you do not know what to put here, use `0.0.0.0`. Since 1.2.2 it is also possible to use hostnames instead of IPv4 addresses, these must resolve to a valid IPv4 address. |
| **ListenPort** | `22023` | The listen port of the server, usually `22023`. |
### AntiCheat
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.
| Key | Default | Value |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Enabled** | `true` | Whether the anticheat should be enabled. |
| **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. |
### Compatibility
Impostor has two compatibility options which allow some extra flexibility but may not work properly. Enabling either of these options is not recommended.
| Key | Default | Value |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **AllowNewGameVersions** | `false` | Warning: Setting this option to `true` is unsupported and may cause issues when large updates to Among Us are released. Allow future versions of Among Us to join your server. |
| **AllowVersionMixing** | `false` | Allow players using different game versions to play in one lobby. |
### Debug
The Debug configuration is used to enable the game recorder. This is mostly useful when developing Impostor.
| Key | Default | Value |
| ----------------------- | ------- | -------------------------------------------- |
| **GameRecorderEnabled** | `false` | Enables the Game Recorder. |
| **GameRecorderPath** | _empty_ | Path where the recorded games will be saved. |
### ServerRedirector
In a multi-node setup these values need to be specified. Note that most people do not need to run a Multi-node setup.
| 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. |
### 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.
### Environment variables
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
```
+57
View File
@@ -0,0 +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 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`
## Disconnected with `Your client is too new, please update your Impostor to play`
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.
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.
+340
View File
@@ -0,0 +1,340 @@
# Writing a plugin
Impostor has support for plugins. This document will help you to setup a development environment for writing a plugin.
- [1. Install .NET Core SDK](#1-install-net-core-sdk)
- [2. Create a C# project](#2-create-a-c-project)
- [3. Add the Impostor.Api library](#3-add-the-impostorapi-library)
- [Quick](#quick)
- [Visual Studio](#visual-studio)
- [4. The plugin class](#4-the-plugin-class)
- [5. Adding an event listener](#5-adding-an-event-listener)
- [6. Registering the event listener](#6-registering-the-event-listener)
- [7. Build and run your plugin](#7-build-and-run-your-plugin)
- [8. Extra](#8-extra)
- [Event listeners](#event-listeners)
- [Dependency injection](#dependency-injection)
- [Server configuration](#server-configuration)
- [Using other libraries](#using-other-libraries)
- [Impostor versions](#impostor-versions)
- [9. Missing/invalid data or want more functions?](#9-missinginvalid-data-or-want-more-functions)
## 1. Install .NET 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 6, which includes:
- .NET Standard 2.0
- .NET Standard 2.1
- .NET 5
- .NET 6
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**. This should give you enough functionality. If not, upgrade to .NET 6.
When the project has been created, you should have `Class.cs` and `Project.csproj` files. Your `Project.csproj` should look something like this.
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
</Project>
```
## 3. Add the Impostor.Api library
You only have to follow the instructions of one below.
### Quick
Install the `Impostor.Api` NuGet package.
Make sure to get a prerelease if you are writing a plugin for a dev release of the server.
### Visual Studio
1. Right click your project.
2. Click `Manage NuGet Packages`.
3. Click `Browse`.
4. Search for `Impostor.Api`.
5. Click the `Impostor.Api` result and press install on the right side.
### Dotnet CLI
1. Open your project folder in command prompt / bash.
2. Run `dotnet add package Impostor.Api`.
## 4. The plugin class
Now the `Impostor.Api` is installed, you need to create a class for your plugin. A plugin **must** contain exactly one. See the code below for an example.
```csharp
using System.Threading.Tasks;
using Impostor.Api.Events.Managers;
using Impostor.Api.Plugins;
using Microsoft.Extensions.Logging;
namespace Impostor.Plugins.Example
{
/// <summary>
/// The metadata information of your plugin, this is required.
/// </summary>
[ImpostorPlugin(
package: "gg.impostor.example",
name: "Example",
author: "AeonLucid",
version: "1.0.0")]
public class ExamplePlugin : PluginBase // This is also required ": PluginBase".
{
/// <summary>
/// A logger that works seamlessly with the server.
/// </summary>
private readonly ILogger<ExamplePlugin> _logger;
/// <summary>
/// The constructor of the plugin. There are a few parameters you can add here and they
/// will be injected automatically by the server, two examples are used here.
///
/// They are not necessary but very recommended.
/// </summary>
/// <param name="logger">
/// A logger to write messages in the console.
/// </param>
/// <param name="eventManager">
/// An event manager to register event listeners.
/// Useful if you want your plugin to interact with the game.
/// </param>
public ExamplePlugin(ILogger<ExamplePlugin> logger, IEventManager eventManager)
{
_logger = logger;
}
/// <summary>
/// This is called when your plugin is enabled by the server.
/// </summary>
/// <returns></returns>
public override ValueTask EnableAsync()
{
_logger.LogInformation("Example is being enabled.");
return default;
}
/// <summary>
/// This is called when your plugin is disabled by the server.
/// Most likely because it is shutting down, this is the place to clean up any managed resources.
/// </summary>
/// <returns></returns>
public override ValueTask DisableAsync()
{
_logger.LogInformation("Example is being disabled.");
return default;
}
}
}
```
## 5. Adding an event listener
Currently you should have a plugin that loads and does nothing. In order to get some actual functionality, you need to add an event listener.
Create a new class called `GameEventListener`. Example code:
```csharp
using Impostor.Api.Events;
using Impostor.Api.Events.Player;
using Microsoft.Extensions.Logging;
namespace Impostor.Plugins.Example.Handlers
{
/// <summary>
/// A class that listens for two events.
/// It may be more but this is just an example.
///
/// Make sure your class implements <see cref="IEventListener"/>.
/// </summary>
public class GameEventListener : IEventListener
{
private readonly ILogger<ExamplePlugin> _logger;
public GameEventListener(ILogger<ExamplePlugin> logger)
{
_logger = logger;
}
/// <summary>
/// An example event listener.
/// </summary>
/// <param name="e">
/// The event you want to listen for.
/// </param>
[EventListener]
public void OnGameStarted(IGameStartedEvent e)
{
_logger.LogInformation($"Game is starting.");
// This prints out for all players if they are impostor or crewmate.
foreach (var player in e.Game.Players)
{
var info = player.Character.PlayerInfo;
var isImpostor = info.IsImpostor;
if (isImpostor)
{
_logger.LogInformation($"- {info.PlayerName} is an impostor.");
}
else
{
_logger.LogInformation($"- {info.PlayerName} is a crewmate.");
}
}
}
[EventListener]
public void OnGameEnded(IGameEndedEvent e)
{
_logger.LogInformation($"Game has ended.");
}
[EventListener]
public void OnPlayerChat(IPlayerChatEvent e)
{
_logger.LogInformation($"{e.PlayerControl.PlayerInfo.PlayerName} said {e.Message}");
}
}
}
```
## 6. Registering the event listener
The last step to get your plugin working is to register the event listener, so the server knows about it. Go back to your plugin class and modify it as below.
```csharp
using System;
using System.Threading.Tasks;
using Impostor.Api.Events.Managers;
using Impostor.Api.Plugins;
using Impostor.Plugins.Example.Handlers;
using Microsoft.Extensions.Logging;
namespace Impostor.Plugins.Example
{
[ImpostorPlugin(
package: "gg.impostor.example",
name: "Example",
author: "AeonLucid",
version: "1.0.0")]
public class ExamplePlugin : PluginBase
{
private readonly ILogger<ExamplePlugin> _logger;
// Add the line below!
private readonly IEventManager _eventManager;
// Add the line below!
private IDisposable _unregister;
public ExamplePlugin(ILogger<ExamplePlugin> logger, IEventManager eventManager)
{
_logger = logger;
// Add the line below!
_eventManager = eventManager;
}
public override ValueTask EnableAsync()
{
_logger.LogInformation("Example is being enabled.");
// Add the line below!
_unregister = _eventManager.RegisterListener(new GameEventListener(_logger));
return default;
}
public override ValueTask DisableAsync()
{
_logger.LogInformation("Example is being disabled.");
// Add the line below!
_unregister.Dispose();
return default;
}
}
}
```
## 7. Build and run your plugin
Now your plugin is ready to be tested.
1. Right click your project and press `Build`.
2. Right click your project and press `Open Folder in File Explorer`.
3. Go to `bin/Debug/netstandard2.1/`.
4. In this directory, you should find your plugin named `Project.dll`.
5. Copy the `Project.dll` to the `plugins` directory in your Impostor server directory.
6. (Re)start your Impostor server.
7. Open Among Us, create a game and send a chat message. In the console you should see your plugin being loaded and the messages from the example.
## 8. Extra
Some extra information that might be useful for those developing plugins.
### Event listeners
- You can have multiple event listener on the same event.
- An event listener can be given a priority `[EventListener(EventPriority.Normal)]` and is called in order.
- It is not recommended to block for a long time inside `EventListener` because the events are called from inside the packet handlers. Blocking too long causes the client to time out. You should create a new `Task` for operations that will take a lot of time.
### Dependency injection
- The main plugin class is constructed by the `IServiceProvider` of the server and can inject everything the server uses. A few examples are:
- `ILogger<T>`
- `IEventManager`
- `IClientManager`
- `IOptions<ServerConfig>`
- `IOptions<ServerRedirectorConfig>`
- You can add your own classes and `EventListener` implementation to the `IServiceProvider` by creating a new class and implementing `IPluginStartup`. Make sure to register them as a singleton `services.AddSingleton<IEventListener, GameEventListener>();`.
### Server configuration
Constantly copying the plugin dll to your server directory can be pretty annoying. Luckily we have a solution for that. In your Impostor server open the `config.json` and add the `PluginLoader` from the example below, replace the path with the build destination of your plugin.
```json
{
"Server": {
"PublicIp": "127.0.0.1",
"PublicPort": 22023,
"ListenIp": "0.0.0.0",
"ListenPort": 22023
},
"PluginLoader": {
"Paths": [
"D:\\Projects\\Impostor\\src\\Impostor.Plugins.Example\\bin\\Debug\\netstandard2.1"
],
"LibraryPaths": []
}
}
```
### Using other libraries
Sometimes you need to use libraries that the original Impostor server does not provide. The dll files of these libraries must be placed in the `libraries` folder next to the server executable. You could also provide them by modifying the `PluginLoader.LibraryPaths` option in the `config.json`, similarly to the `PluginLoader.Paths` option.
### Impostor versions
It is important to use the correct versions when working with `Impostor.Api` prereleases and the `Impostor` dev builds to reduce the chances of mismatching assemblies.
**Example**
The prerelease `Impostor.Api` package `1.2.0-ci.54` belongs to build `54` on AppVeyor, which can be found here https://ci.appveyor.com/project/Impostor/Impostor/build/54. Notice the `54` on the end of the url.
## 9. Missing/invalid data or want more functions?
The `Impostor.Api` is currently in beta. There are a lot of things still missing and we would like to hear from you what you need to develop a plugin.
Create an issue:
- [Suggest a function](https://github.com/Impostor/Impostor/issues/new?template=3--api-suggestion.md)
- [Data is invalid](https://github.com/Impostor/Impostor/issues/new?template=4--api-invalid.md)
- [Data is unavailable](https://github.com/Impostor/Impostor/issues/new?template=5--api-missing.md)
- [Other](https://github.com/Impostor/Impostor/issues/new?template=6--api-other.md)
Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

+239
View File
@@ -0,0 +1,239 @@
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:refactoring
dotnet_style_qualification_for_property = false:refactoring
dotnet_style_qualification_for_method = false:refactoring
dotnet_style_qualification_for_event = false:refactoring
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
# Non-private static fields are PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
# Non-private readonly fields are PascalCase
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.constant_style.capitalization = pascal_case
# Static readonly fields are PascalCase
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static, readonly
dotnet_naming_style.static_field_style.capitalization = pascal_case
# Instance fields are camelCase and start with _
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
# Locals and parameters are camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
dotnet_naming_style.camel_case_style.capitalization = camel_case
# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
dotnet_naming_style.local_function_style.capitalization = pascal_case
# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.all_members.applicable_kinds = *
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Async methods should have "Async" suffix
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
dotnet_naming_rule.async_methods_end_in_async.severity = warning
dotnet_naming_symbols.any_async_methods.applicable_kinds = method
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
dotnet_naming_symbols.any_async_methods.required_modifiers = async
dotnet_naming_style.end_in_async.required_prefix =
dotnet_naming_style.end_in_async.required_suffix = Async
dotnet_naming_style.end_in_async.capitalization = pascal_case
dotnet_naming_style.end_in_async.word_separator =
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
dotnet_diagnostic.RS2008.severity = none
# 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
# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = warning
# IDE0043: Format string contains invalid placeholder
dotnet_diagnostic.IDE0043.severity = warning
# IDE0044: Make field readonly
dotnet_diagnostic.IDE0044.severity = warning
# CSharp code style settings:
[*.cs]
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
# csharp_new_line_before_members_in_object_initializers = true TODO seems like Rider/ReSharper has the value inverted, uncomment when its fixed
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Blocks are allowed
csharp_prefer_braces = true:silent
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
# warning RS0037: PublicAPI.txt is missing '#nullable enable'
dotnet_diagnostic.RS0037.severity = none
# ReSharper properties
resharper_trailing_comma_in_multiline_lists = true
+2 -149
View File
@@ -1,3 +1,5 @@
config.*.json
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
@@ -24,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
@@ -70,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
@@ -110,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
@@ -195,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 ;-)
@@ -210,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
+14
View File
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<VersionPrefix>1.7.2</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<EnforceCodeStyleInBuild Condition="$(MSBuildProjectName)!='Hazel'">true</EnforceCodeStyleInBuild>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
</ItemGroup>
</Project>
-94
View File
@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{097be795-88e9-4e7b-92f3-f6dddbe3f012}</ProjectGuid>
<RootNamespace>AmongUsAgent</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)build\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)build\$(Platform)\$(Configuration)\Intermediate\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)build\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)build\$(Platform)\$(Configuration)\Intermediate\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="logger.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="logger.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="logger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="logger.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
-84
View File
@@ -1,84 +0,0 @@
#include "logger.h"
#include <cstdio>
#include <Windows.h>
HANDLE h_out = nullptr, h_old_out = nullptr;
HANDLE h_err = nullptr, h_old_err = nullptr;
HANDLE h_in = nullptr, h_old_in = nullptr;
namespace Logger
{
void Attach()
{
h_old_out = GetStdHandle(STD_OUTPUT_HANDLE);
h_old_err = GetStdHandle(STD_ERROR_HANDLE);
h_old_in = GetStdHandle(STD_INPUT_HANDLE);
AllocConsole() && AttachConsole(GetCurrentProcessId());
h_out = GetStdHandle(STD_OUTPUT_HANDLE);
h_err = GetStdHandle(STD_ERROR_HANDLE);
h_in = GetStdHandle(STD_INPUT_HANDLE);
SetConsoleMode(h_out,
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
SetConsoleMode(h_in,
ENABLE_INSERT_MODE | ENABLE_EXTENDED_FLAGS |
ENABLE_PROCESSED_INPUT | ENABLE_QUICK_EDIT_MODE);
}
void Detach()
{
if (h_out && h_err && h_in) {
FreeConsole();
if (h_old_out)
{
SetStdHandle(STD_OUTPUT_HANDLE, h_old_out);
}
if (h_old_err)
{
SetStdHandle(STD_ERROR_HANDLE, h_old_err);
}
if (h_old_in)
{
SetStdHandle(STD_INPUT_HANDLE, h_old_in);
}
}
}
bool Print(const char* fmt, ...)
{
if (!h_out)
{
return false;
}
char buf[1024];
va_list va;
va_start(va, fmt);
_vsnprintf_s(buf, 1024, fmt, va);
va_end(va);
return !!WriteConsoleA(h_out, buf, static_cast<DWORD>(strlen(buf)), nullptr, nullptr);
}
char ReadKey()
{
if (!h_in)
{
return -1;
}
auto key = char{ 0 };
auto keysread = DWORD{ 0 };
ReadConsoleA(h_in, &key, 1, &keysread, nullptr);
return key;
}
};
-9
View File
@@ -1,9 +0,0 @@
#pragma once
namespace Logger
{
void Attach();
void Detach();
bool Print(const char* fmt, ...);
char ReadKey();
};
-40
View File
@@ -1,40 +0,0 @@
#include <Windows.h>
#include "logger.h"
DWORD WINAPI OnDllAttach(LPVOID base)
{
Logger::Attach();
Logger::Print("[AmongUs.Agent] DLL Attached\n");
FreeLibraryAndExitThread(static_cast<HMODULE>(base), 1);
}
BOOL WINAPI OnDllDetach()
{
Logger::Print("[AmongUs.Agent] DLL Detached\n");
Logger::Detach();
return true;
}
BOOL WINAPI DllMain(
const _In_ HINSTANCE hinstDll,
const _In_ DWORD fdwReason,
const _In_opt_ LPVOID lpvReserved
)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDll);
CreateThread(nullptr, 0, OnDllAttach, hinstDll, 0, nullptr);
return true;
case DLL_PROCESS_DETACH:
if (lpvReserved == nullptr)
return OnDllDetach();
return true;
default:
return true;
}
}
+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,11 @@
namespace Impostor.Api.Config
{
public class AntiCheatConfig
{
public const string Section = "AntiCheat";
public bool Enabled { get; set; } = true;
public bool BanIpFromGame { get; set; } = true;
}
}
@@ -0,0 +1,11 @@
namespace Impostor.Api.Config
{
public class CompatibilityConfig
{
public const string Section = "Compatibility";
public bool AllowFutureGameVersions { get; set; } = false;
public bool AllowVersionMixing { get; set; } = false;
}
}
+11
View File
@@ -0,0 +1,11 @@
namespace Impostor.Api.Config
{
public class DebugConfig
{
public const string Section = "Debug";
public bool GameRecorderEnabled { get; set; }
public string GameRecorderPath { get; set; } = string.Empty;
}
}
@@ -0,0 +1,30 @@
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 NotImplemented = "Game listing has not been implemented in Impostor yet for servers " +
"running in server redirection mode.";
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.";
}
}
+30
View File
@@ -0,0 +1,30 @@
using Impostor.Api.Utils;
namespace Impostor.Api.Config
{
public class ServerConfig
{
public const string Section = "Server";
private string? _resolvedPublicIp;
private string? _resolvedListenIp;
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 ushort ListenPort { get; set; } = 22023;
public string ResolvePublicIp()
{
return _resolvedPublicIp ??= IpUtils.ResolveIp(PublicIp);
}
public string ResolveListenIp()
{
return _resolvedListenIp ??= IpUtils.ResolveIp(ListenIp);
}
}
}
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Impostor.Api.Config
{
public class ServerRedirectorConfig
{
public const string Section = "ServerRedirector";
public bool Enabled { get; set; }
public bool Master { get; set; }
public NodeLocator? Locator { get; set; }
public List<ServerRedirectorNode>? Nodes { get; set; }
public class NodeLocator
{
[AllowNull]
public string Redis { get; set; }
[AllowNull]
public string UdpMasterEndpoint { get; set; }
}
}
}
@@ -0,0 +1,13 @@
using System.Diagnostics.CodeAnalysis;
namespace Impostor.Api.Config
{
public class ServerRedirectorNode
{
[AllowNull]
public string Ip { get; set; }
[AllowNull]
public ushort Port { get; set; }
}
}
@@ -0,0 +1,34 @@
using System;
namespace Impostor.Api.Events
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class EventListenerAttribute : Attribute
{
public EventListenerAttribute(EventPriority priority = EventPriority.Normal)
{
Priority = priority;
}
public EventListenerAttribute(Type @event, EventPriority priority = EventPriority.Normal)
{
Priority = priority;
Event = @event;
}
/// <summary>
/// Gets or sets the priority of the event listener.
/// </summary>
public EventPriority Priority { get; set; }
/// <summary>
/// Gets or sets the event that the listener is listening to.
/// </summary>
public Type? Event { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled" />.
/// </summary>
public bool IgnoreCancelled { get; set; }
}
}
@@ -0,0 +1,12 @@
using Impostor.Api.Net;
namespace Impostor.Api.Events.Client
{
/// <summary>
/// Called just after a <see cref="IClient"/> is created and connected.
/// </summary>
public interface IClientConnectedEvent : IClientEvent
{
IClient Client { get; }
}
}
@@ -0,0 +1,13 @@
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
namespace Impostor.Api.Events.Client
{
/// <summary>
/// Called just before a <see cref="IHazelConnection"/> is registered.
/// </summary>
public interface IClientConnectionEvent : IClientEvent
{
IMessageReader HandshakeData { get; }
}
}
@@ -0,0 +1,9 @@
using Impostor.Api.Net;
namespace Impostor.Api.Events.Client
{
public interface IClientEvent : IEvent
{
IHazelConnection Connection { get; }
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace Impostor.Api.Events
{
public enum EventPriority
{
Lowest = 0,
Low = 1,
Normal = 2,
High = 3,
Highest = 4,
Monitor = 5,
}
}
@@ -0,0 +1,7 @@
namespace Impostor.Api.Events
{
public interface IGameAlterEvent : IGameEvent
{
bool IsPublic { get; }
}
}
@@ -0,0 +1,11 @@
using Impostor.Api.Games;
namespace Impostor.Api.Events
{
/// <summary>
/// Called whenever a new <see cref="IGame" /> is created.
/// </summary>
public interface IGameCreatedEvent : IGameEvent
{
}
}
@@ -0,0 +1,25 @@
using Impostor.Api.Games;
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
/// <summary>
/// Called just before a new <see cref="IGame"/> is created.
/// </summary>
public interface IGameCreationEvent : IEventCancelable
{
/// <summary>
/// Gets the client that requested creation of the game.
/// </summary>
/// <remarks>
/// Will be null if game creation was requested by a plugin.
/// </remarks>
IClient? Client { get; }
/// <summary>
/// Gets or sets the desired <see cref="Games.GameCode"/>.
/// </summary>
/// <exception cref="ImpostorException">If the GameCode is invalid or already used in another game.</exception>
GameCode? GameCode { get; set; }
}
}
@@ -0,0 +1,11 @@
using Impostor.Api.Games;
namespace Impostor.Api.Events
{
/// <summary>
/// Called whenever a new <see cref="IGame" /> is destroyed.
/// </summary>
public interface IGameDestroyedEvent : IGameEvent
{
}
}
@@ -0,0 +1,9 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api.Events
{
public interface IGameEndedEvent : IGameEvent
{
public GameOverReason GameOverReason { get; }
}
}
@@ -0,0 +1,12 @@
using Impostor.Api.Games;
namespace Impostor.Api.Events
{
public interface IGameEvent : IEvent
{
/// <summary>
/// Gets the <see cref="IGame" /> this event belongs to.
/// </summary>
IGame Game { get; }
}
}
@@ -0,0 +1,11 @@
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
public interface IGameHostChangedEvent : IGameEvent
{
IClientPlayer PreviousHost { get; }
IClientPlayer? NewHost { get; }
}
}
@@ -0,0 +1,9 @@
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
public interface IGamePlayerJoinedEvent : IGameEvent
{
IClientPlayer Player { get; }
}
}
@@ -0,0 +1,15 @@
using Impostor.Api.Games;
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
/// <summary>
/// Called just before a <see cref="IClientPlayer"/> joins a game.
/// </summary>
public interface IGamePlayerJoiningEvent : IGameEvent
{
IClientPlayer Player { get; }
GameJoinResult? JoinResult { get; set; }
}
}
@@ -0,0 +1,11 @@
using Impostor.Api.Net;
namespace Impostor.Api.Events
{
public interface IGamePlayerLeftEvent : IGameEvent
{
IClientPlayer Player { get; }
bool IsBan { get; }
}
}
@@ -0,0 +1,9 @@
namespace Impostor.Api.Events
{
/// <summary>
/// The game is started here and players have been initialized.
/// </summary>
public interface IGameStartedEvent : IGameEvent
{
}
}
@@ -0,0 +1,11 @@
namespace Impostor.Api.Events
{
/// <summary>
/// Called when the game is going to start.
/// When this is called, not all players are initialized properly yet.
/// If you want to get correct player states, use <see cref="IGameStartedEvent" />.
/// </summary>
public interface IGameStartingEvent : IGameEvent
{
}
}
@@ -0,0 +1,17 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Meeting
{
public interface IMeetingEndedEvent : IMeetingEvent
{
/// <summary>
/// Gets the exiled player.
/// </summary>
IInnerPlayerControl? Exiled { get; }
/// <summary>
/// Gets a value indicating whether meeting result is a tie.
/// </summary>
bool IsTie { get; }
}
}
@@ -0,0 +1,9 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Meeting
{
public interface IMeetingEvent : IGameEvent
{
IInnerMeetingHud MeetingHud { get; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events.Meeting
{
public interface IMeetingStartedEvent : IMeetingEvent
{
}
}
@@ -0,0 +1,10 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerChatEvent : IPlayerEvent, IEventCancelable
{
/// <summary>
/// Gets the message sent by the player.
/// </summary>
string Message { get; }
}
}
@@ -0,0 +1,9 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
public interface IPlayerCompletedTaskEvent : IPlayerEvent
{
ITaskInfo Task { get; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerDestroyedEvent : IPlayerEvent
{
}
}
@@ -0,0 +1,15 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Called whenever a player enters a vent.
/// </summary>
public interface IPlayerEnterVentEvent : IPlayerEvent
{
/// <summary>
/// Gets the entered vent.
/// </summary>
public IVent Vent { get; }
}
}
@@ -0,0 +1,19 @@
using Impostor.Api.Net;
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
public interface IPlayerEvent : IGameEvent
{
/// <summary>
/// Gets the <see cref="IClientPlayer" /> that triggered this <see cref="IPlayerEvent" />.
/// </summary>
IClientPlayer ClientPlayer { get; }
/// <summary>
/// Gets the networked <see cref="IInnerPlayerControl" /> that triggered this <see cref="IPlayerEvent" />.
/// This <see cref="IInnerPlayerControl" /> belongs to the <see cref="IClientPlayer" />.
/// </summary>
IInnerPlayerControl PlayerControl { get; }
}
}
@@ -0,0 +1,9 @@
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Called whenever a player gets exiled (voted out).
/// </summary>
public interface IPlayerExileEvent : IPlayerEvent
{
}
}
@@ -0,0 +1,15 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Called whenever a player exits a vent.
/// </summary>
public interface IPlayerExitVentEvent : IPlayerEvent
{
/// <summary>
/// Gets the exited vent.
/// </summary>
public IVent Vent { get; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerMovementEvent : IPlayerEvent
{
}
}
@@ -0,0 +1,12 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
public interface IPlayerMurderEvent : IPlayerEvent
{
/// <summary>
/// Gets the player who got murdered.
/// </summary>
IInnerPlayerControl Victim { get; }
}
}
@@ -0,0 +1,10 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerSetStartCounterEvent : IPlayerEvent
{
/// <summary>
/// Gets the current time of the start counter.
/// </summary>
byte SecondsLeft { get; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events.Player
{
public interface IPlayerSpawnedEvent : IPlayerEvent
{
}
}
@@ -0,0 +1,12 @@
using Impostor.Api.Net.Inner.Objects;
namespace Impostor.Api.Events.Player
{
public interface IPlayerStartMeetingEvent : IPlayerEvent
{
/// <summary>
/// Gets the player who's body got reported. Is null when the meeting started by Emergency call button.
/// </summary>
IInnerPlayerControl? Body { get; }
}
}
@@ -0,0 +1,15 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api.Events.Player
{
/// <summary>
/// Called whenever a player moves to another vent.
/// </summary>
public interface IPlayerVentEvent : IPlayerEvent
{
/// <summary>
/// Gets the vent player moved to.
/// </summary>
public IVent NewVent { get; }
}
}
@@ -0,0 +1,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; }
}
}
+6
View File
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events
{
public interface IEvent
{
}
}
@@ -0,0 +1,10 @@
namespace Impostor.Api.Events
{
public interface IEventCancelable : IEvent
{
/// <summary>
/// Gets or sets a value indicating whether the event was cancelled.
/// </summary>
bool IsCancelled { get; set; }
}
}
@@ -0,0 +1,6 @@
namespace Impostor.Api.Events
{
public interface IEventListener
{
}
}
@@ -0,0 +1,13 @@
using System.Threading.Tasks;
namespace Impostor.Api.Events
{
public interface IManualEventListener : IEventListener
{
EventPriority Priority { get; set; }
public bool CanExecute<T>();
public ValueTask Execute(IEvent @event);
}
}
@@ -0,0 +1,35 @@
using System;
using System.Threading.Tasks;
namespace Impostor.Api.Events.Managers
{
public interface IEventManager
{
/// <summary>
/// Register a temporary event listener.
/// </summary>
/// <param name="listener">Event listener.</param>
/// <param name="invoker">Middleware between the events, which can be used to swap to the correct thread dispatcher.</param>
/// <returns>Disposable that unregisters the callback from the event manager.</returns>
/// <typeparam name="TListener">Type of the event listener.</typeparam>
IDisposable RegisterListener<TListener>(TListener listener, Func<Func<Task>, Task>? invoker = null)
where TListener : IEventListener;
/// <summary>
/// Returns true if an event with the type <typeparamref name="TEvent" /> is registered.
/// </summary>
/// <returns>True if the <typeparamref name="TEvent" /> is registered.</returns>
/// <typeparam name="TEvent">Type of the event.</typeparam>
bool IsRegistered<TEvent>()
where TEvent : IEvent;
/// <summary>
/// Call all the event listeners for the type <typeparamref name="TEvent" />.
/// </summary>
/// <param name="event">The event argument.</param>
/// <typeparam name="TEvent">Type of the event.</typeparam>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask CallAsync<TEvent>(TEvent @event)
where TEvent : IEvent;
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Impostor.Api.Events
{
/// <summary>
/// Disposes multiple <see cref="IDisposable" />.
/// </summary>
public class MultiDisposable : IDisposable
{
private readonly IEnumerable<IDisposable> _disposables;
public MultiDisposable(IEnumerable<IDisposable> disposables)
{
_disposables = disposables;
}
public MultiDisposable(params IDisposable[] disposables) : this(disposables.AsEnumerable())
{
}
public void Dispose()
{
foreach (var disposable in _disposables)
{
disposable?.Dispose();
}
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
public class ImpostorConfigException : ImpostorException
{
public ImpostorConfigException()
{
}
public ImpostorConfigException(string? message) : base(message)
{
}
public ImpostorConfigException(string? message, Exception? innerException) : base(message, innerException)
{
}
protected ImpostorConfigException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
public class ImpostorException : Exception
{
public ImpostorException()
{
}
public ImpostorException(string? message) : base(message)
{
}
public ImpostorException(string? message, Exception? innerException) : base(message, innerException)
{
}
protected ImpostorException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.Serialization;
namespace Impostor.Api
{
public class ImpostorProtocolException : ImpostorException
{
public ImpostorProtocolException()
{
}
public ImpostorProtocolException(string? message) : base(message)
{
}
public ImpostorProtocolException(string? message, Exception? innerException) : base(message, innerException)
{
}
protected ImpostorProtocolException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Impostor.Api
{
public static class DictionaryExtensions
{
/// <summary>Returns a read-only <see cref="ReadOnlyDictionary{TKey,TValue}" /> wrapper for the dictionary.</summary>
/// <param name="dictionary">An <see cref="IDictionary{TKey,TValue}" /> to create a <see cref="ReadOnlyDictionary{TKey,TValue}" /> from.</param>
/// <typeparam name="TKey">The type of the keys of <paramref name="dictionary" />.</typeparam>
/// <typeparam name="TValue">The type of the values of <paramref name="dictionary" />.</typeparam>
/// <returns>An object that acts as a read-only wrapper around the <see cref="IDictionary{TKey,TValue}" />.</returns>
public static ReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
where TKey : notnull
{
return new ReadOnlyDictionary<TKey, TValue>(dictionary);
}
}
}
@@ -0,0 +1,69 @@
using System;
using System.Buffers.Binary;
using System.Runtime.CompilerServices;
namespace Impostor.Api
{
/// <summary>
/// Priovides a StreamReader-like api throught extensions.
/// </summary>
public static class SpanReaderExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte ReadByte(this ref ReadOnlySpan<byte> input)
{
var original = Advance<byte>(ref input);
return original[0];
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static 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)
{
var original = Advance<int>(ref input);
return BinaryPrimitives.ReadInt32LittleEndian(original);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint ReadUInt32(this ref ReadOnlySpan<byte> input)
{
var original = Advance<uint>(ref input);
return BinaryPrimitives.ReadUInt32LittleEndian(original);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float ReadSingle(this ref ReadOnlySpan<byte> input)
{
var original = Advance<float>(ref input);
return BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool ReadBoolean(this ref ReadOnlySpan<byte> input)
{
return input.ReadByte() != 0;
}
/// <summary>
/// Advances the position of <paramref name="input" /> by the size of <typeparamref name="T" />.
/// </summary>
/// <typeparam name="T">Type that will be read.</typeparam>
/// <param name="input">input "stream"/span.</param>
/// <returns>The original input.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe ReadOnlySpan<byte> Advance<T>(ref ReadOnlySpan<byte> input)
where T : unmanaged
{
var original = input;
input = input.Slice(sizeof(T));
return original;
}
}
}
@@ -0,0 +1,12 @@
using Impostor.Api.Innersloth;
namespace Impostor.Api
{
public static class SystemTypesExtensions
{
public static string GetFriendlyName(this SystemTypes type)
{
return SystemTypeHelpers.Names[(int)type];
}
}
}
@@ -0,0 +1,42 @@
using System;
using System.Threading.Tasks;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
namespace Impostor.Api.Games
{
public static class GameExtensions
{
public static ValueTask SendToAllExceptAsync(this IGame game, IMessageWriter writer, LimboStates states, int? id)
{
return id.HasValue
? game.SendToAllExceptAsync(writer, id.Value, states)
: game.SendToAllAsync(writer, states);
}
public static ValueTask SendToAllExceptAsync(this IGame game, IMessageWriter writer, LimboStates states, IClient client)
{
if (client == null)
{
throw new ArgumentNullException(nameof(client));
}
return game.SendToAllExceptAsync(writer, client.Id, states);
}
public static ValueTask SendToAsync(this IGame game, IMessageWriter writer, IClient client)
{
if (client == null)
{
throw new ArgumentNullException(nameof(client));
}
return game.SendToAsync(writer, client.Id);
}
public static ValueTask SendToAsync(this IGame game, IMessageWriter writer, IClientPlayer player)
{
return game.SendToAsync(writer, player.Client);
}
}
}
@@ -0,0 +1,14 @@
using System.Linq;
using Impostor.Api.Games.Managers;
using Impostor.Api.Innersloth;
namespace Impostor.Api.Games
{
public static class GameManagerExtensions
{
public static int GetGameCount(this IGameManager manager, MapFlags map)
{
return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << (byte)game.Options.Map)));
}
}
}
+76
View File
@@ -0,0 +1,76 @@
using System;
using Impostor.Api.Innersloth;
namespace Impostor.Api.Games
{
public readonly struct GameCode : IEquatable<GameCode>
{
public GameCode(int value)
{
Value = value;
Code = GameCodeParser.IntToGameName(value);
}
public GameCode(string code)
{
Value = GameCodeParser.GameNameToInt(code);
Code = code.ToUpperInvariant();
}
public string Code { get; }
public int Value { get; }
public bool IsInvalid => Value == -1;
public static implicit operator string(GameCode code) => code.Code;
public static implicit operator int(GameCode code) => code.Value;
public static implicit operator GameCode(string code) => From(code);
public static implicit operator GameCode(int value) => From(value);
public static bool operator ==(GameCode left, GameCode right)
{
return left.Equals(right);
}
public static bool operator !=(GameCode left, GameCode right)
{
return !left.Equals(right);
}
public static GameCode Create()
{
return new GameCode(GameCodeParser.GenerateCode(6));
}
public static GameCode From(int value) => new GameCode(value);
public static GameCode From(string value) => new GameCode(value);
/// <inheritdoc />
public bool Equals(GameCode other)
{
return Code == other.Code && Value == other.Value;
}
/// <inheritdoc />
public override bool Equals(object? obj)
{
return obj is GameCode other && Equals(other);
}
/// <inheritdoc />
public override int GetHashCode()
{
return HashCode.Combine(Code, Value);
}
public override string ToString()
{
return Code;
}
}
}
+58
View File
@@ -0,0 +1,58 @@
namespace Impostor.Api.Games
{
public enum GameJoinError
{
/// <summary>
/// No error occured while joining the game.
/// </summary>
None,
/// <summary>
/// The client is not registered in the client manager.
/// </summary>
InvalidClient,
/// <summary>
/// The client has been banned from the game.
/// </summary>
Banned,
/// <summary>
/// The game is full.
/// </summary>
GameFull,
/// <summary>
/// The limbo state of the player is incorrect.
/// </summary>
InvalidLimbo,
/// <summary>
/// The game is already started.
/// </summary>
GameStarted,
/// <summary>
/// The game has been destroyed.
/// </summary>
GameDestroyed,
/// <summary>
/// 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" />.
/// </remarks>
Custom,
}
}
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Impostor.Api.Net;
namespace Impostor.Api.Games
{
public readonly struct GameJoinResult
{
private GameJoinResult(GameJoinError error, string? message = null, IClientPlayer? player = null)
{
Error = error;
Message = message;
Player = player;
}
public GameJoinError Error { get; }
public bool IsSuccess => Error == GameJoinError.None;
public bool IsCustomError => Error == GameJoinError.Custom;
[MemberNotNullWhen(true, nameof(IsCustomError))]
public string? Message { get; }
[MemberNotNullWhen(true, nameof(IsSuccess))]
public IClientPlayer? Player { get; }
public static GameJoinResult CreateCustomError(string message)
{
return new GameJoinResult(GameJoinError.Custom, message);
}
public static GameJoinResult CreateSuccess(IClientPlayer player)
{
return new GameJoinResult(GameJoinError.None, player: player);
}
public static GameJoinResult FromError(GameJoinError error)
{
if (error == GameJoinError.Custom)
{
throw new InvalidOperationException($"Custom errors should provide a message, use {nameof(CreateCustomError)} instead.");
}
return new GameJoinResult(error);
}
}
}
+113
View File
@@ -0,0 +1,113 @@
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Inner;
using Impostor.Api.Net.Messages;
namespace Impostor.Api.Games
{
public interface IGame
{
GameOptionsData Options { get; }
GameCode Code { get; }
GameStates GameState { get; }
IGameNet GameNet { get; }
IEnumerable<IClientPlayer> Players { get; }
IPEndPoint PublicIp { get; }
int PlayerCount { get; }
IClientPlayer? Host { get; }
bool IsPublic { get; }
/// <summary>
/// Gets or sets display name on game list.
/// </summary>
string? DisplayName { get; set; }
IDictionary<object, object> Items { get; }
int HostId { get; }
IClientPlayer? GetClientPlayer(int clientId);
T? FindObjectByNetId<T>(uint netId)
where T : IInnerNetObject;
/// <summary>
/// Adds an <see cref="IPAddress" /> to the ban list of this game.
/// Prevents all future joins from this <see cref="IPAddress" />.
/// This does not kick the player with that <see cref="IPAddress" /> from the lobby.
/// </summary>
/// <param name="ipAddress">
/// The <see cref="IPAddress" /> to ban.
/// </param>
void BanIp(IPAddress ipAddress);
/// <summary>
/// Syncs the internal <see cref="GameOptionsData" /> to all players.
/// Necessary to do if you modified it, otherwise it won't be used.
/// </summary>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SyncSettingsAsync();
/// <summary>
/// Sets game's privacy.
/// </summary>
/// <param name="isPublic">Privacy to set.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SetPrivacyAsync(bool isPublic);
/// <summary>
/// Send the message to all players.
/// </summary>
/// <param name="writer">Message to send.</param>
/// <param name="states">Required limbo state of the player.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAllAsync(IMessageWriter writer, LimboStates states = LimboStates.NotLimbo);
/// <summary>
/// Send the message to all players except one.
/// </summary>
/// <param name="writer">Message to send.</param>
/// <param name="senderId">The player to exclude from sending the message.</param>
/// <param name="states">Required limbo state of the player.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAllExceptAsync(IMessageWriter writer, int senderId, LimboStates states = LimboStates.NotLimbo);
/// <summary>
/// Send a message to a specific player.
/// </summary>
/// <param name="writer">Message to send.</param>
/// <param name="id">ID of the client.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask SendToAsync(IMessageWriter writer, int id);
/// <summary>
/// Creates a MessageWriter with GameData header.
/// </summary>
/// <remarks>Use with caution, recommended only for advanced developers.</remarks>
/// <param name="targetNetId">Net id of the InnerNetObject.</param>
/// <param name="callId">Rpc id of the message.</param>
/// <param name="targetClientId">Client id of GameDataTo's target.</param>
/// <param name="type">Message type of the message.</param>
/// <returns>A <see cref="IMessageWriter" /> that you can fill with rpc data and send using <see cref="FinishRpcAsync"/>.</returns>
IMessageWriter StartRpc(uint targetNetId, RpcCalls callId, int? targetClientId, MessageType type = MessageType.Reliable);
/// <summary>
/// Finishes rpc message and sends it to the target.
/// </summary>
/// <param name="writer">Message writer of the rpc.</param>
/// <param name="targetClientId">Id of the receiving client.</param>
/// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
ValueTask FinishRpcAsync(IMessageWriter writer, int? targetClientId = null);
}
}
@@ -0,0 +1,7 @@
namespace Impostor.Api.Games
{
public interface IGameCodeFactory
{
GameCode Create();
}
}
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Impostor.Api.Innersloth;
namespace Impostor.Api.Games.Managers
{
public interface IGameManager
{
IEnumerable<IGame> Games { get; }
IGame? Find(GameCode code);
/// <summary>
/// Creates a new game.
/// </summary>
/// <param name="options">Game options.</param>
/// <returns>Created game or null if creation was cancelled by a plugin.</returns>
/// <exception cref="ImpostorException">Thrown when game creation failed.</exception>
ValueTask<IGame?> CreateAsync(GameOptionsData options);
}
}
+42
View File
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CodeAnalysisRuleSet>../ProjectRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>9</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyName>Impostor.Api</AssemblyName>
<AssemblyTitle>Impostor.Api</AssemblyTitle>
<Authors>AeonLucid</Authors>
<Description>An api library for Impostor, an Among Us private server. You need this package to write plugins for Impostor.</Description>
<PackageId>Impostor.Api</PackageId>
<PackageTags>Among Us;Impostor;Impostor Plugin</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/Impostor/Impostor/dev/docs/images/logo_64.png</PackageIconUrl>
<PackageIcon>logo_64.png</PackageIcon>
<PackageProjectUrl>https://github.com/Impostor/Impostor</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Impostor/Impostor</RepositoryUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="../../docs/images/logo_64.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Nullable" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Loaded 100 of 476 files, more files were not shown because too many files have changed in this diff. Show more