Esempio n. 1
0
		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();
		}
Esempio n. 2
0
		internal void Finalize(MapTemplate map)
		{
			Map = map;
			if (ResetTime == 0)
			{
				ResetTime = map.DefaultResetTime;
			}

			//if (Map.Type == MapType.Dungeon)
			//{
			//    IsHeroic = Index == 1;
			//}
			//else if (MaxPlayerCount != 0)
			//{
			//    // use heuristics to determine whether we have heroic difficulty:
			//    foreach (var diff in Map.Difficulties)
			//    {
			//        if (diff != null && diff.MaxPlayerCount == MaxPlayerCount)
			//        {
			//            // Second entry with the same player count -> Probably heroic
			//            IsHeroic = true;
			//            break;
			//        }
			//    }
			//}
			IsHeroic = ResetTime == HeroicResetTime;
			IsRaid = MaxPlayerCount == MaxDungeonPlayerCount;

			BindingType = IsDungeon ? BindingType.Soft : BindingType.Hard;
		}
Esempio n. 3
0
		public override void Convert(byte[] rawData)
		{
			var rgn = new MapTemplate();

			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.RepopMapId = 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_MapTemplates, (uint)rgn.Id, rgn);
		}
Esempio n. 4
0
		internal void Finalize(MapTemplate map)
		{
			Map = map;
			if (ResetTime == 0)
			{
				ResetTime = map.DefaultResetTime;
			}

			if (MaxPlayerCount != 0)
			{
				// use heuristics to determine whether we have a heroic difficulty:
				foreach (var diff in Map.Difficulties)
				{
					if (diff != null && diff.MaxPlayerCount == MaxPlayerCount)
					{
						// Second entry with the same player count -> Probably heroic
						IsHeroic = true;
						break;
					}
				}
			}

			BindingType = !IsHeroic && Map.Type == MapType.Dungeon ? BindingType.Soft : BindingType.Hard;
		}
Esempio n. 5
0
		/// <summary>
		/// Checks the list of stored Raid and Heroic instances and the list of recently run Normal 
		/// instances for a reference to the given map.
		/// </summary>
		/// <param name="template">The MapInfo of the Instance in question.</param>
		/// <returns>The Instance if found, else null.</returns>
		public BaseInstance GetActiveInstance(MapTemplate 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 = InstanceMgr.Instances.GetInstance(binding.MapId, binding.InstanceId);
				if (instance.IsActive)
				{
					return instance as BaseInstance;
				}
			}
			return null;
		}
Esempio n. 6
0
		public BaseInstance GetActiveInstance(MapTemplate mapTemplate)
		{
			var map = m_Map;
			if (map != null && map.Id == map.Id)
			{
				return map as BaseInstance;
			}
			var instances = m_InstanceCollection;
			return instances != null ? instances.GetActiveInstance(mapTemplate) : null;
		}
Esempio n. 7
0
		public InstanceTemplate(MapTemplate template)
		{
			m_MapTemplate = template;
		}