[10682] New table 'item_convert' for convertion items.

* Implment vendor at show replace BoA item with reputation requirement
  by identical item without rep. reqs for player that fit this requirements
  of original item.

* Table also can be used for store item convertion data form one team items
  to similar other team items. This case not impement but added function easy
  used for it.

* Note: strict single convert for item not created problem for both way use:
  item converted for same team or all, can't be original item for conversion to
  another team.
This commit is contained in:
VladimirMangos 2010-11-04 23:53:23 +03:00
parent 225b4db1ca
commit 2f144d9d29
13 changed files with 162 additions and 6 deletions

View file

@ -773,7 +773,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
if (crItem)
{
if (ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(crItem->item))
uint32 itemId = crItem->item;
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemId);
if (pProto)
{
if (!_player->isGameMaster())
{
@ -792,13 +794,25 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
continue;
}
// possible item coverting for BoA case
if (pProto->Flags & ITEM_FLAG_BOA)
{
// convert if can use and then buy
if (pProto->RequiredReputationFaction && uint32(_player->GetReputationRank(pProto->RequiredReputationFaction)) >= pProto->RequiredReputationRank)
{
itemId = sObjectMgr.GetItemConvert(itemId, _player->getRaceMask());
// checked at convert data loading as existed
pProto = ObjectMgr::GetItemPrototype(itemId);
}
}
++count;
// reputation discount
uint32 price = (crItem->ExtendedCost == 0 || pProto->Flags2 & ITEM_FLAG2_EXT_COST_REQUIRES_GOLD) ? uint32(floor(pProto->BuyPrice * discountMod)) : 0;
data << uint32(vendorslot +1); // client size expected counting from 1
data << uint32(crItem->item);
data << uint32(itemId);
data << uint32(pProto->DisplayInfoID);
data << uint32(crItem->maxcount <= 0 ? 0xFFFFFFFF : pCreature->GetVendorItemCurrentCount(crItem));
data << uint32(price);