public void FinalizeDataHolder()
		{
			RegionId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId;

			RegionInfo = World.GetRegionInfo(RegionId);
			if (RegionInfo == null)
			{
				ContentHandler.OnInvalidDBData("BattlegroundTemplate had invalid RegionId: {0} (#{1})",
					RegionId, (int)RegionId);
				return;
			}

			if (BattlegroundMgr.Templates.Length <= (int)Id)
			{
				ContentHandler.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})",
					Id, (int)Id);
				return;
			}

			RegionInfo.MinLevel = Math.Max(1, MinLevel);
			RegionInfo.MaxLevel = Math.Max(MinLevel, MaxLevel);

			BattlegroundMgr.Templates[(int)Id] = this;

			CreateQueues();
            SetStartPos();
		}
Exemple #2
0
		public override void Convert(byte[] rawData)
		{
			var rgn = new RegionInfo();

			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_regionInfos, (uint)rgn.Id, rgn);
		}
Exemple #3
0
		public void Finalize(RegionInfo 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;
		}
Exemple #4
0
		public BaseInstance GetActiveInstance(RegionInfo regionInfo)
		{
			var region = m_region;
			if (region != null && region.Id == region.Id)
			{
				return region as BaseInstance;
			}
			var instances = m_InstanceCollection;
			return instances != null ? instances.GetActiveInstance(regionInfo) : null;
		}
Exemple #5
0
		public InstanceTemplate(RegionInfo info)
		{
			m_regionInfo = info;
		}
Exemple #6
0
		/// <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(RegionInfo 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;
		}
Exemple #7
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 region.
		/// </summary>
		/// <param name="info">The RegionInfo of the Instance in question.</param>
		/// <returns>The Instance if found, else null.</returns>
		public BaseInstance GetActiveInstance(RegionInfo info)
		{
			var chr = Character;
			if (chr == null)
			{
				return null;
			}

			var binding = GetBinding(info.Id, info.GetDifficulty(chr.GetInstanceDifficulty(info.IsRaid)).BindingType);
			if (binding != null)
			{
				var instance = World.GetInstance(binding);
				if (instance.IsActive)
				{
					return instance as BaseInstance;
				}
			}
			return null;
		}