Exemplo n.º 1
0
		[TestFixtureSetUp] public override void Init()
		{
			base.Init();
			RegionData data = new RegionData();
			data.Id = 5555;
			data.Name = "reg data1";
			data.Description = "reg test1";
			data.Mobs = new Mob[0];
			m_reg = WorldMgr.RegisterRegion(new GameTimer.TimeManager("RegTest1"), data);
			//WorldMgr.RegisterZone(5555, 5555, "test zone1", 0, 0, 16, 16);
			m_reg.StartRegionMgr();
		}
Exemplo n.º 2
0
		/// <summary>
		/// Create a new Instance of <see cref="RegionWeather"/>
		/// </summary>
		public RegionWeather(Region Region)
		{
			this.Region = Region;
			WeatherMinPosition = (uint)Math.Max(0, Region.Zones.Min(z => z.XOffset));
			WeatherMaxPosition = (uint)Math.Max(0, Region.Zones.Max(z => z.XOffset + z.Width));
		}
Exemplo n.º 3
0
        public void Delete()
        {
            for (int i = 0; i < SUBZONE_NBR; i++)
            {
                if (m_subZoneElements[i] != null)
                {
                    for (int k = 0; k < m_subZoneElements[i].Length; k++)
                    {
                        if (m_subZoneElements[i][k] != null)
                        {
                            m_subZoneElements[i][k].data = null;
                            m_subZoneElements[i][k] = null;
                        }
                    }

                    m_subZoneElements[i] = null;
                }
            }

            m_subZoneElements = null;
            m_subZoneTimestamps = null;
            m_Region = null;
            DOL.Events.GameEventMgr.RemoveAllHandlersForObject(this);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new Zone object
        /// </summary>
        /// <param name="region">the parent region</param>
        /// <param name="id">the zone id (eg. 15)</param>
        /// <param name="desc">the zone description (eg. "Camelot Hills")</param>
        /// <param name="xoff">the X offset of this zone inside the region</param>
        /// <param name="yoff">the Y offset of this zone inside the region</param>
        /// <param name="width">the Width of this zone</param>
        /// <param name="height">the Height of this zone</param>
        /// <param name="zoneskinID">For clientside positioning in instances: The 'fake' zoneid we send to clients.</param>
        public Zone(Region region, ushort id, string desc, int xoff, int yoff, int width, int height, ushort zoneskinID, bool isDivingEnabled, int waterlevel, bool islava, int xpBonus, int rpBonus, int bpBonus, int coinBonus, byte realm)
        {
            m_Region = region;
            m_ID = id;
            m_Description = desc;
            m_XOffset = xoff;
            m_YOffset = yoff;
            m_Width = width;
            m_Height = height;
            m_zoneSkinID = zoneskinID;
            m_waterlevel = waterlevel;
            m_isDivingEnabled = isDivingEnabled;
            m_isLava = islava;

            m_bonusXP = xpBonus;
            m_bonusRP = rpBonus;
            m_bonusBP = bpBonus;
            m_bonusCoin = coinBonus;

            // initialise subzone objects and counters
            m_subZoneElements = new SubNodeElement[SUBZONE_NBR][];
            m_initialized = false;
            m_realm = (eRealm)realm;
        }
		/// <summary>
		/// Get Client Spot Description Checking Any Area with Description or Zone Description and Try Translating it
		/// </summary>
		/// <param name="client"></param>
		/// <param name="region"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <param name="z"></param>
		/// <returns></returns>
		public static string GetTranslatedSpotDescription(this GameClient client, Region region, int x, int y, int z)
		{
			return region.GetTranslatedSpotDescription(client, x, y, z);
		}
		/// <summary>
		/// Get Player Spot Description Checking Any Area with Description or Zone Description and Try Translating it
		/// </summary>
		/// <param name="player"></param>
		/// <param name="region"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <param name="z"></param>
		/// <returns></returns>
		public static string GetTranslatedSpotDescription(this GamePlayer player, Region region, int x, int y, int z)
		{
			return player.Client.GetTranslatedSpotDescription(region, x, y, z);
		}
		public void SendDoorState(Region region, IDoor door) { }
Exemplo n.º 8
0
		public void SendDoorState(Region region, IDoor door)
		{
			if (SendDoorStateMethod != null) SendDoorStateMethod(this, region, door);
		}
Exemplo n.º 9
0
		/// <summary>
		/// UnRegister a Stopped Region from Weather Manager
		/// Should not be used Externally
		/// </summary>
		/// <param name="region"></param>
		public void UnRegisterRegion(Region region)
		{
			ScheduledTask task;
			lock (LockObject)
			{
				if (RegionsTasks.TryGetValue(region.ID, out task))
					RegionsTasks.Remove(region.ID);
			}
			
			// Stopping Timer is locking on Task Thread
			if (task != null)
				task.Stop();
			
			lock (LockObject)
			{
				RegionWeather weather;
				if (RegionsWeather.TryGetValue(region.ID, out weather))
				{
					RegionsWeather.Remove(region.ID);
					
					if (weather.StartTime != 0)
						StopWeather(weather);
				}
				else
				{
					if (log.IsWarnEnabled)
						log.WarnFormat("Trying to Remove Region {0} (ID:{1}) from WeatherManager but was not registered!", region.Description, region.ID);
				}
			}
		}
Exemplo n.º 10
0
		/// <summary>
		/// Register a new Region to Weather Manager
		/// Should not be used Externally
		/// </summary>
		/// <param name="region"></param>
		public void RegisterRegion(Region region)
		{
			lock (LockObject)
			{
				if (!RegionsWeather.ContainsKey(region.ID))
				{
					try
					{
						// scope copy for thread safety
						var regionId = region.ID;

						RegionsWeather.Add(regionId, new RegionWeather(region));
						RegionsTasks.Add(regionId, Scheduler.Start(() => OnWeatherTick(regionId), 1));
						
					}
					catch (Exception ex)
					{
						if (log.IsErrorEnabled)
							log.ErrorFormat("Error While Registering Region's Weather : {0} (ID:{1})\n{2}", region.Description, region.ID, ex);
					}
				}
				else
				{
					if (log.IsWarnEnabled)
						log.WarnFormat("Trying to Add Region {0} (ID:{1}) to WeatherManager while already Registered!", region.Description, region.ID);
				}
			}
		}
Exemplo n.º 11
0
 protected override void GetPetLocation(out int x, out int y, out int z, out ushort heading, out Region region)
 {
     base.GetPetLocation(out x, out y, out z, out heading, out region);
     heading = Caster.Heading;
 }
Exemplo n.º 12
0
		/// <summary>
		/// Creates and adds a new region to the WorldMgr
		/// </summary>
		/// <param name="time">Time manager for the region</param>
		/// <param name="data">The region data</param>
		/// <returns>Registered region</returns>
		public static Region RegisterRegion(GameTimer.TimeManager time, RegionData data)
		{
			Region region = new Region(time, data);
			lock (m_regions.SyncRoot)
			{
				m_regions.Add(data.Id, region);
			}
			return region;
		}