From 3715cbb23dde9bdde0f01a9b8f9c938280c238f2 Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Tue, 30 Apr 2024 01:41:02 -0400 Subject: [PATCH 1/3] Add HasUst check to Salvaging --- Source/ACE.Server/WorldObjects/Player_Crafting.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/ACE.Server/WorldObjects/Player_Crafting.cs b/Source/ACE.Server/WorldObjects/Player_Crafting.cs index 9819c3db3a..3982d0e7cd 100644 --- a/Source/ACE.Server/WorldObjects/Player_Crafting.cs +++ b/Source/ACE.Server/WorldObjects/Player_Crafting.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; -using ACE.Common.Extensions; using ACE.Entity.Enum; using ACE.Entity.Enum.Properties; using ACE.Server.Entity; @@ -122,8 +121,13 @@ public CreatureSkill GetMaxSkill(List skills) Skill.MagicItemTinkering }; + private bool HasUst => GetNumInventoryItemsOfWeenieClass("tinkeringtool") >= 1; + public void HandleSalvaging(List salvageItems) { + if (!HasUst) + return; + var salvageBags = new List(); var salvageResults = new SalvageResults(); From c6e9362b69aee1f1031211f367a88518eb5f2e7e Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Tue, 30 Apr 2024 02:38:13 -0400 Subject: [PATCH 2/3] Update GameActionCreateTinkeringTool.cs --- .../GameAction/Actions/GameActionCreateTinkeringTool.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ACE.Server/Network/GameAction/Actions/GameActionCreateTinkeringTool.cs b/Source/ACE.Server/Network/GameAction/Actions/GameActionCreateTinkeringTool.cs index 26c7d0fb82..049c3fe5e7 100644 --- a/Source/ACE.Server/Network/GameAction/Actions/GameActionCreateTinkeringTool.cs +++ b/Source/ACE.Server/Network/GameAction/Actions/GameActionCreateTinkeringTool.cs @@ -7,7 +7,7 @@ public static class GameActionCreateTinkeringTool [GameAction(GameActionType.CreateTinkeringTool)] public static void Handle(ClientMessage message, Session session) { - var vendorGuid = message.Payload.ReadUInt32(); + var toolGuid = message.Payload.ReadUInt32(); uint itemcount = message.Payload.ReadUInt32(); var items = new List(); @@ -18,7 +18,7 @@ public static void Handle(ClientMessage message, Session session) items.Add(message.Payload.ReadUInt32()); } - session.Player.HandleSalvaging(items); + session.Player.HandleSalvaging(toolGuid, items); } } } From 708abc852f1d2a942e8fc6f682eb3aeaec80e69b Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Tue, 30 Apr 2024 02:49:56 -0400 Subject: [PATCH 3/3] Update Player_Crafting.cs --- .../WorldObjects/Player_Crafting.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Source/ACE.Server/WorldObjects/Player_Crafting.cs b/Source/ACE.Server/WorldObjects/Player_Crafting.cs index 3982d0e7cd..130f32f128 100644 --- a/Source/ACE.Server/WorldObjects/Player_Crafting.cs +++ b/Source/ACE.Server/WorldObjects/Player_Crafting.cs @@ -121,11 +121,27 @@ public CreatureSkill GetMaxSkill(List skills) Skill.MagicItemTinkering }; - private bool HasUst => GetNumInventoryItemsOfWeenieClass("tinkeringtool") >= 1; + private bool ToolIsValidUst(uint tool) + { + var toolObject = FindObject(tool, SearchLocations.Everywhere, out _, out var rootOwner, out _); + + if (toolObject == null || toolObject.WeenieClassId != (uint)ACE.Entity.Enum.WeenieClassName.W_TINKERINGTOOL_CLASS) + { + SendWeenieError(WeenieError.NotASalvageTool); + return false; + } + else if (rootOwner != this) + { + SendWeenieError(WeenieError.YouDoNotOwnThatSalvageTool); + return false; + } + else + return true; + } - public void HandleSalvaging(List salvageItems) + public void HandleSalvaging(uint tool, List salvageItems) { - if (!HasUst) + if (!ToolIsValidUst(tool)) return; var salvageBags = new List();