public void FinalizeDataHolder() { MapId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId; MapTemplate = World.GetMapTemplate(MapId); if (MapTemplate == null) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid MapId: {0} (#{1})", MapId, (int)MapId); return; } if (BattlegroundMgr.Templates.Length <= (int)Id) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})", Id, (int)Id); return; } MapTemplate.BattlegroundTemplate = this; Difficulties = new PvPDifficultyEntry[BattlegroundMgr.PVPDifficultyReader.Entries.Values.Count(entry => (entry.mapId == MapId))]; foreach (var entry in BattlegroundMgr.PVPDifficultyReader.Entries.Values.Where(entry => (entry.mapId == MapId))) { Difficulties[entry.bracketId] = entry; } MinLevel = MapTemplate.MinLevel = Difficulties.First().minLevel; MaxLevel = MapTemplate.MaxLevel = Difficulties.Last().maxLevel; BattlegroundMgr.Templates[(int)Id] = this; CreateQueues(); SetStartPos(); }
/// <summary> /// Teleports into an instance /// </summary> /// <param name="chr"></param> /// <param name="trigger"></param> /// <returns></returns> public static bool HandleTeleport(Character chr, AreaTrigger trigger) { var mapInfo = World.GetMapTemplate(trigger.Template.TargetMap); #if DEBUG chr.SendSystemMessage("Target location: {0}", trigger.Template.TargetMap); #endif if (mapInfo.IsInstance) { if (mapInfo.Type == MapType.Normal) { InstanceMgr.LeaveInstance(chr, mapInfo, trigger.Template.TargetPos); return(true); } else { return(InstanceMgr.EnterInstance(chr, mapInfo, trigger.Template.TargetPos)); } } else if (mapInfo.BattlegroundTemplate == null) { var rgn = World.GetNonInstancedMap(mapInfo.Id); if (rgn != null) { chr.TeleportTo(rgn, trigger.Template.TargetPos, trigger.Template.TargetOrientation); return(true); } else { ContentMgr.OnInvalidDBData("Invalid Map: " + rgn); } } return(true); }
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 void FinalizeDataHolder() { Spell spell = SpellHandler.Get(this.SpellId); if (spell == null) { ContentMgr.OnInvalidDBData(this.GetType().Name + " for \"{0} {1}\" refers to invalid Spell: {2}.", (object)this.Race, (object)this.Class, (object)this); } else { List <Archetype> archetypes = ArchetypeMgr.GetArchetypes(this.Race, this.Class); if (archetypes == null) { ContentMgr.OnInvalidDBData(this.GetType().Name + " \"{0}\" refers to invalid Archetype: {1} {2}.", (object)this, (object)this.Race, (object)this.Class); } else { foreach (Archetype archetype in archetypes) { archetype.Spells.Add(spell); } } } }
public void FinalizeDataHolder() { AreaTrigger areaTrigger = AreaTriggerMgr.AreaTriggers.Get <AreaTrigger>(this.Id); if (areaTrigger == null) { ContentMgr.OnInvalidDBData("AreaTriggerEntry {0} (#{1}, Type: {2}) had invalid AreaTrigger-id.", (object)this.Name, (object)this.Id, (object)this.Type); } else { areaTrigger.Template = this; if (this.TargetPos.IsSet) { MapTemplate mapTemplate = WCell.RealmServer.Global.World.GetMapTemplate(this.TargetMap); if (mapTemplate != null) { this.Type = AreaTriggerType.Teleport; int num = (int)ArrayUtil.AddOnlyOne <Vector3>(ref mapTemplate.EntrancePositions, this.TargetPos); } } this.Handler = AreaTriggerMgr.GetHandler(this.Type); } }
/// <summary>Teleports into an instance</summary> /// <param name="chr"></param> /// <param name="trigger"></param> /// <returns></returns> public static bool HandleTeleport(Character chr, AreaTrigger trigger) { MapTemplate mapTemplate = World.GetMapTemplate(trigger.Template.TargetMap); if (mapTemplate.IsInstance) { if (mapTemplate.Type != MapType.Normal) { return(InstanceMgr.EnterInstance(chr, mapTemplate, trigger.Template.TargetPos)); } InstanceMgr.LeaveInstance(chr, mapTemplate, trigger.Template.TargetPos); return(true); } if (mapTemplate.BattlegroundTemplate == null) { Map nonInstancedMap = World.GetNonInstancedMap(mapTemplate.Id); if (nonInstancedMap != null) { chr.TeleportTo(nonInstancedMap, trigger.Template.TargetPos, new float?(trigger.Template.TargetOrientation)); return(true); } ContentMgr.OnInvalidDBData("Invalid Map: " + (object)nonInstancedMap); } else { chr.AddMessage((Action)(() => chr.TeleportTo(trigger.Template.TargetMap, trigger.Template.TargetPos))); } return(true); }
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 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); } }
/// <summary> /// Initializes the duel after a new Duel has been proposed /// </summary> private void Initialize() { m_flag = GameObject.Create(GOEntryId.DuelFlag, new WorldLocationStruct(m_Map, (m_challenger.Position + m_rival.Position) / 2f, 1U), null, null); if (m_flag == null) { ContentMgr.OnInvalidDBData("Cannot start Duel: DuelFlag-GameObject (ID: {0}) does not exist.", (object)336); Cancel(); } else { m_flag.Phase = m_challenger.Phase; ((DuelFlagHandler)m_flag.Handler).Duel = this; m_flag.CreatedBy = m_challenger.EntityId; m_flag.Level = m_challenger.Level; m_flag.AnimationProgress = byte.MaxValue; m_flag.Position = m_challenger.Position; m_flag.Faction = m_challenger.Faction; m_flag.ScaleX = m_challenger.ScaleX; m_flag.ParentRotation4 = 1f; m_flag.Orientation = m_challenger.Orientation; m_Map.AddMessage(new Message(() => DuelHandler.SendRequest(m_flag, m_challenger, m_rival))); m_challenger.SetEntityId(PlayerFields.DUEL_ARBITER, m_flag.EntityId); m_rival.SetEntityId(PlayerFields.DUEL_ARBITER, m_flag.EntityId); } }
public new 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 { if (RequiredLevel == 0) { RequiredLevel = Spell.Level; } if (!NPCMgr.TrainerSpellTemplates.ContainsKey(TrainerTemplateId)) { NPCMgr.TrainerSpellTemplates.Add(TrainerTemplateId, new List <TrainerSpellEntry>()); } NPCMgr.TrainerSpellTemplates[TrainerTemplateId].Add(this); } }
public void FinalizeDataHolder() { SpawnEntry = NPCMgr.GetSpawnEntry(SpawnId); if (SpawnEntry == null) { ContentMgr.OnInvalidDBData("{0} had an invalid SpawnId.", this); } else { var added = false; var cur = SpawnEntry.Waypoints.First; while (cur != null) { if (cur.Value.Id > Id) { Node = cur.List.AddBefore(cur, this); added = true; break; } if (cur.Value.Id == Id) { ContentMgr.OnInvalidDBData("Found multiple Waypoints with the same Id {0} for SpawnEntry {1}", Id, SpawnEntry); return; } cur = cur.Next; } if (!added) { SpawnEntry.HasDefaultWaypoints = false; Node = SpawnEntry.Waypoints.AddLast(this); } } }
public void FinalizeDataHolder() { this.MapId = BattlegroundMgr.BattlemasterListReader.Entries[(int)this.Id].MapId; this.MapTemplate = WCell.RealmServer.Global.World.GetMapTemplate(this.MapId); if (this.MapTemplate == null) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid MapId: {0} (#{1})", (object)this.MapId, (object)this.MapId); } else if (BattlegroundMgr.Templates.Length <= (int)this.Id) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})", (object)this.Id, (object)(int)this.Id); } else { this.MapTemplate.BattlegroundTemplate = this; this.Difficulties = new PvPDifficultyEntry[BattlegroundMgr.PVPDifficultyReader.Entries.Values.Count <PvPDifficultyEntry>( (Func <PvPDifficultyEntry, bool>)(entry => entry.mapId == this.MapId))]; foreach (PvPDifficultyEntry pdifficultyEntry in BattlegroundMgr.PVPDifficultyReader.Entries.Values .Where <PvPDifficultyEntry>((Func <PvPDifficultyEntry, bool>)(entry => entry.mapId == this.MapId))) { this.Difficulties[pdifficultyEntry.bracketId] = pdifficultyEntry; } this.MinLevel = this.MapTemplate.MinLevel = ((IEnumerable <PvPDifficultyEntry>) this.Difficulties) .First <PvPDifficultyEntry>().minLevel; this.MaxLevel = this.MapTemplate.MaxLevel = ((IEnumerable <PvPDifficultyEntry>) this.Difficulties) .Last <PvPDifficultyEntry>().maxLevel; BattlegroundMgr.Templates[(int)this.Id] = this; this.CreateQueues(); this.SetStartPos(); } }
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; } } }
/// <summary> /// Initializes the duel after a new Duel has been proposed /// </summary> private void Initialize() { this.m_flag = GameObject.Create(GOEntryId.DuelFlag, (IWorldLocation) new WorldLocationStruct(this.m_Map, (this.m_challenger.Position + this.m_rival.Position) / 2f, 1U), (GOSpawnEntry)null, (GOSpawnPoint)null); if (this.m_flag == null) { ContentMgr.OnInvalidDBData("Cannot start Duel: DuelFlag-GameObject (ID: {0}) does not exist.", (object)336); this.Cancel(); } else { this.m_flag.Phase = this.m_challenger.Phase; ((DuelFlagHandler)this.m_flag.Handler).Duel = this; this.m_flag.CreatedBy = this.m_challenger.EntityId; this.m_flag.Level = this.m_challenger.Level; this.m_flag.AnimationProgress = byte.MaxValue; this.m_flag.Position = this.m_challenger.Position; this.m_flag.Faction = this.m_challenger.Faction; this.m_flag.ScaleX = this.m_challenger.ScaleX; this.m_flag.ParentRotation4 = 1f; this.m_flag.Orientation = this.m_challenger.Orientation; this.m_Map.AddMessage((IMessage) new Message((Action)(() => DuelHandler.SendRequest(this.m_flag, this.m_challenger, this.m_rival)))); this.m_challenger.SetEntityId((UpdateFieldId)PlayerFields.DUEL_ARBITER, this.m_flag.EntityId); this.m_rival.SetEntityId((UpdateFieldId)PlayerFields.DUEL_ARBITER, this.m_flag.EntityId); } }
public void FinalizeDataHolder() { var trigger = AreaTriggerMgr.AreaTriggers.Get(Id); if (trigger == null) { ContentMgr.OnInvalidDBData("AreaTriggerEntry {0} (#{1}, Type: {2}) had invalid AreaTrigger-id.", Name, Id, Type); return; } else { trigger.Template = this; } if (TargetPos.IsSet) { var map = World.GetMapTemplate(TargetMap); if (map != null) { Type = AreaTriggerType.Teleport; ArrayUtil.AddOnlyOne(ref map.EntrancePositions, TargetPos); } } Handler = AreaTriggerMgr.GetHandler(Type); }
public void FinalizeDataHolder() { QuestTemplate template = QuestMgr.GetTemplate(QuestId); if (template == null) { ContentMgr.OnInvalidDBData( GetType().Name + " (QuestGiverId: {0}) referred to invalid QuestId: " + QuestId, (object)QuestGiverId); } else { ObjectTemplate objectTemplate = ObjectTemplate; if (objectTemplate == null) { ContentMgr.OnInvalidDBData( GetType().Name + " (QuestId: {0}) referred to invalid QuestGiverId: " + QuestGiverId, (object)QuestId); } else { QuestHolderInfo questHolderInfo = objectTemplate.QuestHolderInfo; bool flag = questHolderInfo == null; if (flag) { objectTemplate.QuestHolderInfo = questHolderInfo = new QuestHolderInfo(); } switch (RelationType) { case QuestGiverRelationType.Starter: questHolderInfo.QuestStarts.Add(template); template.Starters.Add(objectTemplate); if (!flag) { break; } ++QuestMgr._questStarterCount; break; case QuestGiverRelationType.Finisher: questHolderInfo.QuestEnds.Add(template); template.Finishers.Add(objectTemplate); if (!flag) { break; } ++QuestMgr._questFinisherCount; break; default: ContentMgr.OnInvalidDBData( GetType().Name + " (Quest: {0}, QuestGiver: {1}) had invalid QuestGiverRelationType: " + RelationType, (object)QuestId, (object)QuestGiverId); break; } } } }
/// <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); } } }
public void FinalizeDataHolder() { var template = QuestMgr.GetTemplate(QuestId); if (template == null) { ContentMgr.OnInvalidDBData(GetType().Name + " (QuestGiverId: {0}) referred to invalid QuestId: " + QuestId, QuestGiverId); } else { var entry = ObjectTemplate; if (entry == null) { ContentMgr.OnInvalidDBData(GetType().Name + " (QuestId: {0}) referred to invalid QuestGiverId: " + QuestGiverId, QuestId); } else { var qgEntry = entry.QuestHolderInfo; var newQg = qgEntry == null; if (newQg) { entry.QuestHolderInfo = qgEntry = new QuestHolderInfo(); } switch (RelationType) { case QuestGiverRelationType.Starter: { qgEntry.QuestStarts.Add(template); template.Starters.Add(entry); if (newQg) { QuestMgr._questStarterCount++; } break; } case QuestGiverRelationType.Finisher: { qgEntry.QuestEnds.Add(template); template.Finishers.Add(entry); if (newQg) { QuestMgr._questFinisherCount++; } break; } default: ContentMgr.OnInvalidDBData(GetType().Name + " (Quest: {0}, QuestGiver: {1}) had invalid QuestGiverRelationType: " + RelationType, QuestId, QuestGiverId); break; } } } }
public void FinalizeDataHolder() { if (EquipmentId > 100000) { ContentMgr.OnInvalidDBData("NPCEquipmentEntry had invalid Id: " + EquipmentId); return; } ArrayUtil.Set(ref NPCMgr.EquipmentEntries, EquipmentId, this); }
public void FinalizeDataHolder() { var criteriaEntry = AchievementMgr.GetCriteriaEntryById(CriteriaId); if (criteriaEntry == null) { ContentMgr.OnInvalidDBData("{0} had an invalid criteria id.", this); return; } criteriaEntry.RequirementSet.Add(this); }
public void FinalizeDataHolder() { var achievementEntry = AchievementMgr.AchievementEntries[AchievementEntryId]; if (achievementEntry == null) { ContentMgr.OnInvalidDBData("{0} had an invalid AchievementEntryId.", this); return; } achievementEntry.Rewards.Add(this); }
public void FinalizeDataHolder() { if (this.EquipmentId > 100000U) { ContentMgr.OnInvalidDBData("NPCEquipmentEntry had invalid Id: " + (object)this.EquipmentId); } else { ArrayUtil.Set <NPCEquipmentEntry>(ref NPCMgr.EquipmentEntries, this.EquipmentId, this); } }
public void FinalizeDataHolder() { AchievementEntry achievementEntry = AchievementMgr.AchievementEntries[this.AchievementEntryId]; if (achievementEntry == null) { ContentMgr.OnInvalidDBData("{0} had an invalid AchievementEntryId.", (object)this); } else { achievementEntry.Rewards.Add(this); } }
public void FinalizeDataHolder() { AchievementCriteriaEntry criteriaEntryById = AchievementMgr.GetCriteriaEntryById(this.CriteriaId); if (criteriaEntryById == null) { ContentMgr.OnInvalidDBData("{0} had an invalid criteria id.", (object)this); } else { criteriaEntryById.RequirementSet.Add(this); } }
public void FinalizeDataHolder() { if (DisplayId > 100000) { ContentMgr.OnInvalidDBData("ModelInfo has invalid Id: " + this); return; } if (CombatReach < 1.5f) { CombatReach = 1.5f; } ArrayUtil.Set(ref UnitMgr.ModelInfos, DisplayId, this); }
public void FinalizeDataHolder() { var clss = ArchetypeMgr.GetClass(ClassId); if (clss == null) { ContentMgr.OnInvalidDBData("Invalid ClassId in BaseClassSetting: {0} ({1})", ClassId, (int)ClassId); } else { ArrayUtil.Set(ref clss.Settings, Level, this); } }
public void FinalizeDataHolder() { BaseClass baseClass = ArchetypeMgr.GetClass(this.ClassId); if (baseClass == null) { ContentMgr.OnInvalidDBData("Invalid ClassId in BaseClassSetting: {0} ({1})", (object)this.ClassId, (object)(int)this.ClassId); } else { ArrayUtil.Set <ClassLevelSetting>(ref baseClass.Settings, this.Level, this); } }
public virtual void FinalizeDataHolder() { if (Id != 0U) { GOId = (GOEntryId)Id; } else { Id = (uint)GOId; } if (FactionId != FactionTemplateId.None) { Faction = FactionMgr.Get(FactionId); } InitEntry(); if (GossipId != 0U && DefaultGossip == null) { if (GossipMgr.GetEntry(GossipId) == null) { ContentMgr.OnInvalidDBData("GOEntry {0} has missing GossipId: {1}", (object)this, (object)GossipId); DefaultGossip = new GossipMenu(); } else { DefaultGossip = new GossipMenu(GossipId); } } else if (QuestHolderInfo != null) { DefaultGossip = new GossipMenu(); } if (HandlerCreator == null) { HandlerCreator = GOMgr.Handlers[(int)Type]; } if (GOCreator == null) { GOCreator = !IsTransport ? () => new GameObject() : (Func <GameObject>)(() => (GameObject) new Transport()); } if (Fields == null) { return; } GOMgr.Entries[Id] = this; }
public void FinalizeDataHolder() { Spell spell1 = SpellHandler.Get(this.SpellId); Spell spell2 = SpellHandler.Get(this.AddSpellId); if (spell1 == null || spell2 == null) { ContentMgr.OnInvalidDBData("Invalid SpellLearnRelation: Spell {0} (#{1}) and AddSpell {2} (#{3})", (object)this.SpellId, (object)this.SpellId, (object)this.AddSpellId, (object)this.AddSpellId); } else { spell1.AdditionallyTaughtSpells.Add(spell2); } }
public void FinalizeDataHolder() { BoundingRadius = BoundingRadius / 3; CombatReach = CombatReach / 3; if (DisplayId > 100000) { ContentMgr.OnInvalidDBData("ModelInfo has invalid Id: " + this); return; } if (CombatReach < 0.5f) { CombatReach = 0.5f; } ArrayUtil.Set(ref UnitMgr.ModelInfos, DisplayId, this); }