From 66379a4a17656fed3608cebecc962c43ec6de11f Mon Sep 17 00:00:00 2001 From: hufang360 Date: Sat, 8 Oct 2022 22:50:28 +0800 Subject: [PATCH 1/2] Fix player does't use the Shellphone (Ocean), Shellphone (Underworld) and Shellphone (Spawn). --- CHANGELOG.md | 1 + TShockAPI/GetDataHandlers.cs | 37 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d651ce6d..3f5da5f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed painting wall/tile being rejected from hand of creation. (@Rozen4334) * Added a second `Utils.TryParseTime` method for parsing large, positive time spans. (@punchready) * Fixed `/tempgroup` breaking on durations greater than roughly 24 days. (@punchready) +* Fix player does't use the Shellphone (Ocean), Shellphone (Underworld) and Shellphone (Spawn). (@hufang360) ## TShock 4.5.18 * Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4101e5d4..694c9b23 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3828,9 +3828,11 @@ namespace TShockAPI return true; } break; - case 1: // Magic Conch + case 1: // Magic Conch or Shellphone (Ocean) if (args.Player.ItemInHand.type != ItemID.MagicConch && - args.Player.SelectedItem.type != ItemID.MagicConch) + args.Player.SelectedItem.type != ItemID.MagicConch && + args.Player.ItemInHand.type != ItemID.ShellphoneOcean && + args.Player.SelectedItem.type != ItemID.ShellphoneOcean) { TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected not holding the correct item {0} {1}", args.Player.Name, type); return true; @@ -3838,13 +3840,22 @@ namespace TShockAPI if (!args.Player.HasPermission(Permissions.magicconch)) { - Fail("the Magic Conch"); + if (args.Player.ItemInHand.type == ItemID.ShellphoneOcean || args.Player.SelectedItem.type != ItemID.ShellphoneOcean) + { + Fail("the Shellphone (Ocean)"); + } + else + { + Fail("the Magic Conch"); + } return true; } break; - case 2: // Demon Conch + case 2: // Demon Conch or Shellphone (Underworld) if (args.Player.ItemInHand.type != ItemID.DemonConch && - args.Player.SelectedItem.type != ItemID.DemonConch) + args.Player.SelectedItem.type != ItemID.DemonConch && + args.Player.ItemInHand.type != ItemID.ShellphoneHell && + args.Player.SelectedItem.type != ItemID.ShellphoneHell) { TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected not holding the correct item {0} {1}", args.Player.Name, type); return true; @@ -3852,7 +3863,21 @@ namespace TShockAPI if (!args.Player.HasPermission(Permissions.demonconch)) { - Fail("the Demon Conch"); + if (args.Player.ItemInHand.type == ItemID.ShellphoneHell || args.Player.SelectedItem.type != ItemID.ShellphoneHell) + { + Fail("the Shellphone (Underworld)"); + } + else + { + Fail("the Demon Conch"); + } + return true; + } + break; + case 3: // Shellphone (Spawn) + if (args.Player.ItemInHand.type != ItemID.ShellphoneSpawn && args.Player.SelectedItem.type != ItemID.ShellphoneSpawn) + { + TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected not holding the correct item {0} {1}", args.Player.Name, type); return true; } break; From 678f18b8271e90125ba1a0c1533346c4d960f043 Mon Sep 17 00:00:00 2001 From: hufang360 Date: Sun, 9 Oct 2022 01:35:45 +0800 Subject: [PATCH 2/2] Update GetDataHandlers.cs Correct the mistakes caused by my carelessness. --- TShockAPI/GetDataHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 694c9b23..bf594724 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3840,7 +3840,7 @@ namespace TShockAPI if (!args.Player.HasPermission(Permissions.magicconch)) { - if (args.Player.ItemInHand.type == ItemID.ShellphoneOcean || args.Player.SelectedItem.type != ItemID.ShellphoneOcean) + if (args.Player.ItemInHand.type == ItemID.ShellphoneOcean || args.Player.SelectedItem.type == ItemID.ShellphoneOcean) { Fail("the Shellphone (Ocean)"); } @@ -3863,7 +3863,7 @@ namespace TShockAPI if (!args.Player.HasPermission(Permissions.demonconch)) { - if (args.Player.ItemInHand.type == ItemID.ShellphoneHell || args.Player.SelectedItem.type != ItemID.ShellphoneHell) + if (args.Player.ItemInHand.type == ItemID.ShellphoneHell || args.Player.SelectedItem.type == ItemID.ShellphoneHell) { Fail("the Shellphone (Underworld)"); }