mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Vendors: Support for vendors with empty inventory list (#26895)
This commit is contained in:
@@ -54,6 +54,12 @@ typedef std::list<VendorItemCount> VendorItemCounts;
|
||||
|
||||
#define MAX_VENDOR_ITEMS 150 // Limitation in 4.x.x item count in SMSG_LIST_INVENTORY
|
||||
|
||||
enum class VendorInventoryReason : uint8
|
||||
{
|
||||
None = 0,
|
||||
Empty = 1
|
||||
};
|
||||
|
||||
static constexpr uint8 WILD_BATTLE_PET_DEFAULT_LEVEL = 1;
|
||||
|
||||
//used for handling non-repeatable random texts
|
||||
|
||||
@@ -14605,16 +14605,6 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||
if (!isDead())
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_VENDOR:
|
||||
{
|
||||
VendorItemData const* vendorItems = creature->GetVendorItems();
|
||||
if (!vendorItems || vendorItems->Empty())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Creature %s (%s DB GUID: " UI64FMTD ") has UNIT_NPC_FLAG_VENDOR set but has an empty trading item list.", creature->GetName().c_str(), creature->GetGUID().ToString().c_str(), creature->GetSpawnId());
|
||||
canTalk = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
||||
canTalk = false;
|
||||
break;
|
||||
@@ -14638,6 +14628,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_GOSSIP:
|
||||
case GOSSIP_OPTION_VENDOR:
|
||||
case GOSSIP_OPTION_TRAINER:
|
||||
case GOSSIP_OPTION_SPIRITGUIDE:
|
||||
case GOSSIP_OPTION_INNKEEPER:
|
||||
|
||||
@@ -708,6 +708,8 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
|
||||
// Resize vector to real size (some items can be skipped due to checks)
|
||||
packet.Items.resize(count);
|
||||
|
||||
packet.Reason = AsUnderlyingType(count ? VendorInventoryReason::None : VendorInventoryReason::Empty);
|
||||
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user