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() { 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; } } }
public static void WriteRideEnum() { WriteEnum("MountId", " : uint", "NPCs", SpellHandler.ById, (item) => { return(item.HasEffectWith((effect) => { if (effect.AuraType == AuraType.Mounted && NPCMgr.Mounts.ContainsKey((MountId)item.Effects[0].MiscValue)) { int mountId = item.Effects[0].MiscValue; NPCEntry mount = NPCMgr.Mounts[(MountId)mountId]; return mount != null; } return false; })); }, (item) => { return(item.Name); }, (item) => { var mountId = item.Effects[0].MiscValue; var mount = NPCMgr.Mounts[(MountId)mountId]; uint[] displayIds = mount.DisplayIds; return(displayIds[0].ToString()); }); }
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); } } }
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; } }
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; }
//private void DockPetTalentPoints(int talentBonus) //{ // if (ActivePet != null) // { // if (ActivePet.FreeTalentPoints < talentBonus) // { // DoPetTalentReset(ActivePet.PetRecord); // } // else // { // ActivePet.FreeTalentPoints -= talentBonus; // } // } // if (m_StabledPetRecords != null) // { // foreach (var pet in m_StabledPetRecords) // { // if (pet.FreeTalentPoints < talentBonus) // { // DoPetTalentReset(pet); // } // else // { // pet.FreeTalentPoints -= talentBonus; // } // } // } //} #endregion #region Records internal SummonedPetRecord GetOrCreateSummonedPetRecord(NPCEntry entry) { var record = GetOrCreatePetRecord(entry, SummonedPetRecords); record.PetNumber = (uint)PetMgr.PetNumberGenerator.Next(); return(record); }
private void SpawnMob(int x, int y, NPCEntry entry, IWorldLocation dest) { Vector3 pos = new Vector3(dest.Position.X + x, dest.Position.Y + y); WorldLocation worldLocation = new WorldLocation(dest.Map, pos, 1U); entry.SpawnAt(worldLocation, false).Brain.State = BrainState.GmMove; }
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; if (entry.SpawnEntries == null) { entry.SpawnEntries = new List <NPCSpawnEntry>(3); } spawnEntry = entry.FirstSpawnEntry; } GenerateId(entry.Id); SetEntry(entry); }
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); }); } } } }
protected Figurine(NPCEntry entry) { m_entry = entry; GenerateId(m_entry.Id); UnitFlags = UnitFlags.SelectableNotAttackable | UnitFlags.Possessed; DynamicFlags = UnitDynamicFlags.TrackUnit; EmoteState = EmoteType.StateDead; NPCFlags |= NPCFlags.Gossip; Model = m_entry.GetRandomModel(); EntryId = m_entry.Id; var speed = 10f; m_runSpeed = speed; m_swimSpeed = speed; m_swimBackSpeed = speed; m_walkSpeed = speed; m_walkBackSpeed = speed; m_flightSpeed = speed; m_flightBackSpeed = speed; SetInt32(UnitFields.MAXHEALTH, int.MaxValue); SetInt32(UnitFields.BASE_HEALTH, int.MaxValue); SetInt32(UnitFields.HEALTH, int.MaxValue); // just make a smaller version of the creature to be spawned SetFloat(ObjectFields.SCALE_X, entry.Scale * DefaultScale); IsEvading = 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; }
internal static PermanentPetRecord CreatePermanentPetRecord(NPCEntry entry, uint ownerId) { var record = CreateDefaultPetRecord<PermanentPetRecord>(entry, ownerId); record.PetNumber = (uint)PetNumberGenerator.Next(); record.IsDirty = true; return record; }
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 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); }; }
protected internal override void SetupNPC(NPCEntry entry, SpawnPoint spawnPoint) { base.SetupNPC(entry, spawnPoint); NPCFlags = NPCFlags.SpellClick; SetupSeats(); }
public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry) { var npc = base.Summon(cast, ref targetLoc, entry); npc.HasPermissionToMove = false; return(npc); }
public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry) { NPC npc = entry.SpawnAt(cast.Map, targetLoc, false); npc.RemainingDecayDelayMillis = cast.Spell.GetDuration(cast.CasterReference); npc.Creator = cast.CasterReference.EntityId; return(npc); }
private void SpawnMob(int x, int y, NPCEntry entry, IWorldLocation dest) { var pos = new Vector3(dest.Position.X + x, dest.Position.Y + y); var wl = new WorldLocation(dest.Map, pos); var newNpc = entry.SpawnAt(wl); newNpc.Brain.State = BrainState.GmMove; }
internal static PermanentPetRecord CreatePermanentPetRecord(NPCEntry entry, uint ownerId) { PermanentPetRecord defaultPetRecord = PetMgr.CreateDefaultPetRecord <PermanentPetRecord>(entry, ownerId); defaultPetRecord.PetNumber = (uint)PetMgr.PetNumberGenerator.Next(); defaultPetRecord.IsDirty = true; return(defaultPetRecord); }
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); }; }
private static void InitFlameLeviathan() { FlameLeviathanEntry = NPCMgr.GetEntry(NPCId.FlameLeviathan); FlameLeviathanEntry.BrainCreator = flameLeviathan => new FlameLeviathanBrain(flameLeviathan); FlameLeviathanEntry.Activated += flameLeviathan => { ((BaseBrain)flameLeviathan.Brain).DefaultCombatAction.Strategy = new FlameLeviathanAIAttack(flameLeviathan); }; }
private static void InitAnubrekan() { AnubrekanEntry = NPCMgr.GetEntry(NPCId.AnubRekhan); AnubrekanEntry.BrainCreator = anubrekan => new AnubrekanBrain(anubrekan); AnubrekanEntry.Activated += anubrekan => { ((BaseBrain)anubrekan.Brain).DefaultCombatAction.Strategy = new AnubrekanAIAttack(anubrekan); }; }
private static void InitGrobbulus() { GrobbulusEntry = NPCMgr.GetEntry(NPCId.AnubRekhan); GrobbulusEntry.BrainCreator = grobbulus => new GrobbulusBrain(grobbulus); GrobbulusEntry.Activated += grobbulus => { ((BaseBrain)grobbulus.Brain).DefaultCombatAction.Strategy = new GrobbulusAIAttack(grobbulus); }; }
private static void InitXT002() { XT002 = NPCMgr.GetEntry(NPCId.XT002Deconstructor); XT002.BrainCreator = xt002 => new XT002Brain(xt002); XT002.Activated += xt002 => { ((BaseBrain)xt002.Brain).DefaultCombatAction.Strategy = new XT002AIAttack(xt002); }; }
private static void InitAlgalonTheObserver() { AlgalonTheObserver = NPCMgr.GetEntry(NPCId.AlgalonTheObserver); AlgalonTheObserver.BrainCreator = algalon => new AlgalonTheObserverBrain(algalon); AlgalonTheObserver.Activated += algalon => { ((BaseBrain)algalon.Brain).DefaultCombatAction.Strategy = new AlgalonTheObserverAIAttack(algalon); }; }
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); }; }
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); }
public override NPC Summon(SpellCast cast, ref Vector3 targetLoc, NPCEntry entry) { Unit casterUnit = cast.CasterUnit; if (casterUnit is Character) { return(((Character)casterUnit).SpawnPet(entry, ref targetLoc, cast.Spell.GetDuration(casterUnit.SharedReference))); } return(base.Summon(cast, ref targetLoc, entry)); }
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); }
public override SpellFailedReason Initialize() { 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); return(SpellFailedReason.Error); } return(SpellFailedReason.Ok); }
internal static T CreateDefaultPetRecord<T>(NPCEntry entry, uint ownerId) where T : IPetRecord, new() { var record = new T(); var mode = entry.Type == CreatureType.NonCombatPet ? PetAttackMode.Passive : PetAttackMode.Defensive; record.OwnerId = ownerId; record.AttackMode = mode; record.Flags = PetFlags.None; record.EntryId = entry.NPCId; return record; }
protected internal override void SetupNPC(NPCEntry entry, SpawnPoint spawnPoint) { base.SetupNPC(entry, spawnPoint); NPCFlags = NPCFlags.SpellClick; SetupSeats(); AddMessage(() => { // Set Level/Scale ingame: var level = entry.GetRandomLevel(); Level = level; }); }
protected internal override void SetupNPC(NPCEntry entry, NPCSpawnPoint spawnPoint) { base.SetupNPC(entry, spawnPoint); NPCFlags = NPCFlags.SpellClick; SetupSeats(); SetupMoveFlags(); AddMessage(() => { // Set Level/Scale ingame: var level = entry.GetRandomLevel(); Level = level; PowerType = PowerType.Energy; MaxPower = entry.VehicleEntry.PowerType == VehiclePowerType.Pyrite ? 50 : 100; Power = MaxPower; if (entry.Spells == null) PowerType = PowerType.End; }); }