Core/Items: Disable effects on items marked as legacy
Port From (https://github.com/TrinityCore/TrinityCore/commit/c34e0f80a0337ba582aeee17a478081f99a69686)
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Framework.Constants
|
namespace Framework.Constants
|
||||||
{
|
{
|
||||||
@@ -884,6 +885,7 @@ namespace Framework.Constants
|
|||||||
Equipped = 0x1
|
Equipped = 0x1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum ItemFlags : long
|
public enum ItemFlags : long
|
||||||
{
|
{
|
||||||
NoPickup = 0x01,
|
NoPickup = 0x01,
|
||||||
@@ -894,7 +896,7 @@ namespace Framework.Constants
|
|||||||
NoUserDestroy = 0x20, // Item Can Not Be Destroyed, Except By Using Spell (Item Can Be Reagent For Spell)
|
NoUserDestroy = 0x20, // Item Can Not Be Destroyed, Except By Using Spell (Item Can Be Reagent For Spell)
|
||||||
Playercast = 0x40, // Item's spells are castable by players
|
Playercast = 0x40, // Item's spells are castable by players
|
||||||
NoEquipCooldown = 0x80, // No Default 30 Seconds Cooldown When Equipped
|
NoEquipCooldown = 0x80, // No Default 30 Seconds Cooldown When Equipped
|
||||||
Legacy = 0x100,
|
Legacy = 0x100, // Effects are disabled
|
||||||
IsWrapper = 0x200, // Item Can Wrap Other Items
|
IsWrapper = 0x200, // Item Can Wrap Other Items
|
||||||
UsesResources = 0x400,
|
UsesResources = 0x400,
|
||||||
MultiDrop = 0x800, // Looting This Item Does Not Remove It From Available Loot
|
MultiDrop = 0x800, // Looting This Item Does Not Remove It From Available Loot
|
||||||
|
|||||||
@@ -3817,7 +3817,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void ApplyItemEquipSpell(Item item, bool apply, bool formChange = false)
|
void ApplyItemEquipSpell(Item item, bool apply, bool formChange = false)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null || item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||||
|
|||||||
@@ -1469,6 +1469,8 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void CastItemUseSpell(Item item, SpellCastTargets targets, ObjectGuid castCount, uint[] misc)
|
public void CastItemUseSpell(Item item, SpellCastTargets targets, ObjectGuid castCount, uint[] misc)
|
||||||
|
{
|
||||||
|
if (!item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||||
{
|
{
|
||||||
// special learning case
|
// special learning case
|
||||||
if (item.GetBonus().EffectCount >= 2)
|
if (item.GetBonus().EffectCount >= 2)
|
||||||
@@ -1529,6 +1531,7 @@ namespace Game.Entities
|
|||||||
spell.Prepare(targets);
|
spell.Prepare(targets);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Item enchantments spells casted at use
|
// Item enchantments spells casted at use
|
||||||
for (EnchantmentSlot e_slot = 0; e_slot < EnchantmentSlot.Max; ++e_slot)
|
for (EnchantmentSlot e_slot = 0; e_slot < EnchantmentSlot.Max; ++e_slot)
|
||||||
@@ -1786,6 +1789,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void ApplyItemObtainSpells(Item item, bool apply)
|
void ApplyItemObtainSpells(Item item, bool apply)
|
||||||
{
|
{
|
||||||
|
if (item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (ItemEffectRecord effect in item.GetEffects())
|
foreach (ItemEffectRecord effect in item.GetEffects())
|
||||||
{
|
{
|
||||||
if (effect.TriggerType != ItemSpelltriggerType.OnObtain) // On obtain trigger
|
if (effect.TriggerType != ItemSpelltriggerType.OnObtain) // On obtain trigger
|
||||||
@@ -3178,6 +3184,8 @@ namespace Game.Entities
|
|||||||
// for done procs allow normal + critical + absorbs by default
|
// for done procs allow normal + critical + absorbs by default
|
||||||
bool canTrigger = damageInfo.GetHitMask().HasAnyFlag(ProcFlagsHit.Normal | ProcFlagsHit.Critical | ProcFlagsHit.Absorb);
|
bool canTrigger = damageInfo.GetHitMask().HasAnyFlag(ProcFlagsHit.Normal | ProcFlagsHit.Critical | ProcFlagsHit.Absorb);
|
||||||
if (canTrigger)
|
if (canTrigger)
|
||||||
|
{
|
||||||
|
if (!item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||||
{
|
{
|
||||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||||
{
|
{
|
||||||
@@ -3210,6 +3218,7 @@ namespace Game.Entities
|
|||||||
CastSpell(damageInfo.GetVictim(), spellInfo.Id, item);
|
CastSpell(damageInfo.GetVictim(), spellInfo.Id, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// item combat enchantments
|
// item combat enchantments
|
||||||
for (byte e_slot = 0; e_slot < (byte)EnchantmentSlot.Max; ++e_slot)
|
for (byte e_slot = 0; e_slot < (byte)EnchantmentSlot.Max; ++e_slot)
|
||||||
|
|||||||
Reference in New Issue
Block a user