Commit graph

252 commits

Author SHA1 Message Date
Lucas Nicodemus
046d52ad2e Move emoji player index check into IllegalPerSe
This is the first commit in a pattern that I'd like to follow. The
concept is that we specifically create handlers for things that are
"illegal per se." That is, there are no possible situations (in the
current protocol) where a packet of this type is received from a client.
In this case, I moved the emoji handler out of the Handler just for
emoji, since it seemed like an obvious case.

The rule of thumb is simple: if something is illegal per se, there
should be no possible way in the vanilla client to achieve this result.
If a player sends this combination of packets they *must* be hacking.
Not that there is a 99.9% chance they're hacking, but that there is a
100% unambiguous chance that they're hacking.

Something is illegal per se if it can only be created by a hacked
client. If there's a crashing bug that a normal player can do with a
complex series of vanilla events, that is not illegal per se.

The goal of this namespace and class of handlers is to handle exactly
one type of protocol violation, and remove the packet accordingly. If it
is ever reported that the packet can be sent from a vanilla client, the
check must be removed as it is no longer a per se violation of the
protocol.
2021-05-27 23:59:43 -07:00
Luke
81b6872d6e Fix OTAPI reference
This now allows MonoDevelop to compile without receiving error while starting a build: System.IO.FileLoadException: The assembly name is invalid
2021-04-11 21:00:28 +10:00
Chris
9423febd0a Refactor for new configuration 2020-12-03 17:43:10 +10:30
Chris
db10bf22e7 Refectoring continued - rename STS Handler to STR Handler 2020-11-13 18:50:54 +10:30
Patrikkk
d4e4692d8b Merge branch 'general-devel' into addtileentityinteraction 2020-06-25 13:41:14 +02:00
Patrikkk
64e61b8ed9 Add DisplayDollItemSyncHandler
In a previous PR I have added the tile entity request packet handler which checks for building permissions to prevent the unauthorized player to open a DisplayDoll and see its content.

This Handler is being added to prevent *Hackers* from modifying a DisplayDoll through direct/crafted packet sending, or by sending raw byte data to the server.
In a valid enviroment, the player couldn't even get to see the content of the doll in the first place, to then try to modify it's items.

Because of this,  I do not bother with making sure the player gets their item back.
2020-06-19 14:21:45 +02:00
Patrikkk
c418dda42c Add RequestTileEntityInteractionHandler. Check Mannequin modif perms.
Users can no longer open a Mannequin if they do not have building permissions at the position of the Mannequin.
(Mannequins work as a chest since 1.4)
2020-06-18 17:08:14 +02:00
Patrikkk
e738d8e794 Implementing SyncTilePickingHandler. Patching tile damage related exploits.
With this packet, players could kick all players by sending invalid world position data.
2020-06-02 19:20:27 +02:00
Patrikkk
d919c11add
Merge branch 'general-devel' into handlegolfpacket 2020-06-02 11:52:32 +02:00
Patrikkk
3cc8a75b9b
Merge branch 'general-devel' into emojipacketevent 2020-06-02 11:21:19 +02:00
Patrikkk
f7a8695c8f
Merge branch 'general-devel' into handlegolfpacket 2020-06-02 11:15:17 +02:00
Chris
961c6cd9bc Clean up NetModulePacketHandler a little 2020-06-02 14:18:22 +09:30
Chris
3b6a9ffcc2 Add bestiary handler 2020-06-02 14:06:18 +09:30
Chris
1c0a649a0c Add handling for liquid net module 2020-06-02 13:34:26 +09:30
Chris
48d610d33f Move netmodule handling into handlers namespace
Add handler for teleport pylons, and permission for teleport pylons
2020-06-02 12:59:14 +09:30
Chris
5b72ff6c0a Add IPacketHandler 2020-06-02 10:44:10 +09:30
Patrikkk
c94d15e634 Commit EmojiHandler.cs and register OnEmoji hook. 2020-06-01 15:31:45 +02:00
Patrikkk
4944ee3144 Implement Handler.LandGolfBalInCupHandler and handle packet exploits.
Added multiple checks to prevent clients from sending the golfball packet directly, without having golf play actions.
2020-06-01 12:59:40 +02:00
Chris
d4a0f47e45 WIP - splitting STS into new class and processing methods 2020-05-29 14:05:43 +09:30
Patrikkk
a4075fd590 Revert TShockAPI.csproj to original. 2020-05-29 00:10:57 +02:00
Patrikkk
0fa8ae13d7 Implement FoodPlatter placing event.
This is called when a player is placing a fruit (item) in a plate.
Adding checks to see if they have permission to place or replace a fruit in the item.
Checks if they are within range. And a check to see if they are legitimately placing the item from their hand, and not by sending a raw packet.
2020-05-28 19:24:28 +02:00
Olink
56b695b80b Add initial support for Journey mode in SSC. 2020-05-25 02:24:03 -04:00
Chris
c2e3f65a2a Add modeling to new projectile handling 2020-05-18 15:47:31 +09:30
Chris
db84a9fc8f Adds models for the random bitsbyte data received in packet 13 - player update 2020-05-18 14:42:29 +09:30
鱼鱼
43f586cde5 Merge branch 'general-devel' of https://github.com/Pryaxis/TShock
 Conflicts:
	CHANGELOG.md
	TShockAPI/GetDataHandlers.cs
	TShockAPI/TShock.cs
2020-05-17 21:38:07 +08:00
Lucas Nicodemus
b5f95d5918
Fragments: Separate out item bans (#1595)
* Remove commented out warning disable

* Add initial ItemBans segregation infrastructure

* Add shell for initial OnSecondUpdate stuff

* Add comments yo

* Remove duplicated logic

* Split out more item ban code

This part of the fragments work is primarily aimed at reducing the
complexity of OnSecondUpdate in TShock and moving that check out into
the ItemBans subsytem.

Of major note in this is the removal of "check", which was a string
variable that tracked state and replacement of many of the item ban
activities with sane private methods that are at least somewhat
sensible. Obviously there's a lot to be desired in this system and I'm
really going for a run here by trying to continue a branch from so long
ago that I barely even remember the whole point of existence.

Still to do: GetDataHandlers related item ban code needs to be moved
into its own hook in the ItemBan system. Finally, there is a downside to
some of this: we're basically iterating over players again and again if
we keep this pattern up, which is kinda lame for complexity purposes.

* alt j: comment changes

* Move item ban check out of main playerupdate check

Separates out item ban logic from the rest of GetDataHandlers so that
item bans is more isolated in terms of what fragments is asking for.

* alt-j: convert indentation to tabs

* alt-j: fix botching source code

* Move item ban related chest checks out of gdh

* Remove chest item change detection from item bans

It doesn't do anything. If a user removes an item from a chest, it
bypasses this check. If a user adds an item to a chest, the server seems
to persist the change anyway, even if the event is handled. That's a bug
for sure, but fundamentally, it's not the item ban system's fault.

* Revert "Remove chest item change detection from item bans"

This reverts commit 758541ac5c4d4096df2db05ba2a398968113e1e4.

* Fix logic issues related to item ban handling

Re-implements chest item handling and correctly handles events and
returns after setting handled event state.

* Remove TSPlayer.HasProjectilePermission

In infinite wisdom, it turns out this is not a good method for TSPlayer
to have. It just checks the states of things as per what the item ban
system says is banned and then creates implicit relationships to the
projectile ban system.

Doing this effectively knocks down another external reference to the
item ban system outside of the context of the implementation for the
system itself and its related hooks.

This commit also adds context around what the heck is going on with some
of our more interesting checks as per discussions in Telegram with @Ijwu
and @QuiCM.

* Update changelog

* Remove useless ref to Projectile.SetDefaults

* Change item ban to ban based on ID not strings

I think I was so confused as to why we were passing strings everywhere
that I just felt inclined to continue the trend in previous commits.
2020-05-16 16:27:34 -07:00
Chris
1dc320dbae Update to Newtonsoft JSON v10.0.3 for parity with OTAPI/TSAPI 2019-03-30 15:47:14 +10:30
Lucas Nicodemus
f3e33b7ad7 Remove the stat tracker
The stat tracker has been offline for the last several weeks/months and
nobody has done anything to fix that. Because of that, GDPR, and the
fact that we haven't used it, we're discarding it.
2019-03-29 17:46:44 -07:00
Ivan
44dfc570ab Merge remote-tracking branch 'upstream/general-devel' into regions 2018-04-29 18:39:12 +02:00
Ivan
ec78a070a7 Move Region related code into a separate subsystem 2018-04-29 18:33:07 +02:00
Lucas Nicodemus
3f58274ef4 Remove the stat tracker
The stat tracker has been offline for the last several weeks/months and
nobody has done anything to fix that. Because of that, GDPR, and the
fact that we haven't used it, we're discarding it.
2018-04-19 18:22:52 -06:00
Lucas Nicodemus
9b8aaceb12 Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-10 23:45:03 -07:00
quake1337
1f79e14bd7 Make TShock pull OTAPI from the correct folder on build 2017-12-11 01:12:27 +01:00
Lucas Nicodemus
54c33a5a09 Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-09 10:33:55 -07:00
Ryozuki
055d25330c update otapi 2017-12-09 17:57:33 +01:00
Lucas Nicodemus
e782a07564 Move SendTileSquare handling for Bouncer into Bouncer 2017-12-05 02:32:33 -07:00
Leo Li
0753e6d213 Add more HintPaths for OTAPI
This will help msbuild to find missing libraries when create release
with `/p:Configuration=Release`.

With this patch, the searching order will be:
  - If OTAPI with same configuration found, use that.
  - Else if OTAPI with Release configuration found, use that.
  - Else use OTAPI with Debug configuration.
2017-07-23 20:42:42 -07:00
ZIT WANG
930607a142 Add Localization support
* Add EnglishLanguage type to store English texts
* Itemban now store English item name
* Command `/i` `/give` `/sm` `/tpnpc` can use both English and current language input
2017-04-21 21:58:37 +08:00
White
fc7460c7d5 Added and implemented a basic command-line parser.
This replaces the switch-case in HandleCommandLine and HandleCommandLinePostConfigLoad
2017-03-13 11:43:41 +10:30
White
b3a2b24daa Updated the Stat Tracker to use System.Net.Http types.
Very similar to the previous Update Manager changes. The stat tracker now uses asynchronous threaded calls and manages exceptions better
2017-03-06 21:35:14 +10:30
White
c0a679b3f3 Forgot csproj 2017-01-06 13:57:02 +10:30
Luke
703a31580e Build script alterations, submodule update 2016-12-10 21:54:43 +10:00
Lucas Nicodemus
e4313b6433
Update to latest stuff from death 2016-12-06 20:34:12 -07:00
Lucas Nicodemus
678f6c7cf8
Update to Mintaka (thanks @enerdy) 2016-12-06 17:36:44 -07:00
Lucas Nicodemus
a8b4bf1d95
Remove PacketBufferer
The packet bufferer was obsolete.
2016-10-23 06:02:27 -06:00
George
a5a63cc68c Updated project to use NuGet where possible 2016-05-25 22:43:45 +01:00
Tyler Watson
4eca66a024 Removed ThreadPool threads in favour of plain threads.
See
NyxStudios/TerrariaAPI-Server@b1d62b6cbd
for details.
2016-05-10 23:46:44 +10:00
White
7dbebb2b9a Moved TSServerPlayer and PlayerData classes into their own files 2016-01-10 13:01:11 +10:30
Tyler Watson
f7826f681a Removed debug cruft from csproj 2015-09-12 18:13:40 +10:00
Tyler Watson
34f28bace3 TShock 4.3.10 - APIVersion 1.22 2015-09-12 18:08:10 +10:00