public static void SetCreator(BattlegroundId id, string typeName) { Type type = ServerApp <WCell.RealmServer.RealmServer> .GetType(typeName); BattlegroundTemplate template = BattlegroundMgr.GetTemplate(id); if (type == (Type)null || template == null) { object obj1; object obj2; if (type == (Type)null) { obj1 = (object)"type"; obj2 = (object)string.Format("({0}) - Please correct it in the Battleground-config file: {1}", (object)typeName, (object)InstanceConfigBase <BattlegroundConfig, BattlegroundId> .Filename); } else { obj1 = (object)"Template"; obj2 = (object)"<not in DB>"; } BattlegroundMgr.log.Warn("Battleground {0} has invalid {1} {2}", (object)id, obj1, obj2); } else { IProducer producer = AccessorMgr.GetOrCreateDefaultProducer(type); template.Creator = (BattlegroundCreator)(() => (Battleground)producer.Produce()); } }
public static void InitializeBGs() { BattlegroundMgr.BattlemasterListReader = new MappedDBCReader <BattlemasterList, BattlemasterConverter>( RealmServerConfiguration.GetDBCFile("BattlemasterList.dbc")); BattlegroundMgr.PVPDifficultyReader = new MappedDBCReader <PvPDifficultyEntry, PvPDifficultyConverter>( RealmServerConfiguration.GetDBCFile("PvpDifficulty.dbc")); ContentMgr.Load <BattlegroundTemplate>(); BattlegroundMgr.DeserterSpell = SpellHandler.Get(BattlegroundMgr.DeserterSpellId); BattlegroundMgr.Loaded = true; BattlegroundConfig.LoadSettings(); BattlegroundMgr.EnsureBattlemasterRelations(); }
/// <summary>Enqueues players in a battleground queue.</summary> /// <param name="chr">the character who enqueued</param> /// <param name="bgId">the type of battleground</param> /// <param name="instanceId">the instance id of the battleground</param> /// <param name="asGroup">whether or not to enqueue the character or his/her group</param> internal static void EnqueuePlayers(Character chr, BattlegroundId bgId, uint instanceId, bool asGroup) { if (!chr.Battlegrounds.HasAvailableQueueSlots) { BattlegroundHandler.SendBattlegroundError((IPacketReceiver)chr, BattlegroundJoinError.Max3Battles); } else { if (chr.Battlegrounds.IsEnqueuedFor(bgId)) { return; } BattlegroundTemplate template = BattlegroundMgr.GetTemplate(bgId); if (template == null) { return; } template.TryEnqueue(chr, asGroup, instanceId); } }
public void FinalizeDataHolder() { NPCEntry entry = NPCMgr.GetEntry(this.BattleMasterId); if (entry == null) { ContentMgr.OnInvalidDBData("Invalid BattleMaster in: " + (object)this); } else { BattlegroundTemplate template = BattlegroundMgr.GetTemplate(this.BattlegroundId); if (template == null) { ContentMgr.OnInvalidDBData("Invalid Battleground in: " + (object)this); } else { entry.BattlegroundTemplate = template; } } }
public void FinalizeDataHolder() { var bm = NPCMgr.GetEntry(BattleMasterId); if (bm == null) { ContentMgr.OnInvalidDBData("Invalid BattleMaster in: " + this); } else { var bg = BattlegroundMgr.GetTemplate(BattlegroundId); if (bg == null) { ContentMgr.OnInvalidDBData("Invalid Battleground in: " + this); } else { bm.BattlegroundTemplate = bg; } } }
protected override void InitSetting(InstanceConfigEntry <BattlegroundId> configEntry) { BattlegroundMgr.SetCreator(configEntry.Name, configEntry.TypeName.Trim()); }
/// <summary> /// Gets the <see cref="T:WCell.RealmServer.Battlegrounds.BattlegroundQueue" /> for a specific instance of the given Battleground for /// the given Character. /// </summary> /// <param name="bgid"></param> /// <returns></returns> public static BattlegroundQueue GetInstanceQueue(BattlegroundId bgid, uint instanceId, Unit unit) { return(BattlegroundMgr.GetInstanceQueue(bgid, instanceId, unit.Level)); }
/// <summary> /// Gets the global <see cref="T:WCell.RealmServer.Battlegrounds.BattlegroundQueue" /> for the given Battleground for /// the given Character. /// </summary> /// <param name="bgid"></param> /// <returns></returns> public static GlobalBattlegroundQueue GetGlobalQueue(BattlegroundId bgid, Unit unit) { return(BattlegroundMgr.GetGlobalQueue(bgid, unit.Level)); }
public static void SetCreator(BattlegroundId id, BattlegroundCreator creator) { BattlegroundMgr.GetTemplate(id).Creator = creator; }
public GlobalBattlegroundQueue(BattlegroundId bgid) : this(BattlegroundMgr.GetTemplate(bgid)) { }