Commit Graph

55 Commits

Author SHA1 Message Date
Robin C. Ladiges d6a8df448c
Refactoring ban command (#48)
* rename command: `ban ...` => `ban player ...`

To enable adding other subcommands starting with `ban`.

Moving ban list and crash related code into its own class to tidy the Program class up.

Change Id values of the crash cmds, to fit into the 16 byte max length imposed by ChangeStagePacket.IdSize.

* add command: `ban ip <ipv4-address>`

To add an IPv4 address to the ban list.

* add command: `ban profile <profile-id>`

To add a profile ID to the ban list.

* add command: `unban ip <ipv4-address>`

To remove a banned IPv4 address from the ban list.

* add command: `unban profile <profile-id>`

To remove a banned profile ID from the ban list.

* add commands: `ban enable` and `ban disable`

To set the value of `BanList.Enabled` to `true` or `false` without editing the `settings.json` file.

* add command: `ban list`

To show the current ban list settings.

* fix: actually working ban functionality

Changes:
- ignore new sockets from banned IP addresses way earlier.
- ignore all packets by banned profiles.

Intentionally keeping the connection open instead of d/c banned clients.
This is to prevent endless server logs due to automatically reconnecting clients.

Before:
Reconnecting clients aren't entering `ClientJoined` and therefore the d/c is only working on first connections.
Effectively banned clients got a d/c and then automatically reconnected again without getting a d/c again.
Therefore allowing them to play normally.

* use SortedSet instead of List for settings

To enforce unique entries and maintain a stable order inside of the `settings.json`.

* add commands: `ban stage <stage-name>` and `unban stage <stage-name>`

To kick players from the server when they enter a banned stage.

<stage-name> can also be a kingdom alias, which bans/unbans all stages in that kingdom.

Because we aren't banning the player, d/c them would be no good, because of the client auto reconnect.
Instead send them the crash and ignore all packets by them until they d/c on their own.

This is an alternative solution for issue #43.

* Update Server.cs

---------

Co-authored-by: Sanae <32604996+Sanae6@users.noreply.github.com>
2023-09-05 17:14:54 -06:00
Robin C. Ladiges 1e9d334d6f fix: wrong kingdom values and order like presented in-game 2023-07-25 14:10:54 -06:00
Robin C. Ladiges 71bb96bf1e verify stage values for send and sendall
Changes:
- Moved alias mapping from Constants.cs to Stages.cs.
- Added `odyssey` as an alias.
- Hardcoded all known stage values.
- Verfify that the stage input is either a alias or a known stage name.
- Added an option to append `!` to a stage name to force sending even if the stage is not known (e.g. for custom kingdoms).

Before it only checked that it was a known alias or that it contained `Stage` or `Zone`.
That made it impossible to send players to`MoonWorldShopRoom` and `MoonWorldSphinxRoom`.
And a typo would have resulted in a game crash.
2023-03-22 16:50:38 -06:00
ecumber 67449ffa54 Add date to log messages 2022-06-20 12:57:45 -06:00
Sanae 561d633e40 Add a simple discord bot to manage the server 2022-06-12 18:48:24 -06:00
Sanae 99aabeffc9 Add init packet 2022-05-08 16:04:57 -06:00
Sanae 6a63eb47c2 Use Write instead of WriteLine for logging 2022-04-27 21:33:48 -06:00
Sanae ab318db1b8 Clean up logging from testing 2022-04-27 21:32:52 -06:00
Sanae 24e4333fde Change game packet size 2022-04-27 14:36:36 -06:00
Sanae 88f61f9e79 Fix game packet size 2022-04-27 14:20:01 -06:00
Sanae 605be3947f I'm going to commit war crimes 2022-04-27 14:17:02 -06:00
Sanae bddce48f9d Stop using MemoryMarshal for header serde 2022-04-27 00:24:11 -06:00
Sanae 726bb45a00 What 2022-04-26 23:45:47 -06:00
Sanae 6444675fbb getting good 2022-04-26 23:26:35 -06:00
Sanae ded197601a oops 2022-04-26 23:26:03 -06:00
Sanae 6964c3bbf4 Add max players to connect packet 2022-04-26 23:24:40 -06:00
Sanae 7a088eb314 Fix 2, electric boogaloo 2022-04-26 23:06:27 -06:00
Sanae aea7d4414f Revert potential scenario merging fix 2022-04-05 14:07:02 -06:00
Sanae e75df1bbb4 Fix ChangeStage packet deserializer 2022-04-05 13:43:56 -06:00
CraftyBoss a89471de54 Merge branch 'master' of https://github.com/Sanae6/SmoOnlineServer 2022-04-05 19:35:15 +00:00
CraftyBoss 7eb7c97c43 fix possible typos with send/sendall cmd 2022-04-05 19:35:13 +00:00
Sanae 534a6c9655 Make packet transformation work in Send(Memory)
speedrun flag
2022-04-03 22:29:34 -06:00
CraftyBoss 4e05fe9e3f add short-names for kingdoms, sendall cmd 2022-03-28 06:05:32 +00:00
Sanae 3525ac2099 Add ChangeStagePacket 2022-03-24 22:28:53 -06:00
Sanae 8d11623ada Various useful changes 2022-03-15 14:44:46 -06:00
Sanae cc67ac9ced Waaaa copium seethe 2022-03-15 02:08:52 -06:00
Sanae 7ca0b8591a Worship the monorail 2022-03-15 01:51:37 -06:00
Sanae 6e878e579d Blind af 2022-03-15 01:40:34 -06:00
Sanae fca90851ad Implement tag packet serde 2022-03-15 01:39:33 -06:00
Sanae 3974b7022e Updated test client to send varsize packets, 8p test 2022-03-14 17:48:30 -06:00
Sanae 15960a8d5a Better player packet 2022-03-13 18:07:26 -06:00
Sanae 217dc2765e Remove test exception when disconnecting 2022-03-13 15:27:53 -06:00
Sanae c778d15644 Packet cleanup and refactoring 2022-03-13 05:14:01 -06:00
Sanae 8c5cd0ced2 Untested conversion to variable size packets 2022-03-10 23:59:02 -06:00
Sanae 713e5f4cce So now we know about the new secret boolean 2022-03-08 17:35:07 -06:00
Sanae 00626ab12f Add scenario merging and run reformatting on solution 2022-03-01 15:08:53 -06:00
Sanae a554af2a44 Hack fixed 2022-02-22 14:11:06 -06:00
Sanae f21bfb7425 Lower max client count to 8 due to client reasons 2022-02-21 22:05:37 -06:00
Sanae b3bcf72283 Set defaults with constructor to fix an error 2022-02-21 21:39:12 -06:00
Sanae 821301e756 Implement console commands and settings (flip list broken) 2022-02-17 19:56:12 -06:00
Sanae 78af568603 Add RentZero extension as rented memory can be non-zero 2022-02-16 15:20:03 -06:00
Sanae 860f5c242b Add log packet and don't spam 2022-02-16 15:00:52 -06:00
Sanae f0c3ae6963 Logs cleaned up, and tested shine support 2022-02-15 14:26:50 -06:00
Sanae 70c9ad88cd it doesn't work but here's a patchfix 2022-02-14 16:09:55 -06:00
Sanae d60aa07e1f Implementing shine sync and other minor fixes 2022-02-14 13:45:58 -06:00
Sanae 7bbba0c691 Everything just works™ 2022-02-10 22:25:47 -06:00
Sanae 6cae63ca38 Currently cleaning up transport related stuff 2022-02-09 22:29:10 -06:00
Sanae 7dbe2ecd55 Reformat solution 2022-02-09 19:44:50 -06:00
Sanae b660fcfd53 Good shit 2022-02-08 16:46:12 -06:00
Sanae f8955b630d Add attributes to new packets 2022-02-08 10:22:09 -06:00