Core/Creatures: Implemented new extended cost requirements and fixed some items requiring too much honor/conquest points
This commit is contained in:
1 parent
3579942438
commit
21c42bf5a7
6 files changed
+126
-23
No files matched your search
@@ -571,7 +571,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
vendor->StopMoving();
|
||||
|
||||
VendorItemData const* vendorItems = vendor->GetVendorItems();
|
||||
uint8 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;
|
||||
uint32 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;
|
||||
|
||||
//if (rawItemCount > 300),
|
||||
// rawItemCount = 300; // client cap but uint8 max value is 255
|
||||
@@ -582,10 +582,11 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
|
||||
const float discountMod = _player->GetReputationPriceDiscount(vendor);
|
||||
uint8 count = 0;
|
||||
for (uint8 slot = 0; slot < rawItemCount; ++slot)
|
||||
for (uint32 slot = 0; slot < rawItemCount; ++slot)
|
||||
{
|
||||
VendorItem const* vendorItem = vendorItems->GetItem(slot);
|
||||
if (!vendorItem) continue;
|
||||
if (!vendorItem)
|
||||
continue;
|
||||
|
||||
if (vendorItem->Type == ITEM_VENDOR_TYPE_ITEM)
|
||||
{
|
||||
@@ -622,18 +623,18 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
if (int32 priceMod = _player->GetTotalAuraModifier(SPELL_AURA_MOD_VENDOR_ITEMS_PRICES))
|
||||
price -= CalculatePct(price, priceMod);
|
||||
|
||||
++count;
|
||||
itemsData << uint32(slot + 1); // client expects counting to start at 1
|
||||
itemsData << uint32(itemTemplate->MaxDurability);
|
||||
|
||||
if (vendorItem->ExtendedCost != 0)
|
||||
if (vendorItem->ExtendedCost)
|
||||
{
|
||||
enablers.push_back(0);
|
||||
itemsData << uint32(vendorItem->ExtendedCost);
|
||||
}
|
||||
else
|
||||
enablers.push_back(1);
|
||||
enablers.push_back(1); // unk bit
|
||||
|
||||
enablers.push_back(1); // item is unlocked
|
||||
|
||||
itemsData << uint32(vendorItem->item);
|
||||
itemsData << uint32(vendorItem->Type); // 1 is items, 2 is currency
|
||||
@@ -642,6 +643,9 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
// if (!unk "enabler") data << uint32(something);
|
||||
itemsData << int32(leftInStock);
|
||||
itemsData << uint32(itemTemplate->BuyCount);
|
||||
|
||||
if (++count >= MAX_VENDOR_ITEMS)
|
||||
break;
|
||||
}
|
||||
else if (vendorItem->Type == ITEM_VENDOR_TYPE_CURRENCY)
|
||||
{
|
||||
@@ -649,22 +653,16 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
if (!currencyTemplate)
|
||||
continue;
|
||||
|
||||
if (vendorItem->ExtendedCost == 0)
|
||||
if (!vendorItem->ExtendedCost)
|
||||
continue; // there's no price defined for currencies, only extendedcost is used
|
||||
|
||||
++count;
|
||||
itemsData << uint32(slot + 1); // client expects counting to start at 1
|
||||
itemsData << uint32(0); // max durability
|
||||
|
||||
if (vendorItem->ExtendedCost != 0)
|
||||
{
|
||||
enablers.push_back(0);
|
||||
itemsData << uint32(vendorItem->ExtendedCost);
|
||||
}
|
||||
else
|
||||
enablers.push_back(1);
|
||||
enablers.push_back(0);
|
||||
itemsData << uint32(vendorItem->ExtendedCost);
|
||||
|
||||
enablers.push_back(1); // unk bit
|
||||
enablers.push_back(1); // item is unlocked
|
||||
|
||||
itemsData << uint32(vendorItem->item);
|
||||
itemsData << uint32(vendorItem->Type); // 1 is items, 2 is currency
|
||||
@@ -673,6 +671,9 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
// if (!unk "enabler") data << uint32(something);
|
||||
itemsData << int32(-1);
|
||||
itemsData << uint32(vendorItem->maxcount);
|
||||
|
||||
if (++count >= MAX_VENDOR_ITEMS)
|
||||
break;
|
||||
}
|
||||
// else error
|
||||
}
|
||||
@@ -706,7 +707,13 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
data.WriteByteSeq(guid[0]);
|
||||
data.WriteByteSeq(guid[6]);
|
||||
|
||||
data << uint8(count == 0); // unk byte, item count 0: 1, item count != 0: 0 or some "random" value below 300
|
||||
// It doesn't matter what value is used here (PROBABLY its full vendor size)
|
||||
// What matters is that if count of items we can see is 0 and this field is 1
|
||||
// then client will open the vendor list, otherwise it won't
|
||||
if (rawItemCount)
|
||||
data << uint8(rawItemCount);
|
||||
else
|
||||
data << uint8(vendor->IsArmorer());
|
||||
|
||||
data.WriteByteSeq(guid[2]);
|
||||
data.WriteByteSeq(guid[3]);
|
||||
|
||||
Reference in new issue
Block a user