Core/Spells: Implement spell attribute SPELL_ATTR3_NO_DURABILITY_LOSS
Port From (https://github.com/TrinityCore/TrinityCore/commit/f205a89c86f64bab531a611aa89766aad1c27e83)
This commit is contained in:
@@ -1683,7 +1683,7 @@ namespace Framework.Constants
|
||||
Unk2 = 0x04, // 2
|
||||
BlockableSpell = 0x08, // 3 Only Dmg Class Melee In 3.1.3
|
||||
IgnoreResurrectionTimer = 0x10, // 4 You Don'T Have To Wait To Be Resurrected With These Spells
|
||||
Unk5 = 0x20, // 5
|
||||
NoDurabilityLoss = 0x20, // 5 No Durability Loss
|
||||
Unk6 = 0x40, // 6
|
||||
StackForDiffCasters = 0x80, // 7 Separate Stack For Every Caster
|
||||
OnlyTargetPlayers = 0x100, // 8 Can Only Target Players
|
||||
|
||||
@@ -2585,6 +2585,9 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (spellProto != null && spellProto.HasAttribute(SpellAttr3.NoDurabilityLoss))
|
||||
durabilityLoss = false;
|
||||
|
||||
if (killed)
|
||||
Kill(attacker, victim, durabilityLoss, skipSettingDeathState);
|
||||
else
|
||||
@@ -2609,7 +2612,7 @@ namespace Game.Entities
|
||||
else // victim is a player
|
||||
{
|
||||
// random durability for items (HIT TAKEN)
|
||||
if (WorldConfig.GetFloatValue(WorldCfg.RateDurabilityLossDamage) > RandomHelper.randChance())
|
||||
if (durabilityLoss && WorldConfig.GetFloatValue(WorldCfg.RateDurabilityLossDamage) > RandomHelper.randChance())
|
||||
{
|
||||
byte slot = (byte)RandomHelper.IRand(0, EquipmentSlot.End - 1);
|
||||
victim.ToPlayer().DurabilityPointLossForEquipSlot(slot);
|
||||
@@ -2619,7 +2622,7 @@ namespace Game.Entities
|
||||
if (attacker != null && attacker.IsPlayer())
|
||||
{
|
||||
// random durability for items (HIT DONE)
|
||||
if (RandomHelper.randChance(WorldConfig.GetFloatValue(WorldCfg.RateDurabilityLossDamage)))
|
||||
if (durabilityLoss && RandomHelper.randChance(WorldConfig.GetFloatValue(WorldCfg.RateDurabilityLossDamage)))
|
||||
{
|
||||
byte slot = (byte)RandomHelper.IRand(0, EquipmentSlot.End - 1);
|
||||
attacker.ToPlayer().DurabilityPointLossForEquipSlot(slot);
|
||||
|
||||
Reference in New Issue
Block a user