Core/Item: Modify IsCurrencyToken to use IsCurrencyToken in item template.

Changed all BAG_FAMILY_MASK_CURRENCY_TOKENS to IsCurrencyToken.
This commit is contained in:
Abdollah Hasan
2012-06-22 16:34:06 +03:00
parent b859deed80
commit 24a395c82d
4 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ class Item : public Object
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
bool IsCurrencyToken() const { return GetTemplate()->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
bool CanBeTraded(bool mail = false, bool trade = false) const;
@@ -681,6 +681,8 @@ struct ItemTemplate
return false;
}
bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
uint32 GetMaxStackSize() const
{
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
+4 -4
View File
@@ -10678,7 +10678,7 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
// currencytoken case
if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS))
if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->IsCurrencyToken()))
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
// prevent cheating
@@ -11031,7 +11031,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
}
}
else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
else if (pProto->IsCurrencyToken())
{
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
@@ -11198,7 +11198,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
}
}
else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
else if (pProto->IsCurrencyToken())
{
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
@@ -11447,7 +11447,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
if (b_found)
continue;
if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
if (pProto->IsCurrencyToken())
{
for (uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{
+1 -1
View File
@@ -479,7 +479,7 @@ void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
if (proto->IsCurrencyToken())
player->StoreLootItem(i, this);
}
}