Core/Vendors: Support for vendors with empty inventory list (#26895)

This commit is contained in:
Meji
2021-10-03 21:50:21 +02:00
committed by GitHub
parent 3080c37952
commit bedc050357
3 changed files with 9 additions and 10 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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());
}