Ejemplo n.º 1
0
		public static void InitNPCs()
		{
			LadySarevessEntry = NPCMgr.GetEntry(NPCId.LadySarevess);
			LadySarevessEntry.Activated += LadySarevess =>
			{
				((BaseBrain)LadySarevess.Brain).DefaultCombatAction.Strategy = new SarevessAttackAction(LadySarevess);
			};

			GelihastEntry = NPCMgr.GetEntry(NPCId.Gelihast);
			GelihastEntry.Activated += Gelihast =>
			{
				((BaseBrain)Gelihast.Brain).DefaultCombatAction.Strategy = new GelihastAttackAction(Gelihast);
			};

			LorgusJettEntry = NPCMgr.GetEntry(NPCId.LorgusJett);
			LorgusJettEntry.Activated += LorgusJett =>
			{
				((BaseBrain)LorgusJett.Brain).DefaultCombatAction.Strategy = new LorgusJettAttackAction(LorgusJett);
			};

			LordKelrisEntry = NPCMgr.GetEntry(NPCId.TwilightLordKelris);
			LordKelrisEntry.Activated += LordKelris =>
			{
				((BaseBrain)LordKelris.Brain).DefaultCombatAction.Strategy = new LordKelrisAttackAction(LordKelris);
			};

			AkuMaiEntry = NPCMgr.GetEntry(NPCId.AkuMai);
			AkuMaiEntry.Activated += AkuMai =>
			{
				((BaseBrain)AkuMai.Brain).DefaultCombatAction.Strategy = new AkuMaiAttackAction(AkuMai);
			};
		}
Ejemplo n.º 2
0
		public virtual NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry)
		{
			var caster = cast.CasterUnit;
			var duration = cast.Spell.GetDuration(cast.CasterReference);

			NPC minion;
			if (caster != null)
			{
				minion = caster.SpawnMinion(entry, ref targetLoc, duration);
			}
			else
			{
				minion = entry.Create(cast.TargetMap.DifficultyIndex);

				minion.Position = targetLoc;
				minion.Brain.IsRunning = true;
				minion.Phase = cast.Phase;
				cast.Map.AddObject(minion);
			}

			if (caster is Character)
			{
				minion.Level = caster.Level;
			}
			minion.Summoner = caster;
			minion.Creator = cast.CasterReference.EntityId;

			return minion;
		}
Ejemplo n.º 3
0
		public virtual NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry)
		{
			var caster = cast.CasterUnit;
			var pet = caster.SpawnMinion(entry, ref targetLoc, cast.Spell.GetDuration(caster.CasterInfo));
			pet.Summoner = caster;
			pet.Creator = caster.EntityId;
			return pet;
		}
Ejemplo n.º 4
0
		public static void InitNPCs()
		{
			// KamDeepfury
			kamdeepfuryEntry = NPCMgr.GetEntry(NPCId.KamDeepfury);
			kamdeepfuryEntry.Activated += kamdeepfury =>
			{
				((BaseBrain)kamdeepfury.Brain).DefaultCombatAction.Strategy = new KamdeepfuryAttackAction(kamdeepfury);
			};

			// Hamhock
			hamhockEntry = NPCMgr.GetEntry(NPCId.Hamhock);
			hamhockEntry.Activated += hamhock =>
			{
				((BaseBrain)hamhock.Brain).DefaultCombatAction.Strategy = new HamhockAttackAction(hamhock);
			};

			// Bazil
			bazilThreddEntry = NPCMgr.GetEntry(NPCId.BazilThredd);
			bazilThreddEntry.Activated += bazilthredd =>
			{
				((BaseBrain)bazilthredd.Brain).DefaultCombatAction.Strategy = new BazilThreddAttackAction(bazilthredd);
			};

			// Dextren
			dextrenEntry = NPCMgr.GetEntry(NPCId.DextrenWard);
			dextrenEntry.Activated += dextren =>
			{
				((BaseBrain)dextren.Brain).DefaultCombatAction.Strategy = new DextrenAttackAction(dextren);
			};

			// Defias Inmate
			inmateEntry = NPCMgr.GetEntry(NPCId.DefiasInmate);
			inmateEntry.Activated += inmate =>
			{
				((BaseBrain)inmate.Brain).DefaultCombatAction.Strategy = new InmateAttackAction(inmate);
			};

			// Defias Insurgent
			insurgentEntry = NPCMgr.GetEntry(NPCId.DefiasInsurgent);
			insurgentEntry.Activated += insurgent =>
			{
				((BaseBrain)insurgent.Brain).DefaultCombatAction.Strategy = new InsurgentAttackAction(insurgent);
			};

			// Defias Prisoner
			prisonerEntry = NPCMgr.GetEntry(NPCId.DefiasPrisoner);
			prisonerEntry.Activated += prisoner =>
			{
				((BaseBrain)prisoner.Brain).DefaultCombatAction.Strategy = new PrisonerAttackAction(prisoner);
			};

			// Defias Convict
			convictEntry = NPCMgr.GetEntry(NPCId.DefiasConvict);
			convictEntry.Activated += convict =>
			{
				((BaseBrain)convict.Brain).DefaultCombatAction.Strategy = new ConvictAttackAction(convict);
			};
		}
Ejemplo n.º 5
0
 /// <summary>
 /// Returns all NPCTypeHandlers for the given NPCPrototype
 /// </summary>
 public static NPCTypeHandler[] GetNPCTypeHandlers(NPCEntry entry)
 {
     NPCTypeHandler[] npcTypeHandlerArray = new NPCTypeHandler[entry.SetFlagIndices.Length];
     for (int index = 0; index < npcTypeHandlerArray.Length; ++index)
     {
         npcTypeHandlerArray[index] = NPCMgr.NPCTypeHandlers[entry.SetFlagIndices[index]];
     }
     return(npcTypeHandlerArray);
 }
Ejemplo n.º 6
0
 public static void InitNPCs()
 {
     MarrowgarEntry = NPCMgr.GetEntry(NPCId.LordMarrowgar);
     MarrowgarEntry.BrainCreator = marrowgar => new MarrowgarBrain(marrowgar);
     MarrowgarEntry.Activated += marrowgar =>
     {
         ((BaseBrain)marrowgar.Brain).DefaultCombatAction.Strategy = new MarrowgarAIAttackAction(marrowgar);
     };
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns all NPCSpawnTypeHandlers for the given NPCPrototype
 /// </summary>
 internal static NPCSpawnTypeHandler[] GetNPCSpawnTypeHandlers(NPCEntry entry)
 {
     NPCSpawnTypeHandler[] spawnTypeHandlerArray = new NPCSpawnTypeHandler[entry.SetFlagIndices.Length];
     for (int index = 0; index < spawnTypeHandlerArray.Length; ++index)
     {
         spawnTypeHandlerArray[index] = NPCMgr.NPCSpawnTypeHandlers[entry.SetFlagIndices[index]];
     }
     return(spawnTypeHandlerArray);
 }
Ejemplo n.º 8
0
        public static void InitNPCs()
        {
            //Pandemonius
            pandemoniusEntry = NPCMgr.GetEntry(NPCId.Pandemonius);
            pandemoniusEntry.BrainCreator = pandemonius => new PandemoniusBrain(pandemonius);
            pandemoniusEntry.AddSpells(pandemoniusSpells);

			SpellHandler.Apply(spell => spell.AISettings.SetCooldown(15000, 25000), SpellId.VoidBlast);
			SpellHandler.Apply(spell => spell.CooldownTime = 20000, SpellId.DarkShell);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a new custom NPCEntry with the given Id.
 /// The id must be hardcoded, so the client will always recognize it in its cache.
 /// </summary>
 public static void AddEntry(uint id, NPCEntry entry)
 {
     if (id < (uint)NPCId.End)
     {
         throw new ArgumentException("Cannot create an NPCEntry with id < NPCId.End (" + (int)NPCId.End + ")");
     }
     entry.Id = id;
     CustomEntries.Add(id, entry);
     entry.FinalizeDataHolder();
 }
Ejemplo n.º 10
0
 public static void Apply(this Action <NPCEntry> cb, params NPCId[] ids)
 {
     foreach (NPCId id in ids)
     {
         NPCEntry entry = NPCMgr.GetEntry(id);
         if (entry != null)
         {
             cb(entry);
         }
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Returns all NPCSpawnTypeHandlers for the given NPCPrototype
        /// </summary>
        internal static NPCSpawnTypeHandler[] GetNPCSpawnTypeHandlers(NPCEntry entry)
        {
            var handlers = new NPCSpawnTypeHandler[entry.SetFlagIndices.Length];

            for (int i = 0; i < handlers.Length; i++)
            {
                handlers[i] = NPCSpawnTypeHandlers[entry.SetFlagIndices[i]];
            }

            return(handlers);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns all NPCTypeHandlers for the given NPCPrototype
        /// </summary>
        public static NPCTypeHandler[] GetNPCTypeHandlers(NPCEntry entry)
        {
            var handlers = new NPCTypeHandler[entry.SetFlagIndices.Length];

            for (var i = 0; i < handlers.Length; i++)
            {
                handlers[i] = NPCTypeHandlers[entry.SetFlagIndices[i]];
            }

            return(handlers);
        }
Ejemplo n.º 13
0
Archivo: Summon.cs Proyecto: NVN/WCell
		public override void Initialize(ref SpellFailedReason failReason)
		{
			var id = (NPCId)Effect.MiscValue;
			entry = NPCMgr.GetEntry(id);
			if (entry == null)
			{
				LogManager.GetCurrentClassLogger().Warn("The NPC for Summon-Spell {0} does not exist: {1} (Are NPCs loaded?)", Effect.Spell, id);
				failReason = SpellFailedReason.Error;
				return;
			}
		}
Ejemplo n.º 14
0
		public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry)
		{
			var caster = cast.CasterUnit;
			if (caster is Character)
			{
				return ((Character)caster).SpawnPet(entry, ref targetLoc, cast.Spell.GetDuration(caster.SharedReference));
			}
			else
			{
				return base.Summon(cast, ref targetLoc, entry);
			}
		}
Ejemplo n.º 15
0
		public static void InitNPCs()
		{
//          Oggleflint
			oggleflintEntry = NPCMgr.GetEntry(NPCId.Oggleflint);
			oggleflintEntry.AddSpell(SpellId.Cleave);            
			oggleflintEntry.Activated += oggleflint =>
			{
				var brain = (BaseBrain)oggleflint.Brain;
				var combatAction = (AICombatAction)brain.Actions[BrainState.Combat];
				combatAction.Strategy = new OggleflintAttackAction(oggleflint);
                oggleflint.AddProcHandler(cleave);
			};

//          Taragaman the Hungerer
			taragamanEntry = NPCMgr.GetEntry(NPCId.TaragamanTheHungerer);
//          taragamanEntry.AddSpell(SpellId.Uppercut);  //Not working properly
			taragamanEntry.AddSpell(SpellId.FireNova);
			taragamanEntry.Activated += taragaman =>
			{
				var brain = (BaseBrain)taragaman.Brain;
				var combatAction = (AICombatAction)brain.Actions[BrainState.Combat];
				combatAction.Strategy = new TaragamanAttackAction(taragaman);
//              taragaman.AddProcHandler(uppercut);  //Currently not working
                taragaman.AddProcHandler(firenova); 
            };

//          Jergosh the Invoker
			jergoshEntry = NPCMgr.GetEntry(NPCId.JergoshTheInvoker);
			jergoshEntry.AddSpell(SpellId.CurseOfWeakness);
			jergoshEntry.AddSpell(SpellId.Immolate);
			jergoshEntry.Activated += jergosh =>
			{
				var brain = (BaseBrain)jergosh.Brain;
				var combatAction = (AICombatAction)brain.Actions[BrainState.Combat];
				combatAction.Strategy = new JergoshAttackAction(jergosh);
                jergosh.AddProcHandler(weakness);
                jergosh.AddProcHandler(immolate);
			};

//          Bazzalan
			bazzalanEntry = NPCMgr.GetEntry(NPCId.Bazzalan);
			bazzalanEntry.AddSpell(SpellId.Poison);
			bazzalanEntry.AddSpell(SpellId.SinisterStrike);
			bazzalanEntry.Activated += bazzalan =>
			{
				var brain = (BaseBrain)bazzalan.Brain;
				var combatAction = (AICombatAction)brain.Actions[BrainState.Combat];
				combatAction.Strategy = new BazzalanAttackAction(bazzalan);
                bazzalan.AddProcHandler(poison);
                bazzalan.AddProcHandler(sstrike);
			};
		}
Ejemplo n.º 16
0
        internal void InitAddonData(INPCDataHolder dataHolder)
        {
            this.DataHolder = dataHolder;
            NPCEntry entry = dataHolder.Entry;

            if (!string.IsNullOrEmpty(this.AuraIdStr))
            {
                SpellId[] spellIdArray = ((IEnumerable <string>) this.AuraIdStr.Split(new char[1]
                {
                    ' '
                }, StringSplitOptions.RemoveEmptyEntries)).TransformArray <string, SpellId>(
                    (Func <string, SpellId>)(idStr =>
                {
                    uint result;
                    if (!uint.TryParse(idStr.Trim(), out result))
                    {
                        LogManager.GetCurrentClassLogger()
                        .Warn("Invalidly formatted Aura ({0}) in AuraString for SpawnEntry: {1}",
                              (object)idStr, (object)this);
                    }
                    return((SpellId)result);
                }));
                if (spellIdArray != null)
                {
                    this.Auras = new List <Spell>(spellIdArray.Length);
                    foreach (SpellId spellId in spellIdArray)
                    {
                        Spell spell = SpellHandler.Get(spellId);
                        if (spell != null)
                        {
                            if (!spell.IsAura || spell.Durations.Min > 0 && spell.Durations.Min < int.MaxValue)
                            {
                                if (entry.Spells == null || !entry.Spells.ContainsKey(spell.SpellId))
                                {
                                    entry.AddSpell(spell);
                                }
                            }
                            else
                            {
                                this.Auras.Add(spell);
                            }
                        }
                    }
                }
            }

            if (this.Auras != null)
            {
                return;
            }
            this.Auras = new List <Spell>(2);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Creates a new custom NPCEntry with the given Id.
 /// The id must be hardcoded, so the client will always recognize it in its cache.
 /// </summary>
 public static void AddEntry(uint id, NPCEntry entry)
 {
     if (id < 844U)
     {
         throw new ArgumentException("Cannot create an NPCEntry with id < NPCId.End (" + (object)844 + ")");
     }
     if (NPCMgr.CustomEntries.ContainsKey(id))
     {
         NPCMgr.CustomEntries.Remove(id);
     }
     entry.Id = id;
     NPCMgr.CustomEntries.Add(id, entry);
     entry.FinalizeDataHolder();
 }
Ejemplo n.º 18
0
        public static void InitNPCs()
        {
            // (!)Rethilgore
            rethilgoreEntry = NPCMgr.GetEntry(3914);
            rethilgoreEntry.AddSpell((SpellId)7295);		// add Rethilgore Spell
            rethilgoreEntry.BrainCreator = rethilgore => new RethilgoreBrain(rethilgore);

            // Rethilgore spell has a cooldown of about 30s
            SpellHandler.Apply(spell => { spell.CooldownTime = 30000; }, (SpellId)7295);


            // (!)Baron Silverlaine
            baronsilverlaineEntry = NPCMgr.GetEntry(3887);
            baronsilverlaineEntry.AddSpell((SpellId)7068);

            SpellHandler.Apply(spell => { spell.CooldownTime = 15000; }, (SpellId)7068);


            // (!)Commander Springvale
            commanderspringvaleEntry = NPCMgr.GetEntry(4278);
            commanderspringvaleEntry.AddSpell((SpellId)5588);
            commanderspringvaleEntry.AddSpell((SpellId)31713);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, (SpellId)5588);
            SpellHandler.Apply(spell => { spell.CooldownTime = 45000; }, (SpellId)31713);


            // (!)Odo the Blindwatcher
            blindwatcherEntry = NPCMgr.GetEntry(4279);
            blindwatcherEntry.AddSpell((SpellId)7484);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, (SpellId)7484);


            // (!)Fenrus the Devourer
            fenrusEntry = NPCMgr.GetEntry(4274);
            fenrusEntry.AddSpell((SpellId)7125);
            fenrusEntry.BrainCreator = fenrus => new FenrusBrain(fenrus);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, (SpellId)7125);


            // (!)Archmage Arugal
            arugalEntry = NPCMgr.GetEntry(4275);
            arugalEntry.AddSpell((SpellId)7803);
            arugalEntry.AddSpell((SpellId)7588);

            SpellHandler.Apply(spell => { spell.CooldownTime = 25000; }, (SpellId)7803);
            SpellHandler.Apply(spell => { spell.CooldownTime = 40000; }, (SpellId)7588);
        }
Ejemplo n.º 19
0
        public static void InitNPCs()
        {
            // (!)Rethilgore
            rethilgoreEntry = NPCMgr.GetEntry(NPCId.Rethilgore);
            rethilgoreEntry.AddSpell(SpellId.SoulDrain);		// add Rethilgore Spell
            rethilgoreEntry.BrainCreator = rethilgore => new RethilgoreBrain(rethilgore);

            // Rethilgore spell has a cooldown of about 30s
            SpellHandler.Apply(spell => { spell.CooldownTime = 30000; }, SpellId.SoulDrain);


            // (!)Baron Silverlaine
            baronsilverlaineEntry = NPCMgr.GetEntry(NPCId.BaronSilverlaine);
            baronsilverlaineEntry.AddSpell(SpellId.VeilOfShadow);
            SpellHandler.Apply(spell => { spell.CooldownTime = 15000; }, SpellId.VeilOfShadow);


            // (!)Commander Springvale
            commanderspringvaleEntry = NPCMgr.GetEntry(NPCId.CommanderSpringvale);
            commanderspringvaleEntry.AddSpell(SpellId.ClassSkillHammerOfJusticeRank2);
            commanderspringvaleEntry.AddSpell(SpellId.HolyLight_7);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, SpellId.ClassSkillHammerOfJusticeRank2);
            SpellHandler.Apply(spell => { spell.CooldownTime = 45000; }, SpellId.HolyLight_7);


            // (!)Odo the Blindwatcher
            blindwatcherEntry = NPCMgr.GetEntry(NPCId.OdoTheBlindwatcher);
            blindwatcherEntry.AddSpell(SpellId.SkullforgeBrand);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, SpellId.HowlingRage_3);


            // (!)Fenrus the Devourer
            fenrusEntry = NPCMgr.GetEntry(NPCId.FenrusTheDevourer);
            fenrusEntry.AddSpell(SpellId.ToxicSaliva);
            fenrusEntry.BrainCreator = fenrus => new FenrusBrain(fenrus);

            SpellHandler.Apply(spell => { spell.CooldownTime = 60000; }, SpellId.ToxicSaliva);


            // (!)Archmage Arugal
            arugalEntry = NPCMgr.GetEntry(NPCId.Arugal);
            arugalEntry.AddSpell(SpellId.Thundershock);
            arugalEntry.AddSpell(SpellId.VoidBolt);

            SpellHandler.Apply(spell => { spell.CooldownTime = 25000; }, SpellId.Thundershock);
            SpellHandler.Apply(spell => { spell.CooldownTime = 40000; }, SpellId.VoidBolt);
        }
Ejemplo n.º 20
0
		static void SetupGrizzly()
		{
			// default settings
			GrizzlyBear = new NPCEntry
			{
				Id = BearId,
				DefaultName = "Sample Grizzly",
				EntryFlags = NPCEntryFlags.Tamable,
				Type = CreatureType.Humanoid,
				DisplayIds = new[] { 21635u },
				Scale = 1,
				MinLevel = 73,
				MaxLevel = 74,
				HordeFactionId = FactionTemplateId.Monster_2,
				MinHealth = 100000,
				MaxHealth = 500000,
				AttackPower = 314,
				AttackTime = 1500,
				MinDamage = 250,
				MaxDamage = 360,
				WalkSpeed = 2.5f,
				RunSpeed = 8f,
				FlySpeed = 14f,

				MinMana = 2000
			};

			GrizzlyBear.SetResistance(DamageSchool.Physical, 7600);

			// AOE damage spell
			GrizzlyBear.AddSpell(SpellId.ConeOfFire);

			// A spell with a freeze debuff
			GrizzlyBear.AddSpell(SpellId.Chilled);

			// Sample gossip menu
			GossipMgr.AddText(sampleGossipTextId, new GossipText
			{
				Probability = 1,
				TextMale = "Sample Gossip Menu",
				TextFemale = "Take a good look"
			});
			GrizzlyBear.DefaultGossip = CreateSampleGossipMenu();

			GrizzlyBear.FinalizeDataHolder();

			//NPCMgr.AddEntry(BearId, GrizzlyBear);
		}
Ejemplo n.º 21
0
		public static void InitNPCs()
		{
			// Dragonflayer Ironhelm
			dragonflayerIronhelm = NPCMgr.GetEntry(NPCId.DragonflayerIronhelm);

			dragonflayerIronhelm.AddSpell(SpellId.HeroicStrike_9);
			SpellHandler.Apply(spell => { spell.CooldownTime = 5000; },
				SpellId.HeroicStrike_9);


			//Prince Keleseth
			SetupPrinceKeleseth();


			// Dragonflayer Ironhelm
			dragonflayerIronhelm = NPCMgr.GetEntry(NPCId.DragonflayerIronhelm);

			dragonflayerIronhelm.AddSpell(SpellId.HeroicStrike_9);
			SpellHandler.Apply(spell => { spell.CooldownTime = 5000; },
				SpellId.HeroicStrike_9);
		}
Ejemplo n.º 22
0
        /// <summary>
        /// Is called to initialize the object; usually after a set of other operations have been performed or if
        /// the right time has come and other required steps have been performed.
        /// </summary>
        public void FinalizeAfterLoad()
        {
            NPCId          = (NPCId)Id;
            SetFlagIndeces = Utility.GetSetIndices((uint)Flags);
            DefaultFaction = FactionMgr.Get(DefaultFactionId);

            if (AuraIds != null)
            {
                var auras = new List <Spell>(AuraIds.Length);
                foreach (var auraId in AuraIds)
                {
                    var spell = SpellHandler.Get(auraId);
                    if (spell != null)
                    {
                        auras.Add(spell);
                    }
                }
                Auras = auras.ToArray();
            }
            else
            {
                Auras = Spell.EmptyArray;
            }

            var entry = NPCMgr.GetEntry(Id);

            if (entry != null)
            {
                // set the prototype
                entry.Prototype = this;
                Entry           = entry;
            }

            InstanceTypeHandlers = NPCMgr.GetNPCTypeHandlers(this);
            SpawnTypeHandlers    = NPCMgr.GetNPCSpawnTypeHandlers(this);
        }
Ejemplo n.º 23
0
		private static void SetupPrinceKeleseth()
		{
			princeKelesethEntry = NPCMgr.GetEntry(NPCId.PrinceKeleseth);
			princeKelesethEntry.BrainCreator = princeKeleseth => new PrinceKelesethBrain(princeKeleseth);

			PrinceSkeletonEntry = NPCMgr.GetEntry(NPCId.VrykulSkeleton);

			// add spell to prince
			PrinceSkeletonEntry.AddSpell(SpellId.Decrepify);
			SpellHandler.Apply(spell => { spell.CooldownTime = 5000; }, SpellId.Decrepify);

			var princeSpawnEntry = princeKelesethEntry.SpawnEntries[0];
			var poolTemplate = princeSpawnEntry.PoolTemplate;

			// do not let Skeletons decay
			PrinceSkeletonEntry.DefaultDecayDelayMillis = 0;

			// add skeleton spawn entries to pool
			for (var i = 0; i < PrinceSkeletonCount; i++)
			{
				var skelSpawnEntry = new NPCSpawnEntry(PrinceSkeletonEntry.NPCId, MapId.UtgardeKeep, PrinceSkeletonPositions[i])
				{
					AutoSpawns = false,						// must not respawn automatically when dead
					IsDead = true,							// spawn dead
					PoolId = poolTemplate.PoolId			// share Prince' pool
				};
				skelSpawnEntry.FinalizeDataHolder();		// adds to PoolTemplate automatically

				PrinceSkeletonSpawnEntries[i] = skelSpawnEntry;
			}

			// give the prince his AttackAction
			princeKelesethEntry.Activated += prince =>
			{
				var instance = prince.Map as UtgardeKeep;
				if (instance == null || prince.SpawnPoint == null) return;

				((BaseBrain)prince.Brain).DefaultCombatAction.Strategy = new PrinceKelesethAttackAction(prince);

				instance.SpawnDeadPrinceSkeletons(prince);
			};

			// prince deleted
			princeKelesethEntry.Deleted += prince =>
			{
				var instance = prince.Map as UtgardeKeep;
				if (instance == null) return;

				// add this "if", in case a GM spawns more than one prince
				if (instance.PrinceKeleseth == prince)
				{
					// unset PrinceKeleseth object
					instance.PrinceKeleseth = null;
				}
			};

			// prince dies
			princeKelesethEntry.Died += prince =>
			{
				var instance = prince.Map as UtgardeKeep;
				if (instance == null) return;

				// kill all skeletons
				instance.KillPrinceSkeletons();
			};

			// update Skeleton if it dies/lives or gets deleted
			PrinceSkeletonEntry.Activated += UpdateSkeleton;
			PrinceSkeletonEntry.Died += UpdateSkeleton;
			PrinceSkeletonEntry.Deleted += UpdateSkeleton;

			princeKelesethEntry.AddSpell(SpellId.ShadowBolt_73);
			SpellHandler.Apply(spell => { spell.CooldownTime = 10000; },
				SpellId.ShadowBolt_73);

			//Heroic
			//princeKelesethEntry.AddSpell(SpellId.ShadowBolt_99);
			//SpellHandler.Apply(spell => { spell.CooldownTime = 5000; },
			//    SpellId.ShadowBolt_73);

			//princeKelesethEntry.AddSpell(SpellId.FrostTomb_3);

			//princeKelesethEntry.AddSpell(SpellId.FrostTomb_3);

			//princeKelesethEntry.AddSpell(SpellId.FrostTombSummon);

			//princeKelesethEntry.AddSpell(SpellId.Decrepify);

			//princeKelesethEntry.AddSpell(SpellId.ScourgeResurrection);

		}
Ejemplo n.º 24
0
		public virtual bool CanSummon(SpellCast cast, NPCEntry entry)
		{
			return true;
		}
Ejemplo n.º 25
0
        protected internal virtual void SetupNPC(NPCEntry entry, NPCSpawnPoint spawnPoint)
        {
            NPCSpawnEntry spawnEntry;
            if (spawnPoint != null)
            {
                // Spawn-specific information
                spawnEntry = spawnPoint.SpawnEntry;
                m_spawnPoint = spawnPoint;
                Phase = spawnEntry.Phase;
                m_orientation = spawnEntry.Orientation;

                if (spawnEntry.DisplayIdOverride != 0)
                {
                    DisplayId = spawnEntry.DisplayIdOverride;
                }
            }
            else
            {
                Phase = 1;
                spawnEntry = entry.FirstSpawnEntry;
            }

            GenerateId(entry.Id);

            SetEntry(entry);
        }
Ejemplo n.º 26
0
 public override NPC SpawnMinion(NPCEntry entry, ref Vector3 position, int durationMillis)
 {
     var minion = base.SpawnMinion(entry, ref position, durationMillis);
     if (Group == null)
     {
         Group = new AIGroup(this);
     }
     Group.Add(minion);
     return minion;
 }
Ejemplo n.º 27
0
        public void SetEntry(NPCEntry entry)
        {
            Entry = entry;

            if (m_spawnPoint == null || m_spawnPoint.SpawnEntry.DisplayIdOverride == 0)
            {
                if (entry.ModelInfos.Length > 0)
                {
                    Model = entry.ModelInfos.GetRandom();
                }
            }
            NativeDisplayId = DisplayId;

            if (m_brain == null)
            {
                // new brain
                m_brain = m_entry.BrainCreator(this);
                m_brain.IsRunning = true;
            }

            if (m_Movement == null)
            {
                m_Movement = new Movement(this);
            }

            // misc stuff
            Name = m_entry.DefaultName;
            NPCFlags = entry.NPCFlags;
            UnitFlags = entry.UnitFlags;
            DynamicFlags = entry.DynamicFlags;
            Class = entry.ClassId;
            Race = entry.RaceId;
            YieldsXpOrHonor = entry.GeneratesXp;
            SheathType = SheathType.Melee;

            // decide which faction
            if (m_spawnPoint != null)
            {
                var map = m_spawnPoint.Map;
                if (map != null)
                {
                    Faction = DefaultFaction;
                }
            }
            if (Faction == null)
            {
                Faction = entry.RandomFaction;
            }

            // speeds
            m_runSpeed = entry.RunSpeed;
            m_swimSpeed = entry.RunSpeed;
            m_swimBackSpeed = entry.RunSpeed;
            m_walkSpeed = entry.WalkSpeed;
            m_walkBackSpeed = entry.WalkSpeed;
            m_flightSpeed = entry.FlySpeed;
            m_flightBackSpeed = entry.FlySpeed;

            Array.Copy(entry.Resistances, m_baseResistances, m_baseResistances.Length);

            MainWeapon = m_entry.CreateMainHandWeapon();
            RangedWeapon = m_entry.CreateRangedWeapon();
            OffHandWeapon = entry.CreateOffhandWeapon();

            // Set model after Scale
            Model = m_entry.GetRandomModel();

            GossipMenu = entry.DefaultGossip; // set gossip menu

            // TODO: Init stats
            //for (int i = 0; i < 5; i++)
            //{
            //    m_baseStats[i] = statVal;
            //}
            PowerType = PowerType.Mana;
            SetBaseStat(StatType.Strength, 1, false);
            SetBaseStat(StatType.Agility, 1, false);
            SetBaseStat(StatType.Intellect, 1, false);
            SetBaseStat(StatType.Stamina, 1, false);
            SetBaseStat(StatType.Spirit, 1, false);

            // health + power
            var health = entry.GetRandomHealth();
            SetInt32(UnitFields.MAXHEALTH, health);
            SetInt32(UnitFields.BASE_HEALTH, health);

            if (m_entry.IsDead || m_spawnPoint == null || !m_spawnPoint.SpawnEntry.IsDead)
            {
                SetInt32(UnitFields.HEALTH, health);
            }
            else if (m_entry.Regenerates)
            {
                Regenerates = true;
                HealthRegenPerTickNoCombat = Math.Max(m_entry.MaxHealth / 10, 1);
            }

            var mana = entry.GetRandomMana();
            if (mana == 0)
            {
                SetInt32(UnitFields.MAXPOWER1, 1);
                SetInt32(UnitFields.BASE_MANA, 1);
            }
            else
            {
                SetInt32(UnitFields.MAXPOWER1, mana);
                SetInt32(UnitFields.BASE_MANA, mana);
            }
            SetInt32(UnitFields.POWER1, mana);
            internalPower = mana;

            HoverHeight = entry.HoverHeight;

            PowerCostMultiplier = 1f;

            if (PowerType == PowerType.Mana)
            {
                ManaRegenPerTickInterrupted = 20;
            }

            UpdateUnitState();

            if (m_entry.InhabitType.HasFlag(InhabitType.Air))
            {
                Flying++;
            }

            AddStandardEquipment();
            if (m_entry.AddonData != null)
            {
                // first add general addon data
                AddAddonData(m_entry.AddonData);
            }
            if (m_spawnPoint != null && m_spawnPoint.SpawnEntry.AddonData != null)
            {
                // then override with per-spawn addon data
                AddAddonData(m_spawnPoint.SpawnEntry.AddonData);
            }

            if (m_mainWeapon != GenericWeapon.Peace)
            {
                IncMeleePermissionCounter();
            }

            if (IsImmovable)
            {
                InitImmovable();
            }
            Level = entry.GetRandomLevel();

            AddMessage(UpdateSpellRanks);
        }
Ejemplo n.º 28
0
		public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry)
		{
			var pet = base.Summon(cast, ref targetLoc, entry);
			return pet;
		}
Ejemplo n.º 29
0
		public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry)
		{
			var npc = base.Summon(cast, ref targetLoc, entry);
			npc.HasOwnerPermissionToMove = false;
			return npc;
		}
Ejemplo n.º 30
0
		public static void InitNPCs()
		{
			// both big bosses are invul at first
			arthasMirrorEntry = NPCMgr.GetEntry(29280u);
			arthasMirrorEntry.MinLevel = arthasMirrorEntry.MaxLevel = 83;
			arthasMirrorEntry.UnitFlags = UnitFlags.SelectableNotAttackable;

			svalaEntry = NPCMgr.GetEntry(29281u);
			svalaEntry.UnitFlags = UnitFlags.SelectableNotAttackable;
			svalaEntry.Activated += svala =>
			{
				var instance = svala.Map as UtgardePinnacle;
				if (instance != null)
				{
					instance.PrepareEncounter(svala);
				}
			};

			// TODO: Set the emotestate of the sitting audience correctly and make them idle until the convo is over
			var observanceTrigger = AreaTriggerMgr.GetTrigger(AreaTriggerId.UtgardePinnacleObservanceHall);
            if(observanceTrigger != null)
            {
			    observanceTrigger.Triggered += OnObservanceHallTriggered;                
            }


		}
Ejemplo n.º 31
0
        public static void InitNPCs()
        {
            _deviateStinglashEntry = NPCMgr.GetEntry(NPCId.DeviateStinglash);
            _deviateStinglashEntry.AddSpell(SpellId.Lash);
            var lash = SpellHandler.Get(SpellId.Lash);
            lash.AISettings.SetCooldownRange(17000, 20000);

            _deviateCreeperEntry = NPCMgr.GetEntry(NPCId.DeviateCreeper);
            _deviateCreeperEntry.AddSpell(SpellId.InfectedWound);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(12000, 18000), SpellId.InfectedWound);

            _deviateSlayerEntry = NPCMgr.GetEntry(NPCId.DeviateSlayer);
            _deviateSlayerEntry.Activated +=
                deviateSlayer => { ((BaseBrain) deviateSlayer.Brain).DefaultCombatAction.Strategy = new DeviateSlayerAttackAction(deviateSlayer); };

            _mutanustheDevourerEntry = NPCMgr.GetEntry(NPCId.MutanusTheDevourer);
            var mutanustheDevourerSpells = new[] {SpellId.NaralexsNightmare, SpellId.Terrify, SpellId.ThundercrackRank1};
            _mutanustheDevourerEntry.AddSpells(mutanustheDevourerSpells);
            SpellHandler.Apply(spell => spell.CooldownTime = 30000, mutanustheDevourerSpells[0]);
            SpellHandler.Apply(spell => spell.CooldownTime = 50000, mutanustheDevourerSpells[1]);
            SpellHandler.Apply(spell =>
                               	{
                               		spell.TargetFlags = SpellTargetFlags.Self;
                               		spell.CooldownTime = 10000;
                               	}, mutanustheDevourerSpells[2]);

            _madMagglishEntry = NPCMgr.GetEntry(NPCId.MadMagglish);
            _madMagglishEntry.AddSpell(SpellId.SmokeBomb);
            SpellHandler.Apply(spell =>
                               	{
                               		spell.TargetFlags = SpellTargetFlags.Self;
                               		spell.CooldownTime = 9000;
                               	}, SpellId.SmokeBomb);

            _lordCobrahnEntry = NPCMgr.GetEntry(NPCId.LordCobrahn);
            _lordCobrahnEntry.BrainCreator = lordCobrahn => new LordCobrahnBrain(lordCobrahn);
            _lordCobrahnEntry.Activated +=
                lordCobrahn => { ((BaseBrain) lordCobrahn.Brain).DefaultCombatAction.Strategy = new LordCobrahnAttackAction(lordCobrahn); };

            _lordPythasEntry = NPCMgr.GetEntry(NPCId.LordPythas);
            var lordPythasSpells = new[] {SpellId.ThunderclapRank1, SpellId.SleepRank1};
            _lordPythasEntry.AddSpells(lordPythasSpells);
            SpellHandler.Apply(spell =>
                               	{
                               		spell.TargetFlags = SpellTargetFlags.Self;
                               		spell.CooldownTime = Random.Next(6000, 11000);
                               	}, lordPythasSpells[0]);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(12000, 20000), lordPythasSpells[1]);
            _lordPythasEntry.BrainCreator = lordPythas => new LordPythasBrain(lordPythas);
            _lordPythasEntry.Activated +=
                lordPythas => { ((BaseBrain) lordPythas.Brain).DefaultCombatAction.Strategy = new LordPythasAttackAction(lordPythas); };

            _ladyAnacondraEntry = NPCMgr.GetEntry(NPCId.LadyAnacondra);
            _ladyAnacondraEntry.AddSpell(SpellId.SleepRank1);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(12000, 25000), SpellId.SleepRank1);
            _ladyAnacondraEntry.BrainCreator = ladyAnacondra => new LadyAnacondraBrain(ladyAnacondra);
            _ladyAnacondraEntry.Activated +=
                ladyAnacondra => { ((BaseBrain) ladyAnacondra.Brain).DefaultCombatAction.Strategy = new LadyAnacondraAttackAction(ladyAnacondra); };

            _boahnEntry = NPCMgr.GetEntry(NPCId.Boahn);
            _boahnEntry.BrainCreator = boahn => new BoahnBrain(boahn);
            _boahnEntry.Activated +=
                boahn => { ((BaseBrain) boahn.Brain).DefaultCombatAction.Strategy = new BoahnAttackAction(boahn); };

            _lordSerpentisEntry = NPCMgr.GetEntry(NPCId.LordSerpentis);
            _lordSerpentisEntry.AddSpell(SpellId.SleepRank1);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(10000, 19000), SpellId.SleepRank1);
            _lordSerpentisEntry.BrainCreator = lordSerpentis => new LordSerpentisBrain(lordSerpentis);
            _lordSerpentisEntry.Activated +=
                lordSerpentis => { ((BaseBrain) lordSerpentis.Brain).DefaultCombatAction.Strategy = new LordSerpentisAttackAction(lordSerpentis); };

            _skumEntry = NPCMgr.GetEntry(NPCId.Skum);
            _skumEntry.AddSpell(SpellId.ChainedBolt);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(4000, 6000), SpellId.ChainedBolt);

            _druidoftheFangEntry = NPCMgr.GetEntry(NPCId.DruidOfTheFang);
            _druidoftheFangEntry.BrainCreator = druidoftheFang => new DruidoftheFangBrain(druidoftheFang);
            _druidoftheFangEntry.Activated +=
                druidoftheFang => { ((BaseBrain) druidoftheFang.Brain).DefaultCombatAction.Strategy = new DruidoftheFangAttackAction(druidoftheFang); };

            _deviateAdderEntry = NPCMgr.GetEntry(NPCId.DeviateAdder);
            _deviateAdderEntry.AddSpell(SpellId.EffectPoison);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(15000, 25000), SpellId.EffectPoison);

            _deviateCrocoliskEntry = NPCMgr.GetEntry(NPCId.DeviateCrocolisk);
            _deviateCrocoliskEntry.AddSpell(SpellId.TendonRip);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(10000, 12000), SpellId.TendonRip);

            _deviateLasherEntry = NPCMgr.GetEntry(NPCId.DeviateLasher);
            _deviateLasherEntry.AddSpell(SpellId.WideSlashRank1);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(8000, 12000), SpellId.WideSlashRank1);

            _deviateDreadfangEntry = NPCMgr.GetEntry(NPCId.DeviateDreadfang);
            _deviateDreadfangEntry.AddSpell(SpellId.Terrify);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(20000, 25000), SpellId.Terrify);

            _deviateViperEntry = NPCMgr.GetEntry(NPCId.DeviateViper);
            _deviateViperEntry.AddSpell(SpellId.LocalizedToxin);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(10000, 15000), SpellId.LocalizedToxin);

            _deviateVenomwingEntry = NPCMgr.GetEntry(NPCId.DeviateVenomwing);
            _deviateVenomwingEntry.AddSpell(SpellId.ToxicSpit);
            SpellHandler.Apply(spell => spell.CooldownTime = Random.Next(8000, 10000), SpellId.ToxicSpit);

            _deviateShamblerEntry = NPCMgr.GetEntry(NPCId.DeviateShambler);
            _deviateShamblerEntry.Activated +=
                deviateShambler => { ((BaseBrain) deviateShambler.Brain).DefaultCombatAction.Strategy = new DeviateShamblerAttackAction(deviateShambler); };

            _verdanTheEverlivingEntry = NPCMgr.GetEntry(NPCId.VerdanTheEverliving);
            _verdanTheEverlivingEntry.AddSpell(SpellId.GraspingVines);
            SpellHandler.Apply(spell =>
                               	{
                               		spell.TargetFlags = SpellTargetFlags.Self;
                               		spell.CooldownTime = Random.Next(10000, 13000);
                               	}, SpellId.GraspingVines);
        }
Ejemplo n.º 32
0
		public static void InitNPCs()
		{
			arelasEntry = NPCMgr.GetEntry(NPCId.ArelasBrightstar);
			jaerenEntry = NPCMgr.GetEntry(NPCId.JaerenSunsworn);
			tirionEntry = NPCMgr.GetEntry(NPCId.HighlordTirionFordring_9);

			//eresseaEntry = NPCMgr.GetEntry(NPCId.EresseaDawnsinger_2);
			//colososEntry = NPCMgr.GetEntry(NPCId.Colosos_2);
			//jaelyneEntry = NPCMgr.GetEntry(NPCId.JaelyneEvensong_2);
			//lanaEntry = NPCMgr.GetEntry(NPCId.LanaStouthammer_2);
			//jacobEntry = NPCMgr.GetEntry(NPCId.MarshalJacobAlerius_2);

			//exodarChampionEntry = NPCMgr.GetEntry(NPCId.ExodarChampion_3);
			//stormwindChampionEntry = NPCMgr.GetEntry(NPCId.StormwindChampion_3);
			//ironforgeChampionEntry = NPCMgr.GetEntry(NPCId.IronforgeChampion_3);
			//gnomereganChampionEntry = NPCMgr.GetEntry(NPCId.GnomereganChampion_3);
			//darnassusChampionEntry = NPCMgr.GetEntry(NPCId.DarnassusChampion_3);

			warhorseEntry = NPCMgr.GetEntry(NPCId.ArgentWarhorse_6);
			battleworgEntry = NPCMgr.GetEntry(NPCId.ArgentBattleworg_2);
			//colososMountEntry = NPCMgr.GetEntry(NPCId.ColososMount);

			// Wrong DB datas...
			battleworgEntry.HordeFactionId = warhorseEntry.AllianceFactionId = FactionTemplateId.Friendly;
			warhorseEntry.HordeFactionId = battleworgEntry.AllianceFactionId = FactionTemplateId.Monster;
			NPCMgr.GetEntry(NPCId.WorldTrigger).SpawnEntries.Find(spawn => spawn.MapId == MapId.TrialOfTheChampion).AutoSpawns = false;

			jaerenEntry.UnitFlags = arelasEntry.UnitFlags |= UnitFlags.NotAttackable;
			jaerenEntry.UnitFlags = arelasEntry.UnitFlags &= ~UnitFlags.Passive;
			jaerenEntry.NPCFlags = arelasEntry.NPCFlags |= NPCFlags.Gossip;

			arelasEntry.DefaultGossip = jaerenEntry.DefaultGossip = new GossipMenu(new DynamicGossipEntry(91802, new GossipStringFactory(
				convo =>
				{
					var instance = convo.Character.Map as TrialOfTheChampion;
					if (instance != null)
					{
						if (convo.Character.Vehicle != null && (convo.Character.Vehicle.Entry == warhorseEntry
							|| convo.Character.Vehicle.Entry == battleworgEntry))
						{
							return string.Format("Are you ready for your first challenge, {0} ?", convo.Character.Class);
						}
						else if (instance._step == Steps.NotStarted)
						{
							return string.Format("The First Challenge requires you to be mounted on an {0}." +
								"You will find these mounts along the walls of this coliseum.",
								convo.Character.FactionGroup == FactionGroup.Horde ? "Argent Battleworg" : "Argent Warhorse");
						}
						else
						{
							return string.Format("Are you ready for your next challenge, {0} ?", convo.Character.Class);
						}
					}
					else return string.Empty;
				})),
				new MultiStringGossipMenuItem(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.NPCArelas1),
					new NonNavigatingDecidingGossipAction(new GossipActionHandler(
					convo =>
					{
						((NPC)convo.Speaker).NPCFlags &= ~NPCFlags.Gossip;
						var instance = convo.Character.Map as TrialOfTheChampion;
						if (instance != null)
						{
							instance.NextStep(Steps.GrandChampionTrash);
							instance.announcerNPC.MoveToThenExecute(instance.announcerPlaceInCombat,
								unit => unit.Orientation = 4.714f);
						}
					}), new GossipActionDecider(
								convo =>
								{
									if (convo.Character.Vehicle != null && (convo.Character.Vehicle.Entry == warhorseEntry
											|| convo.Character.Vehicle.Entry == battleworgEntry))
										return true;
									else
										return false;
								}))),
				new MultiStringGossipMenuItem(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.NPCArelas2),
					new NonNavigatingDecidingGossipAction(new GossipActionHandler(
						convo =>
						{
							((NPC)convo.Speaker).NPCFlags &= ~NPCFlags.Gossip;
							var instance = convo.Character.Map as TrialOfTheChampion;
							if (instance != null)
							{
								instance.NextStep(instance._step++);
								instance.announcerNPC.MoveToThenExecute(instance.announcerPlaceInCombat,
									unit => unit.Orientation = 4.714f);
							}
						}), new GossipActionDecider(
									convo =>
									{
										var instance = convo.Speaker.Map as TrialOfTheChampion;
										if (instance != null)
										{
											if (instance._step == Steps.GrandChampionBosses
												|| instance._step == Steps.ArgentChampionBosses)
											{
												return true;
											}
										}
										return false;
									}))));

			arelasEntry.Activated += arelas =>
			{
				var instance = arelas.Map as TrialOfTheChampion;
				if (instance != null)
				{
					instance.ChangeAnnouncer(arelas);
				}
			};

			tirionEntry.Activated += tirion =>
			{
				var instance = tirion.Map as TrialOfTheChampion;
				if (instance != null)
				{
					instance.tirionNPC = tirion;
				}
			};
				
			/* List of spectators
			 * spectatorsNPC.Add(NPCId.DwarvenColiseumSpectator);
			spectatorsNPC.Add(NPCId.TrollColiseumSpectator);
			spectatorsNPC.Add(NPCId.TaurenColiseumSpectator);
			spectatorsNPC.Add(NPCId.OrcishColiseumSpectator);
			spectatorsNPC.Add(NPCId.ForsakenColiseumSpectator);
			spectatorsNPC.Add(NPCId.BloodElfColiseumSpectator);
			spectatorsNPC.Add(NPCId.DraeneiColiseumSpectator);
			spectatorsNPC.Add(NPCId.GnomishColiseumSpectator);
			spectatorsNPC.Add(NPCId.HumanColiseumSpectator);
			spectatorsNPC.Add(NPCId.NightElfColiseumSpectator);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator_2);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator_3);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator_4);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator_5);
			spectatorsNPC.Add(NPCId.ArgentCrusadeSpectator_6);*/
		}
Ejemplo n.º 33
0
		/// <summary>
		/// Is called to initialize the object; usually after a set of other operations have been performed or if
		/// the right time has come and other required steps have been performed.
		/// </summary>
		public void FinalizeAfterLoad()
		{
			NPCId = (NPCId)Id;
			SetFlagIndeces = Utility.GetSetIndices((uint)Flags);
			DefaultFaction = FactionMgr.Get(DefaultFactionId);

			if (AuraIds != null)
			{
				var auras = new List<Spell>(AuraIds.Length);
				foreach (var auraId in AuraIds)
				{
					var spell = SpellHandler.Get(auraId);
					if (spell != null)
					{
						auras.Add(spell);
					}
				}
				Auras = auras.ToArray();
			}
			else
			{
				Auras = Spell.EmptyArray;
			}

			var entry = NPCMgr.GetEntry(Id);
			if (entry != null)
			{
				// set the prototype
				entry.Prototype = this;
				Entry = entry;
			}

			InstanceTypeHandlers = NPCMgr.GetNPCTypeHandlers(this);
			SpawnTypeHandlers = NPCMgr.GetNPCSpawnTypeHandlers(this);
		}
Ejemplo n.º 34
0
		/// <summary>
		/// Creates and makes visible the Unit's controlled Minion
		/// </summary>
		/// <param name="entry">The template for the Minion</param>
		/// <param name="position">The place to spawn the minion.</param>
		/// <param name="duration">Time till the minion goes away.</param>
		/// <returns>A reference to the minion.</returns>
		public NPC CreateMinion(NPCEntry entry, int durationMillis)
		{
			var minion = entry.Create();
			minion.Phase = Phase;
			minion.Zone = Zone;
			minion.RemainingDecayDelay = durationMillis;
			minion.Brain.IsRunning = true;

			if (Health > 0)
			{
				Enslave(minion, durationMillis);
			}
			return minion;
		}
Ejemplo n.º 35
0
        public static void InitNPCs()
        {
            _vanndarStormpike = NPCMgr.GetEntry(NPCId.VanndarStormpike);
            _drekThar = NPCMgr.GetEntry(NPCId.DrekThar);
            _cptBalindaStonehearth = NPCMgr.GetEntry(NPCId.CaptainBalindaStonehearth);
            _cptGalvangar = NPCMgr.GetEntry(NPCId.CaptainGalvangar);

            
            _vanndarStormpike.Died += (vann) =>
            {
                var instance = vann.Map as AlteracValley;
                if (instance != null)
                {
                    instance.Factions[(int)BattlegroundSide.Horde].Win();
                }
            };

            _drekThar.Died += (drek) =>
            {
                var instance = drek.Map as AlteracValley;
                if (instance != null)
                {
                    instance.Factions[(int)BattlegroundSide.Alliance].Win();
                }
            };

            _cptBalindaStonehearth.Died += (balinda) =>
            {
                var instance = balinda.Map as AlteracValley;
                if (instance != null)
                {
                    instance.Factions[(int)BattlegroundSide.Horde].Reinforcements -=
                        100;
                }
            };

            _cptGalvangar.Died += (galv) =>
            {
                var instance = galv.Map as AlteracValley;
                if (instance != null)
                {
                    instance.Factions[(int)BattlegroundSide.Horde].Reinforcements -=
                        100;
                }
            };
        }
Ejemplo n.º 36
0
		public virtual bool MaySpawnPet(NPCEntry entry)
		{
			return true;
		}
Ejemplo n.º 37
0
		public static void InitNPCs()
		{
			// Rahkzor
			rhahkzorEntry = NPCMgr.GetEntry(NPCId.RhahkZor);
			rhahkzorEntry.BrainCreator = rhahkzor => new RhahkzorBrain(rhahkzor);

			rhahkzorEntry.AddSpell(SpellId.RhahkZorSlam);		// add Rhakzor's slam


			// Sneed
			sneedShredderEntry = NPCMgr.GetEntry(NPCId.SneedsShredder);
			sneedShredderEntry.Died += sneedShredder =>
			{
				// Cast the sneed ejection spell on the corpse after a short delay
				sneedShredder.CallDelayed(2500, (delayed) => { sneedShredder.SpellCast.TriggerSelf(ejectSneed); });
			};

			sneedEntry = NPCMgr.GetEntry(NPCId.Sneed);
			sneedEntry.AddSpell(disarm);
			sneedEntry.Died += sneed =>
			{
				var instance = sneed.Map as Deadmines;
				if (instance != null)
				{
					GameObject door = instance.sneedDoor;
					if (door != null && door.IsInWorld)
					{
						// Open the door
						door.State = GameObjectState.Disabled;
					}
				}
			};


			// Gilnid
			gilnidEntry = NPCMgr.GetEntry(NPCId.Gilnid);

			gilnidEntry.AddSpell(SpellId.MoltenMetal);
			gilnidEntry.AddSpell(SpellId.MeltOre);

			gilnidEntry.Died += gilnid =>
			{
				var instance = gilnid.Map as Deadmines;
				if (instance != null)
				{
					GameObject door = instance.gilnidDoor;

					if (door != null && door.IsInWorld)
					{
						// Open the door
						door.State = GameObjectState.Disabled;
					}
				}
			};

			gilnidEntry.Activated += gilnid =>
			{
				((BaseBrain)gilnid.Brain).DefaultCombatAction.Strategy = new GilnidAttackAction(gilnid);
			};


			// Mr Smite
			smiteEntry = NPCMgr.GetEntry(NPCId.MrSmite);
			smiteEntry.BrainCreator = smite => new SmiteBrain(smite);
			smiteEntry.Activated += smite =>
			{
				((BaseBrain)smite.Brain).DefaultCombatAction.Strategy = new SmiteAttackAction(smite);
			};
		}
Ejemplo n.º 38
0
		/// <summary>
		/// Creates and makes visible the Unit's controlled Minion
		/// </summary>
		/// <param name="entry">The template for the Minion</param>
		/// <param name="position">The place to spawn the minion.</param>
		/// <param name="duration">Time till the minion goes away.</param>
		/// <returns>A reference to the minion.</returns>
		public virtual NPC SpawnMinion(NPCEntry entry, ref Vector3 position, int durationMillis)
		{
			//return SpawnMinion(entry, summonSpell, ref position, durationMillis != 0 ? DateTime.Now.AddMilliseconds(durationMillis) : (DateTime?)null);
			var minion = CreateMinion(entry, durationMillis);
			minion.Position = position;
			m_region.AddObjectLater(minion);
			return minion;
		}
Ejemplo n.º 39
0
		public override NPC SpawnMinion(NPCEntry entry, ref Vector3 position, int durationMillis)
		{
			var minion = base.SpawnMinion(entry, ref position, durationMillis);
			minion.Group = Group;
			return minion;
		}