[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

@ -18704,12 +18704,31 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
}
VendorItem const* crItem = vendorslot < vCount ? vItems->GetItem(vendorslot) : tItems->GetItem(vendorslot - vCount);
if(!crItem || crItem->item != item) // store diff item (cheating)
if (!crItem) // store diff item (cheating)
{
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
return false;
}
if (crItem->item != item) // store diff item (cheating or special convert)
{
ItemPrototype const* crProto = ObjectMgr::GetItemPrototype(crItem->item);
// possible item coverting for BoA case
if (crProto->Flags & ITEM_FLAG_BOA)
{
// convert if can use and then buy
if (crProto->RequiredReputationFaction && uint32(GetReputationRank(crProto->RequiredReputationFaction)) >= crProto->RequiredReputationRank)
{
uint32 newitemid = sObjectMgr.GetItemConvert(crItem->item, getRaceMask());
if (newitemid != item) // store diff item (cheating or special convert)
{
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
return false;
}
}
}
}
// check current item amount if it limited
if (crItem->maxcount != 0)