Exemplo n.º 1
0
        /// <summary>
        /// Lets this Pet cast the given spell
        /// </summary>
        public void CastPetSpell(SpellId spellId, WorldObject target)
        {
            var spell = NPCSpells.GetReadySpell(spellId);
            SpellFailedReason err;

            if (spell != null)
            {
                if (spell.HasTargets)
                {
                    Target = m_master.Target;
                }

                err = spell.CheckCasterConstraints(this);
                if (err == SpellFailedReason.Ok)
                {
                    err = SpellCast.Start(spell, false, target != null ? new[] { target } : null);
                }
            }
            else
            {
                err = SpellFailedReason.NotReady;
            }

            if (err != SpellFailedReason.Ok && m_master is IPacketReceiver)
            {
                PetHandler.SendCastFailed((IPacketReceiver)m_master, spellId, err);
            }
        }
Exemplo n.º 2
0
        private static void BuildSpells()
        {
            for (var i = 0; i < spells.Count; i++)
            {
                Table[i] = new SpellId[NumLevels];
            }

            for (var i = 0; i < spells.Count; i++)
            {
                var spell = spells[i];

                var spellLevels = SpellLevelProgression.GetSpellLevels(spell);

                if (spellLevels == null)
                {
                    log.Error($"ArmorCantrips - couldn't find {spell}");
                    continue;
                }

                if (spellLevels.Count != NumLevels)
                {
                    log.Error($"ArmorCantrips - expected {NumLevels} levels for {spell}, found {spellLevels.Count}");
                    continue;
                }

                for (var j = 0; j < NumLevels; j++)
                {
                    Table[i][j] = spellLevels[j];
                }
            }
        }
Exemplo n.º 3
0
            public override SkillAbility ConvertTo(byte[] rawData, ref int id)
            {
                SkillAbility ability = new SkillAbility();
                int          field   = 0;

                id            = (int)(ability.AbilityId = GetUInt32(rawData, field++));
                ability.Skill = ById[GetUInt32(rawData, field++)];
                SpellId spellId = (SpellId)GetUInt32(rawData, field++);

                if (spellId > SpellId.None)
                {
                    Spell spell = SpellHandler.Get(spellId);
                    if (spell != null)
                    {
                        ability.Spell = spell;
                    }
                }

                ability.RaceMask  = (RaceMask)GetUInt32(rawData, field++);
                ability.ClassMask = (ClassMask)GetUInt32(rawData, field++);
                GetUInt32(rawData, field++);
                GetUInt32(rawData, field++);
                GetInt32(rawData, field++);
                ability.NextSpellId   = (SpellId)GetUInt32(rawData, field++);
                ability.AcquireMethod = (SkillAcquireMethod)GetInt32(rawData, field++);
                ability.GreyValue     = GetUInt32(rawData, field++);
                ability.YellowValue   = GetUInt32(rawData, field);
                uint num2 = ability.GreyValue - ability.YellowValue;
                int  num3 = (int)(ability.YellowValue - (num2 / 2));

                ability.RedValue     = (num3 < 0) ? 0 : ((uint)num3);
                ability.GreenValue   = ability.YellowValue + (num2 / 2);
                ability.CanGainSkill = ability.GreenValue > 0;
                return(ability);
            }
        private static SpellId AdjustForWeaponMastery(WorldObject wo, SpellId spell)
        {
            // handle two-handed weapons
            if (wo.WeaponSkill == Skill.TwoHandedCombat)
            {
                return(SpellId.CANTRIPTWOHANDEDAPTITUDE1);
            }

            // 10% chance to adjust to dual wielding
            var rng = ThreadSafeRandom.Next(0.0f, 1.0f);

            if (rng < 0.1f)
            {
                return(SpellId.CantripDualWieldAptitude1);
            }

            // heavy/light/finesse weapons
            switch (wo.WeaponSkill)
            {
            case Skill.HeavyWeapons:
                return(SpellId.CANTRIPHEAVYWEAPONSAPTITUDE1);

            case Skill.LightWeapons:
                return(SpellId.CANTRIPLIGHTWEAPONSAPTITUDE1);

            case Skill.FinesseWeapons:
                return(SpellId.CANTRIPFINESSEWEAPONSAPTITUDE1);
            }
            return(spell);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds the spell without doing any further checks nor adding any spell-related skills or showing animations (after load)
        /// </summary>
        internal void OnlyAdd(SpellRecord record)
        {
            SpellId spellId = record.SpellId;
            Spell   spell   = SpellHandler.Get(spellId);

            this.m_byId[spellId] = spell;
        }
Exemplo n.º 6
0
 public static void SendMagicDamage(WorldObject victim, IEntity attacker, SpellId spell, uint damage,
                                    uint overkill, DamageSchoolMask schools, uint absorbed, uint resisted, uint blocked, bool unkBool,
                                    SpellLogFlags flags)
 {
     using (RealmPacketOut packet =
                new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40))
     {
         victim.EntityId.WritePacked((BinaryWriter)packet);
         if (attacker != null)
         {
             attacker.EntityId.WritePacked((BinaryWriter)packet);
         }
         else
         {
             packet.Write((byte)0);
         }
         packet.Write((uint)spell);
         packet.Write(damage);
         packet.Write(overkill);
         packet.Write((byte)schools);
         packet.Write(absorbed);
         packet.Write(resisted);
         packet.Write(0);
         packet.Write(unkBool);
         packet.Write(blocked);
         packet.Write((uint)flags);
         packet.Write((byte)0);
         victim.SendPacketToArea(packet, true, false, Locale.Any, new float?());
     }
 }
Exemplo n.º 7
0
        public static void BuySpell(this NPC trainer, Character chr, SpellId spellEntryId)
        {
            if (!trainer.CheckTrainerCanTrain(chr))
            {
                return;
            }
            TrainerSpellEntry spellEntry = trainer.TrainerEntry.GetSpellEntry(spellEntryId);

            if (spellEntry == null || !trainer.CheckBuySpellConditions(chr, spellEntry))
            {
                return;
            }
            chr.SubtractMoney(spellEntry.GetDiscountedCost(chr, trainer));
            WCell.RealmServer.Handlers.NPCHandler.SendTrainerBuySucceeded((IPacketReceiver)chr.Client, trainer,
                                                                          spellEntry);
            SpellHandler.SendVisual((WorldObject)trainer, 179U);
            if (spellEntry.Spell.IsTeachSpell)
            {
                trainer.SpellCast.Trigger(spellEntry.Spell, new WorldObject[1]
                {
                    (WorldObject)chr
                });
            }
            else if (chr.PowerType == PowerType.Mana || spellEntry.Spell.PreviousRank == null)
            {
                chr.Spells.AddSpell(spellEntry.Spell);
                trainer.TalkToTrainer(chr);
            }
            else
            {
                chr.Spells.Replace(spellEntry.Spell.PreviousRank, spellEntry.Spell);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds the spell without doing any further checks or adding any spell-related skills or showing animations
        /// </summary>
        public void OnlyAdd(SpellId id)
        {
            var spell = SpellHandler.ById.Get((uint)id);

            m_byId.Add(id, spell);
            m_byRealId.Add(spell.RealId, spell);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns the TrainerSpellEntry from SpellsForSale with the given spellId, else null.
        /// </summary>
        public TrainerSpellEntry GetSpellEntry(SpellId spellId)
        {
            TrainerSpellEntry trainerSpellEntry;

            Spells.TryGetValue(spellId, out trainerSpellEntry);
            return(trainerSpellEntry);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Adds the spell without doing any further checks or adding any spell-related skills or showing animations
        /// </summary>
        public void OnlyAdd(SpellId id)
        {
            Spell spell = SpellHandler.ById.Get <Spell>((uint)id);

            this.m_byId.Add(id, spell);
            this.m_byRealId.Add(spell.RealId, spell);
        }
Exemplo n.º 11
0
		static void FixTameSpell(SpellId id, SpellId triggerId)
		{
			// add a spell-trigger
			var spell = SpellHandler.Get(id);
			var effect = spell.AddTriggerSpellEffect(triggerId, ImplicitSpellTargetType.SingleEnemy);
			effect.Amplitude = spell.Durations.Min;
		}
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlayerLevel != 0)
            {
                hash ^= PlayerLevel.GetHashCode();
            }
            if (EncounterId.Length != 0)
            {
                hash ^= EncounterId.GetHashCode();
            }
            if (SpellId.Length != 0)
            {
                hash ^= SpellId.GetHashCode();
            }
            if (Outcome != 0)
            {
                hash ^= Outcome.GetHashCode();
            }
            if (CheckpointFailRound != 0)
            {
                hash ^= CheckpointFailRound.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 13
0
        private static void BuildSpells(List <SpellId> spells, SpellId[][] matrix)
        {
            for (var i = 0; i < NumTiers; i++)
            {
                matrix[i] = new SpellId[spells.Count];
            }

            for (var i = 0; i < spells.Count; i++)
            {
                var spell = spells[i];

                var spellLevels = SpellLevelProgression.GetSpellLevels(spell);

                if (spellLevels == null)
                {
                    log.Error($"GemSpells - couldn't find {spell}");
                    continue;
                }

                if (spellLevels.Count != NumTiers)
                {
                    log.Error($"GemSpells - expected {NumTiers} levels for {spell}, found {spellLevels.Count}");
                    continue;
                }

                for (var j = 0; j < NumTiers; j++)
                {
                    matrix[j][i] = spellLevels[j];
                }
            }
        }
Exemplo n.º 14
0
        public static void SendMagicDamage(WorldObject victim, IEntity attacker,
                                           SpellId spell, uint damage, uint overkill, DamageSchoolMask schools,
                                           uint absorbed, uint resisted, uint blocked,
                                           bool unkBool, SpellLogFlags flags)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40))
            {
                victim.EntityId.WritePacked(packet);
                if (attacker != null)
                {
                    attacker.EntityId.WritePacked(packet);
                }
                else
                {
                    packet.Write((byte)0);
                }
                packet.Write((uint)spell);

                packet.Write(damage);
                packet.Write(overkill);
                packet.Write((byte)schools);
                packet.Write(absorbed);
                packet.Write(resisted);
                packet.Write(0);                                        // apparently always 0
                packet.Write(unkBool);                                  // 0 or 1
                packet.Write(blocked);
                // also flags 0x8, 0x10,
                packet.Write((uint)flags);
                packet.Write((byte)0);                // unused by client

                victim.SendPacketToArea(packet, true, false);
            }
        }
Exemplo n.º 15
0
		static void AddProcTrigger(SpellId id, SpellId triggerId)
		{
			SpellHandler.Apply(spell =>
			{
				var effect = spell.AddAuraEffect(AuraType.ProcTriggerSpell, ImplicitSpellTargetType.Self);
				effect.TriggerSpellId = triggerId;
			},id);
		}
Exemplo n.º 16
0
 public SpellRecord(SpellId id, uint ownerId, int specIndex)
 {
     this.SpellId   = id;
     this.OwnerId   = ownerId;
     this.SpecIndex = specIndex;
     this.RecordId  = SpellRecord.NextId();
     this.State     = RecordState.New;
 }
Exemplo n.º 17
0
 public static void SendPetLearnedSpell(IPacketReceiver receiver, SpellId spellId)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_LEARNED_SPELL, 4))
     {
         packet.Write((uint)spellId);
         receiver.Send(packet, false);
     }
 }
Exemplo n.º 18
0
 public SpellRecord(SpellId id, uint ownerId, int specIndex)
 {
     SpellId   = id;
     OwnerId   = ownerId;
     SpecIndex = specIndex;
     RecordId  = NextId();
     State     = RecordState.New;
 }
Exemplo n.º 19
0
        static void FixTameSpell(SpellId id, SpellId triggerId)
        {
            // add a spell-trigger
            var spell  = SpellHandler.Get(id);
            var effect = spell.AddTriggerSpellEffect(triggerId, ImplicitSpellTargetType.SingleEnemy);

            effect.Amplitude = spell.Durations.Min;
        }
Exemplo n.º 20
0
 public MountSpellHandler(SpellCast cast, SpellEffect effect, SpellId apprenticeRidingSkill, SpellId journeymanRidingSkill, SpellId expertRidingSkill, SpellId artisanRidingSkill)
     : base(cast, effect)
 {
     _apprenticeRidingSpell = apprenticeRidingSkill;
     _journeymanRidingSpell = journeymanRidingSkill;
     _expertRidingSpell     = expertRidingSkill;
     _artisanRidingSpell    = artisanRidingSkill;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Returns the spell with the given spellId or null if it doesn't exist
 /// </summary>
 public static Spell Get(SpellId spellId)
 {
     if ((uint)spellId >= ById.Length)
     {
         return(null);
     }
     return(ById[(uint)spellId]);
 }
Exemplo n.º 22
0
 static void AddProcTrigger(SpellId id, SpellId triggerId)
 {
     SpellHandler.Apply(spell =>
     {
         var effect            = spell.AddAuraEffect(AuraType.ProcTriggerSpell, ImplicitSpellTargetType.Self);
         effect.TriggerSpellId = triggerId;
     }, id);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Teaches a new spell to the unit. Also sends the spell learning animation, if applicable.
 /// </summary>
 public void AddSpell(SpellId spellId)
 {
     if (this.Contains(spellId))
     {
         return;
     }
     this.AddSpell(SpellHandler.Get(spellId));
 }
Exemplo n.º 24
0
 public Spell this[SpellId id]
 {
     get
     {
         Spell spell;
         this.m_byId.TryGetValue(id, out spell);
         return(spell);
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// Only works if you have 2 valid spell ids and oldSpellId already exists.
        /// </summary>
        public void Replace(SpellId oldSpellId, SpellId newSpellId)
        {
            Spell oldSpell, newSpell = SpellHandler.Get(newSpellId);

            if (m_byId.TryGetValue(oldSpellId, out oldSpell))
            {
                Replace(oldSpell, newSpell);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Adds a Spell that will be used by all NPCs of this Entry
        /// </summary>
        public void AddSpell(SpellId spellId)
        {
            var spell = SpellHandler.Get(spellId);

            if (spell != null)
            {
                AddSpell(spell);
            }
        }
Exemplo n.º 27
0
        public bool Remove(SpellId id)
        {
            Spell spell = SpellHandler.Get(id);

            if (spell != null)
            {
                return(this.Remove(spell));
            }
            return(false);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Teaches a new spell to the unit. Also sends the spell learning animation, if applicable.
        /// </summary>
        public void AddSpell(SpellId spellId)
        {
            if (Contains(spellId))
            {
                return;
            }
            var spell = SpellHandler.Get(spellId);

            AddSpell(spell);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Adds a Spell that will be used by all NPCs of this Entry
        /// </summary>
        public void AddSpell(SpellId spellId)
        {
            Spell spell = SpellHandler.Get(spellId);

            if (spell == null)
            {
                return;
            }
            this.AddSpell(spell);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Forces the client to start or update a cooldown timer on the given single spell
        /// (mostly important for certain talents and item spells that don't automatically start cooling down)
        /// </summary>
        public static void SendCooldownUpdate(Character chr, SpellId spellId)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_COOLDOWN_EVENT, 12))
            {
                packet.WriteUInt((uint)spellId);
                chr.EntityId.WritePacked(packet);

                chr.Send(packet, addEnd: false);
            }
        }
Exemplo n.º 31
0
 public static void SendCastFailed(IPacketReceiver receiver, SpellId spellId, SpellFailedReason reason)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_CAST_FAILED, 8))
     {
         packet.Write(0);
         packet.Write((uint)spellId);
         packet.Write((byte)reason);
         receiver.Send(packet, false);
     }
 }
Exemplo n.º 32
0
		public Spell GetReadySpell(SpellId spellId)
		{
			foreach (var spell in m_readySpells)
			{
				if (spell.SpellId == spellId)
				{
					return spell;
				}
			}
			return null;
		}
Exemplo n.º 33
0
 public Spell GetReadySpell(SpellId spellId)
 {
     foreach (var spell in m_readySpells)
     {
         if (spell.SpellId == spellId)
         {
             return(spell);
         }
     }
     return(null);
 }
Exemplo n.º 34
0
		public Spell GetReadySpell(SpellId spellId)
		{
			for (int i = 0; i < m_readySpells.Count; i++)
			{
				var spell = m_readySpells[i];
				if (spell.SpellId == spellId)
				{
					return spell;
				}
			}
			return null;
		}
Exemplo n.º 35
0
		static void FixTameSpell(SpellId id, SpellId triggerId)
		{
			// convert the Dummy aura into a spell-trigger
			var spell = SpellHandler.Get(id);
			var effect = spell.GetEffect(SpellEffectType.ApplyAura);
			effect.AuraType = AuraType.None;
			effect.EffectType = SpellEffectType.TriggerSpell;
			//spell.Durations.Min = 200;
			//spell.Durations.Max = 200;
			effect.Amplitude = spell.Durations.Min;
			effect.TriggerSpellId = triggerId;
		}
Exemplo n.º 36
0
		public void AddAura(SpellId spellId)
		{
			var spell = SpellHandler.Get(spellId);
			if (spell == null)
			{
				LogManager.GetCurrentClassLogger().Warn("Tried to add invalid Aura-Spell \"{0}\" to NPCEntry: {1}", spellId, this);
			}
			else
			{
				Auras.Add(spell);
			}
		}
Exemplo n.º 37
0
		/// <summary>
		/// Correct 3.0.9
		/// </summary>
		public static void SendSpellMiss(SpellId spell, WorldObject caster, bool doIt, ICollection<CastMiss> missedTargets)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLLOGMISS, 34))
			{
				packet.Write((uint)spell);
				packet.Write(caster.EntityId);
				packet.Write(doIt);// TODO: test this value. Its a bool that seems to determine whether to display this packet in the combat log
				packet.Write(missedTargets.Count);
				foreach (var miss in missedTargets)
				{
					packet.Write(miss.Target.EntityId);
					packet.Write((byte)miss.Reason);
				}
				caster.SendPacketToArea(packet);
			}
		}
Exemplo n.º 38
0
		public DynamicObject(Unit creator, SpellId spellId, float radius, Region region, Vector3 pos)
		{
			if (creator == null)
				throw new ArgumentNullException("creator", "creator must not be null");

			Master = m_creator = creator;
			EntityId = EntityId.GetDynamicObjectId(++lastId);
			Type |= ObjectTypes.DynamicObject;
			SetEntityId(DynamicObjectFields.CASTER, Caster.EntityId);
			SpellId = spellId;
			Radius = radius;
			Bytes = 0x01EEEEEE;
			ScaleX = 1;

			m_position = pos;
			region.AddObjectLater(this);
		}
Exemplo n.º 39
0
#pragma warning restore 0649

		#endregion

		protected WSGFaction(WarsongGulch instance,
			SpellId flagSpell,
			SpellId flagDropSpell,
			SpellId flagDropDebuff,
			SpellId flagCarrierDebuffSpellId,
			GOEntryId flagStand,
			GOEntryId flagDropId)
		{
			Instance = instance;
			_flagSpell = SpellHandler.Get(flagSpell);
			_flagDropSpell = SpellHandler.Get(flagDropSpell);
			_flagDropDebuff = SpellHandler.Get(flagDropDebuff);
			_flagCarrierDebuffSpell = SpellHandler.Get(flagCarrierDebuffSpellId);
			FlagStandEntry = GOMgr.GetEntry(flagStand);
			DroppedFlagEntry = GOMgr.GetEntry(flagDropId);

			_flagRespawn = WarsongGulch.FlagRespawnTime;
			Score = 0;
		}
Exemplo n.º 40
0
		static void HandleTrainerList(PacketParser parser)
		{
			var spells = parser.ParsedPacket["Spells"].List;
			foreach (var spellSegment in spells)
			{
				var id = (SpellId)spellSegment["Spell"].UIntValue;
				var moneyCost = spellSegment["MoneyCost"].IntValue;
				var talentCost = spellSegment["TalentCost"].IntValue;
				var profCost = spellSegment["ProfessionPointCost"].IntValue;
				int reqLevel = spellSegment["RequiredLevel"].ByteValue;
				var reqSkill = (SkillId)spellSegment["RequiredSkill"].UIntValue;
				var reqSkillValue = spellSegment["RequiredSkillLevel"].IntValue;
				var reqSpells = new SpellId[3];

				reqSpells[0] = (SpellId)spellSegment["RequiredSpellId1"].UIntValue;
				reqSpells[1] = (SpellId)spellSegment["RequiredSpellId2"].UIntValue;
				reqSpells[2] = (SpellId)spellSegment["RequiredSpellId3"].UIntValue;

				// TODO: Calc exact money cost, depending on the faction
			}
		}
Exemplo n.º 41
0
		private static void FixFeralSwiftness(SpellId origSpell, SpellId triggerSpell)
		{
			// Feral Swiftness should only be applied in Cat Form
			SpellHandler.Apply(spell =>
			{
				// only as cat
				// triggers the dodge effect spell
				spell.AllowedShapeshiftMask = ShapeshiftMask.Cat;
				spell.AddTriggerSpellEffect(triggerSpell);
			},
			origSpell);
			SpellHandler.Apply(spell =>
			{
				// this spell applies the dodge bonus for Feral Swiftness
				// "increases your chance to dodge while in Cat Form, Bear Form and Dire Bear Form"
				// must be passive
				spell.Attributes |= SpellAttributes.Passive;
				spell.AllowedShapeshiftMask = ShapeshiftMask.Cat | ShapeshiftMask.Bear | ShapeshiftMask.DireBear;
			},
			triggerSpell);
		}
Exemplo n.º 42
0
		/// <summary>
		/// Adds a SpellEffect that will trigger the given Spell on the given type of target
		/// </summary>
		public SpellEffect AddPeriodicTriggerSpellEffect(SpellId triggerSpell, ImplicitTargetType targetType)
		{
			var effect = AddAuraEffect(AuraType.PeriodicTriggerSpell);
			effect.TriggerSpellId = triggerSpell;
			effect.ImplicitTargetA = targetType;
			return effect;
		}
Exemplo n.º 43
0
		/// <summary>
		/// Adds a SpellEffect that will trigger the given Spell on oneself
		/// </summary>
		public SpellEffect AddPeriodicTriggerSpellEffect(SpellId triggerSpell)
		{
			return AddPeriodicTriggerSpellEffect(triggerSpell, ImplicitTargetType.Self);
		}
Exemplo n.º 44
0
		/// <summary>
		/// Adds a SpellEffect that will trigger the given Spell on the given type of target
		/// </summary>
		public SpellEffect AddTriggerSpellEffect(SpellId triggerSpell, ImplicitTargetType targetType)
		{
			var effect = AddEffect(SpellEffectType.TriggerSpell);
			effect.TriggerSpellId = triggerSpell;
			effect.ImplicitTargetA = targetType;
			return effect;
		}
Exemplo n.º 45
0
		/// <summary>
		/// Teaches a new spell to the unit. Also sends the spell learning animation, if applicable.
		/// </summary>
		public void AddSpell(SpellId spellId)
		{
			var spell = SpellHandler.Get(spellId);
			AddSpell(spell);
		}
Exemplo n.º 46
0
		/// <summary>
		/// Only works if you have 2 valid spell ids and oldSpellId already exists.
		/// </summary>
		public void Replace(SpellId oldSpellId, SpellId newSpellId)
		{
			Spell oldSpell, newSpell = SpellHandler.Get(newSpellId);
			if (m_byId.TryGetValue((uint)oldSpellId, out oldSpell))
			{
				Replace(oldSpell, newSpell);
			}
		}
Exemplo n.º 47
0
		public void Remove(SpellId spellId)
		{
			Replace(SpellHandler.Get(spellId), null);
		}
Exemplo n.º 48
0
		public Spell this[SpellId id]
		{
			get
			{
				Spell spell;
				m_byId.TryGetValue((uint)id, out spell);
				return spell;
			}
		}
Exemplo n.º 49
0
		public bool Contains(SpellId id)
		{
			return m_byId.ContainsKey((uint)id);
		}
Exemplo n.º 50
0
		/// <summary>
		/// Clears a single spell's cooldown
		/// </summary>
		public static void SendClearCoolDown(Character chr, SpellId spellId)
		{
			IRealmClient client = chr.Client;

			if (client != null)
			{
				using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CLEAR_COOLDOWN, 12))
				{
					packet.WriteUInt((uint)spellId);
					chr.EntityId.WritePacked(packet);

					client.Send(packet);
				}
			}
		}
Exemplo n.º 51
0
 public ToggleAuraHandler(SpellId auraId)
 {
     ToggleAuraSpell = SpellHandler.Get(auraId);
 }
Exemplo n.º 52
0
		public static void SendImpact(WorldObject target, SpellId id)
		{
			var spell = Get(id);
			SendImpact(target, spell.Visual);
		}
Exemplo n.º 53
0
		public static void SendPetLearnedSpell(IPacketReceiver receiver, SpellId spellId)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_LEARNED_SPELL, 4))
			{
				packet.Write((uint)spellId);

				receiver.Send(packet);
			}
		}
Exemplo n.º 54
0
		public static void SendCastFailed(IPacketReceiver receiver, SpellId spellId, SpellFailedReason reason)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_CAST_FAILED, 8))
			{
				packet.Write(0);				// unkown
				packet.Write((uint)spellId);
				packet.Write((byte)reason);
				receiver.Send(packet);
			}
		}
Exemplo n.º 55
0
		/// <summary>
		/// Returns the TrainerSpellEntry from SpellsForSale with the given spellId, else null.
		/// </summary>
		public TrainerSpellEntry GetSpellEntry(SpellId spellId)
		{
			TrainerSpellEntry entry;
			Spells.TryGetValue(spellId, out entry);
			return entry;
		}
Exemplo n.º 56
0
		/// <summary>
		/// Adds a Spell that will be used by all NPCs of this Entry
		/// </summary>
		public void AddSpell(SpellId spellId)
		{
			var spell = SpellHandler.Get(spellId);
			if (spell != null)
			{
				AddSpell(spell);
			}
		}
Exemplo n.º 57
0
 /// <summary>
 /// Adds a SpellEffect that will trigger the given Spell on oneself
 /// </summary>
 public SpellEffect AddTriggerSpellEffect(SpellId triggerSpell)
 {
     return AddTriggerSpellEffect(triggerSpell, ImplicitSpellTargetType.Self);
 }
Exemplo n.º 58
0
		/// <summary>
		/// Adds the spell without doing any further checks or adding any spell-related skills or showing animations
		/// </summary>
		public void OnlyAdd(SpellId id)
		{
			m_byId.Add((uint)id, SpellHandler.ById.Get((uint)id));
		}
Exemplo n.º 59
0
		public void RemoveProcHandler(SpellId procId)
		{
			if (m_procHandlers != null)
			{
				foreach (var handler in m_procHandlers)
				{
					if (handler.ProcSpell != null && handler.ProcSpell.SpellId == procId)
					{
						m_procHandlers.Remove(handler);
						break;
					}
				}
			}
		}
Exemplo n.º 60
0
		/// <summary>
		/// Forces the client to start or update a cooldown timer on the given single spell
		/// (mostly important for certain talents and item spells that don't automatically start cooling down)
		/// </summary>
		public static void SendCooldownUpdate(Character chr, SpellId spellId)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_COOLDOWN_EVENT, 12))
			{
				packet.WriteUInt((uint)spellId);
				chr.EntityId.WritePacked(packet);

				chr.Send(packet);
			}
		}