Пример #1
0
        public static IEnumerable <Spell> FindSpellsWithMiscValueBWithEffect(SpellEffectType effectType)
        {
            var spells = GetSpells();

            var query = from spell in spells
                        where spell.HasEffectWith((e) => e.MiscValueB != 0)
                        select spell;

            foreach (var spell in query)
            {
                foreach (var effect in spell.Effects)
                {
                    if (effect.EffectType == effectType)
                    {
                        if (effect.MiscValueB != 0)
                        {
                            Console.WriteLine("{0}: {1} - {2} - {3}", spell.Id, spell.Name, effect.EffectType, effect.MiscValueB);
                        }
                    }
                }
            }
            Console.WriteLine("{0} spells matched condition", query.Count());

            return(query);
        }
Пример #2
0
        public SpellEffectDefinitionDataModel(int spellEffectId, SpellEffectType effectType, float basePointsAdditiveLevelModifier, int effectBasePoints, int effectPointsDiceRange, SpellEffectTargetType effectTargetingType, SpellEffectTargetType additionalEffectTargetingType)
        {
            if (spellEffectId < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellEffectId));
            }
            if (!Enum.IsDefined(typeof(SpellEffectType), effectType))
            {
                throw new InvalidEnumArgumentException(nameof(effectType), (int)effectType, typeof(SpellEffectType));
            }
            if (!Enum.IsDefined(typeof(SpellEffectTargetType), effectTargetingType))
            {
                throw new InvalidEnumArgumentException(nameof(effectTargetingType), (int)effectTargetingType, typeof(SpellEffectTargetType));
            }
            if (!Enum.IsDefined(typeof(SpellEffectTargetType), additionalEffectTargetingType))
            {
                throw new InvalidEnumArgumentException(nameof(additionalEffectTargetingType), (int)additionalEffectTargetingType, typeof(SpellEffectTargetType));
            }

            SpellEffectId = spellEffectId;
            EffectType    = effectType;
            BasePointsAdditiveLevelModifier = basePointsAdditiveLevelModifier;
            EffectBasePoints              = effectBasePoints;
            EffectPointsDiceRange         = effectPointsDiceRange;
            EffectTargetingType           = effectTargetingType;
            AdditionalEffectTargetingType = additionalEffectTargetingType;
        }
Пример #3
0
        public static void CreateEffectFile(SpellEffectType type)
        {
            using (var writer = new StreamWriter(effectsDir.FullName + type + ".cs", false))
            {
                writer.WriteLine("using System;");
                writer.WriteLine("using System.Collections.Generic;");
                writer.WriteLine("using System.Linq;");
                writer.WriteLine("using System.Text;");

                writer.WriteLine("using WCell.RealmServer.Entities;");

                writer.WriteLine("namespace WCell.RealmServer.Spells.Effects");
                writer.WriteLine("{");
                writer.WriteLine("	public class {0}Effect : EffectHandler", type);
                writer.WriteLine("	{");
                writer.WriteLine("		public {0}Effect(SpellEffect effect)", type);
                writer.WriteLine("			: base(effect)");
                writer.WriteLine("		{");
                writer.WriteLine("		}");

                writer.WriteLine("		public override void Handle(SpellCast cast)");
                writer.WriteLine("		{");
                writer.WriteLine("			// TODO: {0}EffectHandler", type);
                writer.WriteLine("		}");
                writer.WriteLine("	}");
                writer.WriteLine("});");
            }
        }
Пример #4
0
 public                 SpellEffectType this[int i]
 {
     get
     {
         if (i < 0 || i >= 3)
         {
             throw new IndexOutOfRangeException();
         }
         return(i == 0 ? A : (i == 1 ? B : C));
     }
     set
     {
         if (i < 0 || i >= 3)
         {
             throw new IndexOutOfRangeException();
         }
         if (i == 0)
         {
             A = value;
         }
         else if (i == 1)
         {
             B = value;
         }
         else
         {
             C = value;
         }
     }
 }
Пример #5
0
        public static void CreateEffectFile(SpellEffectType type)
        {
            using (var writer = new StreamWriter(effectsDir.FullName + type + ".cs", false))
            {
                writer.WriteLine("using System;");
                writer.WriteLine("using System.Collections.Generic;");
                writer.WriteLine("using System.Linq;");
                writer.WriteLine("using System.Text;");

                writer.WriteLine("using WCell.RealmServer.Entities;");

                writer.WriteLine("namespace WCell.RealmServer.Spells.Effects");
                writer.WriteLine("{");
                writer.WriteLine("	public class {0}Effect : EffectHandler", type);
                writer.WriteLine("	{");
                writer.WriteLine("		public {0}Effect(SpellEffect effect)", type);
                writer.WriteLine("			: base(effect)");
                writer.WriteLine("		{");
                writer.WriteLine("		}");

                writer.WriteLine("		public override void Handle(SpellCast cast)");
                writer.WriteLine("		{");
                writer.WriteLine("			// TODO: {0}EffectHandler", type);
                writer.WriteLine("		}");
                writer.WriteLine("	}");
                writer.WriteLine("});");
            }
        }
Пример #6
0
        public static void FindUnusedEffectTypes()
        {
            var highest = FindHighestEffectType();
            var spells  = GetSpells();

            SpellEffectType[]         effs       = (SpellEffectType[])Enum.GetValues(typeof(SpellEffectType));
            HashSet <SpellEffectType> allEffects = new HashSet <SpellEffectType>();


            foreach (var spell in spells)
            {
                foreach (var eff in spell.Effects)
                {
                    allEffects.Add(eff.EffectType);
                }
            }

            Console.WriteLine("Unused Effects");
            for (SpellEffectType effect = SpellEffectType.None; effect < highest; effect++)
            {
                if (!allEffects.Contains(effect))
                {
                    Console.WriteLine(effect);
                }
            }
        }
Пример #7
0
 public static void UnsetHandler(SpellEffectType type)
 {
     //if (SpellEffectCreators[(int)type] != null && SpellEffectCreators[(int)type].GetType() == typeof(NotImplementedEffectHandler))
     {
         SpellEffectCreators[(int)type] = null;
     }
 }
Пример #8
0
        public SpellEffectHandlerAttribute(SpellEffectType effectType)
        {
            if (!Enum.IsDefined(typeof(SpellEffectType), effectType))
            {
                throw new InvalidEnumArgumentException(nameof(effectType), (int)effectType, typeof(SpellEffectType));
            }

            EffectType = effectType;
        }
Пример #9
0
 public static Type GetSpellEffectEffectMiscValueBType(SpellEffectType type)
 {
     if (type >= SpellEffectType.End)
     {
         log.Warn("Found invalid SpellEffectType {0}.", type);
         return(null);
     }
     return(SpellEffectMiscValueBTypes[(int)type]);
 }
Пример #10
0
 public DB_SpellEffect(byte type, byte target, float data01, float data02, float data03, float bConst, float mLevel, float mAttack)
 {
     Type          = (SpellEffectType)type;
     Target        = (SpellTarget)target;
     Data01        = data01;
     Data02        = data02;
     Data03        = data03;
     BaseConst     = bConst;
     LevelModifer  = mLevel;
     AttackModifer = mAttack;
 }
    private void ExecuteEffect(SpellEffectType type, int index)
    {
        switch (type)
        {
        case SpellEffectType.SCHOOL_DAMAGE:
            EffectSchoolDMG(index);
            break;

        default:
            break;
        }
    }
Пример #12
0
        public SpellEffectEntryModel(bool isDefault, SpellEffectType effectType, float basePointsAdditiveLevelModifier, int effectBasePoints, int effectPointsDiceRange, SpellEffectTargetType effectTargetingType)
        {
            this.isDefault = isDefault;
            EffectType     = effectType;
            BasePointsAdditiveLevelModifier = basePointsAdditiveLevelModifier;
            EffectBasePoints      = effectBasePoints;
            EffectPointsDiceRange = effectPointsDiceRange;
            EffectTargetingType   = effectTargetingType;

            //TODO: Support secondary targeting type.
            AdditionalEffectTargetingType = SpellEffectTargetType.NO_TARGET;
        }
Пример #13
0
        public static void FindSpellsWithEffect(SpellEffectType effectType)
        {
            var spells = GetSpells();

            foreach (var spell in spells)
            {
                if (spell.HasEffectWith(effect => effect.EffectType == effectType))
                {
                    Console.WriteLine("{0}: {1}", spell.Id, spell.Name);
                    foreach (var eff in spell.Effects)
                    {
                        eff.DumpInfo(Console.Out, "\t");
                    }
                }
            }
        }
Пример #14
0
        public static SpellEffectType FindHighestEffectType()
        {
            var spells = GetSpells();

            SpellEffectType highest = SpellEffectType.None;

            foreach (var spell in spells)
            {
                foreach (var effect in spell.Effects)
                {
                    if (effect.EffectType > highest)
                    {
                        highest = effect.EffectType;
                    }
                }
            }

            Console.WriteLine("Highest EffectType: {0}", highest);

            return(highest);
        }
Пример #15
0
		public static void UnsetHandler(SpellEffectType type)
		{
			SpellEffectCreators[(int)type] = null;
		}
Пример #16
0
		///// <summary>
		///// Unused
		///// </summary>
		//public static void SendMagicResist(ObjectBase caster, ObjectBase target, uint spellId)
		//{
		//    using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_RESISTLOG, 21))
		//    {
		//        caster.EntityId.WritePacked(packet);
		//        target.EntityId.WritePacked(packet);
		//        packet.WriteUInt(spellId);
		//        packet.WriteByte((byte)0);
		//    }
		//}

		/// <summary>
		/// Correct for 3.0.9
		/// </summary>
		/// <param name="target">Optional</param>
		/// <param name="value">Optional</param>
		public static RealmPacketOut SendSpellLogExecute(ObjectBase caster, uint spellId, SpellEffectType effect, ObjectBase target, uint value)
		{
			// TODO: Info we still need for this packet: spellId of interrupted spell, itemId of created item

			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLLOGEXECUTE, 37);
			caster.EntityId.WritePacked(packet);
			packet.Write(spellId);
			const int effectCount = 1;
			packet.Write(effectCount);

			for (int i = 0; i < effectCount; i++)
			{
				packet.Write((int)effect);
				const int targetCount = 1; // unsure

				for (int j = 0; j < targetCount; j++)
				{
					switch (effect)
					{
						case SpellEffectType.PowerDrain:
							{
								target.EntityId.WritePacked(packet);
								packet.Write(0);
								packet.Write(0);
								packet.Write(0.0f);
								break;
							}
						case SpellEffectType.AddExtraAttacks:
							{
								target.EntityId.WritePacked(packet);
								packet.Write(0);
								break;
							}
						case SpellEffectType.InterruptCast:
							{
								packet.Write(0); // spellId of interrupted spell
								break;
							}
						case SpellEffectType.DurabilityDamage:
							{
								packet.Write(0);
								packet.Write(0);
								break;
							}
						case SpellEffectType.OpenLock:
						case SpellEffectType.OpenLockItem:
							{
								if (target is Item)
								{
									target.EntityId.WritePacked(packet);
								}
								else
								{
									packet.Write((byte)0);
								}
								break;
							}
						case SpellEffectType.CreateItem:
						case SpellEffectType.CreateItem2:
							{
								packet.Write(0); // itemId
								break;
							}
						case SpellEffectType.Summon:
						case SpellEffectType.TransformItem:
						case SpellEffectType.SummonPet:
						case SpellEffectType.SummonObjectWild:
						case SpellEffectType.CreateHouse:
						case SpellEffectType.Duel:
						case SpellEffectType.SummonObjectSlot1:
						case SpellEffectType.SummonObjectSlot2:
						case SpellEffectType.SummonObjectSlot3:
						case SpellEffectType.SummonObjectSlot4:
							{
								if (target is Unit)
								{
									target.EntityId.WritePacked(packet); // summon recipient
								}
								else
								{
									packet.Write((byte)0);
								}
								break;
							}
						case SpellEffectType.FeedPet:
							{
								if (target is Item)
								{
									packet.Write(target.EntryId);
								}
								else
								{
									packet.Write(0);
								}
								break;
							}
						case SpellEffectType.DismissPet:
							{
								target.EntityId.WritePacked(packet);
								break;
							}
						case SpellEffectType.Resurrect:
						case SpellEffectType.ResurrectFlat:
							{
								if (target is Unit)
								{
									target.EntityId.WritePacked(packet);
								}
								else
								{
									packet.Write((byte)0);
								}
								break;
							}

					}
				}
			}

			return packet;
		}
Пример #17
0
 public bool HasEffect(SpellEffectType effectType)
 {
     return(Effects.Exists(effect => effect.EffectType == effectType));
 }
Пример #18
0
 /// <summary>
 /// Returns the first SpellEffect of the given Type within this Spell
 /// </summary>
 public SpellEffect GetEffect(SpellEffectType type, bool force)
 {
     foreach (var effect in Effects)
     {
         if (effect.EffectType == type)
         {
             return effect;
         }
     }
     //ContentHandler.OnInvalidClientData("Spell {0} does not contain Effect of type {1}", this, type);
     //return null;
     if (!init1 && force)
     {
         throw new ContentException("Spell {0} does not contain Effect of type {1}", this, type);
     }
     return null;
 }
Пример #19
0
 public bool HasEffect(SpellEffectType type)
 {
     return GetEffect(type, false) != null;
 }
Пример #20
0
		public static Type GetSpellEffectEffectMiscValueBType(SpellEffectType type)
		{
			if (type >= SpellEffectType.End)
			{
				log.Warn("Found invalid SpellEffectType {0}.", type);
				return null;
			}
			return SpellEffectMiscValueBTypes[(int)type];
		}
Пример #21
0
        public static void FindSpellsWithEffect(SpellEffectType effectType)
        {
            var spells = GetSpells();

            foreach (var spell in spells)
            {
                if (spell.HasEffectWith(effect => effect.EffectType == effectType))
                {
                    Console.WriteLine("{0}: {1}", spell.Id, spell.Name);
                    foreach (var eff in spell.Effects)
                    {
                        eff.DumpInfo(Console.Out, "\t");
                    }
                }
            }
        }
Пример #22
0
 public void ModifyStatSpell(SpellEffectType stat, int baseAmount)
 {
     switch (stat)
     {
         case SpellEffectType.AGL:
             break;
         case SpellEffectType.ATK:
             break;
         case SpellEffectType.DEF:
             break;
         case SpellEffectType.HP:
             this.hpLoss -= baseAmount;
             break;
         case SpellEffectType.MAG_ATK:
             break;
         case SpellEffectType.MP:
             this.mpLoss -= baseAmount;
             break;
         case SpellEffectType.REVIVE:
             break;
     }
 }
Пример #23
0
 public static void UnsetHandler(SpellEffectType type)
 {
     //if (SpellEffectCreators[(int)type] != null && SpellEffectCreators[(int)type].GetType() == typeof(NotImplementedEffectHandler))
     {
         SpellEffectCreators[(int)type] = null;
     }
 }
Пример #24
0
 public bool IsEffect(SpellEffectType effectName)
 {
     return(EffectType == effectName);
 }
Пример #25
0
        public SpellEffectHandler GetHandler(SpellEffectType type)
        {
            if (Handlers == null)
            {
                throw new InvalidOperationException("Tried to get Handler from unintialized SpellCast");
            }

            return Handlers.FirstOrDefault(handler => handler.Effect.EffectType == type);
        }
Пример #26
0
 public SpellEffect(SpellEffectType type, float power) : base(EntityClass.SpellEffect, (uint)type)
 {
     this.power = power;
 }
Пример #27
0
 public static void SetSpellEffectEffectMiscValueBType(SpellEffectType effectType, Type type)
 {
     SpellEffectMiscValueBTypes[(int)effectType] = type;
 }
Пример #28
0
		/// <summary>
		/// Removes the first Effect of the given Type and replace it with a new one which will be returned.
		/// Appends a new one if none of the given type was found.
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public SpellEffect ReplaceEffect(SpellEffectType type)
		{
			for (var i = 0; i < Effects.Length; i++)
			{
				var effect = Effects[i];
				if (effect.EffectType == type)
				{
					return Effects[i] = new SpellEffect();
				}
			}
			return AddEffect(SpellEffectType.None);
		}
Пример #29
0
        public static IEnumerable<Spell> FindSpellsWithMiscValueBWithEffect(SpellEffectType effectType)
        {
            var spells = GetSpells();

            var query = from spell in spells
                        where spell.HasEffectWith((e) => e.MiscValueB != 0)
                        select spell;

            foreach (var spell in query)
            {
                foreach (var effect in spell.Effects)
                {
                    if (effect.EffectType == effectType)
                    {
                        if (effect.MiscValueB != 0)
                        {
                            Console.WriteLine("{0}: {1} - {2} - {3}", spell.Id, spell.Name, effect.EffectType, effect.MiscValueB);
                        }
                    }
                }
            }
            Console.WriteLine("{0} spells matched condition", query.Count());

            return query;
        }
Пример #30
0
		/// <summary>
		/// Adds a new Effect to this Spell
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public SpellEffect AddEffect(SpellEffectType type, ImplicitTargetType target)
		{
			var effect = new SpellEffect(this, Effects.Length > 0 ? Effects[Effects.Length - 1].EffectIndex : 0) { EffectType = type };
			var effects = new SpellEffect[Effects.Length + 1];
			Array.Copy(Effects, effects, Effects.Length);
			Effects = effects;
			Effects[effects.Length - 1] = effect;

			effect.ImplicitTargetA = target;
			return effect;
		}
Пример #31
0
		public static void SetSpellEffectEffectMiscValueBType(SpellEffectType effectType, Type type)
		{
			SpellEffectMiscValueBTypes[(int)effectType] = type;
		}
Пример #32
0
        /// <summary>Correct for 3.0.9</summary>
        /// <param name="target">Optional</param>
        /// <param name="value">Optional</param>
        public static RealmPacketOut SendSpellLogExecute(ObjectBase caster, uint spellId, SpellEffectType effect,
                                                         ObjectBase target, uint value)
        {
            RealmPacketOut realmPacketOut = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SPELLLOGEXECUTE, 37);

            caster.EntityId.WritePacked((BinaryWriter)realmPacketOut);
            realmPacketOut.Write(spellId);
            realmPacketOut.Write(1);
            for (int index1 = 0; index1 < 1; ++index1)
            {
                realmPacketOut.Write((int)effect);
                for (int index2 = 0; index2 < 1; ++index2)
                {
                    switch (effect)
                    {
                    case SpellEffectType.PowerDrain:
                        target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                        realmPacketOut.Write(0);
                        realmPacketOut.Write(0);
                        realmPacketOut.Write(0.0f);
                        break;

                    case SpellEffectType.Resurrect:
                    case SpellEffectType.ResurrectFlat:
                        if (target is Unit)
                        {
                            target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                            break;
                        }

                        realmPacketOut.Write((byte)0);
                        break;

                    case SpellEffectType.AddExtraAttacks:
                        target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                        realmPacketOut.Write(0);
                        break;

                    case SpellEffectType.CreateItem:
                    case SpellEffectType.CreateItem2:
                        realmPacketOut.Write(0);
                        break;

                    case SpellEffectType.Summon:
                    case SpellEffectType.TransformItem:
                    case SpellEffectType.SummonPet:
                    case SpellEffectType.SummonObjectWild:
                    case SpellEffectType.CreateHouse:
                    case SpellEffectType.Duel:
                    case SpellEffectType.SummonObjectSlot1:
                    case SpellEffectType.SummonObjectSlot2:
                    case SpellEffectType.SummonObjectSlot3:
                    case SpellEffectType.SummonObjectSlot4:
                        if (target is Unit)
                        {
                            target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                            break;
                        }

                        realmPacketOut.Write((byte)0);
                        break;

                    case SpellEffectType.OpenLock:
                    case SpellEffectType.OpenLockItem:
                        if (target is Item)
                        {
                            target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                            break;
                        }

                        realmPacketOut.Write((byte)0);
                        break;

                    case SpellEffectType.InterruptCast:
                        realmPacketOut.Write(0);
                        break;

                    case SpellEffectType.FeedPet:
                        if (target is Item)
                        {
                            realmPacketOut.Write(target.EntryId);
                            break;
                        }

                        realmPacketOut.Write(0);
                        break;

                    case SpellEffectType.DismissPet:
                        target.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                        break;

                    case SpellEffectType.DurabilityDamage:
                        realmPacketOut.Write(0);
                        realmPacketOut.Write(0);
                        break;
                    }
                }
            }

            return(realmPacketOut);
        }
Пример #33
0
 /// <summary>
 /// Returns the first SpellEffect of the given Type within this Spell
 /// </summary>
 public SpellEffect GetEffect(SpellEffectType type)
 {
     return GetEffect(type, true);
 }
Пример #34
0
 internal bool IsEffectInSpell(SpellEffectType set)
 {
     return _effects.Count(e => e.TypeId == (int)set) > 0;
 }
Пример #35
0
 public SpellEffect RemoveEffect(SpellEffectType type)
 {
     var effect = GetEffect(type);
     RemoveEffect(effect);
     return effect;
 }
 public SpellEffectHandlerAttribute(SpellEffectType spellEffectType)
 {
     SpellEffectType = spellEffectType;
 }
Пример #37
0
		/// <summary>
		/// Returns the first SpellEffect of the given Type within this Spell
		/// </summary>
		public SpellEffect GetEffect(SpellEffectType type)
		{
			foreach (var effect in Effects)
			{
				if (effect.EffectType == type)
				{
					return effect;
				}
			}
			return null;
		}
Пример #38
0
		public SpellEffectHandler GetHandler(SpellEffectType type)
		{
			if (Handlers == null)
			{
				throw new InvalidOperationException("Tried to get Handler from unintialized SpellCast");
			}

			foreach (var handler in Handlers)
			{
				if (handler.Effect.EffectType == type)
				{
					return handler;
				}
			}
			return null;
		}
Пример #39
0
		/// <summary>
		/// Adds a new Effect to this Spell
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public SpellEffect AddEffect(SpellEffectType type)
		{
			return AddEffect(type, ImplicitTargetType.None);
		}
Пример #40
0
 public SpellEffect(SpellEffectType type, SpellTargetType target, int value)
 {
     this.type = type;
     this.target = target;
     this.value = value;
 }
Пример #41
0
        ///// <summary>
        ///// Unused
        ///// </summary>
        //public static void SendMagicResist(ObjectBase caster, ObjectBase target, uint spellId)
        //{
        //    using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_RESISTLOG, 21))
        //    {
        //        caster.EntityId.WritePacked(packet);
        //        target.EntityId.WritePacked(packet);
        //        packet.WriteUInt(spellId);
        //        packet.WriteByte((byte)0);
        //    }
        //}

        /// <summary>
        /// Correct for 3.0.9
        /// </summary>
        /// <param name="target">Optional</param>
        /// <param name="value">Optional</param>
        public static RealmPacketOut SendSpellLogExecute(ObjectBase caster, uint spellId, SpellEffectType effect, ObjectBase target, uint value)
        {
            // TODO: Info we still need for this packet: spellId of interrupted spell, itemId of created item

            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLLOGEXECUTE, 37);

            caster.EntityId.WritePacked(packet);
            packet.Write(spellId);
            const int effectCount = 1;

            packet.Write(effectCount);

            for (int i = 0; i < effectCount; i++)
            {
                packet.Write((int)effect);
                const int targetCount = 1;                 // unsure

                for (int j = 0; j < targetCount; j++)
                {
                    switch (effect)
                    {
                    case SpellEffectType.PowerDrain:
                    {
                        target.EntityId.WritePacked(packet);
                        packet.Write(0);
                        packet.Write(0);
                        packet.Write(0.0f);
                        break;
                    }

                    case SpellEffectType.AddExtraAttacks:
                    {
                        target.EntityId.WritePacked(packet);
                        packet.Write(0);
                        break;
                    }

                    case SpellEffectType.InterruptCast:
                    {
                        packet.Write(0);                                         // spellId of interrupted spell
                        break;
                    }

                    case SpellEffectType.DurabilityDamage:
                    {
                        packet.Write(0);
                        packet.Write(0);
                        break;
                    }

                    case SpellEffectType.OpenLock:
                    case SpellEffectType.OpenLockItem:
                    {
                        if (target is Item)
                        {
                            target.EntityId.WritePacked(packet);
                        }
                        else
                        {
                            packet.Write((byte)0);
                        }
                        break;
                    }

                    case SpellEffectType.CreateItem:
                    case SpellEffectType.CreateItem2:
                    {
                        packet.Write(0);                                         // itemId
                        break;
                    }

                    case SpellEffectType.Summon:
                    case SpellEffectType.TransformItem:
                    case SpellEffectType.SummonPet:
                    case SpellEffectType.SummonObjectWild:
                    case SpellEffectType.CreateHouse:
                    case SpellEffectType.Duel:
                    case SpellEffectType.SummonObjectSlot1:
                    case SpellEffectType.SummonObjectSlot2:
                    case SpellEffectType.SummonObjectSlot3:
                    case SpellEffectType.SummonObjectSlot4:
                    {
                        if (target is Unit)
                        {
                            target.EntityId.WritePacked(packet);                                             // summon recipient
                        }
                        else
                        {
                            packet.Write((byte)0);
                        }
                        break;
                    }

                    case SpellEffectType.FeedPet:
                    {
                        if (target is Item)
                        {
                            packet.Write(target.EntryId);
                        }
                        else
                        {
                            packet.Write(0);
                        }
                        break;
                    }

                    case SpellEffectType.DismissPet:
                    {
                        target.EntityId.WritePacked(packet);
                        break;
                    }

                    case SpellEffectType.Resurrect:
                    case SpellEffectType.ResurrectFlat:
                    {
                        if (target is Unit)
                        {
                            target.EntityId.WritePacked(packet);
                        }
                        else
                        {
                            packet.Write((byte)0);
                        }
                        break;
                    }
                    }
                }
            }

            return(packet);
        }
Пример #42
0
 /// <summary>
 /// Return <see cref="SpellEffectDelegate"/> for supplied <see cref="SpellEffectType"/>.
 /// </summary>
 public SpellEffectDelegate GetEffectHandler(SpellEffectType spellEffectType)
 {
     return(spellEffectDelegates.TryGetValue(spellEffectType, out SpellEffectDelegate handler) ? handler : null);
 }