From 7bc70c02ad00a5b9b0789e0f79c9589e8b1640fd Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 1 Jun 2022 15:55:27 -0400 Subject: [PATCH] Core/Spells: Rename SpellAttr6 to use official attribute names Port From (https://github.com/TrinityCore/TrinityCore/commit/94aac14b4da2d6d2b7565dfdb91313f09a87f168) --- .../Framework/Constants/Spells/SpellConst.cs | 70 +++++++++---------- Source/Game/Entities/Object/WorldObject.cs | 10 +-- Source/Game/Spells/Spell.cs | 8 +-- Source/Game/Spells/SpellHistory.cs | 2 +- Source/Game/Spells/SpellInfo.cs | 8 +-- Source/Game/Spells/SpellManager.cs | 4 +- Source/Scripts/World/DuelReset.cs | 2 +- 7 files changed, 50 insertions(+), 54 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 2b6d2a5ab..662b89bb7 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1782,48 +1782,48 @@ namespace Framework.Constants NotOnTrivial = 0x400000, /*Nyi*/ // Not On Trivial NoPartialResists = 0x800000, /*Nyi*/ // No Partial Resists IgnoreCasterRequirements = 0x1000000, /*Nyi*/ // Ignore Caster Requirements - AlwaysLineOfSight = 0x2000000, /*Nyi*/ // Always Line Of Sight - AlwaysAoeLineOfSight = 0x4000000, /*Wrong Impl*/ // Always Aoe Line Of Sight Description Requires Line Of Sight Between Caster And Target In Addition To Between Dest And Target + AlwaysLineOfSight = 0x2000000, // Always Line Of Sight + AlwaysAoeLineOfSight = 0x4000000, // Always Aoe Line Of Sight Description Requires Line Of Sight Between Caster And Target In Addition To Between Dest And Target NoCasterAuraIcon = 0x8000000, // No Caster Aura Icon (Client Only) NoTargetAuraIcon = 0x10000000, // No Target Aura Icon (Client Only) - AuraUniquePerCaster = 0x20000000, /*Nyi*/ // Aura Unique Per Caster + AuraUniquePerCaster = 0x20000000, // Aura Unique Per Caster AlwaysShowGroundTexture = 0x40000000, // Always Show Ground Texture AddMeleeHitRating = 0x80000000 /*Nyi*/ // Add Melee Hit Rating } public enum SpellAttr6 : uint { - DontDisplayCooldown = 0x01, // 0 Client Doesn'T Display Cooldown In Tooltip For These Spells - OnlyInArena = 0x02, // 1 Only Usable In Arena - IgnoreCasterAuras = 0x04, // 2 - AssistIgnoreImmuneFlag = 0x08, // 3 - Unk4 = 0x10, // 4 - DoNotConsumeResources = 0x20, // 5 dont consume proc charges - UseSpellCastEvent = 0x40, // 6 - Unk7 = 0x80, // 7 - CantTargetCrowdControlled = 0x100, // 8 - Unk9 = 0x200, // 9 - CanTargetPossessedFriends = 0x400, // 10 Nyi! - NotInRaidInstance = 0x800, // 11 Not Usable In Raid Instance - CastableWhileOnVehicle = 0x1000, // 12 Castable While Caster Is On Vehicle - CanTargetInvisible = 0x2000, // 13 Ignore Visibility Requirement For Spell Target (Phases, Invisibility, Etc.) - Unk14 = 0x4000, // 14 - Unk15 = 0x8000, // 15 Only 54368, 67892 - Unk16 = 0x10000, // 16 - Unk17 = 0x20000, // 17 Mount Spell - CastByCharmer = 0x40000, // 18 Client Won'T Allow To Cast These Spells When Unit Is Not Possessed && Charmer Of Caster Will Be Original Caster - Unk19 = 0x80000, // 19 Only 47488, 50782 - OnlyVisibleToCaster = 0x100000, // 20 Only 58371, 62218 - ClientUiTargetEffects = 0x200000, // 21 It'S Only Client-Side Attribute - Unk22 = 0x400000, // 22 Only 72054 - Unk23 = 0x800000, // 23 - CanTargetUntargetable = 0x1000000, // 24 - NotResetSwingIfInstant = 0x2000000, // 25 Exorcism, Flash Of Light - Unk26 = 0x4000000, // 26 Related To Player Castable Positive Buff - IgnoreHealingModifiers = 0x8000000, // 27 some custom rules - complicated - Unk28 = 0x10000000, // 28 Death Grip - IgnoreCasterDamageModifiers = 0x20000000, // 29 ignores done percent damage mods? some custom rules - complicated - Unk30 = 0x40000000, // 30 - IgnoreCategoryCooldownMods = 0x80000000 // 31 Some Special Cooldown Calc? Only 2894 + NoCooldownOnTooltip = 0x01, // No Cooldown On Tooltip (Client Only) + DoNotResetCooldownInArena = 0x02, /*Nyi*/ // Do Not Reset Cooldown In Arena + NotAnAttack = 0x04, /*Nyi*/ // Not An Attack + CanAssistImmunePc = 0x08, // Can Assist Immune Pc + IgnoreForModTimeRate = 0x10, /*Nyi, Time Rate Not Implemented*/ // Ignore For Mod Time Rate + DoNotConsumeResources = 0x20, // Do Not Consume Resources + FloatingCombatTextOnCast = 0x40, // Floating Combat Text On Cast (Client Only) + AuraIsWeaponProc = 0x80, /*Nyi*/ // Aura Is Weapon Proc + DoNotChainToCrowdControlledTargets = 0x100, // Do Not Chain To Crowd-Controlled Targets Description Implicit Targeting (Chaining And Area Targeting) Will Not Impact Crowd Controlled Targets + AllowOnCharmedTargets = 0x200, /*Nyi*/ // Allow On Charmed Targets + NoAuraLog = 0x400, // No Aura Log + NotInRaidInstances = 0x800, // Not In Raid Instances + AllowWhileRidingVehicle = 0x1000, // Allow While Riding Vehicle + IgnorePhaseShift = 0x2000, // Ignore Phase Shift + AiPrimaryRangedAttack = 0x4000, /*Nyi*/ // Ai Primary Ranged Attack + NoPushback = 0x8000, /*Nyi*/ // No Pushback + NoJumpPathing = 0x10000, /*Nyi*/ // No Jump Pathing + AllowEquipWhileCasting = 0x20000, /*Nyi*/ // Allow Equip While Casting + OriginateFromController = 0x40000, // Originate From Controller Description Client Will Prevent Casting If Not Possessed, Charmer Will Be Caster For All Intents And Purposes + DelayCombatTimerDuringCast = 0x80000, /*Nyi*/ // Delay Combat Timer During Cast + AuraIconOnlyForCasterLimit10 = 0x100000, // Aura Icon Only For Caster (Limit 10) (Client Only) + ShowMechanicAsCombatText = 0x200000, // Show Mechanic As Combat Text (Client Only) + AbsorbCannotBeIgnore = 0x400000, /*Nyi*/ // Absorb Cannot Be Ignore + TapsImmediately = 0x800000, /*Nyi*/ // Taps Immediately + CanTargetUntargetable = 0x1000000, // Can Target Untargetable + DoesntResetSwingTimerIfInstant = 0x2000000, // Doesn'T Reset Swing Timer If Instant + VehicleImmunityCategory = 0x4000000, /*Nyi*/ // Vehicle Immunity Category + IgnoreHealingModifiers = 0x8000000, // Ignore Healing Modifiers Description This Prevents Certain Healing Modifiers From Applying - See Implementation If You Really Care About Details + DoNotAutoSelectTargetWithInitiatesCombat = 0x10000000, // Do Not Auto Select Target With Initiates Combat (Client Only) + IgnoreCasterDamageModifiers = 0x20000000, // Ignore Caster Damage Modifiers Description This Prevents Certain Damage Modifiers From Applying - See Implementation If You Really Care About Details + DisableTiedEffectPoints = 0x40000000, /*Nyi*/ // Disable Tied Effect Points + NoCategoryCooldownMods = 0x80000000 // No Category Cooldown Mods } public enum SpellAttr7 : uint { diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 94e04cc79..d11d834e9 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -2525,7 +2525,7 @@ namespace Game.Entities if (unit != null) { // can't attack invisible - if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) + if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.IgnorePhaseShift)) { if (!unit.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea())) return false; @@ -2557,7 +2557,7 @@ namespace Game.Entities unitOrOwner = go.GetOwner(); // ignore immunity flags when assisting - if (unitOrOwner != null && unitTarget != null && !(isPositiveSpell && bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))) + if (unitOrOwner != null && unitTarget != null && !(isPositiveSpell && bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc))) { if (!unitOrOwner.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget.IsImmuneToNPC()) return false; @@ -2687,7 +2687,7 @@ namespace Game.Entities } // can't assist invisible - if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea())) + if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.IgnorePhaseShift)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea())) return false; // can't assist dead @@ -2702,7 +2702,7 @@ namespace Game.Entities if (isNegativeSpell && unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.NonAttackable | UnitFlags.OnTaxi | UnitFlags.NotAttackable1 | UnitFlags.NonAttackable2)) return false; - if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)) + if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc)) { if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled)) { @@ -2748,7 +2748,7 @@ namespace Game.Entities // !target.HasFlag(UNIT_FIELD_FLAGS, UnitFlags.PvpAttackable) && else if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled)) { - if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)) + if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc)) { if (unitTarget != null && !unitTarget.IsPvP()) { diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index d450903ef..f8b685586 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -40,7 +40,7 @@ namespace Game.Spells public Spell(WorldObject caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default, ObjectGuid originalCastId = default) { m_spellInfo = info; - m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster); + m_caster = (info.HasAttribute(SpellAttr6.OriginateFromController) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster); m_spellValue = new SpellValue(m_spellInfo, caster); m_castItemLevel = -1; @@ -5861,10 +5861,6 @@ namespace Game.Spells if (unitCaster == null) return SpellCastResult.SpellCastOk; - // spells totally immuned to caster auras (wsg flag drop, give marks etc) - if (m_spellInfo.HasAttribute(SpellAttr6.IgnoreCasterAuras)) - return SpellCastResult.SpellCastOk; - // these attributes only show the spell as usable on the client when it has related aura applied // still they need to be checked against certain mechanics @@ -7156,7 +7152,7 @@ namespace Game.Spells if (IsTriggered()) return false; - if (m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr6.NotResetSwingIfInstant)) + if (m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr6.DoesntResetSwingTimerIfInstant)) return false; return true; diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs index ca1944a82..686aefe95 100644 --- a/Source/Game/Spells/SpellHistory.cs +++ b/Source/Game/Spells/SpellHistory.cs @@ -384,7 +384,7 @@ namespace Game.Spells if (cooldown >= TimeSpan.Zero) applySpellMod(ref cooldown); - if (categoryCooldown >= TimeSpan.Zero && !spellInfo.HasAttribute(SpellAttr6.IgnoreCategoryCooldownMods)) + if (categoryCooldown >= TimeSpan.Zero && !spellInfo.HasAttribute(SpellAttr6.NoCategoryCooldownMods)) applySpellMod(ref categoryCooldown); } diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 686f793a6..af027b1af 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -884,7 +884,7 @@ namespace Game.Spells var mapEntry = CliDB.MapStorage.LookupByKey(map_id); // raid instance limitation - if (HasAttribute(SpellAttr6.NotInRaidInstance)) + if (HasAttribute(SpellAttr6.NotInRaidInstances)) { if (mapEntry == null || mapEntry.IsRaid()) return SpellCastResult.NotInRaidInstance; @@ -1003,7 +1003,7 @@ namespace Game.Spells return SpellCastResult.BadTargets; // check visibility - ignore stealth for implicit (area) targets - if (!HasAttribute(SpellAttr6.CanTargetInvisible) && !caster.CanSeeOrDetect(target, Implicit)) + if (!HasAttribute(SpellAttr6.IgnorePhaseShift) && !caster.CanSeeOrDetect(target, Implicit)) return SpellCastResult.BadTargets; Unit unitTarget = target.ToUnit(); @@ -1095,7 +1095,7 @@ namespace Game.Spells return SpellCastResult.TargetsDead; // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness - if (Implicit && HasAttribute(SpellAttr6.CantTargetCrowdControlled) && !unitTarget.CanFreeMove()) + if (Implicit && HasAttribute(SpellAttr6.DoNotChainToCrowdControlledTargets) && !unitTarget.CanFreeMove()) return SpellCastResult.BadTargets; if (!CheckTargetCreatureType(unitTarget)) @@ -1237,7 +1237,7 @@ namespace Game.Spells checkMask = VehicleSeatFlags.CanAttack; var vehicleSeat = vehicle.GetSeatForPassenger(caster); - if (!HasAttribute(SpellAttr6.CastableWhileOnVehicle) && !HasAttribute(SpellAttr0.AllowWhileMounted) + if (!HasAttribute(SpellAttr6.AllowWhileRidingVehicle) && !HasAttribute(SpellAttr0.AllowWhileMounted) && (vehicleSeat.Flags & (int)checkMask) != (int)checkMask) return SpellCastResult.CantDoThatRightNow; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 3ea9533d2..838fff483 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -3328,7 +3328,7 @@ namespace Game.Entities 41487 // Envenom - Black Temple }, spellInfo => { - spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible; + spellInfo.AttributesEx6 |= SpellAttr6.IgnorePhaseShift; }); // Oscillation Field @@ -4073,7 +4073,7 @@ namespace Game.Entities // Twilight Mending ApplySpellFix(new[] { 75509 }, spellInfo => { - spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible; + spellInfo.AttributesEx6 |= SpellAttr6.IgnorePhaseShift; spellInfo.AttributesEx2 |= SpellAttr2.IgnoreLineOfSight; }); diff --git a/Source/Scripts/World/DuelReset.cs b/Source/Scripts/World/DuelReset.cs index 91ae182ec..8cbb8ae90 100644 --- a/Source/Scripts/World/DuelReset.cs +++ b/Source/Scripts/World/DuelReset.cs @@ -118,7 +118,7 @@ namespace Scripts.World.DuelReset if (cooldownMod != 0) totalCooldown += TimeSpan.FromMilliseconds(cooldownMod); - if (!spellInfo.HasAttribute(SpellAttr6.IgnoreCategoryCooldownMods)) + if (!spellInfo.HasAttribute(SpellAttr6.NoCategoryCooldownMods)) applySpellMod(ref categoryCooldown); return remainingCooldown > TimeSpan.Zero