コード例 #1
0
        /// <summary>
        /// load keep from Db object and load keep component and object of keep
        /// </summary>
        /// <param name="keep"></param>
        public virtual void Load(DBKeep keep)
        {
            CurrentRegion = WorldMgr.GetRegion((ushort)keep.Region);
            InitialiseTimers();
            LoadFromDatabase(keep);
            GameEventMgr.AddHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit));
            KeepArea area = null;

            //see if any keep areas for this keep have already been added via DBArea
            foreach (AbstractArea a in CurrentRegion.GetAreasOfSpot(keep.X, keep.Y, keep.Z))
            {
                if (a is KeepArea && a.Description == keep.Name)
                {
                    log.Debug("Found a DBArea entry for " + keep.Name + ", loading that instead of creating a new one.");
                    area      = a as KeepArea;
                    area.Keep = this;
                    break;
                }
            }

            if (area == null)
            {
                area = new KeepArea(this);
                area.CanBroadcast = true;
                area.CheckLOS     = true;
                CurrentRegion.AddArea(area);
            }
            area.Keep = this;
            this.Area = area;
        }
コード例 #2
0
        /// <summary>
        /// Remove a keep from the database
        /// </summary>
        /// <param name="area"></param>
        public virtual void Remove(KeepArea area)
        {
            Dictionary <string, GameKeepGuard> guards = new Dictionary <string, GameKeepGuard>(Guards);           // Use a shallow copy

            foreach (GameKeepGuard guard in guards.Values)
            {
                guard.Delete();
                guard.DeleteFromDatabase();
            }

            Dictionary <string, GameKeepBanner> banners = new Dictionary <string, GameKeepBanner>(Banners);           // Use a shallow copy

            foreach (GameKeepBanner banner in banners.Values)
            {
                banner.Delete();
                banner.DeleteFromDatabase();
            }

            Dictionary <string, GameKeepDoor> doors = new Dictionary <string, GameKeepDoor>(Doors);           // Use a shallow copy

            foreach (GameKeepDoor door in doors.Values)
            {
                door.Delete();
                GameDoor d = new GameDoor();
                d.CurrentRegionID = door.CurrentRegionID;
                d.DoorID          = door.DoorID;
                d.Heading         = door.Heading;
                d.Level           = door.Level;
                d.Model           = door.Model;
                d.Name            = "door";
                d.Realm           = door.Realm;
                d.State           = eDoorState.Closed;
                d.X = door.X;
                d.Y = door.Y;
                d.Z = door.Z;
                DoorMgr.RegisterDoor(door);
                d.AddToWorld();
            }

            UnloadTimers();
            GameEventMgr.RemoveHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit));
            if (area != null)
            {
                CurrentRegion.RemoveArea(area);
            }

            RemoveFromDatabase();
            GameServer.KeepManager.Keeps[KeepID] = null;
        }
コード例 #3
0
ファイル: AbstractGameKeep.cs プロジェクト: mynew4/DAoC
		/// <summary>
		/// Remove a keep from the database
		/// </summary>
		/// <param name="area"></param>
		public virtual void Remove(KeepArea area)
		{
			foreach (GameKeepGuard guard in (m_guards.Clone() as Hashtable).Values)
			{
				guard.Delete();
				guard.DeleteFromDatabase();
			}

			foreach (GameKeepBanner banner in (m_banners.Clone() as Hashtable).Values)
			{
				banner.Delete();
				banner.DeleteFromDatabase();
			}

			foreach (GameKeepDoor door in (m_doors.Clone() as Hashtable).Values)
			{
				door.Delete();
				GameDoor d = new GameDoor();
				d.CurrentRegionID = door.CurrentRegionID;
				d.DoorID = door.DoorID;
				d.Heading = door.Heading;
				d.Level = door.Level;
				d.Model = door.Model;
				d.Name = "door";
				d.Realm = door.Realm;
				d.State = eDoorState.Closed;
				d.X = door.X;
				d.Y = door.Y;
				d.Z = door.Z;
				DoorMgr.RegisterDoor(door);
				d.AddToWorld();
			}

			UnloadTimers();
			GameEventMgr.RemoveHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit));
			if (area != null)
			{
				CurrentRegion.RemoveArea(area);
			}

			RemoveFromDatabase();
			GameServer.KeepManager.Keeps[KeepID] = null;
		}
コード例 #4
0
ファイル: AbstractGameKeep.cs プロジェクト: mynew4/DAoC
		/// <summary>
		/// load keep from Db object and load keep component and object of keep
		/// </summary>
		/// <param name="keep"></param>
		public virtual void Load(DBKeep keep)
		{
			CurrentRegion = WorldMgr.GetRegion((ushort)keep.Region);
			InitialiseTimers();
			LoadFromDatabase(keep);
			GameEventMgr.AddHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit));
			KeepArea area = null;
			//see if any keep areas for this keep have already been added via DBArea
			foreach (AbstractArea a in CurrentRegion.GetAreasOfSpot(keep.X, keep.Y, keep.Z))
			{
				if (a is KeepArea && a.Description == keep.Name)
				{
					log.Debug("Found a DBArea entry for " + keep.Name + ", loading that instead of creating a new one.");
					area = a as KeepArea;
					area.Keep = this;
					break;
				}
			}

			if (area == null)
			{
				area = new KeepArea(this);
				area.CanBroadcast = true;
				area.CheckLOS = true;
				CurrentRegion.AddArea(area);
			}
			area.Keep = this;
			this.Area = area;
		}