From fe4679ba952b220ddcc51598bed5a604823762bb Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Thu, 4 Jun 2020 19:40:41 +0930 Subject: [PATCH 1/5] Remove invalid dictionary entries in CreativePowerHandler --- TShockAPI/Handlers/NetModules/CreativePowerHandler.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs b/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs index 470890d1..ac9c7c34 100644 --- a/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs +++ b/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs @@ -95,9 +95,6 @@ namespace TShockAPI.Handlers.NetModules { { Permissions.journey_timefreeze, "freeze the time of the server" }, { Permissions.journey_timeset, "modify the time of the server" }, - { Permissions.journey_timeset, "modify the time of the server" }, - { Permissions.journey_timeset, "modify the time of the server" }, - { Permissions.journey_timeset, "modify the time of the server" }, { Permissions.journey_godmode, "toggle godmode" }, { Permissions.journey_windstrength, "modify the wind strength of the server" }, { Permissions.journey_rainstrength, "modify the rain strength of the server" }, From 2fd59418212a4191c6218c6795f551decf740a44 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Thu, 4 Jun 2020 12:23:48 +0200 Subject: [PATCH 2/5] OnFishout - Fixing #1985 - Making debug messages clearer. Modifying redundant check. The actual issue was a missing `!` beind IsInRange. If player was doing a valid fishing event, it handled the NPC spawning. I've split up the checks to make clearer debug messages. Main.projectile objects are never null. Bobber projectile is never killed when the FishOutNPC event occurs. The projectile type in the check can only be 0 if no recent projectile found that has the name Bobber. --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 823bb7de..98e4eb6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Handling SyncCavernMonsterType packet to prevent an exploit where players could modify the server's cavern monster types and make the server spawn any NPCs - including bosses - onto other players. * Added LandGolfBallInCup event which is accessible for developers to work with, as well as LandGolfBallInCup handler to handle exploits where players could send direct packets to trigger and imitate golf ball cup landing anywhere in the game world. Added two public lists in Handlers.LandGolfBallInCupHandler: GolfBallProjectileIDs and GolfClubItemIDs. (@Patrikkk) * Add SyncTilePicking event. This is called when a player damages a tile. Implementing SyncTilePickingHandler and patching tile damaging related exploits. (Preventing player sending invalid world position data which disconnects other players.) +* Fix the issue where mobs could not be fished out during bloodmoon because of Bouncer checks. (@Patrikkk) ## TShock 4.4.0 (Pre-release 10) * Fix all rope coils. (@Olink) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 6f2a2ae4..69be781f 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1906,11 +1906,24 @@ namespace TShockAPI /// internal void OnFishOutNPC(object sender, GetDataHandlers.FishOutNPCEventArgs args) { - var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index] != null && Main.projectile[p.Index].Name == "Bobber"); + /// Getting recent projectiles of the player which are named Bobber. All bobbers have the same Name. + var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index].Name == "Bobber"); - if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type) || Main.projectile[projectile.Index] == null || !FishableNpcIDs.Contains(args.NpcID)) + if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type)) { - TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected invalid NPC spawning from {0}", args.Player.Name); + TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for not using a fishing rod! - From {0}", args.Player.Name); + args.Handled = true; + return; + } + if (projectile.Type == 0 || projectile.Killed) /// The bobber projectile is never killed when the NPC spawns. Type can only be 0 if no recent projectile is found that is named Bobber. + { + TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for not finding active bobber projectile! - From {0}", args.Player.Name); + args.Handled = true; + return; + } + if (!FishableNpcIDs.Contains(args.NpcID)) + { + TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for the NPC not being on the fishable NPCs list! - From {0}", args.Player.Name); args.Handled = true; return; } @@ -1920,9 +1933,9 @@ namespace TShockAPI args.Handled = true; return; } - if (args.Player.IsInRange(args.TileX, args.TileY, 55)) + if (!args.Player.IsInRange(args.TileX, args.TileY, 55)) { - TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name); + TShock.Log.ConsoleError("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name); args.Handled = true; } } From 00161088e790c0f5f3c110b1b62e823bed815674 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Thu, 4 Jun 2020 12:25:55 +0200 Subject: [PATCH 3/5] OnFishoutNPC - Use ConsoleDebug for message. --- TShockAPI/Bouncer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 69be781f..f21b60eb 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1935,7 +1935,7 @@ namespace TShockAPI } if (!args.Player.IsInRange(args.TileX, args.TileY, 55)) { - TShock.Log.ConsoleError("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name); + TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name); args.Handled = true; } } From 268c772eeab6c4ab53e590567b58a5b8a7a5e83b Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 5 Jun 2020 00:25:01 +0200 Subject: [PATCH 4/5] Update submodule. 1.4.0.5 --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 891380c8..7942fe87 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 891380c8946dd53e670d34002d984e88d1c6179e +Subproject commit 7942fe87e30e0c42c311848e95cde9100d08ae8d From 65b0eb9ccf81624b36db4d23e53c982998e7004b Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 5 Jun 2020 00:26:32 +0200 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e4eb6a..d0906ec4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added LandGolfBallInCup event which is accessible for developers to work with, as well as LandGolfBallInCup handler to handle exploits where players could send direct packets to trigger and imitate golf ball cup landing anywhere in the game world. Added two public lists in Handlers.LandGolfBallInCupHandler: GolfBallProjectileIDs and GolfClubItemIDs. (@Patrikkk) * Add SyncTilePicking event. This is called when a player damages a tile. Implementing SyncTilePickingHandler and patching tile damaging related exploits. (Preventing player sending invalid world position data which disconnects other players.) * Fix the issue where mobs could not be fished out during bloodmoon because of Bouncer checks. (@Patrikkk) +* Update for OTAPI 2.0.0.37 and Terraria 1.4.0.5. (@hakusaro, @Patrikkk) ## TShock 4.4.0 (Pre-release 10) * Fix all rope coils. (@Olink)