public static void SetupCustomGossips() { var SnurkBucksquickEntry = NPCMgr.GetEntry(NPCId.SnurkBucksquick); SnurkBucksquickEntry.DefaultGossip = StranglethornGossipMenu(); var FrezzaEntry = NPCMgr.GetEntry(NPCId.Frezza); FrezzaEntry.DefaultGossip = BrillGossipMenu(); var SquibbyOverspeckEntry = NPCMgr.GetEntry(NPCId.SquibbyOverspeck); SquibbyOverspeckEntry.DefaultGossip = BrillGossipMenu(); var NezRazEntry = NPCMgr.GetEntry(NPCId.NezRaz); NezRazEntry.DefaultGossip = OrgrimmarGossipMenu(); var HinDenburgEntry = NPCMgr.GetEntry(NPCId.HinDenburg); HinDenburgEntry.DefaultGossip = StranglethornGossipMenu(); var ZapettaEntry = NPCMgr.GetEntry(NPCId.Zapetta); ZapettaEntry.DefaultGossip = StranglethornGossipMenu(); var GrizzloweEntry = NPCMgr.GetEntry(NPCId.Grizzlowe); GrizzloweEntry.DefaultGossip = RatchetGossipMenu(); var GrimbleEntry = NPCMgr.GetEntry(NPCId.Grimble); GrimbleEntry.DefaultGossip = BootyBayGossipMenu(); }
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); }; }
private static void OnLoadClicked(GossipConversation convo) { GOMgr.LoadAllLater(); NPCMgr.LoadAllLater(); convo.Character.SendSystemMessage(RealmLangKey.PleaseWait, new object[0]); convo.Character.AddUpdateAction((ObjectUpdateTimer) new MapEditorMenu.PeriodicLoadMapTimer(convo)); }
private static void FixAcherusDKTeleporters() { var dKPortalHeartToHall = NPCMgr.GetEntry(NPCId.TeleportHeartHall); if (dKPortalHeartToHall != null) { var hallPortSpell = SpellHandler.Get(SpellId.EffectTeleportToHallOfCommand); hallPortSpell.OverrideAITargetDefinitions( DefaultTargetAdders.AddAreaSource, DefaultTargetEvaluators.NearestEvaluator, DefaultTargetFilters.IsPlayer); hallPortSpell.AISettings.SetCooldown(0); dKPortalHeartToHall.AddSpell(hallPortSpell); dKPortalHeartToHall.AggroBaseRange = 10; dKPortalHeartToHall.Activated += DKPortalActivated; } var dKPortalHallToHeart = NPCMgr.GetEntry(NPCId.TeleportHallHeart); if (dKPortalHallToHeart == null) { return; } var heartPortSpell = SpellHandler.Get(SpellId.EffectTeleportToHeartOfAcherus); heartPortSpell.OverrideAITargetDefinitions( DefaultTargetAdders.AddAreaSource, DefaultTargetEvaluators.NearestEvaluator, DefaultTargetFilters.IsPlayer); heartPortSpell.AISettings.SetCooldown(0); dKPortalHallToHeart.AddSpell(heartPortSpell); dKPortalHallToHeart.AggroBaseRange = 10; dKPortalHallToHeart.Activated += DKPortalActivated; }
public void FinalizeDataHolder() { NPCSpawnEntry spawnEntry = NPCMgr.GetSpawnEntry(NPCSpawnId); IGossipEntry entry1 = GossipMgr.GetEntry(GossipId); if (spawnEntry == null) { ContentMgr.OnInvalidDBData("{0} refers to invalid spawn id: {1}", (object)GetType(), (object)this); } else if (entry1 == null) { ContentMgr.OnInvalidDBData("{0} has invalid GossipId: {1}", (object)GetType(), (object)this); } else { NPCEntry entry2 = spawnEntry.Entry; if (spawnEntry.DefaultGossip == null) { spawnEntry.DefaultGossip = new GossipMenu(entry1); } else { spawnEntry.DefaultGossip.GossipEntry = entry1; } } }
protected void AddSpawnEntry(NpcCustomEntryId id, int timeToSpawnsecs, int amount, float amountMod, BrainState brainState = BrainState.DefenceTownEventMove) { int num1 = 0; int num2 = (int)((double)amount * (double)amountMod); for (int index1 = 1; index1 <= num2; ++index1) { int index2 = index1 % this.MovingPaths.Count; if (index2 == 0) { num1 += 2000; } NPCEntry entry = NPCMgr.GetEntry((uint)id); if (entry.Rank >= CreatureRank.Boss) { index2 = Utility.Random(0, this.MovingPaths.Count - 1); } this.NpcEntries.Add(new NpcSpawnEntry() { BrainState = brainState, TimeToSpawnMillis = timeToSpawnsecs * 1000 + num1, NpcEntry = entry, MovingPoints = (List <Vector3>) this.MovingPaths[index2] }); } }
public void FinalizeDataHolder() { if ((Spell = SpellHandler.Get(SpellId)) == null) { ContentMgr.OnInvalidDBData("SpellId is invalid in " + this); } else if (RequiredSpellId != SpellId.None && SpellHandler.Get(RequiredSpellId) == null) { ContentMgr.OnInvalidDBData("RequiredSpellId is invalid in " + this); } else if (RequiredSkillId != SkillId.None && SkillHandler.Get(RequiredSkillId) == null) { ContentMgr.OnInvalidDBData("RequiredSkillId is invalid in " + this); } else { NPCEntry entry = NPCMgr.GetEntry(TrainerId); if (entry == null) { ContentMgr.OnInvalidDBData("TrainerId is invalid in " + this); } else { if (RequiredLevel == 0) { RequiredLevel = Spell.Level; } if (entry.TrainerEntry == null) { entry.TrainerEntry = new TrainerEntry(); } entry.TrainerEntry.AddSpell(this); } } }
private static void CreateCustomEntry(NPCId npcId, NpcCustomEntryId customEntryId, float healthMod, float otherStatsMod, int maxLevel, float speedMod, NpcCustomEntrySettings npcCustomEntrySettings, bool isAggressive = true) { var entry = NPCMgr.GetEntry(npcId).Clone(); entry.SetLevel(maxLevel - 5); if (npcCustomEntrySettings.Health != null) { entry.SetHealth((int)(npcCustomEntrySettings.Health.Value * healthMod)); } if (npcCustomEntrySettings.PDef != null) { entry.Resistances[(int)DamageSchool.Physical] = (int)(npcCustomEntrySettings.PDef.Value * otherStatsMod); } if (npcCustomEntrySettings.MDef != null) { entry.Resistances[(int)DamageSchool.Magical] = (int)(npcCustomEntrySettings.MDef.Value * otherStatsMod); } if (npcCustomEntrySettings.Damage != null) { entry.MinDamage = npcCustomEntrySettings.Damage.Value * 0.9f * otherStatsMod; entry.MaxDamage = npcCustomEntrySettings.Damage.Value * 1.1f * otherStatsMod; } if (npcCustomEntrySettings.Speed != null) { entry.RunSpeed = npcCustomEntrySettings.Speed.Value * speedMod; entry.WalkSpeed = npcCustomEntrySettings.Speed.Value * speedMod; } entry.IsAgressive = isAggressive; NPCMgr.AddEntry((uint)customEntryId, entry); entry.NPCId = npcId; }
public NPC CreateMob(Faction faction) { Setup.EnsureNPCsLoaded(); var newNpc = NPCMgr.GetEntry(DefaultMobId).Create(); return(newNpc); }
private static void CreateCustomEntry(NPCId npcId, NpcCustomEntryId customEntryId, float healthMod, float otherStatsMod, int maxLevel, float speedMod, NpcCustomEntries.NpcCustomEntrySettings npcCustomEntrySettings, bool isAggressive = true) { NPCEntry entry = NPCMgr.GetEntry(npcId).Clone <NPCEntry>(); entry.SetLevel(maxLevel - 5); if (npcCustomEntrySettings.Health.HasValue) { entry.SetHealth((int)((double)npcCustomEntrySettings.Health.Value * (double)healthMod)); } if (npcCustomEntrySettings.PDef.HasValue) { entry.Resistances[0] = (int)((double)npcCustomEntrySettings.PDef.Value * (double)otherStatsMod); } if (npcCustomEntrySettings.MDef.HasValue) { entry.Resistances[1] = (int)((double)npcCustomEntrySettings.MDef.Value * (double)otherStatsMod); } if (npcCustomEntrySettings.Damage.HasValue) { entry.MinDamage = (float)npcCustomEntrySettings.Damage.Value * 0.9f * otherStatsMod; entry.MaxDamage = (float)npcCustomEntrySettings.Damage.Value * 1.1f * otherStatsMod; } if (npcCustomEntrySettings.Speed.HasValue) { entry.RunSpeed = npcCustomEntrySettings.Speed.Value * speedMod; entry.WalkSpeed = npcCustomEntrySettings.Speed.Value * speedMod; } entry.IsAgressive = isAggressive; NPCMgr.AddEntry((uint)customEntryId, entry); entry.NPCId = npcId; }
public static void WriteAll() { DBSetup.Initialize(); World.EnsureMapDataLoaded(); SpellHandler.Initialize(); FactionMgr.Initialize(); SkillHandler.Initialize(); TalentMgr.Initialize(); WriteZoneEnum(); WriteMapEnum(); WriteSkillEnums(); WriteRangeEnum(); WriteFactionEnums(); WriteSpellFocusEnum(); WriteSpellId(); WriteSpellMechanicEnum(); WriteTalentEnums(); WriteItemId(); WriteItemSetId(); WriteNpcId(); WriteGOEntryId(); WriteRealmCategory(); NPCMgr.ForceInitialize(); WriteRideEnum(); }
protected override void Apply() { var owner = m_aura.Auras.Owner; owner.Dismount(); displayId = owner.DisplayId; if (m_spellEffect.MiscValue > 0) { if (NPCMgr.EntriesLoaded) { var npcEntry = NPCMgr.GetEntry((uint)m_spellEffect.MiscValue); if (npcEntry == null) { log.Warn("Transform spell {0} has invalid creature-id {1}", m_aura.Spell, m_spellEffect.MiscValue); } else { owner.Model = npcEntry.GetRandomModel(); } } } else { log.Warn("Transform spell {0} has no creature-id set", m_aura.Spell); } }
public void FinalizeDataHolder() { Template = ItemMgr.GetTemplate(ItemId); if (Template == null) { ContentMgr.OnInvalidDBData("{0} has invalid ItemId: {1} ({2})", this, ItemId, (int)ItemId); } else { var list = NPCMgr.GetOrCreateVendorList(VendorId); // set defaults if (StockAmount < 0) { StockAmount = Template.StockAmount; } if (StockRefillDelay < 0) { StockRefillDelay = Template.StockRefillDelay; } remainingStackAmount = StockAmount; list.Add(this); } }
public void PrepareNpcEntriesList() { foreach (Asda2GuildWaveNpc npc in npcTemplates[currentWaveNumber]) { for (int i = 0; i < npc.NpcCount; ++i) { var entry = NPCMgr.GetEntry((uint)npc.NpcId); //entry.SetHealth((entry.MaxHealth * (Difficulty == 0 ? 2 : Difficulty == 1 ? 4 : Difficulty == 2 ? 6 : 1))); // npcTemplate.Add(entry); if (Difficulty == 0) { entry.SetHealth(entry.MaxHealth); entry.SetDamage(entry.MaxDamage); } else if (Difficulty == 1) { entry.SetHealth(entry.MaxHealth); entry.SetDamage(entry.MaxDamage); } else if (Difficulty == 2) { entry.SetHealth(entry.MaxHealth); entry.SetDamage(entry.MaxDamage); } else { npcTemplate.Add(entry); } npcTemplate.Add(entry); } } npcsCount1 = npcTemplate.Count / 2; npcsCount2 = npcTemplate.Count - npcsCount1; }
private static void OnLoadClicked(GossipConversation convo) { GOMgr.LoadAllLater(); NPCMgr.LoadAllLater(); convo.Character.SendSystemMessage(RealmLangKey.PleaseWait); convo.Character.AddUpdateAction(new PeriodicLoadMapTimer(convo)); }
public void FinalizeDataHolder() { var spawn = NPCMgr.GetSpawnEntry(NPCSpawnId); var gossipEntry = GossipMgr.GetEntry(GossipId); if (spawn == null) { ContentMgr.OnInvalidDBData("{0} refers to invalid spawn id: {1}", GetType(), this); } else if (gossipEntry == null) { ContentMgr.OnInvalidDBData("{0} has invalid GossipId: {1}", GetType(), this); } else { var entry = spawn.Entry; if (entry.DefaultGossip == null) { entry.DefaultGossip = new GossipMenu(gossipEntry); } else { entry.DefaultGossip.GossipEntry = gossipEntry; } //entry.NPCFlags |= NPCFlags.Gossip; } }
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; } }
protected override void Apply() { Unit owner = this.m_aura.Auras.Owner; owner.Dismount(); this.displayId = owner.DisplayId; if (this.m_spellEffect.MiscValue > 0) { if (!NPCMgr.EntriesLoaded) { return; } NPCEntry entry = NPCMgr.GetEntry((uint)this.m_spellEffect.MiscValue); if (entry == null) { TransformHandler.log.Warn("Transform spell {0} has invalid creature-id {1}", (object)this.m_aura.Spell, (object)this.m_spellEffect.MiscValue); } else { owner.Model = entry.GetRandomModel(); } } else { TransformHandler.log.Warn("Transform spell {0} has no creature-id set", (object)this.m_aura.Spell); } }
public static void WriteVehicles() { Tools.StartRealm(); NPCMgr.Initialize(); NPCMgr.LoadNPCDefs(); using (var writer = new IndentTextWriter(ToolConfig.OutputDir + "Vehicles.txt")) { foreach (var entry in NPCMgr.GetAllEntries()) { if (entry.IsVehicle) { writer.WriteLine(entry); } } foreach (var entry in NPCMgr.GetAllEntries()) { if (entry.IsVehicle) { entry.Dump(writer); writer.WriteLine(); writer.WriteLine(" ################################### "); writer.WriteLine(); } } } }
private void SetupSeats() { VehicleSeatEntry[] seats = m_entry.VehicleEntry.Seats; _seats = new VehicleSeat[seats.Length]; for (int i = 0; i < seats.Length; i++) { VehicleSeatEntry entry = seats[i]; if (entry != null) { _seats[i] = new VehicleSeat(this, entry, (byte)i); if (_seats[i].Entry.PassengerNPCId != 0u) { HasUnitAttachment = true; _seats[i].CharacterCanEnterOrExit = false; int seat = i; AddMessage(delegate { NPCEntry ent = NPCMgr.GetEntry(entry.PassengerNPCId); if (ent == null) { return; } NPC npc = ent.SpawnAt(this, false); npc.Brain.EnterDefaultState(); _seats[seat].Enter(npc); }); } } } }
private void SpawnMob(int x, int y, uint npcId, IWorldLocation dest) { Vector3 pos = new Vector3(dest.Position.X + x, dest.Position.Y + y); WorldLocation worldLocation = new WorldLocation(dest.Map, pos, 1U); NPCMgr.GetEntry(npcId).SpawnAt(worldLocation, false).Brain.State = BrainState.Roam; }
private static bool TonkConsoleUsed(GameObject go, Character user) { go.State = GameObjectState.Disabled; var tonkEntry = NPCMgr.GetEntry(SteamTonkNPCId); var tonk = tonkEntry.SpawnAt(user); tonk.Summoner = user; //Remove any of the special abilities from the tonk entry //and add a random one foreach (var tonkSpell in SpecialTonkSpells.Where(tonkSpell => tonkEntry.Spells.ContainsKey(tonkSpell))) { tonkEntry.Spells.Remove(tonkSpell); } var rand = new Random(); tonkEntry.AddSpell(SpecialTonkSpells[rand.Next(0, 3)]); var cast = user.SpellCast; if (cast == null) { go.State = GameObjectState.Enabled; return(false); } if (cast.Start(UseTonkSpellId, false, tonk, user) != SpellFailedReason.Ok) { go.State = GameObjectState.Enabled; return(false); } return(true); }
protected FigurineBase(NPCId id) { if (_sharedAuras == null) { _sharedAuras = new AuraCollection(this); } m_auras = _sharedAuras; GenerateId((uint)id); NPCEntry entry = NPCMgr.GetEntry(id); UnitFlags = UnitFlags.SelectableNotAttackable | UnitFlags.Possessed; DynamicFlags = UnitDynamicFlags.TrackUnit; EmoteState = EmoteType.StateDead; NPCFlags |= NPCFlags.Gossip; Model = entry.GetRandomModel(); EntryId = entry.Id; m_runSpeed = 1f; m_swimSpeed = 1f; m_swimBackSpeed = 1f; m_walkSpeed = 1f; m_walkBackSpeed = 1f; m_flightSpeed = 1f; m_flightBackSpeed = 1f; SetInt32(UnitFields.MAXHEALTH, int.MaxValue); SetInt32(UnitFields.BASE_HEALTH, int.MaxValue); SetInt32(UnitFields.HEALTH, int.MaxValue); SetFloat(ObjectFields.SCALE_X, entry.Scale * DefaultScale); m_evades = true; }
public static void WriteNpcId() { RealmDBMgr.Initialize(); SpellHandler.LoadSpells(); FactionMgr.Initialize(); NPCMgr.LoadAll(); WriteEnum("NPCId", " : uint", "NPCs", NPCMgr.GetAllEntries(), false, (item) => { return(item != null); }, (item) => { return(item.DefaultName); }, entry => { var strs = new List <string>(); if (entry.DefaultTitle.Length > 0) { strs.Add("Title: " + entry.DefaultTitle); } if (entry.MinLevel > 0) { strs.Add("Level: " + entry.MinLevel + (entry.MaxLevel != entry.MinLevel ? " - " + entry.MaxLevel : "")); } if (entry.Rank != CreatureRank.Normal) { strs.Add("Rank: " + entry.Rank + (entry.IsLeader ? " (Leader)" : "")); } else if (entry.IsLeader) { strs.Add("Leader"); } return(strs.ToString("\n")); }, (item, name) => null, (item) => { return(item.Id.ToString()); }); }
public static void FixNPCs() { var warhorseEntry = NPCMgr.GetEntry(NPCId.ArgentWarhorse_6); var battleworgEntry = NPCMgr.GetEntry(NPCId.ArgentBattleworg_2); battleworgEntry.HordeFactionId = warhorseEntry.AllianceFactionId = FactionTemplateId.Friendly; warhorseEntry.HordeFactionId = battleworgEntry.AllianceFactionId = FactionTemplateId.Monster; var battleworg = NPCMgr.GetEntry(NPCId.ArgentBattleworg); if (battleworg != null) { battleworg.AllianceFactionId = FactionTemplateId.Monster; battleworg.HordeFactionId = FactionTemplateId.Friendly; } var warhorse = NPCMgr.GetEntry(NPCId.ArgentWarhorse_5); if (warhorse != null) { warhorse.AllianceFactionId = FactionTemplateId.Friendly; warhorse.HordeFactionId = FactionTemplateId.Monster; } var tank = NPCMgr.GetEntry(NPCId.ReedsSteamTank); if (tank != null) { tank.VehicleId = 192; tank.VehicleAimAdjustment = 3.455752f; tank.HoverHeight = 1; tank.InfoString = "vehichleCursor"; //This is not a typo, "vehichleCursor" denotes the vehicle icon } var mammoth = NPCMgr.GetEntry(NPCId.EnragedMammoth); if (mammoth != null) { mammoth.VehicleId = 145; mammoth.VehicleEntry.Seats[0].AttachmentOffset = new Vector3 { X = 0.5554f, Y = 0.0392f, Z = 7.867001f }; mammoth.VehicleAimAdjustment = 1.658063f; mammoth.HoverHeight = 1; mammoth.SpellTriggerInfo = new SpellTriggerInfo { QuestId = 0, SpellId = SpellId.EnragedMammoth }; } FixAcherusDKTeleporters(); //NPCMgr.Apply(entry => //{ // entry.AddSpell(SpellId.EffectFireNovaRank1); //}, NPCId.FireNovaTotem); SetupMirrorImage(); }
void Awake() { Inst = this; _enemy = gameObject.AddComponent <EnemyMgr>(); _ui = gameObject.AddComponent <UIMgr>(); _shop = gameObject.AddComponent <ShopMgr>(); _npc = gameObject.AddComponent <NPCMgr>(); }
private void SpawnMob(int x, int y, uint npcId, IWorldLocation dest) { var pos = new Vector3(dest.Position.X + x, dest.Position.Y + y); var wl = new WorldLocation(dest.Map, pos); var newNpc = NPCMgr.GetEntry(npcId).SpawnAt(wl); newNpc.Brain.State = BrainState.Roam; }
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); }; }
/// <summary>Finalize this NPCSpawnEntry</summary> /// <param name="addToPool">If set to false, will not try to add it to any pool (recommended for custom NPCSpawnEntry that share a pool)</param> public override void FinalizeDataHolder(bool addToPool) { if (Entry == null) { Entry = NPCMgr.GetEntry(EntryId); if (Entry == null) { ContentMgr.OnInvalidDBData("{0} had an invalid EntryId.", (object)this); return; } } if (EquipmentId != 0U) { Equipment = NPCMgr.GetEquipment(EquipmentId); } if (DisplayIdOverride == 16777215U) { DisplayIdOverride = 0U; } base.FinalizeDataHolder(addToPool); if (MapId != MapId.End) { Entry.SpawnEntries.Add(this); ArrayUtil.Set(ref NPCMgr.SpawnEntries, SpawnId, this); if (addToPool) { AddToPoolTemplate(); } } if (_eventId != 0) { uint id = (uint)Math.Abs(_eventId); WorldEvent worldEvent = WorldEventMgr.GetEvent(id); if (worldEvent != null) { WorldEventNPC worldEventNpc = new WorldEventNPC { _eventId = _eventId, EventId = id, Guid = SpawnId, Spawn = _eventId > 0 }; worldEvent.NPCSpawns.Add(worldEventNpc); } EventId = id; } foreach (NPCSpawnTypeHandler spawnTypeHandler in Entry.SpawnTypeHandlers) { if (spawnTypeHandler != null) { spawnTypeHandler(this); } } }
private static void ApplyEventNPCData(WorldEvent worldEvent) { foreach (var eventNpcData in worldEvent.ModelEquips) { var spawnEntry = NPCMgr.GetSpawnEntry(eventNpcData.Guid); if (spawnEntry == null) { Log.Warn("Invalid Spawn Entry in World Event NPC Data, Entry: {0}", eventNpcData.Guid); continue; } if (eventNpcData.EntryId != 0) { eventNpcData.OriginalEntryId = spawnEntry.EntryId; spawnEntry.EntryId = eventNpcData.EntryId; spawnEntry.Entry = NPCMgr.GetEntry(spawnEntry.EntryId); if (spawnEntry.Entry == null) { Log.Warn("{0} had an invalid World Event EntryId.", spawnEntry); spawnEntry.EntryId = eventNpcData.OriginalEntryId; spawnEntry.Entry = NPCMgr.GetEntry(spawnEntry.EntryId); } } if (eventNpcData.ModelId != 0) { spawnEntry.DisplayIdOverride = eventNpcData.ModelId; } if (eventNpcData.EquipmentId != 0) { eventNpcData.OriginalEquipmentId = spawnEntry.EquipmentId; spawnEntry.EquipmentId = eventNpcData.EquipmentId; spawnEntry.Equipment = NPCMgr.GetEquipment(spawnEntry.EquipmentId); } foreach (var point in spawnEntry.SpawnPoints.ToArray().Where(point => point.IsActive)) { point.Respawn(); if (eventNpcData.SpellIdToCastAtStart == 0) { continue; } Spell spell = SpellHandler.Get(eventNpcData.SpellIdToCastAtStart); if (spell == null) { continue; } SpellCast cast = point.ActiveSpawnling.SpellCast; cast.Start(spell); } } }