Core/AreaTriggers: Add Spell* argument to AreaTriggerAI::OnCreate script
Port From (https://github.com/TrinityCore/TrinityCore/commit/a03455acbbbb6b070c9592a9c5c24c8f109dccc8)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Game.Entities;
|
||||
using Game.Spells;
|
||||
|
||||
namespace Game.AI
|
||||
{
|
||||
@@ -18,7 +19,7 @@ namespace Game.AI
|
||||
public virtual void OnInitialize() { }
|
||||
|
||||
// Called when the AreaTrigger has just been created
|
||||
public virtual void OnCreate() { }
|
||||
public virtual void OnCreate(Spell creatingSpell) { }
|
||||
|
||||
// Called on each AreaTrigger update
|
||||
public virtual void OnUpdate(uint diff) { }
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
bool Create(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, SpellCastVisualField spellVisual, ObjectGuid castId, AuraEffect aurEff)
|
||||
bool Create(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spellInfo, Position pos, int duration, SpellCastVisualField spellVisual, Spell spell, AuraEffect aurEff)
|
||||
{
|
||||
_targetGuid = target ? target.GetGUID() : ObjectGuid.Empty;
|
||||
_aurEff = aurEff;
|
||||
@@ -106,10 +106,11 @@ namespace Game.Entities
|
||||
|
||||
var areaTriggerData = m_values.ModifyValue(m_areaTriggerData);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.Caster), caster.GetGUID());
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.CreatingEffectGUID), castId);
|
||||
if (spell != null)
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.CreatingEffectGUID), spell.m_castId);
|
||||
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellID), spell.Id);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), spell.Id);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellID), spellInfo.Id);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), spellInfo.Id);
|
||||
|
||||
SpellCastVisualField spellCastVisual = areaTriggerData.ModifyValue(m_areaTriggerData.SpellVisual);
|
||||
SetUpdateFieldValue(ref spellCastVisual.SpellXSpellVisualID, spellVisual.SpellXSpellVisualID);
|
||||
@@ -204,15 +205,15 @@ namespace Game.Entities
|
||||
|
||||
caster._RegisterAreaTrigger(this);
|
||||
|
||||
_ai.OnCreate();
|
||||
_ai.OnCreate(spell);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static AreaTrigger CreateAreaTrigger(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, SpellCastVisualField spellVisual, ObjectGuid castId = default, AuraEffect aurEff = null)
|
||||
public static AreaTrigger CreateAreaTrigger(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spellInfo, Position pos, int duration, SpellCastVisualField spellVisual, Spell spell = null, AuraEffect aurEff = null)
|
||||
{
|
||||
AreaTrigger at = new();
|
||||
if (!at.Create(areaTriggerCreatePropertiesId, caster, target, spell, pos, duration, spellVisual, castId, aurEff))
|
||||
if (!at.Create(areaTriggerCreatePropertiesId, caster, target, spellInfo, pos, duration, spellVisual, spell, aurEff))
|
||||
return null;
|
||||
|
||||
return at;
|
||||
@@ -273,7 +274,7 @@ namespace Game.Entities
|
||||
|
||||
AI_Initialize();
|
||||
|
||||
_ai.OnCreate();
|
||||
_ai.OnCreate(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5755,7 +5755,7 @@ namespace Game.Spells
|
||||
|
||||
if (apply)
|
||||
{
|
||||
AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellVisual(), ObjectGuid.Empty, this);
|
||||
AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellVisual(), null, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5027,7 +5027,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
int duration = GetSpellInfo().CalcDuration(GetCaster());
|
||||
AreaTrigger.CreateAreaTrigger((uint)effectInfo.MiscValue, unitCaster, null, GetSpellInfo(), destTarget.GetPosition(), duration, m_SpellVisual, m_castId);
|
||||
AreaTrigger.CreateAreaTrigger((uint)effectInfo.MiscValue, unitCaster, null, GetSpellInfo(), destTarget.GetPosition(), duration, m_SpellVisual, this);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.RemoveTalent)]
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCreate()
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
RefreshPeriod();
|
||||
_refreshTimer = _period;
|
||||
|
||||
@@ -410,7 +410,7 @@ namespace Scripts.Spells.Shaman
|
||||
_period = TimeSpan.FromSeconds(1);
|
||||
}
|
||||
|
||||
public override void OnCreate()
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
|
||||
Reference in New Issue
Block a user