Core/Spells: Send OriginalCastId in SMSG_SPELL_START and SMSG_SPELL_GO for triggered spells in 'game' project

Port From (https://github.com/TrinityCore/TrinityCore/commit/555b2d40ecc22eb0ea4bf913b534ffa7197fa6fe)
This commit is contained in:
hondacrx
2021-10-03 13:55:43 -04:00
parent aa29ce8e39
commit 727e0100a1
12 changed files with 139 additions and 90 deletions
+12 -9
View File
@@ -242,7 +242,7 @@ namespace Game.Spells
Aura aura = GetBase();
AuraDataInfo auraData = auraInfo.AuraData.Value;
auraData.CastID = aura.GetCastGUID();
auraData.CastID = aura.GetCastId();
auraData.SpellID = (int)aura.GetId();
auraData.Visual= aura.GetSpellVisual();
auraData.Flags = GetFlags();
@@ -329,7 +329,7 @@ namespace Game.Spells
{
m_spellInfo = createInfo._spellInfo;
m_castDifficulty = createInfo._castDifficulty;
m_castGuid = createInfo._castId;
m_castId = createInfo._castId;
m_casterGuid = createInfo.CasterGUID;
m_castItemGuid = createInfo.CastItemGUID;
m_castItemId = createInfo.CastItemId;
@@ -1212,7 +1212,7 @@ namespace Game.Spells
else if (spellArea.flags.HasAnyFlag(SpellAreaFlag.AutoCast))
{
if (!target.HasAura(spellArea.spellId))
target.CastSpell(target, spellArea.spellId, new CastSpellExtraArgs(true));
target.CastSpell(target, spellArea.spellId, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(GetCastId()));
}
}
}
@@ -1246,7 +1246,9 @@ namespace Game.Spells
if (spell < 0)
target.RemoveAurasDueToSpell((uint)-spell);
else if (removeMode != AuraRemoveMode.Death)
target.CastSpell(target, (uint)spell, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCaster(GetCasterGUID()));
target.CastSpell(target, (uint)spell, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
.SetOriginalCaster(GetCasterGUID())
.SetOriginalCastId(GetCastId()));
}
}
spellTriggered = Global.SpellMgr.GetSpellLinked((int)GetId() + (int)SpellLinkedType.Aura);
@@ -1294,11 +1296,11 @@ namespace Game.Spells
break;
case 33572: // Gronn Lord's Grasp, becomes stoned
if (GetStackAmount() >= 5 && !target.HasAura(33652))
target.CastSpell(target, 33652, new CastSpellExtraArgs(true));
target.CastSpell(target, 33652, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(GetCastId()));
break;
case 50836: //Petrifying Grip, becomes stoned
if (GetStackAmount() >= 5 && !target.HasAura(50812))
target.CastSpell(target, 50812, new CastSpellExtraArgs(true));
target.CastSpell(target, 50812, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(GetCastId()));
break;
case 60970: // Heroic Fury (remove Intercept cooldown)
if (target.IsTypeId(TypeId.Player))
@@ -1371,6 +1373,7 @@ namespace Game.Spells
{
float multiplier = aurEff.GetAmount();
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SetOriginalCastId(GetCastId());
args.AddSpellMod(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(caster.GetMaxPower(PowerType.Mana), multiplier));
caster.CastSpell(caster, 47755, args);
}
@@ -1433,7 +1436,7 @@ namespace Game.Spells
if (target.HasAura(70755))
{
if (apply)
target.CastSpell(target, 71166, new CastSpellExtraArgs(true));
target.CastSpell(target, 71166, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(GetCastId()));
else
target.RemoveAurasDueToSpell(71166);
}
@@ -2280,7 +2283,7 @@ namespace Game.Spells
public SpellInfo GetSpellInfo() { return m_spellInfo; }
public uint GetId() { return m_spellInfo.Id; }
public Difficulty GetCastDifficulty() { return m_castDifficulty; }
public ObjectGuid GetCastGUID() { return m_castGuid; }
public ObjectGuid GetCastId() { return m_castId; }
public ObjectGuid GetCasterGUID() { return m_casterGuid; }
public ObjectGuid GetCastItemGUID() { return m_castItemGuid; }
public uint GetCastItemId() { return m_castItemId; }
@@ -2553,7 +2556,7 @@ namespace Game.Spells
List<AuraScript> m_loadedScripts = new();
SpellInfo m_spellInfo;
Difficulty m_castDifficulty;
ObjectGuid m_castGuid;
ObjectGuid m_castId;
ObjectGuid m_casterGuid;
ObjectGuid m_castItemGuid;
uint m_castItemId;
+14 -13
View File
@@ -2117,7 +2117,7 @@ namespace Game.Spells
{
var mountCapability = CliDB.MountCapabilityStorage.LookupByKey(GetAmount());
if (mountCapability != null)
target.CastSpell(target, mountCapability.ModSpellAuraID, new CastSpellExtraArgs(true));
target.CastSpell(target, mountCapability.ModSpellAuraID, new CastSpellExtraArgs(this));
}
}
else
@@ -4270,14 +4270,14 @@ namespace Game.Spells
break;
case 91604: // Restricted Flight Area
if (aurApp.GetRemoveMode() == AuraRemoveMode.Expire)
target.CastSpell(target, 58601, new CastSpellExtraArgs(true));
target.CastSpell(target, 58601, new CastSpellExtraArgs(this));
break;
}
break;
case SpellFamilyNames.Deathknight:
// Summon Gargoyle (Dismiss Gargoyle at remove)
if (GetId() == 61777)
target.CastSpell(target, (uint)GetAmount(), new CastSpellExtraArgs(true));
target.CastSpell(target, (uint)GetAmount(), new CastSpellExtraArgs(this));
break;
default:
break;
@@ -4309,7 +4309,8 @@ namespace Game.Spells
CastSpellExtraArgs args = new();
args.TriggerFlags = TriggerCastFlags.FullMask;
args.OriginalCaster = GetCasterGUID();
args.CastDifficulty = spell.Difficulty;
args.OriginalCastId = GetBase().GetCastId();
args.CastDifficulty = GetBase().GetCastDifficulty();
for (uint i = 0; i < spell.StackAmount; ++i)
caster.CastSpell(target, spell.Id, args);
@@ -4327,7 +4328,8 @@ namespace Game.Spells
SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellId, GetBase().GetCastDifficulty());
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.OriginalCaster = GetCasterGUID();
args.CastDifficulty = spell.Difficulty;
args.OriginalCastId = GetBase().GetCastId();
args.CastDifficulty = GetBase().GetCastDifficulty();
for (uint i = 0; i < spell.StackAmount; ++i)
caster.CastSpell(target, spell.Id, args);
@@ -4383,7 +4385,7 @@ namespace Game.Spells
target.PlayDirectSound(14970, target.ToPlayer());
// continue in 58205
else
target.CastSpell(target, 58205, new CastSpellExtraArgs(true));
target.CastSpell(target, 58205, new CastSpellExtraArgs(this));
}
break;
// LK Intro VO (2)
@@ -4645,7 +4647,7 @@ namespace Game.Spells
break;
}
target.CastSpell(target, triggerSpell, new CastSpellExtraArgs(true));
target.CastSpell(target, triggerSpell, new CastSpellExtraArgs(this));
}
[AuraEffectHandler(AuraType.TriggerSpellOnPowerAmount)]
@@ -4674,7 +4676,7 @@ namespace Game.Spells
break;
}
target.CastSpell(target, triggerSpell, new CastSpellExtraArgs(true));
target.CastSpell(target, triggerSpell, new CastSpellExtraArgs(this));
}
[AuraEffectHandler(AuraType.OpenStable)]
@@ -5066,7 +5068,7 @@ namespace Game.Spells
uint resist = damageInfo.GetResist();
// SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
SpellNonMeleeDamage log = new(caster, target, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastGUID());
SpellNonMeleeDamage log = new(caster, target, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastId());
log.damage = damage;
log.originalDamage = (uint)dmg;
log.absorb = absorb;
@@ -5338,7 +5340,7 @@ namespace Game.Spells
SpellInfo spellProto = GetSpellInfo();
// maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
SpellNonMeleeDamage damageInfo = new(caster, target, spellProto, GetBase().GetSpellVisual(), spellProto.SchoolMask, GetBase().GetCastGUID());
SpellNonMeleeDamage damageInfo = new(caster, target, spellProto, GetBase().GetSpellVisual(), spellProto.SchoolMask, GetBase().GetCastId());
// no SpellDamageBonus for burn mana
caster.CalculateSpellDamageTaken(damageInfo, (int)(gain * dmgMultiplier), spellProto);
@@ -5438,7 +5440,7 @@ namespace Game.Spells
return;
}
SpellNonMeleeDamage damageInfo = new(target, triggerTarget, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().SchoolMask, GetBase().GetCastGUID());
SpellNonMeleeDamage damageInfo = new(target, triggerTarget, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().SchoolMask, GetBase().GetCastId());
int damage = (int)target.SpellDamageBonusDone(triggerTarget, GetSpellInfo(), (uint)GetAmount(), DamageEffectType.SpellDirect, GetSpellEffectInfo());
damage = (int)triggerTarget.SpellDamageBonusTaken(target, GetSpellInfo(), (uint)damage, DamageEffectType.SpellDirect);
target.CalculateSpellDamageTaken(damageInfo, damage, GetSpellInfo());
@@ -5615,8 +5617,7 @@ namespace Game.Spells
// on apply cast summon spell
if (apply)
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.TriggeringAura = this;
CastSpellExtraArgs args = new(this);
args.CastDifficulty = triggerSpellInfo.Difficulty;
target.CastSpell(target, triggerSpellInfo.Id, args);
}