|
|
|
@@ -1,18 +1,3 @@
|
|
|
|
|
#include "HouseInteriorMap.h"
|
|
|
|
|
#include "Housing.h"
|
|
|
|
|
#include "HousingDecorEntity.h"
|
|
|
|
|
#include "HousingDefines.h"
|
|
|
|
|
#include "HousingMap.h"
|
|
|
|
|
#include "HousingMgr.h"
|
|
|
|
|
#include "HousingMirrorEntity.h"
|
|
|
|
|
#include "HousingNeighborhoodMirrorEntity.h"
|
|
|
|
|
#include "HousingPackets.h"
|
|
|
|
|
#include "HousingPlayerHouseEntity.h"
|
|
|
|
|
#include "HousingRoomEntity.h"
|
|
|
|
|
#include "InitiativeManager.h"
|
|
|
|
|
#include "MeshObject.h"
|
|
|
|
|
#include "Neighborhood.h"
|
|
|
|
|
#include "NeighborhoodMgr.h"
|
|
|
|
|
/*
|
|
|
|
|
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
|
|
|
|
*
|
|
|
|
@@ -186,6 +171,21 @@
|
|
|
|
|
#include "QuaternionData.h"
|
|
|
|
|
#include "LFGPackets.h"
|
|
|
|
|
#include "ScriptHelpers.h"
|
|
|
|
|
#include "HouseInteriorMap.h"
|
|
|
|
|
#include "Housing.h"
|
|
|
|
|
#include "HousingDecorEntity.h"
|
|
|
|
|
#include "HousingDefines.h"
|
|
|
|
|
#include "HousingMap.h"
|
|
|
|
|
#include "HousingMgr.h"
|
|
|
|
|
#include "HousingMirrorEntity.h"
|
|
|
|
|
#include "HousingNeighborhoodMirrorEntity.h"
|
|
|
|
|
#include "HousingPackets.h"
|
|
|
|
|
#include "HousingPlayerHouseEntity.h"
|
|
|
|
|
#include "HousingRoomEntity.h"
|
|
|
|
|
#include "InitiativeManager.h"
|
|
|
|
|
#include "MeshObject.h"
|
|
|
|
|
#include "Neighborhood.h"
|
|
|
|
|
#include "NeighborhoodMgr.h"
|
|
|
|
|
#include <cmath>
|
|
|
|
|
//WowCommunity
|
|
|
|
|
|
|
|
|
@@ -13660,11 +13660,11 @@ void Player::SendEquipError(InventoryResult msg, Item const* item1 /*= nullptr*/
|
|
|
|
|
SendDirectMessage(failure.Write());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::SendBuyError(BuyResult msg, Creature const* creature, uint32 item) const
|
|
|
|
|
void Player::SendBuyError(BuyResult msg, Creature const* creature, uint32 vendorslot) const
|
|
|
|
|
{
|
|
|
|
|
WorldPackets::Item::BuyFailed packet;
|
|
|
|
|
packet.VendorGUID = creature ? creature->GetGUID() : ObjectGuid::Empty;
|
|
|
|
|
packet.Muid = item;
|
|
|
|
|
packet.Muid = vendorslot + 1;
|
|
|
|
|
packet.Reason = msg;
|
|
|
|
|
SendDirectMessage(packet.Write());
|
|
|
|
|
}
|
|
|
|
@@ -25537,7 +25537,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
|
|
|
|
CurrencyTypesEntry const* proto = sCurrencyTypesStore.LookupEntry(currency);
|
|
|
|
|
if (!proto)
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25546,20 +25546,20 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
|
|
|
|
{
|
|
|
|
|
TC_LOG_DEBUG("network", "Player::BuyCurrencyFromVendorSlot: Vendor ({}) not found or player '{}' ({}) can't interact with him.",
|
|
|
|
|
vendorGuid.ToString(), GetName(), GetGUID().ToString());
|
|
|
|
|
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VendorItemData const* vItems = creature->GetVendorItems();
|
|
|
|
|
if (!vItems || vItems->Empty())
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vendorSlot >= vItems->GetItemCount())
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25624,7 +25624,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
|
|
|
|
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(iece->CurrencyID[i]);
|
|
|
|
|
if (!entry)
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, currency); // Find correct error
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorSlot); // Find correct error
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25651,7 +25651,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
|
|
|
|
|
|
|
|
|
if (iece->MinFactionID && uint32(GetReputationRank(iece->MinFactionID)) < iece->RequiredAchievement)
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25669,7 +25669,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
|
|
|
|
}
|
|
|
|
|
else // currencies have no price defined, can only be bought with ExtendedCost
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, currency);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, vendorSlot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25718,13 +25718,13 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
|
|
|
|
|
if (!pProto)
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(pProto->GetAllowableClass() & GetClassMask()) && pProto->GetBonding() == BIND_ON_ACQUIRE && !IsGameMaster())
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25736,7 +25736,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
{
|
|
|
|
|
TC_LOG_DEBUG("network", "Player::BuyItemFromVendorSlot: Vendor ({}) not found or player '{}' ({}) can't interact with him.",
|
|
|
|
|
vendorguid.ToString(), GetName(), GetGUID().ToString());
|
|
|
|
|
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item);
|
|
|
|
|
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25744,20 +25744,20 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
{
|
|
|
|
|
TC_LOG_DEBUG("condition", "Player::BuyItemFromVendorSlot: Player '{}' ({}) doesn't meed conditions for creature (Entry: {}, Item: {})",
|
|
|
|
|
GetName(), GetGUID().ToString(), creature->GetEntry(), item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VendorItemData const* vItems = creature->GetVendorItems();
|
|
|
|
|
if (!vItems || vItems->Empty())
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vendorslot >= vItems->GetItemCount())
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25765,7 +25765,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
// store diff item (cheating)
|
|
|
|
|
if (!crItem || crItem->item != item)
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25787,7 +25787,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
|
|
|
|
|
if (pProto->GetRequiredReputationFaction() && (uint32(GetReputationRank(pProto->GetRequiredReputationFaction())) < pProto->GetRequiredReputationRank()))
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -25894,7 +25894,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
|
|
|
|
|
|
|
|
|
if (!HasEnoughMoney(price))
|
|
|
|
|
{
|
|
|
|
|
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item);
|
|
|
|
|
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, vendorslot);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|