Commit graph

3385 commits

Author SHA1 Message Date
Lucas Nicodemus
7314a34986
Properly don't log if not logging enabled 2020-05-20 00:00:09 -07:00
Lucas Nicodemus
3b748f1156
Potentially fix player desync issue
It was discovered that LastNetPosition is being checked to see if it's
zero in Bouncer. Then, Bouncer rejects the update. The default is zero
and potentially this can be zero in other ways. The original code in
master (checked at 9f4892f in GetDataHandlers) had an additional write
on LastNetPosition to update it, but this write was not moved over to
Bouncer. Thus, there is a high probability that players are "desync'd"
after LastNetPosition gets stuck at zero and never updates.
2020-05-19 23:50:02 -07:00
Lucas Nicodemus
e6df3edeec
Merge branch 'general-devel' into h/betterlogs 2020-05-19 23:02:46 -07:00
Lucas Nicodemus
e20f717269
Remove reimplementation of Terraria player sync
The reimplementation of Terraria player sync was first created by
@Zidonuke when introducing better antihack and the item ban system. He
added this because he was probably attempting to correct the client that
sent that sent bad data. The primary purpose was to send data back to
the client, not necessarily for the purpose of doing anything for the
server. This is demonstrated by the fact that when we added player
update handling, we started rejecting the packets outright and not
sending the player any packets. This means that functionally we don't
run this code hardly ever if someone is actually disabled.

Some of those code was related to /confuse. That is also being removed.
2020-05-19 22:26:46 -07:00
Lucas Nicodemus
145885beb3
Remove /confuse command 2020-05-19 22:26:45 -07:00
Lucas Nicodemus
e9098d0e78
Add verbose debug logs to a variety of checks
These are high priority checks we really want to look at. I want to add
more of these debug statements to all checks in Bouncer and other parts
of GetDataHandlers, but I think this is good enough for now.
2020-05-19 22:11:21 -07:00
Lucas Nicodemus
b76d906c59
Overhaul debug logging
Debug logging now provides ConsoleDebug and ILog has been updated to
support the concept of debug logs. Debug logs are now controlled by
config.json instead of by preprocessor debug flag.
2020-05-19 22:04:10 -07:00
Chris
2df23c53b7 Add annotations to new permissions 2020-05-20 00:39:24 +09:30
Chris
6ecdf8545f Consolidated a number of world event commands into one master command
`worldevent` is now the root for the following:
Meteor, fullmoon, bloodmoon, eclipse, invasions, sandstorm, rain.
Added a new set of permission nodes to represent world events: `tshock.world.events.*`
2020-05-20 00:11:04 +09:30
Chris
a178b31333 Fixes world mode some more 2020-05-19 23:04:23 +09:30
Asada shinon
31f9c57080 Quick Command ID Fix 2020-05-19 19:02:40 +08:00
Chris
240b6b71b0 Change toggleexpert command to change the world mode 2020-05-19 13:20:45 +09:30
Lucas Nicodemus
35198647a1
Presumptively fix MySQL 8 compat
`Groups` is a reserved name in MySQL 8 and this should fix compat issues
with it.
2020-05-18 18:40:51 -07:00
Lucas Nicodemus
d8747c34e9
Rename /bloodmoon to /tbloodmoon 2020-05-18 18:25:07 -07:00
Patrikkk
8ced5d5dfc Adding new buffs to OnNPCAddBuff
Missed these buffs with their bufftimes, so it was always caught by the bouncer, thinking players are hacking.
2020-05-18 18:47:39 +02:00
Lucas Nicodemus
41c813a2dd
Version tick: 4.4.0 2020-05-18 01:04:51 -07:00
Lucas Nicodemus
013c58e923
Update TShock version codename 2020-05-18 01:00:23 -07:00
Lucas Nicodemus
3471646dc7
Temporarily disable some projectile cheat checks 2020-05-18 00:52:44 -07:00
Lucas Nicodemus
92f8095277
Read extra data for kill portal 2020-05-18 00:00:55 -07:00
Lucas Nicodemus
0a95457a7e
Merge branch 'general-devel' of github.com:Pryaxis/TShock into general-devel 2020-05-17 23:48:55 -07:00
Lucas Nicodemus
12d40e98ad
Disable always return on HandleLoadNetModule
As of 1.4.x.x, these are used for more than just chat text and we need
to start handling them separately. The original check here would just
return true (handling the event) for any module that's not text. Now, we
need to actually do processing and check for exploits on these.
2020-05-17 23:47:29 -07:00
Chris
ea53fdf04a Merge branch 'general-devel' of https://github.com/Pryaxis/TShock into general-devel 2020-05-18 15:47:40 +09:30
Chris
c2e3f65a2a Add modeling to new projectile handling 2020-05-18 15:47:31 +09:30
Lucas Nicodemus
926f97b49f
Update OnTeleport hook with new changes 2020-05-17 23:17:03 -07:00
Lucas Nicodemus
16df9bb16c
Update "spawn boss invasion" get data handler
This is really "spawn arbitrary stuff" and it can create invasions,
pets, and bosses now.
2020-05-17 22:44:10 -07:00
Chris
ea6425a2e2 Update Bouncer/Item Bans refs for new models 2020-05-18 14:45:36 +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
Patrikkk
f48a18aa7a Fixing my random if logic.
Really.. time for bed.
The Any wasn't terrible, but itwould have allow cross sending projectiles within that dictionary. (send gold stab with copper in hand, or vice versa etc)
2020-05-18 02:44:39 +02:00
Patrikkk
91e3ebf4f0 Fix false cheat catch on stab items.
Stab items (swords) now send projectiles to imitate directional stabbing. Bouncer catched since there was no handling of these new projectiles.
2020-05-18 02:37:39 +02:00
Patrikkk
a02f959f58 Update Buff related packets
Buff IDs no longer fit in a byte. Vanilla reads/writes ushorts but they get converted to int.
- Added helptip for Zone4 in playerzones eventargs.
2020-05-18 02:02:02 +02:00
Patrikkk
3b3fa9fc72 Update Modify Tile packet.
Only updating. Did not patch any possible exploits. Requesting someone to tend to this when possible.
2020-05-18 00:41:12 +02:00
Patrikkk
2d5166cfa4 Updating SpawnPlayer and PlayerUpdate packet
Fixing the HasHackedItemStacks method by adding missing Void Vault check.
2020-05-18 00:04:49 +02:00
Patrikkk
9a05678933 Updating HandleProjectileNew
Packet structure order is different in 1.4
2020-05-17 21:41:31 +02:00
Lucas Nicodemus
1078b579c4
Incorporate @Patrikkk's changes over Axeel's
The TSAPI that Patrikkk has does not contain public fields for the
referenced GameMode types.
2020-05-17 11:58:21 -07:00
Lucas Nicodemus
96468871a0
Merge branch 'general-devel' into 1.4 2020-05-17 11:14:42 -07:00
鱼鱼
01cf85c9ad use GameModeID instead of other consts 2020-05-17 21:46:03 +08:00
鱼鱼
1ed95c737e pass compile; add void vault code 2020-05-17 21:38:47 +08:00
鱼鱼
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
1993900159
Move OnTileEdit ban checks: Bouncer -> Itembans
This change moves the ban checks used to determine, during TileEdit
events, if an item is banned, out of Bouncer and into the newly isolated
ItemBan subsystem. Rather than creating a large pull request for all of
these, I'm just going to create a series of commits and send them in one
at a time. This should result in about one PR per hook that uses item
bans that needs to move.
2020-05-16 21:50:28 -07: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
Lucas Nicodemus
76150e2500
Provide warning message on invalid group command
This fixes #1742 where users could run group commands that didn't exist
and the server would silently fail rather than giving an error.
2020-05-13 21:10:01 -07:00
moisterrific
6007edeb77
Fix BoC false positive kick in NPCAddBuffTimeMax
360 ticks = 6 seconds, according to the wiki, the max possible duration is proportional to dmg taken, so 7.5 seconds would be the max duration (aka 450 ticks)
2020-02-07 16:14:27 -05:00
moisterrific
f50aba8ba6
Fix for Vortex armor set stealth flicker bug
tests on my end showed it fixed, plz confirm as well
2020-01-10 17:55:49 -05:00
Chris
e3bac1871a
Update Bouncer.cs
Removes double occurrence of daybreak buff from dictionary.
Thanks for pointing this out @AxeelAnder
2019-07-18 13:54:20 +00:00
Chris
ad28771e2c Update players when they die to hopefully stop their items floating at their grave 2019-03-30 16:31:20 +10:30
Chris
34a4ef3b7d Remove healing when disabled 2019-03-30 16:25:30 +10:30
Chris
29fb74e578 Add a check for NPC Item strike packets (solves #1651) 2019-03-30 16:02:50 +10:30
Chris
1dc320dbae Update to Newtonsoft JSON v10.0.3 for parity with OTAPI/TSAPI 2019-03-30 15:47:14 +10:30
Chris
42fb0b10f4 Add bounds checking for packet 51, type = 4 2019-03-30 15:46:46 +10:30
Chris
ac02468038 Update dead packets 2019-03-30 15:09:40 +10:30