diff options
| author | Rochet2 <tqbattlenet@gmail.com> | 2014-02-04 15:49:58 +0200 |
|---|---|---|
| committer | Rochet2 <tqbattlenet@gmail.com> | 2014-02-04 15:49:58 +0200 |
| commit | 49593361e3b4296e4275467dbe8480842cc3a8ab (patch) | |
| tree | 070690a0533ae713458275899d26bf31e2cac208 /src | |
| parent | 747184a7c0dc200b9c2c8607a3e1dd990161278e (diff) | |
Core: Add rest of checks from SendListInventory to BuyItemFromVendorSlot
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9ee7bc4b05a..6b7fbebcfb5 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21474,6 +21474,15 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 return false; } + if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster()) + { + SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); + return false; + } + + if (!IsGameMaster() && ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeam() == ALLIANCE) || (pProto->Flags2 == ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeam() == HORDE))) + return false; + Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { @@ -21482,6 +21491,14 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 return false; } + ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), item); + if (!sConditionMgr->IsObjectMeetToConditions(this, creature, conditions)) + { + TC_LOG_DEBUG("condition", "BuyItemFromVendor: conditions not met for creature entry %u item %u", creature->GetEntry(), item); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); + return false; + } + VendorItemData const* vItems = creature->GetVendorItems(); if (!vItems || vItems->Empty()) { |
