Core/Items: ported several enchantment flag implementations from master branch
This commit is contained in:
1 parent
009e1dba37
commit
3ff8840fe2
8 files changed
+35
-63
No files matched your search
@@ -11848,6 +11848,15 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
|
||||
SetVisibleItemSlot(slot, nullptr);
|
||||
if (slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND)
|
||||
CheckTitanGripPenalty();
|
||||
|
||||
if (slot == EQUIPMENT_SLOT_MAINHAND)
|
||||
{
|
||||
// clear main hand only enchantments
|
||||
for (uint32 enchantSlot = 0; enchantSlot < MAX_ENCHANTMENT_SLOT; ++enchantSlot)
|
||||
if (SpellItemEnchantmentEntry const* enchantment = sSpellItemEnchantmentStore.LookupEntry(pItem->GetEnchantmentId(EnchantmentSlot(enchantSlot))))
|
||||
if (enchantment->GetFlags().HasFlag(SpellItemEnchantmentFlags::MainhandOnly))
|
||||
pItem->ClearEnchantment(EnchantmentSlot(enchantSlot));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Bag* pBag = GetBagByPos(bag))
|
||||
@@ -13117,7 +13126,7 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot)
|
||||
// in inventory
|
||||
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
|
||||
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (pItem->GetEnchantmentId(slot))
|
||||
if (!sSpellMgr->IsArenaAllowedEnchancment(pItem->GetEnchantmentId(slot)))
|
||||
pItem->ClearEnchantment(slot);
|
||||
|
||||
// in inventory bags
|
||||
@@ -13125,7 +13134,7 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot)
|
||||
if (Bag* pBag = GetBagByPos(i))
|
||||
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
|
||||
if (Item* pItem = pBag->GetItemByPos(j))
|
||||
if (pItem->GetEnchantmentId(slot))
|
||||
if (!sSpellMgr->IsArenaAllowedEnchancment(pItem->GetEnchantmentId(slot)))
|
||||
pItem->ClearEnchantment(slot);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user