Commit graph

691 commits

Author SHA1 Message Date
Lucas Nicodemus
c6a5de4398 OnPaintTile now uses GetDataHandledEventArgs. 2017-12-23 14:17:51 -07:00
Lucas Nicodemus
dbadcc6db0 OnPlayerHP now uses GetDataHandledEventArgs. 2017-12-23 14:16:52 -07:00
Lucas Nicodemus
d54af26916 OnPlayerSlot now uses GetDataHandledEventArgs. 2017-12-23 14:14:58 -07:00
Lucas Nicodemus
3f9c0ebbfe OnPlayerTeam now uses GetDataHandledEventArgs. 2017-12-23 14:13:51 -07:00
Lucas Nicodemus
62013c7594 OnPvpToggled now uses GetDataHandledEventArgs 2017-12-23 14:12:41 -07:00
Lucas Nicodemus
301125b2d8 OnTileEdit is now a GetDataHandledEventArgs. 2017-12-23 14:11:47 -07:00
Lucas Nicodemus
ef1486b78c Move OnGetSection to Bouncer
Bonus: Introduces a new GetDataHandledEventArgs for use in events that
have players, data, and need to be handled.

I was originally going to modify GetDataHandlerArgs, but that comes from
the EventArgs class of args that isn't handled, and changing that to
extend HandledEventArgs would imply we care or check to see if those are
handled and we don't so we're stuck with this implementation for a
teenie tiny bit.
2017-12-21 18:49:29 -07:00
Lucas Nicodemus
f9a1819e26 Update grammar on stack cheat messages. 2017-12-21 17:16:57 -07:00
Lucas Nicodemus
8a43c701a3 Merge remote-tracking branch 'origin/general-devel' into hackedinventory 2017-12-21 16:59:12 -07:00
Lucas Nicodemus
b316ba8200 Move inventory stack hack detection to TSPlayer
Only called in one method, the stack hack detection can move to
TSPlayer as it only ever operates on one player.

In a future commit, this will replace the stack hack detection
OnSecondUpdate() and also set the disabled flag if a player has
a hacked stack when called.
2017-12-21 16:50:20 -07:00
Chris
215970bab2
Merge branch 'general-devel' into checkignores 2017-12-21 13:28:06 +10:30
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
3a59280834 Pre-initialize TShock hooks for Register method
Hooks have this fancy .Register method when they're of type
HandlerList<Args> that high made but we never bother to initialize
any of them, so .Register doesn't work because it's null.

This solves that problem by just initializing all handlers. Thus,
.Register works, and thus, you can register hooks with priorities.
2017-12-20 12:35:42 -07:00
Lucas Nicodemus
c1de974e16 Remove happiness.
http://rubyonrails.org/doctrine

The problem with most programmers is that they refuse to see any
logic in thinking about a problem from the other side, even just
once. You can't argue with someone over what opinionated "programmer
happiness" things are because logically you'll always be outmatched
with "well you can just do it this other way."

Take this example. How is !args.Player.HasProjectilePermission any
easier to understand than args.Player.LacksProjectilePermission?
 -> One is direct: it focuses on what a player doesn't have.
 -> The other is indirect: it's the inverse of have.

You can read one in a sentence and think "so if a player lacks a
permission then this happens" whereas the other is like "invert
if a player has a permission." In this soupy mess of a codebase
where you're trying to sort out what 300 magic numbers mean and
what everything else is trying to do, then it's kinda nice to
be able to read something and understand it immediately.
2017-12-17 01:10:32 -07:00
Lucas Nicodemus
1e9532a316 Create TSPlayer.IsBouncerThrottled() to avoid code copypasta 2017-12-16 01:14:39 -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
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
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
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
d67d3e66a6 Merge branch 'general-devel' into fragments 2017-12-14 20:21:20 -07:00
Lucas Nicodemus
a6d1d9ab49 Update submodule; PacketTypes.TileKill -> PlaceChest 2017-12-14 20:19:53 -07:00
Lucas Nicodemus
6d7c8aa019 TileKill -> PlaceChest (hook changed, so did packet); +Bouncer 2017-12-14 20:13:25 -07:00
Lucas Nicodemus
9f8db96188 Make death in hardcore sting a little more 2017-12-14 09:18:44 -07:00
Lucas Nicodemus
5cd5bdaaa0 Move OnLiquidSet to Bouncer 2017-12-14 07:46:29 -07:00
Lucas Nicodemus
903b5b124e Remove more randomly commented out code with no apparent reason 2017-12-11 10:04:21 -07:00
Lucas Nicodemus
4b08d61673 Change null check to return true in HandlePlayerUpdate
After confirming with @QuiCM on this, we couldn't figure out why
this was set to false in the first place. As a result, we changed
it to true to conform with usual logic (bad stuff? reject it.).
2017-12-11 00:17:58 -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
2cfa633df4 Remove commented out code from HandleProjectileKill 2017-12-10 11:26:01 -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
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
031398591a Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-09 08:44:49 -07:00
Lucas Nicodemus
46617e61d0 Update changelog re. new hook changes 2017-12-09 01:29:23 -07:00
Lucas Nicodemus
c891a81f67 Move NewProjectile into Bouncer 2017-12-09 01:19:05 -07:00
Lucas Nicodemus
b5a40a4472 Comment OnPlaceObject related hook stuff 2017-12-07 21:46:45 -07:00
Lucas Nicodemus
914782ab9e Create hook PlaceObject; move anti-hack to Bouncer 2017-12-07 21:43:33 -07:00
Edgar Luque
07da3d5f58 missed some more declarations 2017-12-08 01:48:08 +01:00
Edgar Luque
6589531868 Renamed TShockAPI.DB 'User' to 'UserAccount' 2017-12-08 01:38:15 +01:00
Lucas Nicodemus
a4d9f0295a Move OnTileEdit stuff to Bouncer
There are probably a few components in here that don't make sense
for bouncer (looking at you, regions code). However, it's on my todo
list rather than being an imminent thing.
2017-12-06 22:16:19 -07:00