diff options
| author | Shauren <shauren.trinity@gmail.com> | 2022-01-09 16:31:12 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-09 16:31:12 +0100 |
| commit | 241193cd0287c3d7a2cbaf7f2c5775d414b4d0b3 (patch) | |
| tree | 01b863fd5bf6bbfdc048293f4d7c181315f2ae11 /src/server/game/Entities/Item | |
| parent | 6df3cb0995d6bcb28998ca14fd39c9afe9d939b2 (diff) | |
Core/Items: Implemented many new enchantment flags
Diffstat (limited to 'src/server/game/Entities/Item')
| -rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 744dda953cc..5e3ef4a6588 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -580,9 +580,17 @@ void Item::SaveToDB(CharacterDatabaseTransaction& trans) std::ostringstream ssEnchants; for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i) { - ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' '; - ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' '; - ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' '; + if (SpellItemEnchantmentEntry const* enchantment = sSpellItemEnchantmentStore.LookupEntry(GetEnchantmentId(EnchantmentSlot(i))); + enchantment && !enchantment->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotSaveToDB)) + { + ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' '; + ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' '; + ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' '; + } + else + { + ssEnchants << "0 0 0 "; + } } stmt->setString(++index, ssEnchants.str()); @@ -1303,7 +1311,7 @@ bool Item::IsBoundByEnchant() const for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) - if (enchantEntry->Flags & ENCHANTMENT_CAN_SOULBOUND) + if (enchantEntry->GetFlags().HasFlag(SpellItemEnchantmentFlags::Soulbound)) return true; return false; @@ -1369,11 +1377,13 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint Player* owner = GetOwner(); if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT) { - if (uint32 oldEnchant = GetEnchantmentId(slot)) - owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetGUID(), GetEntry(), oldEnchant, slot); + if (SpellItemEnchantmentEntry const* oldEnchant = sSpellItemEnchantmentStore.LookupEntry(GetEnchantmentId(slot))) + if (!oldEnchant->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotLog)) + owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetGUID(), GetEntry(), oldEnchant->ID, slot); - if (id) - owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, slot); + if (SpellItemEnchantmentEntry const* newEnchant = sSpellItemEnchantmentStore.LookupEntry(id)) + if (!newEnchant->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotLog)) + owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, slot); } ApplyArtifactPowerEnchantmentBonuses(slot, GetEnchantmentId(slot), false, owner); |
