public void FinalizeDataHolder() { RegionId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId; RegionTemplate = World.GetRegionTemplate(RegionId); if (RegionTemplate == null) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid RegionId: {0} (#{1})", RegionId, (int)RegionId); return; } if (BattlegroundMgr.Templates.Length <= (int)Id) { ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})", Id, (int)Id); return; } Difficulties = new PvPDifficultyEntry[BattlegroundMgr.PVPDifficultyReader.Entries.Values.Count(entry => (entry.mapId == RegionId))]; foreach (var entry in BattlegroundMgr.PVPDifficultyReader.Entries.Values) { if (entry.mapId == RegionId) Difficulties[entry.bracketId] = entry; } RegionTemplate.MinLevel = Math.Max(1, MinLevel); RegionTemplate.MaxLevel = Math.Max(MinLevel, MaxLevel); BattlegroundMgr.Templates[(int)Id] = this; CreateQueues(); SetStartPos(); }
public override void Convert(byte[] rawData) { var rgn = new RegionTemplate(); rgn.Id = (MapId)GetUInt32(rawData, 0); int i = 2; //rgn.InternalName = GetString(rawData, 1); rgn.Type = (MapType)GetUInt32(rawData, i++); i++; rgn.HasTwoSides = GetUInt32(rawData, i++) != 0; rgn.Name = GetString(rawData, i++); i += 16; i++; //rgn.MinLevel = GetInt32(rawData, 21); //rgn.MaxLevel = GetInt32(rawData, 22); //rgn.MaxPlayerCount = GetInt32(rawData, 23); rgn.AreaTableId = GetUInt32(rawData, i++); // 22 //rgn.LoadScreen = GetUInt32(rawData, 56); //rgn.HordeText = GetString(rawData, 22); //rgn.AllianceText = GetString(rawData, 39); rgn.ParentMapId = (MapId)GetUInt32(rawData, 59); rgn.RepopRegionId = rgn.ParentMapId; rgn.RepopPosition = new Vector3(GetFloat(rawData, 60), GetFloat(rawData, 61), 500); rgn.RequiredClientId = (ClientId)GetUInt32(rawData, 63); rgn.DefaultResetTime = GetInt32(rawData, 64); rgn.MaxPlayerCount = GetInt32(rawData, 65); //rgn.HeroicResetTime = GetUInt32(rawData, 113); //rgn.RaidResetTime = GetUInt32(rawData, 112); ArrayUtil.Set(ref World.s_RegionTemplates, (uint)rgn.Id, rgn); }
public void Finalize(RegionTemplate region) { Region = region; if (ResetTime == 0) { ResetTime = region.DefaultResetTime; } foreach (var diff in Region.Difficulties) { if (diff.MaxPlayerCount == MaxPlayerCount) { // Second entry with the same player count -> Probably heroic IsHeroic = true; break; } } BindingType = !IsHeroic && Region.Type == MapType.Dungeon ? BindingType.Soft : BindingType.Hard; }
internal void Finalize(RegionTemplate region) { Region = region; if (ResetTime == 0) { ResetTime = region.DefaultResetTime; } if (MaxPlayerCount != 0) { // use heuristics to determine whether we have a heroic difficulty: foreach (var diff in Region.Difficulties) { if (diff != null && diff.MaxPlayerCount == MaxPlayerCount) { // Second entry with the same player count -> Probably heroic IsHeroic = true; break; } } } BindingType = !IsHeroic && Region.Type == MapType.Dungeon ? BindingType.Soft : BindingType.Hard; }
public BaseInstance GetActiveInstance(RegionTemplate regionTemplate) { var region = m_region; if (region != null && region.Id == region.Id) { return region as BaseInstance; } var instances = m_InstanceCollection; return instances != null ? instances.GetActiveInstance(regionTemplate) : null; }
/// <summary> /// Checks the list of stored Raid and Heroic instances and the list of recently run Normal /// instances for a reference to the given region. /// </summary> /// <param name="template">The RegionInfo of the Instance in question.</param> /// <returns>The Instance if found, else null.</returns> public BaseInstance GetActiveInstance(RegionTemplate template) { var chr = Character; if (chr == null) { return null; } var binding = GetBinding(template.Id, template.GetDifficulty(chr.GetInstanceDifficulty(template.IsRaid)).BindingType); if (binding != null) { var instance = World.GetInstance(binding); if (instance.IsActive) { return instance as BaseInstance; } } return null; }
/// <summary> /// Gets the Instance of the given Region of either the Leader or any member /// if anyone is already in it. /// </summary> public BaseInstance GetActiveInstance(RegionTemplate region) { // Need to be careful, since we are quite probably not in the corresponding Character's context: var leader = m_leader; if (leader != null) { var leaderChr = leader.Character; if (leaderChr != null) { var instances = leaderChr.Instances; if (instances != null) { var instance = instances.GetActiveInstance(region); if (instance != null) { return instance; } } } } // check all other members foreach (var chr in GetCharacters()) { var instance = chr.GetActiveInstance(region); if (instance != null) { return instance; } } return null; }