Core/Spells: Restored totem category check
Revert "Core/Totems: In cata totem items are no longer needed"
This reverts commit 45e0cae7be
(cherry picked from commit ea9eccae8596d440c372b0d9709d4def4b46e648)
Conflicts:
src/server/game/Entities/Item/ItemPrototype.h
This commit is contained in:
1 parent
8aa7c1995b
commit
6cc38ad7d2
4 files changed
+50
-2
No files matched your search
@@ -991,7 +991,7 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
|
||||
}
|
||||
}
|
||||
|
||||
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
|
||||
bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
|
||||
{
|
||||
if (requiredTotemCategoryId == 0)
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,7 @@ uint32 GetMaxLevelForExpansion(uint32 expansion);
|
||||
|
||||
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
|
||||
|
||||
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
|
||||
bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
|
||||
|
||||
void Zone2MapCoordinates(float &x, float &y, uint32 zone);
|
||||
void Map2ZoneCoordinates(float &x, float &y, uint32 zone);
|
||||
|
||||
@@ -10742,6 +10742,34 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& des
|
||||
return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
|
||||
}
|
||||
|
||||
bool Player::HasItemTotemCategory(uint32 TotemCategory) const
|
||||
{
|
||||
Item* item;
|
||||
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
|
||||
{
|
||||
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (item && IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
|
||||
return true;
|
||||
}
|
||||
|
||||
Bag* bag;
|
||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
{
|
||||
bag = GetBagByPos(i);
|
||||
if (bag)
|
||||
{
|
||||
for (uint32 j = 0; j < bag->GetBagSize(); ++j)
|
||||
{
|
||||
item = GetUseableItemByPos(i, j);
|
||||
if (item && IsTotemCategoryCompatibleWith(item->GetTemplate()->TotemCategory, TotemCategory))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const
|
||||
{
|
||||
Item* pItem2 = GetItemByPos(bag, slot);
|
||||
|
||||
@@ -6034,8 +6034,28 @@ SpellCastResult Spell::CheckItems()
|
||||
else
|
||||
totems -= 1;
|
||||
}
|
||||
|
||||
if (totems != 0)
|
||||
return SPELL_FAILED_TOTEMS;
|
||||
|
||||
// Check items for TotemCategory (items presence in inventory)
|
||||
uint32 totemCategory = 2;
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
{
|
||||
if (m_spellInfo->TotemCategory[i] != 0)
|
||||
{
|
||||
if (player->HasItemTotemCategory(m_spellInfo->TotemCategory[i]))
|
||||
{
|
||||
totemCategory -= 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
totemCategory -= 1;
|
||||
}
|
||||
|
||||
if (totemCategory != 0)
|
||||
return SPELL_FAILED_TOTEM_CATEGORY;
|
||||
}
|
||||
|
||||
// special checks for spell effects
|
||||
|
||||
Reference in new issue
Block a user