Commit graph

65 commits

Author SHA1 Message Date
Lucas Nicodemus
195a23a7e5 Migrate most of CheckTilePermission to TSPlayer
TShock.CheckTilePermission(ply, x, y, paint) has been replaced with
TSPlayer.HasPaintPermission and TSPlayer.HasBuildPermission
respectively. These two methods dramatically simplify the logic required
to process build permissions.

Still todo after this commit:

1. Implement warnings for when a player fails a permission check on
build. This is probably going to be accomplished by a default argument
to the HasBuildPermission signature.

2. Create a variant that checks for ice tile permission and use like
HasPaintPermission() so as to remove the other
TShock.CheckTilePermission method.

Annoyingly, all of the existing methods that start with Check seem to
"check" if they player _doesn't_ have permission (true = no permission),
which makes nearly every call negative.
2017-12-22 00:31:02 -07:00
Lucas Nicodemus
09121368e4 Move TShock.CheckRangePermission to TSPlayer
TShock.CheckRangePermission is now TSPlayer.IsInRange, but the most
important thing is that this method returns the opposite of what the
original did, so all of the calls that would go to it are now inverted.
2017-12-21 20:32:07 -07:00
Lucas Nicodemus
7730faf94f Change diction to refer to "saved data" on Disable 2017-12-21 08:22:51 -07:00
Lucas Nicodemus
ea630e5aa2 Rephrase SSC login message to avoid grammar choice 2017-12-20 21:32:56 -07:00
Chris
215970bab2
Merge branch 'general-devel' into checkignores 2017-12-21 13:28:06 +10:30
Lucas Nicodemus
e1e4f41118 Made disable message for login use specifier 2017-12-20 19:00:16 -07:00
Lucas Nicodemus
97f48d6d41 Renamed TSPlayer.CheckIgnores() -> TSPlayer.IsBeingDisabled()
Since all of the flags it was checking have been demystified, this
is pretty self explanatory now.
2017-12-20 17:42:59 -07:00
Lucas Nicodemus
8e5ee7d286 Renamed IgnoreActionsForClearingTrashCan to conform w/ changes
This just changes IgnoreActionsForClearingTrashCan to meet the
same naming scheme for the rest of the old ignore checks. For
consistency. Consistency is nice.
2017-12-20 17:33:18 -07:00
Lucas Nicodemus
4e186e7375 Replace TSPlayer.IgnoreActionsForDisabledArmor -> boolean
TSPlayer.IgnoreActionsForBannedArmor was useless because it only
stored the last armor/dye a player had. Replaced with a boolean.
2017-12-20 17:29:10 -07:00
Lucas Nicodemus
7efcfd055f Replace TSPlayer.IgnoreActionsForCheating w/ boolean
This replaces IgnoreActionsForCheating in TSPlayer with a new
IsDisabledForStackDetection field that tracks the same basic data.

The previous way we did this was storing a string as the "reason"
why a player was disabled for cheating, but it only stored the last
hacked item stack that caused the check to fail. Since we already
have OnSecondUpdate which notifies on _all_ items, we don't need
to store this info in such a useless way anyway. They'll find out
in one second what they need to remove in a more alarmist way.
2017-12-20 17:19:14 -07:00
Lucas Nicodemus
1ef28dfe0d Replace TSPlayer.IgnoreActionsForInventory => IsDisabledForSSC.
This is the first commit in a series to rewrite CheckIgnores()
into whatever its replacement becomes.

IgnoreActionsForInventory was probably used by the SSC system prior
to when we had in-game support for SSC (ergo, when we just checked
to make sure you had removed all items before joining and worked
our way up in inventory data to track it). I could be wrong about
this though.

Now, IsDisabledForSSC tracks only if a player is shut down due to
SSC, rather than a reason that gets broadcast.
2017-12-20 17:01:55 -07:00
Lucas Nicodemus
713dd2614a Fix regression where Bouncer would create dupe items on drop 2017-12-17 12:40:24 -07:00
Lucas Nicodemus
263c0bc402 Revert "Bouncer: Handle case where prefix < 1"
This reverts commit 3f79a904da.

If prefix is < 1 and we block this event, clients can no longer
delete picked up items. This is what caused what Joshwoo reported.
2017-12-17 12:27:02 -07:00
Lucas Nicodemus
14a6338b73 Add a "remove from bouncer" todo item 2017-12-17 00:44:19 -07:00
Lucas Nicodemus
3f79a904da Bouncer: Handle case where prefix < 1 2017-12-17 00:39:22 -07:00
Lucas Nicodemus
9d0c84fd13 Fix handler registration in Bouncer init constructor 2017-12-16 10:37:44 -07:00
Lucas Nicodemus
1e9532a316 Create TSPlayer.IsBouncerThrottled() to avoid code copypasta 2017-12-16 01:14:39 -07:00
Lucas Nicodemus
0260530848 Change Bouncer initialization to a more permanent home 2017-12-16 01:09:40 -07:00
Lucas Nicodemus
1bee289daf Move TShock.CheckIgnores(TSPlayer) -> TSPlayer.CheckIgnores()
Note: This method really sucks and needs to be rebuilt anyway.
2017-12-16 01:03:05 -07:00
Lucas Nicodemus
9f7c3ead09 Add & move OnPlaceItemFrame to Bouncer 2017-12-15 23:15:43 -07:00
Lucas Nicodemus
748d7f7fab Move OnGemLockToggle -> Bouncer 2017-12-15 22:58:41 -07:00
Lucas Nicodemus
de017f2d41 Create & move OnPlaceTileEntity to Bouncer; fix unreachable code 2017-12-15 22:51:07 -07:00
Lucas Nicodemus
64facfc10c Document internal mass wire op in Bouncer 2017-12-15 22:29:52 -07:00
Lucas Nicodemus
681f2a2432 Add & move OnMassWireOperation hook to Bouncer 2017-12-15 22:15:17 -07:00
Lucas Nicodemus
cdba07c62e Move OnPlayerAnimation to Bouncer 2017-12-15 21:50:20 -07:00
Lucas Nicodemus
d03e899452 dmg -> damage 2017-12-15 21:43:27 -07:00
Lucas Nicodemus
007c685c19 Move OnNPCStrike to Bouncer 2017-12-15 21:42:20 -07:00
Lucas Nicodemus
01d865fddc Move OnPlayerDamage to Bouncer
Remove reference to PlayerDamage v1 hook
2017-12-15 18:27:55 -07:00
Lucas Nicodemus
82e2ecb662 Move OnItemDrop to Bouncer 2017-12-15 18:11:35 -07:00
Lucas Nicodemus
5cdb38675c Move OnPlayerBuff logic to Bouncer 2017-12-15 17:51:16 -07:00
Lucas Nicodemus
c9955a74ec Document OnChestItemChange 2017-12-15 12:14:10 -07:00
Lucas Nicodemus
845fc3b7c8 Move OnChestItemChange to Bouncer
Fix issue where TShock didn't properly do anti-cheat on chest
item changes.
2017-12-15 12:12:21 -07:00
Lucas Nicodemus
943f86615a Move UpdateNPCHome to Bouncer 2017-12-14 20:46:26 -07:00
Lucas Nicodemus
be8cffddfd Move OnChestOpen to Bouncer 2017-12-14 20:31:54 -07:00
Lucas Nicodemus
863fa706c2 Document OnPlaceChest in Bouncer 2017-12-14 20:28:50 -07:00
Lucas Nicodemus
6d7c8aa019 TileKill -> PlaceChest (hook changed, so did packet); +Bouncer 2017-12-14 20:13:25 -07:00
Lucas Nicodemus
5cd5bdaaa0 Move OnLiquidSet to Bouncer 2017-12-14 07:46:29 -07:00
Lucas Nicodemus
98aa01c620 Add note about crash check & change reaosn on OnKillMe 2017-12-11 19:07:53 -07:00
Lucas Nicodemus
5c9d2ed870 Simpler check (thanks @bartico6) on OPK's nullcheck. 2017-12-11 08:23:36 -07:00
Lucas Nicodemus
6ed110f862 Change a bounds check to handle a packet instead of letting it go.
This change reverts mod to line 1525 of GetDataHandlers.cs in
672d360e9d by Deathamx.

We couldn't think of a reason why a bounds check would ever return
false, thus not handling the packet and letting the server accept
it. Therefore, it's now true.

In the future, we need to document handling better.
2017-12-11 00:28:08 -07:00
Lucas Nicodemus
ba851d3570 Remove TShock.CheckProjectilePermission
Add TSPlayer.HasProjectilePermission() and its inverse:
	TSPlayer.LacksProjectilePermission()
2017-12-10 23:38:03 -07:00
Lucas Nicodemus
c5f9a51802 Move most of HandleProjectileKill to Bouncer
Added GetDataHandlers.ProjectileKill hook and related arguments.
Fired when a projectile kill packet is accepted by the server.
2017-12-10 23:07:17 -07:00
Lucas Nicodemus
d3c566db83 Move a large majority of OnPlayerUpdate to Bouncer
I really really don't understand why we're doing Terraria's data
sync for them (see HandlePlayerUpdate). Someone know why?
2017-12-10 10:04:27 -07:00
Lucas Nicodemus
949d0e0ffa More remove notes 2017-12-10 08:56:17 -07:00
Lucas Nicodemus
79802cd9e0 Comment more things in Bouncer 2017-12-10 08:54:32 -07:00
Lucas Nicodemus
dd7ffe2d3a Move PlayerKillMeV2 anti-crash to Bouncer
Removed PacketTypes.PlayerKillMe since it's out of the protocol.
Removed handler method for PlayerKillMe since it's out of the
	protocol.
Updated changelog to reflect new hook changes.
2017-12-09 13:50:18 -07:00
Lucas Nicodemus
436e91c1f1 Change STS to 1 tile for @bartico6's quality of life changes
Since these reverts are on a per-tile basis, we only need to revert
the first block not surrounding ones.

Note: May cause problems with dropped sand because of gravity.
2017-12-09 10:30:20 -07:00
Lucas Nicodemus
a5cbeb166b Fix some SendTileSquare calls with proper args 2017-12-09 02:15:31 -07:00
Lucas Nicodemus
760f5518da More patching to fix potential desync (thanks @bartico6)! 2017-12-09 01:50:58 -07:00
Lucas Nicodemus
aa527496dc Replace a coule TileID magic numbers with direc Tcalls.
Thanks @mistzzt & @QuiCM!
2017-12-09 01:48:43 -07:00