From 0a2425a7907c0c09cc225fec7881944e0a8f55cd Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 18 Nov 2021 20:16:46 -0500 Subject: [PATCH] Core/Spells: Fixed unapplying rockbiter weapon Port From (https://github.com/TrinityCore/TrinityCore/commit/ba2586c92f87230c6380d7a2fe2d52c52471b9cb) --- Source/Game/Entities/Player/Player.Spells.cs | 4 ++-- Source/Game/Entities/Player/Player.cs | 7 +++++-- Source/Game/Entities/Unit/Unit.cs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index 647ec8f5f..c6e4e6fd0 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -578,7 +578,7 @@ namespace Game.Entities { WeaponAttackType attackType = Player.GetAttackBySlot(item.GetSlot(), item.GetTemplate().GetInventoryType()); if (attackType != WeaponAttackType.Max) - UpdateDamageDoneMods(attackType); + UpdateDamageDoneMods(attackType, apply ? -1 : (int)slot); } break; case ItemEnchantmentType.EquipSpell: @@ -795,7 +795,7 @@ namespace Game.Entities { WeaponAttackType attackType = Player.GetAttackBySlot(item.GetSlot(), item.GetTemplate().GetInventoryType()); if (attackType != WeaponAttackType.Max) - UpdateDamageDoneMods(attackType); + UpdateDamageDoneMods(attackType, apply ? -1 : (int)slot); break; } case ItemEnchantmentType.UseSpell: diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 33eedf998..028f18b98 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -6581,9 +6581,9 @@ namespace Game.Entities UpdateBaseModGroup(modGroup); } - public override void UpdateDamageDoneMods(WeaponAttackType attackType) + public override void UpdateDamageDoneMods(WeaponAttackType attackType, int skipEnchantSlot = -1) { - base.UpdateDamageDoneMods(attackType); + base.UpdateDamageDoneMods(attackType, skipEnchantSlot); UnitMods unitMod = attackType switch { @@ -6600,6 +6600,9 @@ namespace Game.Entities for (var slot = EnchantmentSlot.Perm; slot < EnchantmentSlot.Max; ++slot) { + if (skipEnchantSlot == (int)slot) + continue; + SpellItemEnchantmentRecord enchantmentEntry = CliDB.SpellItemEnchantmentStorage.LookupByKey(item.GetEnchantmentId(slot)); if (enchantmentEntry == null) continue; diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 05a71f4be..7a83e64d4 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -3811,7 +3811,7 @@ namespace Game.Entities public virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = WeaponAttackType.BaseAttack) { return SpellSchoolMask.None; } - public virtual void UpdateDamageDoneMods(WeaponAttackType attackType) + public virtual void UpdateDamageDoneMods(WeaponAttackType attackType, int skipEnchantSlot = -1) { UnitMods unitMod = attackType switch {