diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a46e7806961..6830a7a0db0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -20965,7 +20965,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c ItemPosCountVec vDest; uint16 uiDest = 0; InventoryResult msg = bStore ? - CanStoreNewItem(bag, slot, vDest, item, pProto->BuyCount * count) : + CanStoreNewItem(bag, slot, vDest, item, count) : CanEquipNewItem(slot, uiDest, item, false); if (msg != EQUIP_ERR_OK) { @@ -20981,7 +20981,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c for (int i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i) { if (iece->RequiredItem[i]) - DestroyItemCount(iece->RequiredItem[i], iece->RequiredItem[i], true); + DestroyItemCount(iece->RequiredItem[i], iece->RequiredItemCount[i], true); } for (int i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i) @@ -20996,7 +20996,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c EquipNewItem(uiDest, item, true); if (it) { - uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, pProto->BuyCount * count); + uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, count); WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); data << uint64(pVendor->GetGUID()); @@ -21004,7 +21004,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); data << uint32(count); GetSession()->SendPacket(&data); - SendNewItem(it, pProto->BuyCount * count, true, false, false); + SendNewItem(it, count, true, false, false); if (!bStore) AutoUnequipOffhandIfNeed(); @@ -21062,7 +21062,7 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin VendorItem const* crItem = vItems->GetItem(vendorSlot); // store diff item (cheating) - if (!crItem || crItem->item != currency || crItem->Type != 2) + if (!crItem || crItem->item != currency || crItem->Type != ITEM_VENDOR_TYPE_CURRENCY) { SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, currency, 0); return false; @@ -21100,7 +21100,7 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1; - if (HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * count) / precision)) + if (!HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * count) / precision)) { SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error return false; @@ -21193,6 +21193,13 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 if (crItem->ExtendedCost) { + // Can only buy full stacks for extended cost + if (pProto->BuyCount != count) + { + SendEquipError(EQUIP_ERR_CANT_BUY_QUANTITY, NULL, NULL); + return false; + } + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (!iece) { @@ -21223,9 +21230,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1; - if (HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * count) / precision)) + if (!HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * count) / precision)) { - SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // error not verified for currencies + SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); return false; } } @@ -21267,7 +21274,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } else if (IsEquipmentPos(bag, slot)) { - if (pProto->BuyCount * count != 1) + if (count != 1) { SendEquipError(EQUIP_ERR_NOT_EQUIPPABLE, NULL, NULL); return false;