Core/Items: Implemented many new enchantment flags
Port From (https://github.com/TrinityCore/TrinityCore/commit/241193cd0287c3d7a2cbaf7f2c5775d414b4d0b3)
This commit is contained in:
@@ -6351,7 +6351,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (enchantEntry == null)
|
||||
return SpellCastResult.Error;
|
||||
if (enchantEntry.Flags.HasAnyFlag(EnchantmentSlotMask.CanSouldBound))
|
||||
if (enchantEntry.GetFlags().HasFlag(SpellItemEnchantmentFlags.Soulbound))
|
||||
return SpellCastResult.NotTradeable;
|
||||
}
|
||||
break;
|
||||
@@ -6365,10 +6365,10 @@ namespace Game.Spells
|
||||
if (item.GetOwner() != player)
|
||||
{
|
||||
int enchant_id = spellEffectInfo.MiscValue;
|
||||
var pEnchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(enchant_id);
|
||||
if (pEnchant == null)
|
||||
var enchantEntry = CliDB.SpellItemEnchantmentStorage.LookupByKey(enchant_id);
|
||||
if (enchantEntry == null)
|
||||
return SpellCastResult.Error;
|
||||
if (pEnchant.Flags.HasAnyFlag(EnchantmentSlotMask.CanSouldBound))
|
||||
if (enchantEntry.GetFlags().HasFlag(SpellItemEnchantmentFlags.Soulbound))
|
||||
return SpellCastResult.NotTradeable;
|
||||
}
|
||||
|
||||
|
||||
@@ -578,7 +578,11 @@ namespace Game.Entities
|
||||
|
||||
public bool IsArenaAllowedEnchancment(uint ench_id)
|
||||
{
|
||||
return mEnchantCustomAttr.LookupByKey((int)ench_id);
|
||||
var enchantment = CliDB.SpellItemEnchantmentStorage.LookupByKey(ench_id);
|
||||
if (enchantment != null)
|
||||
return enchantment.GetFlags().HasFlag(SpellItemEnchantmentFlags.AllowEnteringArena);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<int> GetSpellLinked(int spell_id)
|
||||
@@ -1685,36 +1689,6 @@ namespace Game.Entities
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} spell pet auras in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
// Fill custom data about enchancments
|
||||
public void LoadEnchantCustomAttr()
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
|
||||
uint count = 0;
|
||||
foreach (var spellInfo in mSpellInfoMap.Values)
|
||||
{
|
||||
// @todo find a better check
|
||||
if (!spellInfo.HasAttribute(SpellAttr2.PreserveEnchantInArena) || !spellInfo.HasAttribute(SpellAttr0.NotShapeshift))
|
||||
continue;
|
||||
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (spellEffectInfo.Effect == SpellEffectName.EnchantItemTemporary)
|
||||
{
|
||||
int enchId = spellEffectInfo.MiscValue;
|
||||
var ench = CliDB.SpellItemEnchantmentStorage.LookupByKey((uint)enchId);
|
||||
if (ench == null)
|
||||
continue;
|
||||
mEnchantCustomAttr[enchId] = true;
|
||||
++count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} custom enchant attributes in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
public void LoadSpellEnchantProcData()
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
@@ -4777,7 +4751,6 @@ namespace Game.Entities
|
||||
Dictionary<uint, PetAura> mSpellPetAuraMap = new();
|
||||
MultiMap<int, int> mSpellLinkedMap = new();
|
||||
Dictionary<uint, SpellEnchantProcEntry> mSpellEnchantProcEventMap = new();
|
||||
Dictionary<int, bool> mEnchantCustomAttr = new();
|
||||
MultiMap<uint, SpellArea> mSpellAreaMap = new();
|
||||
MultiMap<uint, SpellArea> mSpellAreaForQuestMap = new();
|
||||
MultiMap<uint, SpellArea> mSpellAreaForQuestEndMap = new();
|
||||
|
||||
Reference in New Issue
Block a user