Core/Items: Implemented many new enchantment flags
Port From (https://github.com/TrinityCore/TrinityCore/commit/241193cd0287c3d7a2cbaf7f2c5775d414b4d0b3)
This commit is contained in:
@@ -168,7 +168,13 @@ namespace Game.Entities
|
||||
|
||||
ss.Clear();
|
||||
for (EnchantmentSlot slot = 0; slot < EnchantmentSlot.Max; ++slot)
|
||||
ss.AppendFormat("{0} {1} {2} ", GetEnchantmentId(slot), GetEnchantmentDuration(slot), GetEnchantmentCharges(slot));
|
||||
{
|
||||
var enchantment = CliDB.SpellItemEnchantmentStorage.LookupByKey(GetEnchantmentId(slot));
|
||||
if (enchantment != null && !enchantment.GetFlags().HasFlag(SpellItemEnchantmentFlags.DoNotSaveToDB))
|
||||
ss.Append($"{GetEnchantmentId(slot)} {GetEnchantmentDuration(slot)} {GetEnchantmentCharges(slot)} ");
|
||||
else
|
||||
ss.Append("0 0 0 ");
|
||||
}
|
||||
|
||||
stmt.AddValue(++index, ss.ToString());
|
||||
stmt.AddValue(++index, m_randomBonusListId);
|
||||
@@ -892,7 +898,7 @@ namespace Game.Entities
|
||||
{
|
||||
var enchantEntry = CliDB.SpellItemEnchantmentStorage.LookupByKey(enchant_id);
|
||||
if (enchantEntry != null)
|
||||
if (enchantEntry.Flags.HasAnyFlag(EnchantmentSlotMask.CanSouldBound))
|
||||
if (enchantEntry.GetFlags().HasFlag(SpellItemEnchantmentFlags.Soulbound))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -960,12 +966,13 @@ namespace Game.Entities
|
||||
Player owner = GetOwner();
|
||||
if (slot < EnchantmentSlot.MaxInspected)
|
||||
{
|
||||
uint oldEnchant = GetEnchantmentId(slot);
|
||||
if (oldEnchant != 0)
|
||||
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), oldEnchant, (uint)slot);
|
||||
var oldEnchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(GetEnchantmentId(slot));
|
||||
if (oldEnchant != null && !oldEnchant.GetFlags().HasFlag(SpellItemEnchantmentFlags.DoNotLog))
|
||||
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), oldEnchant.Id, (uint)slot);
|
||||
|
||||
if (id != 0)
|
||||
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot);
|
||||
var newEnchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(id);
|
||||
if (newEnchant != null && !newEnchant.GetFlags().HasFlag(SpellItemEnchantmentFlags.DoNotLog))
|
||||
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot);
|
||||
}
|
||||
|
||||
ApplyArtifactPowerEnchantmentBonuses(slot, GetEnchantmentId(slot), false, owner);
|
||||
|
||||
@@ -1919,9 +1919,19 @@ namespace Game.Entities
|
||||
// remove item dependent auras and casts (only weapon and armor slots)
|
||||
if (slot < EquipmentSlot.End)
|
||||
{
|
||||
// remove held enchantments, update expertise
|
||||
// update expertise
|
||||
if (slot == EquipmentSlot.MainHand)
|
||||
{
|
||||
// clear main hand only enchantments
|
||||
for (EnchantmentSlot enchantSlot = 0; enchantSlot < EnchantmentSlot.Max; ++enchantSlot)
|
||||
{
|
||||
var enchantment = CliDB.SpellItemEnchantmentStorage.LookupByKey(pItem.GetEnchantmentId(enchantSlot));
|
||||
if (enchantment != null && enchantment.GetFlags().HasFlag(SpellItemEnchantmentFlags.MainhandOnly))
|
||||
pItem.ClearEnchantment(enchantSlot);
|
||||
}
|
||||
|
||||
UpdateExpertise(WeaponAttackType.BaseAttack);
|
||||
}
|
||||
else if (slot == EquipmentSlot.OffHand)
|
||||
UpdateExpertise(WeaponAttackType.OffAttack);
|
||||
// update armor penetration - passive auras may need it
|
||||
|
||||
@@ -959,9 +959,8 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem)
|
||||
if (pItem.GetEnchantmentId(slot) != 0)
|
||||
pItem.ClearEnchantment(slot);
|
||||
if (pItem && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
pItem.ClearEnchantment(slot);
|
||||
}
|
||||
|
||||
// in inventory bags
|
||||
@@ -973,9 +972,8 @@ namespace Game.Entities
|
||||
for (byte j = 0; j < pBag.GetBagSize(); j++)
|
||||
{
|
||||
Item pItem = pBag.GetItemByPos(j);
|
||||
if (pItem)
|
||||
if (pItem.GetEnchantmentId(slot) != 0)
|
||||
pItem.ClearEnchantment(slot);
|
||||
if (pItem && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
pItem.ClearEnchantment(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user