Esempio n. 1
0
		public override void AddAura(Aura aura, bool start)
		{
			base.AddAura(aura, start);
			OnAuraAddedOrRemoved();
			if (aura.Spell.IsPassive)
			{
				if (aura.Spell.HasItemRequirements)
				{
					ItemRestrictedAuras.Add(aura);
				}
				if (aura.Spell.IsModalShapeshiftDependentAura)
				{
					ShapeshiftRestrictedAuras.Add(aura);
				}
				if (aura.Spell.RequiredCasterAuraState != 0)
				{
					AuraStateRestrictedAuras.Add(aura);
				}
			}
			if (aura.Spell.HasAuraDependentEffects)
			{
				AurasWithAuraDependentEffects.Add(aura);
			}

		}
Esempio n. 2
0
		public static AuraRecord ObtainAuraRecord(Aura aura)
		{
			var record = AuraRecordPool.Obtain();
			record.SyncData(aura);

			return record;
		}
Esempio n. 3
0
		public override void AddAura(Aura aura, bool update)
		{
			base.AddAura(aura, update);
			if (aura.Spell.IsPassive && aura.Spell.HasItemRequirements)
			{
				ItemRestrictedAuras.Add(aura);
			}
		}
Esempio n. 4
0
		protected internal override void Cancel(Aura aura)
		{
			base.Cancel(aura);
			if (aura.Spell.IsPassive && aura.Spell.HasItemRequirements)
			{
				ItemRestrictedAuras.Remove(aura);
			}
		}
Esempio n. 5
0
		internal void NotifyAuraRemoved(Aura aura)
		{
			var evt = AuraRemoved;
			if (evt != null)
			{
				evt(aura);
			}
		}
Esempio n. 6
0
 void Start()
 {
     transform.parent = GameObject.Find ("Baddies").transform;
     Aura tempAura = transform.Find ("Aura").GetComponent<Aura>();
     tempAura.owner = gameObject;
     aura = tempAura;
     gameObject.name = "Bear " + Random.Range (0,99999);
 }
Esempio n. 7
0
 protected override void Remove(bool cancelled)
 {
     if (activeToggleAura != null)
     {
         // remove aura
         activeToggleAura.Cancel();
         activeToggleAura = null;
     }
 }
Esempio n. 8
0
	// Use this for initialization
	void Start () {
		if (target == null) {
			moveToPlayer();
		}
		
		aura = Instantiate(auraPrefab).GetComponent<Aura> ();
		aura.gameObject.transform.SetParent (this.transform);
		aura.transform.localPosition = Vector3.zero;

		setMobSizeAndSprite ();
	}
Esempio n. 9
0
		/// <summary>
		/// Called when this Unit got the given debuff by the given SpellCast
		/// </summary>
		/// <param name="cast"></param>
		internal void OnDebuff(SpellCast cast, Aura debuff)
		{
			// force combat mode
			IsInCombat = true;

			var evt = Debuff;
			if (evt != null)
			{
				evt(this, cast, debuff);
			}
		}
Esempio n. 10
0
		public static void SendAuraUpdate(Unit owner, Aura aura)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AURA_UPDATE))
			{
				owner.EntityId.WritePacked(packet);

				WriteAura(aura, packet);

				owner.SendPacketToArea(packet);
			}
		}
Esempio n. 11
0
 public void AddAura(Aura aura)
 {
     foreach (var oldAura in Auras) {
         if (aura.Name == oldAura.Name && aura.Amount == oldAura.Amount) {
             oldAura.Duration = aura.Duration;
             return;
         }
     }
     Auras.Add(aura);
     RecalculateAttribute(aura.Attribute);
 }
Esempio n. 12
0
 void MoveMe(Aura aura)
 {
     movedBy = aura;
     if(attempts < 5){
         Vector3 newPosition = owner.transform.position;
         newPosition.y = Random.Range (-2f, 2f);
         owner.transform.position = newPosition;
         attempts++;
     }else{
         Destroy (owner);
     }
 }
Esempio n. 13
0
		public override void AddAura(Aura aura, bool update)
		{
			base.AddAura(aura, update);
			if (aura.Spell.IsPassive)
			{
				if (aura.Spell.HasItemRequirements)
				{
					ItemRestrictedAuras.Add(aura);
				}
				if (aura.Spell.AllowedShapeshiftMask != 0)
				{
					ShapeshiftRestrictedAuras.Add(aura);
				}
			}
		}
Esempio n. 14
0
		protected internal override void Cancel(Aura aura)
		{
			base.Cancel(aura);
			if (aura.Spell.IsPassive)
			{
				if (aura.Spell.HasItemRequirements)
				{
					ItemRestrictedAuras.Remove(aura);
				}
				if (aura.Spell.AllowedShapeshiftMask != 0)
				{
					ShapeshiftRestrictedAuras.Add(aura);
				}
			}
		}
Esempio n. 15
0
		public override SpellFailedReason CheckValidTarget(WorldObject target)
		{
			if (Effect.Spell.RequiredTargetAuraState == AuraState.RejuvenationOrRegrowth)
			{
				// consume Reju or Regrowth and apply its full effect at once
				toConsume = ((Unit)target).Auras.FindFirst((aura) =>
				{
					return aura.Spell.IsRejuvenationOrRegrowth && toConsume.TimeLeft > 100;
				});
				if (toConsume == null)
				{
					return SpellFailedReason.TargetAurastate;
				}
			}
			return SpellFailedReason.Ok;
		}
Esempio n. 16
0
		public void SyncData(Aura aura)
		{
			OwnerId = aura.Auras.Owner.EntityId.Low;
			CasterId = (long)aura.CasterReference.EntityId.Full;
			Level = aura.Level;
			m_spell = aura.Spell;
			if (aura.HasTimeout)
			{
				MillisLeft = aura.TimeLeft;
			}
			else
			{
				MillisLeft = -1;
			}
			StackCount = aura.StackCount;
			IsBeneficial = aura.IsBeneficial;
		}
Esempio n. 17
0
		public override SpellFailedReason CheckValidTarget(WorldObject target)
		{
			var caster = m_cast.Caster.CasterInfo;
			var auras = m_cast.CasterUnit.Auras;
			foreach (var aura in ((Unit)target).Auras)
			{
				// find a stealable positive auras
				if (aura.IsBeneficial && 
					aura.CanBeStolen && 
					aura.TimeLeft > 100 &&
					auras.GetAura(caster, aura.Id, aura.Spell) == null)
				{
					toSteal = aura;
					return SpellFailedReason.Ok;
				}
			}

			return SpellFailedReason.NothingToSteal;
		}
Esempio n. 18
0
        protected override void Apply()
        {
            // add aura
            // first check, if Aura already exists (eg. because it was loaded from DB)
            if (ToggleAuraSpell == null)
            {
                ToggleAuraSpell = m_spellEffect.TriggerSpell;
            }

            activeToggleAura = Owner.Auras[ToggleAuraSpell];
            if (activeToggleAura == null)
            {
                activeToggleAura = Owner.Auras.CreateAndStartAura(m_aura.CasterReference, ToggleAuraSpell, true);
                activeToggleAura.CanBeSaved = false;
            }
            else
            {
                LogManager.GetCurrentClassLogger().Warn("Tried to toggle on already created Aura \"{0}\" on {1}", activeToggleAura, Owner);
                activeToggleAura.IsActivated = true;
            }
        }
Esempio n. 19
0
        private static void WriteAura(Aura aura, BinaryWriter packet)
        {
            packet.Write(aura.Index);

            packet.Write(aura.Spell.Id);

            packet.Write((byte)aura.Flags);
            packet.Write(aura.Level);
            packet.Write((byte)aura.StackCount);

            // If the target was not the caster
            if (!aura.Flags.HasFlag(AuraFlags.TargetIsCaster))
            {
                aura.CasterReference.EntityId.WritePacked(packet);
            }

            if (aura.Flags.HasFlag(AuraFlags.HasDuration))
            {
                packet.Write(aura.Duration);
                packet.Write(aura.TimeLeft);
            }
        }
Esempio n. 20
0
 public virtual void OnDebuff(Unit caster, SpellCast cast, Aura debuff)
 {
 }
Esempio n. 21
0
 private Heal(Entity target, Entity caster, Aura prototype)
     : base(target, caster, prototype)
 {
 }
Esempio n. 22
0
 public virtual Aura Clone(Entity target, Entity caster, Aura prototpe)
 {
     return null;
 }
Esempio n. 23
0
 public AuraEffectSpellTrigger(Aura aura, AuraEffectInfoSpellTrigger effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
     EffectInfo = effectInfo;
 }
Esempio n. 24
0
 protected AuraEffectPeriodic(Aura aura, AuraEffectInfoPeriodic effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
     EffectInfo = effectInfo;
 }
Esempio n. 25
0
        public static void HandleAuraUpdate(Packet packet)
        {
            PacketAuraUpdate packetAuraUpdate = packet.Holder.AuraUpdate = new();

            packet.ReadBit("UpdateAll");
            var count = packet.ReadBits("AurasCount", 9);

            var auras = new List <Aura>();

            for (var i = 0; i < count; ++i)
            {
                var auraEntry = new PacketAuraUpdateEntry();
                packetAuraUpdate.Updates.Add(auraEntry);
                var aura = new Aura();

                auraEntry.Slot = packet.ReadByte("Slot", i);

                packet.ResetBitReader();
                var hasAura = packet.ReadBit("HasAura", i);
                auraEntry.Remove = !hasAura;
                if (hasAura)
                {
                    packet.ReadPackedGuid128("CastID", i);
                    aura.SpellId = auraEntry.Spell = (uint)packet.ReadInt32 <SpellId>("SpellID", i);
                    ReadSpellCastVisual(packet, i, "Visual");
                    var flags = packet.ReadUInt16E <AuraFlagMoP>("Flags", i);
                    aura.AuraFlags  = flags;
                    auraEntry.Flags = flags.ToUniversal();
                    packet.ReadUInt32("ActiveFlags", i);
                    aura.Level   = packet.ReadUInt16("CastLevel", i);
                    aura.Charges = packet.ReadByte("Applications", i);
                    packet.ReadInt32("ContentTuningID", i);

                    packet.ResetBitReader();

                    var hasCastUnit  = packet.ReadBit("HasCastUnit", i);
                    var hasDuration  = packet.ReadBit("HasDuration", i);
                    var hasRemaining = packet.ReadBit("HasRemaining", i);

                    var hasTimeMod = packet.ReadBit("HasTimeMod", i);

                    var pointsCount = packet.ReadBits("PointsCount", 6, i);
                    var effectCount = packet.ReadBits("EstimatedPoints", 6, i);

                    var hasContentTuning = packet.ReadBit("HasContentTuning", i);

                    if (hasContentTuning)
                    {
                        CombatLogHandler.ReadContentTuningParams(packet, i, "ContentTuning");
                    }

                    if (hasCastUnit)
                    {
                        auraEntry.CasterUnit = packet.ReadPackedGuid128("CastUnit", i);
                    }

                    aura.Duration    = hasDuration ? packet.ReadInt32("Duration", i) : 0;
                    aura.MaxDuration = hasRemaining ? packet.ReadInt32("Remaining", i) : 0;

                    if (hasDuration)
                    {
                        auraEntry.Duration = aura.Duration;
                    }

                    if (hasRemaining)
                    {
                        auraEntry.Remaining = aura.MaxDuration;
                    }

                    if (hasTimeMod)
                    {
                        packet.ReadSingle("TimeMod");
                    }

                    for (var j = 0; j < pointsCount; ++j)
                    {
                        packet.ReadSingle("Points", i, j);
                    }

                    for (var j = 0; j < effectCount; ++j)
                    {
                        packet.ReadSingle("EstimatedPoints", i, j);
                    }

                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
            }

            var guid = packet.ReadPackedGuid128("UnitGUID");

            packetAuraUpdate.Unit = guid;

            if (Storage.Objects.ContainsKey(guid))
            {
                var unit = Storage.Objects[guid].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                    {
                        unit.Auras = auras;
                    }
                    else
                    {
                        unit.AddedAuras.Add(auras);
                    }
                }
            }
        }
Esempio n. 26
0
 public bool SendAttack(Skill origin, Aura source, Actor receiver, Damage damage) => SendPackage(new Attack(origin, source, this)
 {
     Receiver = receiver, Damage = damage
 });
Esempio n. 27
0
        public static void HandleAuraUpdate(Packet packet)
        {
            packet.ReadBit("UpdateAll");
            var count = packet.ReadBits("AurasCount", 9);

            var auras = new List <Aura>();

            for (var i = 0; i < count; ++i)
            {
                var aura = new Aura();

                packet.ReadByte("Slot", i);

                packet.ResetBitReader();
                var hasAura = packet.ReadBit("HasAura", i);
                if (hasAura)
                {
                    packet.ReadPackedGuid128("CastID", i);
                    aura.SpellId = (uint)packet.ReadInt32 <SpellId>("SpellID", i);
                    packet.ReadInt32("SpellXSpellVisualID", i);
                    aura.AuraFlags = packet.ReadByteE <AuraFlagMoP>("Flags", i);
                    packet.ReadInt32("ActiveFlags", i);
                    aura.Level   = packet.ReadUInt16("CastLevel", i);
                    aura.Charges = packet.ReadByte("Applications", i);

                    packet.ResetBitReader();

                    var hasCastUnit  = packet.ReadBit("HasCastUnit", i);
                    var hasDuration  = packet.ReadBit("HasDuration", i);
                    var hasRemaining = packet.ReadBit("HasRemaining", i);

                    var hasTimeMod = packet.ReadBit("HasTimeMod", i);

                    var pointsCount = packet.ReadBits("PointsCount", 6, i);
                    var effectCount = packet.ReadBits("EstimatedPoints", 6, i);

                    var hasSandboxScaling = packet.ReadBit("HasSandboxScaling", i);

                    if (ClientVersion.AddedInVersion(ClientVersionBuild.V7_2_0_23826))
                    {
                        if (hasSandboxScaling)
                        {
                            ReadSandboxScalingData(packet, "SandboxScalingData", i);
                        }
                    }

                    if (hasCastUnit)
                    {
                        packet.ReadPackedGuid128("CastUnit", i);
                    }

                    aura.Duration    = hasDuration ? (int)packet.ReadUInt32("Duration", i) : 0;
                    aura.MaxDuration = hasRemaining ? (int)packet.ReadUInt32("Remaining", i) : 0;

                    if (hasTimeMod)
                    {
                        packet.ReadSingle("TimeMod");
                    }

                    for (var j = 0; j < pointsCount; ++j)
                    {
                        packet.ReadSingle("Points", i, j);
                    }

                    for (var j = 0; j < effectCount; ++j)
                    {
                        packet.ReadSingle("EstimatedPoints", i, j);
                    }

                    if (ClientVersion.RemovedInVersion(ClientVersionBuild.V7_2_0_23826))
                    {
                        if (hasSandboxScaling)
                        {
                            ReadSandboxScalingData(packet, "SandboxScalingData", i);
                        }
                    }

                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
            }

            var guid = packet.ReadPackedGuid128("UnitGUID");

            if (Storage.Objects.ContainsKey(guid))
            {
                var unit = Storage.Objects[guid].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                    {
                        unit.Auras = auras;
                    }
                    else
                    {
                        unit.AddedAuras.Add(auras);
                    }
                }
            }
        }
Esempio n. 28
0
 public AuraEffectModifyStatPercent(Aura aura, AuraEffectInfoModifyStatPercent effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
     EffectInfo = effectInfo;
 }
Esempio n. 29
0
            public override void UpdateAI(uint diff)
            {
                if (!UpdateVictim())
                {
                    return;
                }

                _events.Update(diff);

                if (me.HasUnitState(UnitState.Casting))
                {
                    return;
                }

                _events.ExecuteEvents(eventId =>
                {
                    switch (eventId)
                    {
                    case Misc.EventBoneSpikeGraveyard:
                        if (IsHeroic() || !me.HasAura(Spells.BoneStorm))
                        {
                            DoCast(me, Spells.BoneSpikeGraveyard);
                        }
                        _events.ScheduleEvent(Misc.EventBoneSpikeGraveyard, RandomHelper.URand(15000, 20000), Misc.EventGroupSpecial);
                        break;

                    case Misc.EventColdflame:
                        _coldflameLastPos.Relocate(me);
                        _coldflameTarget.Clear();
                        if (!me.HasAura(Spells.BoneStorm))
                        {
                            DoCastAOE(Spells.ColdflameNormal);
                        }
                        else
                        {
                            DoCast(me, Spells.ColdflameBoneStorm);
                        }
                        _events.ScheduleEvent(Misc.EventColdflame, 5000, Misc.EventGroupSpecial);
                        break;

                    case Misc.EventWarnBoneStorm:
                        _boneSlice = false;
                        Talk(Texts.SayBoneStorm);
                        me.FinishSpell(CurrentSpellTypes.Melee, false);
                        DoCast(me, Spells.BoneStorm);
                        _events.DelayEvents(3000, Misc.EventGroupSpecial);
                        _events.ScheduleEvent(Misc.EventBoneStormBegin, 3050);
                        _events.ScheduleEvent(Misc.EventWarnBoneStorm, RandomHelper.URand(90000, 95000));
                        break;

                    case Misc.EventBoneStormBegin:
                        Aura pStorm = me.GetAura(Spells.BoneStorm);
                        if (pStorm != null)
                        {
                            pStorm.SetDuration((int)_boneStormDuration);
                        }
                        me.SetSpeedRate(UnitMoveType.Run, _baseSpeed * 3.0f);
                        Talk(Texts.SayBoneStorm);
                        _events.ScheduleEvent(Misc.EventBoneStormEnd, _boneStormDuration + 1);
                        goto case Misc.EventBoneStormMove;

                    // no break here
                    case Misc.EventBoneStormMove:
                        {
                            _events.ScheduleEvent(Misc.EventBoneStormMove, _boneStormDuration / 3);
                            Unit unit = SelectTarget(SelectAggroTarget.Random, 0, new NonTankTargetSelector(me));
                            if (!unit)
                            {
                                unit = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
                            }
                            if (unit)
                            {
                                me.GetMotionMaster().MovePoint(Misc.PointTargetBonestormPlayer, unit);
                            }
                            break;
                        }

                    case Misc.EventBoneStormEnd:
                        if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
                        {
                            me.GetMotionMaster().MovementExpired();
                        }
                        me.GetMotionMaster().MoveChase(me.GetVictim());
                        me.SetSpeedRate(UnitMoveType.Run, _baseSpeed);
                        _events.CancelEvent(Misc.EventBoneStormMove);
                        _events.ScheduleEvent(Misc.EventEnableBoneSlice, 10000);
                        if (!IsHeroic())
                        {
                            _events.RescheduleEvent(Misc.EventBoneSpikeGraveyard, 15000, Misc.EventGroupSpecial);
                        }
                        break;

                    case Misc.EventEnableBoneSlice:
                        _boneSlice = true;
                        break;

                    case Misc.EventEnrage:
                        DoCast(me, Texts.SayBerserk, true);
                        Talk(Texts.SayBerserk);
                        break;
                    }
                });

                // We should not melee attack when storming
                if (me.HasAura(Spells.BoneStorm))
                {
                    return;
                }

                // 10 seconds since encounter start Bone Slice replaces melee attacks
                if (_boneSlice && !me.GetCurrentSpell(CurrentSpellTypes.Melee))
                {
                    DoCastVictim(Spells.BoneSlice);
                }

                DoMeleeAttackIfReady();
            }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuraSendMessage"/> class.
 /// </summary>
 /// <param name="aura">The aura.</param>
 public AuraSendMessage(Aura aura)
 {
     this.Aura = aura;
 }
Esempio n. 31
0
        public static async Task <bool> IronJawsOnOffTarget()
        {
            if (Core.Me.ClassLevel < 6) //No Dots at this point
            {
                return(false);
            }

            if (!BardSettings.Instance.EnableMultiDotting)
            {
                return(false);
            }

            //We wont need to IJ when we dont want double DoTs on everything
            if (!BardSettings.Instance.MultiDotVenomousBite || !BardSettings.Instance.MultiDotWindBite)
            {
                return(false);
            }

            if (Core.Me.ClassLevel < 56 || !ActionManager.HasSpell(Spells.IronJaws.Id))
            {
                return(false);
            }

            BattleCharacter multiDotTarget = Combat.Enemies.FirstOrDefault(IsValidIronJawsTarget);

            if (multiDotTarget == null)
            {
                return(false);
            }

            if (!await Spells.IronJaws.Cast(multiDotTarget))
            {
                return(false);
            }

            Logger.WriteInfo($@"[MultiDot] Iron Jaws on {multiDotTarget.Name}");
            return(true);

            bool IsValidIronJawsTarget(BattleCharacter unit)
            {
                if (unit == Core.Me.CurrentTarget)
                {
                    return(false);
                }
                if (!unit.InLineOfSight())
                {
                    return(false);
                }
                if (BardSettings.Instance.DontDotIfMultiDotTargetIsDyingSoon && unit.CombatTimeLeft() <= BardSettings.Instance.DontDotIfMultiDotTargetIsDyingWithinXSeconds)
                {
                    return(false);
                }

                if (!unit.HasAura(Utilities.Routines.Bard.Windbite, true) || !unit.HasAura(Utilities.Routines.Bard.VenomousBite, true))
                {
                    return(false);
                }

                Aura windbite     = unit.Auras.FirstOrDefault(x => x.Id == Utilities.Routines.Bard.Windbite && x.CasterId == Core.Player.ObjectId);
                Aura venomousbite = unit.Auras.FirstOrDefault(x => x.Id == Utilities.Routines.Bard.VenomousBite && x.CasterId == Core.Player.ObjectId);

                if (windbite.TimespanLeft.TotalMilliseconds - Spells.HeavyShot.AdjustedCooldown.TotalMilliseconds > BardSettings.Instance.RefreshDotsWithXmsLeftAfterLastGCD &&
                    venomousbite.TimespanLeft.TotalMilliseconds - Spells.HeavyShot.AdjustedCooldown.TotalMilliseconds > BardSettings.Instance.RefreshDotsWithXmsLeftAfterLastGCD)
                {
                    return(false);
                }

                return(true);
            }
        }
 internal override AuraEffect CreateEffect(Aura aura, Unit caster, int index)
 {
     return(new AuraEffectSharedSpeedChange(aura, this, index, Value));
 }
Esempio n. 33
0
 public Aura SendSpell(Skill origin, Aura source, Actor receiver, Aura prefab) => SendPackage(new Spell(origin, source, this)
 {
     Receiver = receiver, Prefab = prefab
 });
Esempio n. 34
0
		private static void EffectTheEyeOfAcherusRemoved(Aura obj)
		{
			if (obj.Owner is Character)
			{
				var chr = obj.Owner as Character;
				CleanUpEyeOfAcherus(chr);
			}
		}
Esempio n. 35
0
 public AuraRecord(Aura aura)
 {
     this.State    = RecordState.New;
     this.RecordId = AuraRecord.NextId();
     this.SyncData(aura);
 }
Esempio n. 36
0
 private chaosbarrage(Entity target, Entity caster, Aura prototype) : base(target, caster, prototype) { }
Esempio n. 37
0
        void OnPeriodic(AuraEffect aurEff)
        {
            Unit target = GetTarget();

            if (target.HasAura(SpellIds.ExhaustedRam))
            {
                return;
            }

            switch (GetId())
            {
            case SpellIds.RamLevelNeutral:
            {
                Aura aura = target.GetAura(SpellIds.RamFatigue);
                if (aura != null)
                {
                    aura.ModStackAmount(-4);
                }
            }
            break;

            case SpellIds.RamTrot:     // green
            {
                Aura aura = target.GetAura(SpellIds.RamFatigue);
                if (aura != null)
                {
                    aura.ModStackAmount(-2);
                }
                if (aurEff.GetTickNumber() == 4)
                {
                    target.CastSpell(target, QuestIds.BrewfestSpeedBunnyGreen, true);
                }
            }
            break;

            case SpellIds.RamCanter:
            {
                CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
                args.AddSpellMod(SpellValueMod.AuraStack, 1);
                target.CastSpell(target, SpellIds.RamFatigue, args);
                if (aurEff.GetTickNumber() == 8)
                {
                    target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true);
                }
                break;
            }

            case SpellIds.RamGallop:
            {
                CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
                args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
                target.CastSpell(target, SpellIds.RamFatigue, args);
                if (aurEff.GetTickNumber() == 8)
                {
                    target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
                }
                break;
            }

            default:
                break;
            }
        }
 internal override AuraEffect CreateEffect(Aura aura, Unit caster, int index)
 {
     return(new AuraEffectControlVehicle(aura, this, index, Value));
 }
Esempio n. 39
0
 private static bool Equals(Aura a, Aura b)
 {
     // I guess we don't need to check auras
     return(true);
 }
Esempio n. 40
0
 public AuraEffectSharedSpeedChange(Aura aura, AuraEffectInfo effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
 }
Esempio n. 41
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var guid = new byte[8];

            guid[3] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[4] = packet.ReadBit();

            var bits0 = packet.ReadBits(24);

            var bit10 = packet.ReadBit();

            var hasAura        = new bool[bits0];
            var hasCasterGUID  = new bool[bits0];
            var hasMaxDuration = new bool[bits0];
            var hasDuration    = new bool[bits0];
            var bits48         = new uint[bits0];
            var casterGUID     = new byte[bits0][];
            var effectCount    = new uint[bits0];

            for (var i = 0; i < bits0; ++i)
            {
                hasAura[i] = packet.ReadBit();

                if (hasAura[i])
                {
                    effectCount[i] = packet.ReadBits(22);
                    bits48[i]      = packet.ReadBits(22);

                    hasCasterGUID[i] = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 7, 4, 2, 5, 6, 1, 3, 0);
                    }

                    hasMaxDuration[i] = packet.ReadBit();
                    hasDuration[i]    = packet.ReadBit();
                }
            }

            guid[1] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            var auras = new List <Aura>();

            for (var i = 0; i < bits0; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 0, 3, 7, 1, 2, 5, 4, 6);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new WowGuid(BitConverter.ToUInt64(casterGUID[i], 0));
                    }

                    if (hasDuration[i])
                    {
                        aura.Duration = packet.ReadInt32("Duration", i);
                    }
                    else
                    {
                        aura.Duration = 0;
                    }

                    for (var j = 0; j < bits48[i]; ++j)
                    {
                        packet.ReadSingle("Float3", i, j);
                    }

                    for (var j = 0; j < effectCount[i]; ++j)
                    {
                        packet.ReadSingle("Effect Value", i, j);
                    }

                    aura.Level = packet.ReadUInt16("Caster Level", i);

                    if (hasMaxDuration[i])
                    {
                        aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                    }
                    else
                    {
                        aura.MaxDuration = 0;
                    }

                    aura.Charges   = packet.ReadByte("Charges", i);
                    aura.SpellId   = packet.ReadUInt32("Spell Id", i);
                    aura.AuraFlags = packet.ReadEnum <AuraFlagMoP>("Flags", TypeCode.Byte, i);
                    packet.ReadInt32("Effect Mask", i);

                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }

                packet.ReadByte("Slot", i);
            }

            packet.ParseBitStream(guid, 5, 1, 2, 6, 0, 7, 4, 3);

            packet.WriteGuid("Guid", guid);

            var GUID = new WowGuid(BitConverter.ToUInt64(guid, 0));

            if (Storage.Objects.ContainsKey(GUID))
            {
                var unit = Storage.Objects[GUID].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                    {
                        unit.Auras = auras;
                    }
                    else
                    {
                        unit.AddedAuras.Add(auras);
                    }
                }
            }
        }
Esempio n. 42
0
        public Aura GetById(int id)
        {
            Aura aura = AuraList.FirstOrDefault(i => i.AuraId == id);

            return(aura);
        }
Esempio n. 43
0
 public virtual void OnDebuff(Unit caster, SpellCast cast, Aura debuff)
 {
 }
Esempio n. 44
0
        public static void GX_Quality_SetUltraHighQuality()
        {
            Aura mainComponent = SetupAura();

            mainComponent.frustum.SetResolution(ultraHighQualityResolution);
        }
Esempio n. 45
0
    private void UnTrackAura(Aura aura)
    {
        if ((AuraType)aura.Type == AuraType.Buff)
        {
            _buffs.Remove(aura);
            _buffs.Sort
            (
                delegate(Aura aura1, Aura aura2)
                {
                    return ((aura1.TimeRemaining).CompareTo(aura2.TimeRemaining));
                }
            );
        }

        else
        {
            _debuffs.Remove(aura);
            _debuffs.Sort
            (
                delegate(Aura aura1, Aura aura2)
                {
                    return ((aura1.TimeRemaining).CompareTo(aura2.TimeRemaining));
                }
            );
        }
    }
Esempio n. 46
0
        public static void GX_Quality_SetMediumQuality()
        {
            Aura mainComponent = SetupAura();

            mainComponent.frustum.SetResolution(mediumQualityResolution);
        }
Esempio n. 47
0
 /// <summary>
 /// Call this from the aura manager to get a unique copy of this aura from the prototype. Target, caster, and prototype cannot be null."
 /// </summary>
 /// <param name="target">The target of the aura.</param>
 /// <param name="caster">The caster of the aura.</param>
 /// <param name="prototpe">The prototype from which to clone.</param>
 /// <returns></returns>
 public override Aura Clone(Entity target, Entity caster, Aura prototpe)
 {
     return new Heal(target, caster, prototpe);
 }
Esempio n. 48
0
        public static void GX_Quality_SetVeryLowQuality()
        {
            Aura mainComponent = SetupAura();

            mainComponent.frustum.SetResolution(veryLowQualityResolution);
        }
Esempio n. 49
0
		/// <summary>
		/// Called when owner received a debuff by the given caster
		/// </summary>
		/// <param name="caster"></param>
		/// <param name="cast"></param>
		/// <param name="debuff"></param>
		public override void OnDebuff(Unit caster, SpellCast cast, Aura debuff)
		{
			if (!m_IsRunning || caster == null)
				return;

			// TODO: How much threat do debuffs cause?
			if (m_owner is NPC && m_owner.CanBeAggroedBy(caster))
			{
				((NPC)m_owner).ThreatCollection[caster] += 1;
			}
		}
Esempio n. 50
0
 public void SetAura(Aura aura)
 {
     Contract.Assert(_aura == null && aura != null);
     _aura = aura;
 }
Esempio n. 51
0
        public static void SendRemoveAura(Unit owner, Aura aura)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AURA_UPDATE))
            {
                owner.EntityId.WritePacked(packet);
                packet.Write(aura.Index);

                // a spellid of 0 tells the client to remove the aura
                packet.Write(0);

                owner.SendPacketToArea(packet);
            }
        }
Esempio n. 52
0
 public AuraEffectPeriodicHealing(Aura aura, AuraEffectInfoPeriodicHealing effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
     EffectInfo = effectInfo;
 }
Esempio n. 53
0
 public AuraEffectDummy(Aura aura, AuraEffectInfo effectInfo, int index, float value) : base(aura, effectInfo, index, value)
 {
 }
Esempio n. 54
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var guid  = new byte[8];
            var guid2 = new byte[8];

            guid[1] = packet.ReadBit();
            var hasPowerData = packet.ReadBit();

            uint bits3C = 0;

            if (hasPowerData)
            {
                packet.StartBitStream(guid2, 1, 5, 6);
                bits3C = packet.ReadBits(21);
                packet.StartBitStream(guid2, 2, 3, 7, 0, 4);
            }

            var bits4 = packet.ReadBits(24);

            guid[6] = packet.ReadBit();

            var hasAura        = new bool[bits4];
            var hasCasterGUID  = new bool[bits4];
            var hasDuration    = new bool[bits4];
            var hasMaxDuration = new bool[bits4];
            var effectCount    = new uint[bits4];
            var casterGUID     = new byte[bits4][];

            for (var i = 0; i < bits4; ++i)
            {
                hasAura[i] = packet.ReadBit();
                if (hasAura[i])
                {
                    hasMaxDuration[i] = packet.ReadBit();
                    effectCount[i]    = packet.ReadBits(22);
                    hasCasterGUID[i]  = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 5, 7, 4, 1, 6, 0, 3, 2);
                    }
                    hasDuration[i] = packet.ReadBit();
                }
            }
            packet.StartBitStream(guid, 2, 3, 7, 4);
            packet.ReadBit("Is AURA_UPDATE_ALL");
            packet.StartBitStream(guid, 0, 5);
            packet.ResetBitReader();

            var auras = new List <Aura>();

            for (var i = 0; i < bits4; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 2, 7, 6, 1, 4, 0, 5, 3);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new Guid(BitConverter.ToUInt64(casterGUID[i], 0));
                    }
                    else
                    {
                        aura.CasterGuid = new Guid();
                    }

                    aura.Charges = packet.ReadByte("Charges", i);

                    if (hasDuration[i])
                    {
                        aura.Duration = packet.ReadInt32("Duration", i);
                    }
                    else
                    {
                        aura.Duration = 0;
                    }

                    aura.SpellId   = packet.ReadUInt32("Spell Id", i);
                    aura.AuraFlags = packet.ReadEnum <AuraFlagMoP>("Flags", TypeCode.Byte, i);

                    for (var j = 0; j < effectCount[i]; ++j)
                    {
                        packet.ReadSingle("Effect Value", i, j);
                    }
                    packet.ReadInt32("Effect Mask", i);

                    if (hasMaxDuration[i])
                    {
                        aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                    }
                    else
                    {
                        aura.MaxDuration = 0;
                    }

                    aura.Level = packet.ReadUInt16("Caster Level", i);
                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
                packet.ReadByte("Slot", i);
            }

            if (hasPowerData)
            {
                packet.ReadXORBytes(guid2, 7, 0);
                for (var i = 0; i < bits3C; ++i)
                {
                    packet.ReadEnum <PowerType>("Power Type", TypeCode.UInt32, i);
                    packet.ReadInt32("Power Value", i);
                }
                packet.ReadXORBytes(guid2, 2, 5);
                packet.ReadInt32("Attack power");
                packet.ReadInt32("Spell power");
                packet.ReadXORBytes(guid2, 6, 4, 3, 1);
                packet.ReadInt32("Current Health");
                packet.WriteGuid("PowerUnitGUID", guid2);
            }
            packet.ParseBitStream(guid, 0, 5, 7, 2, 1, 4, 3, 6);
            packet.WriteGuid("Guid", guid);

            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));

            if (Storage.Objects.ContainsKey(GUID))
            {
                var unit = Storage.Objects[GUID].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                    {
                        unit.Auras = auras;
                    }
                    else if (unit.AddedAuras == null)
                    {
                        unit.AddedAuras = new List <List <Aura> > {
                            auras
                        }
                    }
                    ;
                    else
                    {
                        unit.AddedAuras.Add(auras);
                    }
                }
            }
        }
Esempio n. 55
0
 /// <summary>
 /// Call this from the aura manager to get a unique copy of this aura from the prototype. Target, caster, and prototype cannot be null."
 /// </summary>
 /// <param name="target">The target of the aura.</param>
 /// <param name="caster">The caster of the aura.</param>
 /// <param name="prototpe">The prototype from which to clone.</param>
 /// <returns></returns>
 public override Aura Clone(Entity target, Entity caster, Aura prototpe)
 {
     return new chaosbarrage(target, caster, prototpe);
 }
Esempio n. 56
0
 internal override AuraEffect CreateEffect(Aura aura, Unit caster, int index)
 {
     return(new AuraEffectAbsorbDamage(aura, this, index, Value));
 }
Esempio n. 57
0
		protected internal void Init(Aura aura)
		{
			m_aura = aura;
		}
Esempio n. 58
0
        public void DuelComplete(DuelCompleteType type)
        {
            // duel not requested
            if (duel == null)
            {
                return;
            }

            // Check if DuelComplete() has been called already up in the stack and in that case don't do anything else here
            if (duel.State == DuelState.Completed)
            {
                return;
            }

            Player opponent = duel.Opponent;

            duel.State          = DuelState.Completed;
            opponent.duel.State = DuelState.Completed;

            Log.outDebug(LogFilter.Player, $"Duel Complete {GetName()} {opponent.GetName()}");

            DuelComplete duelCompleted = new();

            duelCompleted.Started = type != DuelCompleteType.Interrupted;
            SendPacket(duelCompleted);

            if (opponent.GetSession() != null)
            {
                opponent.SendPacket(duelCompleted);
            }

            if (type != DuelCompleteType.Interrupted)
            {
                DuelWinner duelWinner = new();
                duelWinner.BeatenName = (type == DuelCompleteType.Won ? opponent.GetName() : GetName());
                duelWinner.WinnerName = (type == DuelCompleteType.Won ? GetName() : opponent.GetName());
                duelWinner.BeatenVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
                duelWinner.WinnerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
                duelWinner.Fled = type != DuelCompleteType.Won;

                SendMessageToSet(duelWinner, true);
            }

            opponent.DisablePvpRules();
            DisablePvpRules();

            Global.ScriptMgr.OnPlayerDuelEnd(opponent, this, type);

            switch (type)
            {
            case DuelCompleteType.Fled:
                // if initiator and opponent are on the same team
                // or initiator and opponent are not PvP enabled, forcibly stop attacking
                if (GetTeam() == opponent.GetTeam())
                {
                    AttackStop();
                    opponent.AttackStop();
                }
                else
                {
                    if (!IsPvP())
                    {
                        AttackStop();
                    }
                    if (!opponent.IsPvP())
                    {
                        opponent.AttackStop();
                    }
                }
                break;

            case DuelCompleteType.Won:
                UpdateCriteria(CriteriaType.LoseDuel, 1);
                opponent.UpdateCriteria(CriteriaType.WinDuel, 1);

                // Credit for quest Death's Challenge
                if (GetClass() == Class.Deathknight && opponent.GetQuestStatus(12733) == QuestStatus.Incomplete)
                {
                    opponent.CastSpell(duel.Opponent, 52994, true);
                }

                // Honor points after duel (the winner) - ImpConfig
                int amount = WorldConfig.GetIntValue(WorldCfg.HonorAfterDuel);
                if (amount != 0)
                {
                    opponent.RewardHonor(null, 1, amount);
                }

                break;

            default:
                break;
            }

            // Victory emote spell
            if (type != DuelCompleteType.Interrupted)
            {
                opponent.CastSpell(duel.Opponent, 52852, true);
            }

            //Remove Duel Flag object
            GameObject obj = GetMap().GetGameObject(m_playerData.DuelArbiter);

            if (obj)
            {
                duel.Initiator.RemoveGameObject(obj, true);
            }

            //remove auras
            var itsAuras = opponent.GetAppliedAuras();

            foreach (var pair in itsAuras)
            {
                Aura aura = pair.Value.GetBase();
                if (!pair.Value.IsPositive() && aura.GetCasterGUID() == GetGUID() && aura.GetApplyTime() >= duel.StartTime)
                {
                    opponent.RemoveAura(pair);
                }
            }

            var myAuras = GetAppliedAuras();

            foreach (var pair in myAuras)
            {
                Aura aura = pair.Value.GetBase();
                if (!pair.Value.IsPositive() && aura.GetCasterGUID() == opponent.GetGUID() && aura.GetApplyTime() >= duel.StartTime)
                {
                    RemoveAura(pair);
                }
            }

            // cleanup combo points
            ClearComboPoints();
            opponent.ClearComboPoints();

            //cleanups
            SetDuelArbiter(ObjectGuid.Empty);
            SetDuelTeam(0);
            opponent.SetDuelArbiter(ObjectGuid.Empty);
            opponent.SetDuelTeam(0);

            opponent.duel = null;
            duel          = null;
        }
Esempio n. 59
0
 internal override AuraEffect CreateEffect(Aura aura, Unit caster, int index)
 {
     return(new AuraEffectSpellModifier(aura, this, index, Value));
 }
Esempio n. 60
0
 public void SetAura(Aura aura)
 {
     Cypher.Assert(_aura == null && aura != null);
     _aura = aura;
 }