From 0d2b59176047bc6777241c7a44b29adfe7b4d6e6 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 13:45:31 -0400 Subject: [PATCH 01/15] Update NPCAddBuff to include Sparkle Slime debuff It's a new cosmetic debuff added in 1.4, like Wet and Slimed that can be applied to Town NPCs. Wiki: https://terraria.gamepedia.com/Sparkle_Slime_Balloon --- TShockAPI/Bouncer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index ad6e516a..b58681a4 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1537,7 +1537,7 @@ namespace TShockAPI if (npc.townNPC && npc.netID != NPCID.Guide && npc.netID != NPCID.Clothier) { if (type != BuffID.Lovestruck && type != BuffID.Stinky && type != BuffID.DryadsWard && - type != BuffID.Wet && type != BuffID.Slimed) + type != BuffID.Wet && type != BuffID.Slimed && type != BuffID.GelBalloonBuff) { detectedNPCBuffTimeCheat = true; } From 720feed7af46f12c4d23adda822621ec71e9057e Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 26 May 2020 22:22:41 -0700 Subject: [PATCH 02/15] Fix journey mode / kick on death conflict This fixes an issue where kick/ban on hardcore/mediumcore death penalties applied to journey mode characters unintentionally. Fixes #1901. --- CHANGELOG.md | 1 + TShockAPI/GetDataHandlers.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0eb992..7c321eac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `-worldselectpath` is identical to the old `-worldpath`. If you specify `-worldselectpath` and `-world` without specifying an absolute path the server will crash for sure. * Thank you again to @fjfnaranjo for supplying a [detailed feature request](https://github.com/Pryaxis/TShock/issues/1914) explaining precisely why this option should be available. Without this, we would have had no context as to why this feature was useful or important. Thank you, @fjfnaranjo! * This change was implemented by (@QuiCM, @hakusaro). +* Fix kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index e7fa1874..09667f33 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3524,7 +3524,7 @@ namespace TShockAPI } // Handle kicks/bans on mediumcore/hardcore deaths. - if (args.TPlayer.difficulty != 0) // Player is not softcore + if (args.TPlayer.difficulty == 1 || args.TPlayer.difficulty == 2) // Player is not softcore { bool mediumcore = args.TPlayer.difficulty == 1; bool shouldBan = mediumcore ? TShock.Config.BanOnMediumcoreDeath : TShock.Config.BanOnHardcoreDeath; From 7ee9541ea115ef3c735bda655e3ad91cf10bdcdf Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 27 May 2020 01:41:52 -0700 Subject: [PATCH 03/15] Add devs who've enabled github sponsors to funding --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 32f48df7..4c84987b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms - +github: [QuiCM, hakusaro] custom: https://www.givedirectly.org/ From 073088156cb28b0d30e1cd6badae9103849ff285 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 27 May 2020 01:51:12 -0700 Subject: [PATCH 04/15] Undo the last change related to funding file :S --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 4c84987b..b8e325e5 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,2 @@ # These are supported funding model platforms -github: [QuiCM, hakusaro] custom: https://www.givedirectly.org/ From 814801d894e83f03b98bbdf1db2d61bcbfc12849 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 27 May 2020 20:21:29 -0700 Subject: [PATCH 05/15] Experimentally change spawn rules for #1849 This change applies @AxeelAnder's suggeted patch from #1845 to attempt to resolve spawn point issues. If you remove your bed spawn point it should send you back to the map spawn point with this. --- CHANGELOG.md | 3 ++- TShockAPI/GetDataHandlers.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c321eac..bbae6522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `-worldselectpath` is identical to the old `-worldpath`. If you specify `-worldselectpath` and `-world` without specifying an absolute path the server will crash for sure. * Thank you again to @fjfnaranjo for supplying a [detailed feature request](https://github.com/Pryaxis/TShock/issues/1914) explaining precisely why this option should be available. Without this, we would have had no context as to why this feature was useful or important. Thank you, @fjfnaranjo! * This change was implemented by (@QuiCM, @hakusaro). -* Fix kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) +* Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) +* Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 09667f33..1f90f29e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2118,7 +2118,7 @@ namespace TShockAPI TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpawn force teleport 'vanilla spawn' {0}", args.Player.Name); } - if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0) && (args.TPlayer.SpawnX > 0) && ((args.TPlayer.SpawnX != args.Player.sX) && (args.TPlayer.SpawnY != args.Player.sY))) + else if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0) && (args.TPlayer.SpawnX > 0) && ((args.TPlayer.SpawnX != args.Player.sX) && (args.TPlayer.SpawnY != args.Player.sY))) { args.Player.sX = args.TPlayer.SpawnX; From 0fa8ae13d79ec4acdce9d3943ebb3d02573dea4b Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Thu, 28 May 2020 19:24:28 +0200 Subject: [PATCH 06/15] 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. --- TShockAPI/Bouncer.cs | 49 +++++++++++++++++++++++++++++ TShockAPI/GetDataHandlers.cs | 61 +++++++++++++++++++++++++++++++++++- TShockAPI/TShockAPI.csproj | 4 +-- 3 files changed, 111 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index ad6e516a..abd5fe05 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -67,6 +67,7 @@ namespace TShockAPI GetDataHandlers.MassWireOperation += OnMassWireOperation; GetDataHandlers.PlayerDamage += OnPlayerDamage; GetDataHandlers.KillMe += OnKillMe; + GetDataHandlers.FoodPlatterTryPlacing += OnFoodPlatterTryPlacing; } internal void OnGetSection(object sender, GetDataHandlers.GetSectionEventArgs args) @@ -2062,6 +2063,54 @@ namespace TShockAPI } } + /// + /// Called when a player is trying to place an item into a food plate. + /// + /// + /// + internal void OnFoodPlatterTryPlacing(object sender, GetDataHandlers.FoodPlatterTryPlacingEventArgs args) + { + if (args.Player.ItemInHand.type != args.ItemID) + { + TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected item not placed by hand from {0}", args.Player.Name); + args.Player.SendTileSquare(args.TileX, args.TileY, 1); + args.Handled = true; + return; + } + if (args.Player.IsBeingDisabled()) + { + TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected disabled from {0}", args.Player.Name); + Item item = new Item(); + item.netDefaults(args.ItemID); + args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix); + args.Player.SendTileSquare(args.TileX, args.TileY, 1); + args.Handled = true; + return; + } + + if (!args.Player.HasBuildPermission(args.TileX, args.TileY)) + { + TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected permissions from {0}", args.Player.Name); + Item item = new Item(); + item.netDefaults(args.ItemID); + args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix); + args.Player.SendTileSquare(args.TileX, args.TileY, 1); + args.Handled = true; + return; + } + + if (!args.Player.IsInRange(args.TileX, args.TileY)) + { + TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected range checks from {0}", args.Player.Name); + Item item = new Item(); + item.netDefaults(args.ItemID); + args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix); + args.Player.SendTileSquare(args.TileX, args.TileY, 1); + args.Handled = true; + return; + } + } + internal void OnSecondUpdate() { Task.Run(() => diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 1f90f29e..74dbff85 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -150,7 +150,8 @@ namespace TShockAPI { PacketTypes.ToggleParty, HandleToggleParty }, { PacketTypes.CrystalInvasionStart, HandleOldOnesArmy }, { PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 }, - { PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 } + { PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 }, + { PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing } }; } @@ -1863,6 +1864,52 @@ namespace TShockAPI return args.Handled; } + public class FoodPlatterTryPlacingEventArgs : GetDataHandledEventArgs + { + /// + /// The X tile position of the placement action. + /// + public short TileX { get; set; } + /// + /// The Y tile position of the placement action. + /// + public short TileY { get; set; } + /// + /// The Item ID that is being placed in the plate. + /// + public short ItemID { get; set; } + /// + /// The prefix of the item that is being placed in the plate. + /// + public byte Prefix { get; set; } + /// + /// The stack of the item that is being placed in the plate. + /// + public short Stack { get; set; } + } + /// + /// Called when a player is placing an item in a food plate. + /// + public static HandlerList FoodPlatterTryPlacing = new HandlerList(); + private static bool OnFoodPlatterTryPlacing(TSPlayer player, MemoryStream data, short tileX, short tileY, short itemID, byte prefix, short stack) + { + if (FoodPlatterTryPlacing == null) + return false; + + var args = new FoodPlatterTryPlacingEventArgs + { + Player = player, + Data = data, + TileX = tileX, + TileY = tileY, + ItemID = itemID, + Prefix = prefix, + Stack = stack, + }; + FoodPlatterTryPlacing.Invoke(null, args); + return args.Handled; + } + #endregion private static bool HandlePlayerInfo(GetDataHandlerArgs args) @@ -3559,7 +3606,19 @@ namespace TShockAPI return false; } + private static bool HandleFoodPlatterTryPlacing(GetDataHandlerArgs args) + { + short tileX = args.Data.ReadInt16(); + short tileY = args.Data.ReadInt16(); + short itemID = args.Data.ReadInt16(); + byte prefix = args.Data.ReadInt8(); + short stack = args.Data.ReadInt16(); + if (OnFoodPlatterTryPlacing(args.Player, args.Data, tileX, tileY, itemID, prefix, stack)) + return true; + + return false; + } public enum EditAction { diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index c941ea0a..ab982025 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -31,7 +31,7 @@ true full false - bin\Debug\ + ..\..\..\Debug\ServerPlugins\ DEBUG;TRACE prompt 4 @@ -221,4 +221,4 @@ --> - + \ No newline at end of file From 3c0a990de650c9e8d56643d325c13a440b808d58 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Thu, 28 May 2020 20:47:21 +0200 Subject: [PATCH 07/15] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbae6522..94b9e1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * This change was implemented by (@QuiCM, @hakusaro). * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) +* Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From a4075fd590cc07fa3f7e171591f48a6dcdd11a90 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 29 May 2020 00:10:57 +0200 Subject: [PATCH 08/15] Revert TShockAPI.csproj to original. --- TShockAPI/TShockAPI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index ab982025..f6a2d81c 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -31,7 +31,7 @@ true full false - ..\..\..\Debug\ServerPlugins\ + bin\Debug\ DEBUG;TRACE prompt 4 From 6e4b6e1f5ef4e278bfbb5cd08be8a1ad91204dfe Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 13:58:44 +0930 Subject: [PATCH 09/15] Fix paint permission check --- TShockAPI/TSPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 3d7deaae..1a204594 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -685,7 +685,7 @@ namespace TShockAPI /// True if they can paint. public bool HasPaintPermission(int x, int y) { - return HasBuildPermission(x, y) || HasPermission(Permissions.canpaint); + return HasBuildPermission(x, y) && HasPermission(Permissions.canpaint); } /// Checks if a player can place ice, and if they can, tracks ice placements and removals. From ecb1a8a4e724fbd305af6d09de8550b8d72d94c0 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:14:56 +0930 Subject: [PATCH 10/15] Update GetDataHandlers.cs --- TShockAPI/GetDataHandlers.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 74dbff85..b6d35d62 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2316,6 +2316,14 @@ namespace TShockAPI { var player = args.Player; var size = args.Data.ReadInt16(); + + var changeType = TileChangeType.None; + bool hasChangeType = ((size & 0x7FFF) & 0x8000) != 0; + if (hasChangeType) + { + changeType = (TileChangeType)args.Data.ReadInt8(); + } + var tileX = args.Data.ReadInt16(); var tileY = args.Data.ReadInt16(); var data = args.Data; From 2e0e5596b0df770cdb94de5d1251716aa02c4fa1 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:17:24 +0930 Subject: [PATCH 11/15] Fix wall read bug in NetTile --- TShockAPI/Net/NetTile.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index 76d8e943..62896c10 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -30,7 +30,7 @@ namespace TShockAPI.Net public short FrameX { get; set; } public short FrameY { get; set; } public bool Lighted { get; set; } - public byte Wall { get; set; } + public ushort Wall { get; set; } public byte Liquid { get; set; } public byte LiquidType { get; set; } public bool Wire { get; set; } @@ -175,7 +175,7 @@ namespace TShockAPI.Net } if (HasWall) - stream.WriteInt8(Wall); + stream.WriteInt16((short)Wall);; if (HasLiquid) { @@ -218,7 +218,7 @@ namespace TShockAPI.Net if (flags[2]) { - Wall = stream.ReadInt8(); + Wall = stream.ReadUInt16(); } if (flags[3]) From cdeac344b8fbf6a4db73335cefd4c2ef242f2764 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:18:11 +0930 Subject: [PATCH 12/15] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b9e1ba..169d1271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) +* Fixed an offset error in NetTile that impacted SendTileSquare ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From 0c3242a6f543c88622a0d788219bf5ad0eb02a6a Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 10:56:40 -0700 Subject: [PATCH 13/15] Tuned changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 169d1271..02cdc3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * This change was implemented by (@QuiCM, @hakusaro). * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) -* Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) -* Fixed an offset error in NetTile that impacted SendTileSquare +* Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) +* Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From 44ad2d2effcc2c0e3e82c1944c8737586a78c532 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 19:50:07 -0700 Subject: [PATCH 14/15] Remove extra debug info from OnGetData Per packet debug logs are redundant for people with the packet monitor plugin. If you need packet monitoring, please install the packet monitor plugin. --- CHANGELOG.md | 9 +++++---- TShockAPI/TShock.cs | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cdc3b2..d409b244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,10 @@ This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. ## Upcoming Release -* Fix pet licenses. (@Olink) -* Initial support for Journey mode in SSC worlds. (@Olink) -* Make TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) -* Reintroduce `-worldselectpath` per feedback from @fjfnaranjo. This command line argument should be used to specify the place where the interactive server startup will look for worlds to show on the world select screen. The original version of this argument, `-worldpath`, was removed because several game service providers have broken configurations that stop the server from running with an unhelpful error. This specific configuration was `-world` and `-worldpath`. In the new world, you can do the following: +* Fixed pet licenses. (@Olink) +* Added initial support for Journey mode in SSC worlds. (@Olink) +* Made TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) +* Reintroduced `-worldselectpath` per feedback from @fjfnaranjo. This command line argument should be used to specify the place where the interactive server startup will look for worlds to show on the world select screen. The original version of this argument, `-worldpath`, was removed because several game service providers have broken configurations that stop the server from running with an unhelpful error. This specific configuration was `-world` and `-worldpath`. In the new world, you can do the following: * `-worldselectpath` should be used if you want to customize the server interactive boot world list (so that you can select from a number of worlds in non-standard locations). * `-world` will behave as an absolute path to the world to load. This is the most common thing you want if you're starting the server and have a specific world in mind. * `-worldselectpath` and `-worldname` should work together enabling you to select from a world from the list that you specify. This is *not* a world file name, but a world name as described by Terraria. @@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) +* Removed packet monitoring from debug logs. To achieve the same results, install @QuiCM's packet monitor plugin (it does better things). (@hakusaro) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0d19a6fb..3839a5ec 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1493,8 +1493,6 @@ namespace TShockAPI PacketTypes type = e.MsgID; - Log.ConsoleDebug("Recv: {0:X}: {2} ({1:XX})", e.Msg.whoAmI, (byte)type, type); - var player = Players[e.Msg.whoAmI]; if (player == null || !player.ConnectionAlive) { From f82ab41a254f893f332900e5f22d6bc8cf5f08a2 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 21:04:48 -0700 Subject: [PATCH 15/15] Add /sync command to alleviate door related sadness Run /sync if your doors disappear. This will resync your local client with the server state. For more information, please see the associated changelog entry. --- CHANGELOG.md | 6 ++++++ TShockAPI/Bouncer.cs | 6 ++++-- TShockAPI/Commands.cs | 11 +++++++++++ TShockAPI/DB/GroupManager.cs | 3 ++- TShockAPI/Permissions.cs | 3 +++ 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d409b244..fd59e1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) * Removed packet monitoring from debug logs. To achieve the same results, install @QuiCM's packet monitor plugin (it does better things). (@hakusaro) +* Updated packet monitoring in send tile square handler for Bouncer debugging. (@hakusaro) +* Added `/sync`, activated with `tshock.synclocalarea`. This is a default guest permission. When the command is issued, the server will resync area around the player in the event of a desync issue. (@hakusaro) + * If your doors disappear, this command will allow a player to resync without having to disconnect from the server. + * The default group that gets this permission is `Guest` for the time being. + * To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`. + * This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed). ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index abd5fe05..c3a62dae 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -558,6 +558,8 @@ namespace TShockAPI return; } + bool changed = false; + bool failed = false; try { var tiles = new NetTile[size, size]; @@ -569,7 +571,6 @@ namespace TShockAPI } } - bool changed = false; for (int x = 0; x < size; x++) { int realx = tileX + x; @@ -709,9 +710,10 @@ namespace TShockAPI catch { args.Player.SendTileSquare(tileX, tileY, size); + failed = true; } - TShock.Log.ConsoleDebug("Bouncer / SendTileSquare reimplemented from spaghetti from {0}", args.Player.Name); + TShock.Log.ConsoleDebug("Bouncer / SendTileSquare from {0} {1} {2}", args.Player.Name, changed, failed); args.Handled = true; } diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8d131588..fd3f5e9e 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -589,6 +589,10 @@ namespace TShockAPI { HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder." }); + add(new Command(Permissions.synclocalarea, SyncLocalArea, "sync") + { + HelpText = "Sends all tiles from the server to the player to resync the client with the actual world state." + }); #endregion add(new Command(Aliases, "aliases") @@ -5302,6 +5306,13 @@ namespace TShockAPI return; } + private static void SyncLocalArea(CommandArgs args) + { + args.Player.SendTileSquare((int) args.Player.TileX, (int) args.Player.TileY, 32); + args.Player.SendWarningMessage("Sync'd!"); + return; + } + #endregion General Commands #region Cheat Commands diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 6405b5bc..c9a3b760 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -64,7 +64,8 @@ namespace TShockAPI.DB Permissions.canlogin, Permissions.canpartychat, Permissions.cantalkinthird, - Permissions.canchat)); + Permissions.canchat, + Permissions.synclocalarea)); AddDefaultGroup("default", "guest", string.Join(",", diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 322b1199..baf21a73 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -465,6 +465,9 @@ namespace TShockAPI [Description("Player can see advanced information about any user account.")] public static readonly string advaccountinfo = "tshock.accountinfo.details"; + + [Description("Player can resync themselves with server state.")] + public static readonly string synclocalarea = "tshock.synclocalarea"; #endregion /// /// Lists all commands associated with a given permission