[9507] Implement SPELL_EFFECT_RESTORE_ITEM_CHARGES

Also it application in special case of item 5513 and similar.
This commit is contained in:
VladimirMangos 2010-03-03 05:58:36 +03:00
parent d775eea9a4
commit 4c4629e861
11 changed files with 105 additions and 3 deletions

View file

@ -8622,6 +8622,26 @@ uint32 Player::GetItemCountWithLimitCategory( uint32 limitCategory ) const
return count;
}
Item* Player::GetItemByEntry( uint32 item ) const
{
for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem->GetEntry() == item)
return pItem;
for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem->GetEntry() == item)
return pItem;
for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i))
if (Item* itemPtr = pBag->GetItemByEntry(item))
return itemPtr;
return NULL;
}
Item* Player::GetItemByGuid( uint64 guid ) const
{
for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)