Ejemplo n.º 1
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.MisdirectionProc, new CastSpellExtraArgs(aurEff));
 }
Ejemplo n.º 2
0
 void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     _procTargetGuid = eventInfo.GetProcTarget().GetGUID();
     eventInfo.GetActor().CastSpell(eventInfo.GetActor(), SpellIds.EarthenRagePeriodic, true);
 }
Ejemplo n.º 3
0
 void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.LavaSurge, true);
 }
Ejemplo n.º 4
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     eventInfo.GetActor().CastSpell((Unit)null, SpellIds.ManaSurge, true);
 }
Ejemplo n.º 5
0
 void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().RemoveAurasDueToSpell(SpellIds.Paralysis);
 }
Ejemplo n.º 6
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.MisdirectionProc, true, null, aurEff);
 }
Ejemplo n.º 7
0
 void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.LockAndLoad, true, null, aurEff);
 }
Ejemplo n.º 8
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     eventInfo.GetActionTarget().CastSpell((Unit)null, SpellIds.RunicReturn, true);
 }
Ejemplo n.º 9
0
 void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
 {
     amount = (int)GetUnitOwner().CountPctFromMaxHealth(amount);
 }
Ejemplo n.º 10
0
 void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
 {
     amount = MathFunctions.CalculatePct(maxHealth, absorbPct);
 }
Ejemplo n.º 11
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.NecrosisEffect, true);
 }
Ejemplo n.º 12
0
        bool Create(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, SpellCastVisualField spellVisual, ObjectGuid castId, AuraEffect aurEff)
        {
            _targetGuid = target ? target.GetGUID() : ObjectGuid.Empty;
            _aurEff     = aurEff;

            SetMap(caster.GetMap());
            Relocate(pos);
            if (!IsPositionValid())
            {
                Log.outError(LogFilter.AreaTrigger, $"AreaTrigger (areaTriggerCreatePropertiesId: {areaTriggerCreatePropertiesId}) not created. Invalid coordinates (X: {GetPositionX()} Y: {GetPositionY()})");
                return(false);
            }

            _areaTriggerCreateProperties = Global.AreaTriggerDataStorage.GetAreaTriggerCreateProperties(areaTriggerCreatePropertiesId);
            if (_areaTriggerCreateProperties == null)
            {
                Log.outError(LogFilter.AreaTrigger, $"AreaTrigger (areaTriggerCreatePropertiesId {areaTriggerCreatePropertiesId}) not created. Invalid areatrigger create properties id ({areaTriggerCreatePropertiesId})");
                return(false);
            }

            _areaTriggerTemplate = _areaTriggerCreateProperties.Template;

            _Create(ObjectGuid.Create(HighGuid.AreaTrigger, GetMapId(), GetTemplate() != null ? GetTemplate().Id.Id : 0, caster.GetMap().GenerateLowGuid(HighGuid.AreaTrigger)));

            if (GetTemplate() != null)
            {
                SetEntry(GetTemplate().Id.Id);
            }

            SetDuration(duration);

            SetObjectScale(1.0f);

            _shape           = GetCreateProperties().Shape;
            _maxSearchRadius = GetCreateProperties().GetMaxSearchRadius();

            var areaTriggerData = m_values.ModifyValue(m_areaTriggerData);

            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.Caster), caster.GetGUID());
            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.CreatingEffectGUID), castId);

            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellID), spell.Id);
            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), spell.Id);

            SpellCastVisualField spellCastVisual = areaTriggerData.ModifyValue(m_areaTriggerData.SpellVisual);

            SetUpdateFieldValue(ref spellCastVisual.SpellXSpellVisualID, spellVisual.SpellXSpellVisualID);
            SetUpdateFieldValue(ref spellCastVisual.ScriptVisualID, spellVisual.ScriptVisualID);

            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.TimeToTargetScale), GetCreateProperties().TimeToTargetScale != 0 ? GetCreateProperties().TimeToTargetScale : m_areaTriggerData.Duration);
            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.BoundsRadius2D), GetMaxSearchRadius());
            SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.DecalPropertiesID), GetCreateProperties().DecalPropertiesId);

            ScaleCurve extraScaleCurve = areaTriggerData.ModifyValue(m_areaTriggerData.ExtraScaleCurve);

            if (GetCreateProperties().ExtraScale.Structured.StartTimeOffset != 0)
            {
                SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.StartTimeOffset), GetCreateProperties().ExtraScale.Structured.StartTimeOffset);
            }
            if (GetCreateProperties().ExtraScale.Structured.X != 0 || GetCreateProperties().ExtraScale.Structured.Y != 0)
            {
                Vector2 point = new(GetCreateProperties().ExtraScale.Structured.X, GetCreateProperties().ExtraScale.Structured.Y);
                SetUpdateFieldValue(ref extraScaleCurve.ModifyValue(extraScaleCurve.Points, 0), point);
            }
            if (GetCreateProperties().ExtraScale.Structured.Z != 0 || GetCreateProperties().ExtraScale.Structured.W != 0)
            {
                Vector2 point = new(GetCreateProperties().ExtraScale.Structured.Z, GetCreateProperties().ExtraScale.Structured.W);
                SetUpdateFieldValue(ref extraScaleCurve.ModifyValue(extraScaleCurve.Points, 1), point);
            }
            unsafe
            {
                if (GetCreateProperties().ExtraScale.Raw.Data[5] != 0)
                {
                    SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.ParameterCurve), GetCreateProperties().ExtraScale.Raw.Data[5]);
                }
                if (GetCreateProperties().ExtraScale.Structured.OverrideActive != 0)
                {
                    SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), GetCreateProperties().ExtraScale.Structured.OverrideActive != 0);
                }
            }

            VisualAnim visualAnim = areaTriggerData.ModifyValue(m_areaTriggerData.VisualAnim);

            SetUpdateFieldValue(visualAnim.ModifyValue(visualAnim.AnimationDataID), GetCreateProperties().AnimId);
            SetUpdateFieldValue(visualAnim.ModifyValue(visualAnim.AnimKitID), GetCreateProperties().AnimKitId);
            if (GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.Unk3))
            {
                SetUpdateFieldValue(visualAnim.ModifyValue(visualAnim.Field_C), true);
            }

            PhasingHandler.InheritPhaseShift(this, caster);

            if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
            {
                m_movementInfo.transport.guid = target.GetGUID();
            }

            UpdateShape();

            uint timeToTarget = GetCreateProperties().TimeToTarget != 0 ? GetCreateProperties().TimeToTarget : m_areaTriggerData.Duration;

            if (GetCreateProperties().OrbitInfo.HasValue)
            {
                AreaTriggerOrbitInfo orbit = GetCreateProperties().OrbitInfo.Value;
                if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
                {
                    orbit.PathTarget.Set(target.GetGUID());
                }
                else
                {
                    orbit.Center.Set(new Vector3(pos.posX, pos.posY, pos.posZ));
                }

                InitOrbit(orbit, timeToTarget);
            }
            else if (GetCreateProperties().HasSplines())
            {
                InitSplineOffsets(GetCreateProperties().SplinePoints, timeToTarget);
            }

            // movement on transport of areatriggers on unit is handled by themself
            Transport transport = m_movementInfo.transport.guid.IsEmpty() ? caster.GetTransport() : null;

            if (transport)
            {
                float x, y, z, o;
                pos.GetPosition(out x, out y, out z, out o);
                transport.CalculatePassengerOffset(ref x, ref y, ref z, ref o);
                m_movementInfo.transport.pos.Relocate(x, y, z, o);

                // This object must be added to transport before adding to map for the client to properly display it
                transport.AddPassenger(this);
            }

            AI_Initialize();

            // Relocate areatriggers with circular movement again
            if (HasOrbit())
            {
                Relocate(CalculateOrbitPosition());
            }

            if (!GetMap().AddToMap(this))
            {         // Returning false will cause the object to be deleted - remove from transport
                if (transport)
                {
                    transport.RemovePassenger(this);
                }
                return(false);
            }

            caster._RegisterAreaTrigger(this);

            _ai.OnCreate();

            return(true);
        }
Ejemplo n.º 13
0
        public static AreaTrigger CreateAreaTrigger(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, SpellCastVisualField spellVisual, ObjectGuid castId = default, AuraEffect aurEff = null)
        {
            AreaTrigger at = new();

            if (!at.Create(areaTriggerCreatePropertiesId, caster, target, spell, pos, duration, spellVisual, castId, aurEff))
            {
                return(null);
            }

            return(at);
        }
Ejemplo n.º 14
0
 void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().GetThreatManager().UnregisterRedirectThreat(SpellIds.Misdirection);
 }
Ejemplo n.º 15
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.Exhilaration, -TimeSpan.FromSeconds(aurEff.GetAmount()));
     GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.ExhilarationPet, -TimeSpan.FromSeconds(aurEff.GetAmount()));
 }
Ejemplo n.º 16
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(_procTarget, SpellIds.FocusMagicProc, true, null, aurEff);
 }
Ejemplo n.º 17
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.ImprovedMendPet, true, null, aurEff);
 }
Ejemplo n.º 18
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
 }
Ejemplo n.º 19
0
 void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().ResetRedirectThreat();
 }
Ejemplo n.º 20
0
 void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     GetTarget().GetSpellHistory().ResetCooldown(SpellIds.AvengersShield, true);
 }
Ejemplo n.º 21
0
 void SuppressWarning(AuraEffect aurEff, ProcEventInfo procInfo)
 {
     PreventDefaultAction();
 }
Ejemplo n.º 22
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.ItemHealingTrance, true, null, aurEff);
 }
Ejemplo n.º 23
0
 void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().RemoveVehicleKit();
 }
Ejemplo n.º 24
0
 void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().CastSpell(GetTarget(), SpellIds.AuraMasteryImmune, true);
 }
Ejemplo n.º 25
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            GetTarget().CastSpell(GetTarget(), SpellIds.EarthShieldHeal, true, null, aurEff, GetCasterGUID());
        }
Ejemplo n.º 26
0
 void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
 {
     GetTarget().RemoveOwnedAura(SpellIds.AuraMasteryImmune, GetCasterGUID());
 }
Ejemplo n.º 27
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(GetTarget(), SpellIds.ItemLightningShieldDamage, true, null, aurEff);
 }
Ejemplo n.º 28
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     GetTarget().CastSpell(eventInfo.GetActor(), SpellIds.CracklingJadeLightningKnockback, TriggerCastFlags.FullMask);
     GetTarget().CastSpell(GetTarget(), SpellIds.CracklingJadeLightningKnockbackCd, TriggerCastFlags.FullMask);
 }
Ejemplo n.º 29
0
 void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     PreventDefaultAction();
     GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.RetaliationDamage, true, null, aurEff);
 }
Ejemplo n.º 30
0
 void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     _damagePerSecond[0] += eventInfo.GetDamageInfo().GetDamage();
 }