Core/Vendors: allow players to interact with vendors that do not have any items to sell

This commit is contained in:
Ovahlord committed 2021-09-10 10:04:14 +02:00
1 parent c2be4c4a86
commit d8753ef5d7
3 files changed
+5 -10

No files matched your search

@@ -53,6 +53,7 @@ typedef std::list<VendorItemCount> VendorItemCounts;
#define CREATURE_Z_ATTACK_RANGE 3
#define MAX_VENDOR_ITEMS 150 // Limitation in 4.x.x item count in SMSG_VENDOR_INVENTORY
static constexpr uint8 VENDOR_INVENTORY_REASON_INVENTORY_EMPTY = 1;
//used for handling non-repeatable random texts
typedef std::vector<uint8> CreatureTextRepeatIds;
+1 -10
View File
@@ -13814,16 +13814,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 (Entry: %u GUID: %u DB GUID: %u) has UNIT_NPC_FLAG_VENDOR set, but has an empty trading item list.", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUID().GetCounter(), creature->GetSpawnId());
canTalk = false;
}
break;
}
case GOSSIP_OPTION_LEARNDUALSPEC:
case GOSSIP_OPTION_DUALSPEC_INFO:
if (!(GetSpecsCount() == 1 && creature->CanResetTalents(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
@@ -13864,6 +13854,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
case GOSSIP_OPTION_PETITIONER:
case GOSSIP_OPTION_TABARDDESIGNER:
case GOSSIP_OPTION_AUCTIONEER:
case GOSSIP_OPTION_VENDOR:
break; // no checks
case GOSSIP_OPTION_OUTDOORPVP:
if (!sOutdoorPvPMgr->CanTalkTo(this, creature, itr->second))
+3
View File
@@ -710,6 +710,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
// Resize vector to real size (some items can be skipped due to checks)
packet.Items.resize(count);
if (!count)
packet.Reason = VENDOR_INVENTORY_REASON_INVENTORY_EMPTY;
SendPacket(packet.Write());
}