From 025595cba141a2463f36fce57e3e93dc5f18c425 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 3 Oct 2021 22:27:11 -0400 Subject: [PATCH] Core/Vendors: Support for vendors with empty inventory list Port From (https://github.com/TrinityCore/TrinityCore/commit/bedc0503578b220b19d23559f670f65d26c8bc87) --- Source/Framework/Constants/CreatureConst.cs | 8 +++++++- Source/Game/Entities/Player/Player.cs | 11 ++--------- Source/Game/Handlers/NPCHandler.cs | 2 ++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Source/Framework/Constants/CreatureConst.cs b/Source/Framework/Constants/CreatureConst.cs index fc5c0f0ce..5a6efd043 100644 --- a/Source/Framework/Constants/CreatureConst.cs +++ b/Source/Framework/Constants/CreatureConst.cs @@ -149,7 +149,7 @@ namespace Framework.Constants } public enum NPCFlags2 - { + { None = 0x00, ItemUpgradeMaster = 0x01, GarrisonArchitect = 0x02, @@ -394,4 +394,10 @@ namespace Framework.Constants Max } + + public enum VendorInventoryReason + { + None = 0, + Empty = 1 + } } diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 119b2059e..ae0c0f586 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -2294,14 +2294,6 @@ namespace Game.Entities if (!IsDead()) canTalk = false; break; - case GossipOption.Vendor: - VendorItemData vendorItems = creature.GetVendorItems(); - if (vendorItems == null || vendorItems.Empty()) - { - Log.outError(LogFilter.Sql, "Creature (GUID: {0}, Entry: {1}) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature.GetGUID().ToString(), creature.GetEntry()); - canTalk = false; - } - break; case GossipOption.Learndualspec: canTalk = false; break; @@ -2324,8 +2316,9 @@ namespace Game.Entities case GossipOption.Questgiver: canTalk = false; break; - case GossipOption.Trainer: case GossipOption.Gossip: + case GossipOption.Vendor: + case GossipOption.Trainer: case GossipOption.Spiritguide: case GossipOption.Innkeeper: case GossipOption.Banker: diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index 536836b10..d154674c7 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -564,6 +564,8 @@ namespace Game break; } + packet.Reason = (byte)(count != 0 ? VendorInventoryReason.None : VendorInventoryReason.Empty); + SendPacket(packet); } }