/// <summary>
            /// Called on every timer tick
            /// </summary>
            protected override void OnTick()
            {
                var player = (GamePlayer)m_actionSource;
                List<IDoor> doorList = DoorMgr.getDoorByID(m_doorId);

                if (doorList.Count > 0)
                {
                    bool success = false;
                    foreach (IDoor mydoor in doorList)
                    {
                        if (success)
                            break;
                        if (mydoor is GameKeepDoor)
                        {
                            var door = mydoor as GameKeepDoor;
                            //portal keeps left click = right click
                            if (door.Component.Keep is GameKeepTower && door.Component.Keep.KeepComponents.Count > 1)
                                door.Interact(player);
                            success = true;
                        }
                        else
                        {
                            if (player.IsWithinRadius(mydoor, m_radius))
                            {
                                if (m_doorState == 0x01)
                                    mydoor.Open(player);
                                else
                                    mydoor.Close(player);
                                success = true;
                            }
                        }
                    }

                    if (!success)
                        player.Out.SendMessage(
                            LanguageMgr.GetTranslation(player.Client, "DoorRequestHandler.OnTick.TooFarAway", doorList[0].Name),
                            eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
                else
                {
                    //new frontiers we don't want this, i.e. relic gates etc
                    if (player.CurrentRegionID == 163 && player.Client.Account.PrivLevel == 1)
                        return;
                    /*
                    //create a bug report
                    BugReport report = new BugReport();
                    report.DateSubmitted = DateTime.Now;
                    report.ID = GameServer.Database.GetObjectCount<BugReport>() + 1;
                    report.Message = "There is a missing door at location Region: " + player.CurrentRegionID + " X:" + player.X + " Y: " + player.Y + " Z: " + player.Z;
                    report.Submitter = player.Name;
                    GameServer.Database.AddObject(report);
                     */

                    player.Out.SendDebugMessage("Door {0} not found in door list, opening via GM door hack.", m_doorId);

                    //else basic quick hack
                    var door = new GameDoor();
                    door.DoorID = m_doorId;
                    door.X = player.X;
                    door.Y = player.Y;
                    door.Z = player.Z;
                    door.Realm = eRealm.Door;
                    door.CurrentRegion = player.CurrentRegion;
                    door.Open(player);
                }
            }
Example #2
0
		/// <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;
		}
Example #3
0
		private void unlocked(GameClient client, GameDoor targetDoor)
		{
			targetDoor.Locked = 0;
			targetDoor.SaveIntoDatabase();
			client.Out.SendMessage("Door " + targetDoor.Name + " is unlocked", eChatType.CT_System, eChatLoc.CL_SystemWindow);
		}
Example #4
0
		private void kill(GameClient client, GameDoor targetDoor, string[] args)
		{
			try
			{
				targetDoor.AddAttacker(client.Player);
				targetDoor.AddXPGainer(client.Player, targetDoor.Health);
				targetDoor.Die(client.Player);
				targetDoor.XPGainers.Clear();
				client.Out.SendMessage("Door " + targetDoor.Name + " health reaches 0", eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}
			catch (Exception e)
			{
				client.Out.SendMessage(e.ToString(), eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}
		}
Example #5
0
		private void info(GameClient client, GameDoor targetDoor)
		{
			if (targetDoor.Realm == eRealm.None)
				Realmname = "None";

			if (targetDoor.Realm == eRealm.Albion)
				Realmname = "Albion";

			if (targetDoor.Realm == eRealm.Midgard)
				Realmname = "Midgard";

			if (targetDoor.Realm == eRealm.Hibernia)
				Realmname = "Hibernia";

			if (targetDoor.Realm == eRealm.Door)
				Realmname = "All";

			if (targetDoor.Locked == 1)
				statut = " Locked";

			if (targetDoor.Locked == 0)
				statut = " Unlocked";

			int doorType = DoorRequestHandler.m_handlerDoorID/100000000;

			var info = new List<string>();

			info.Add(" + Door Info :  " + targetDoor.Name);
			info.Add("  ");
			info.Add(" + Name : " + targetDoor.Name);
			info.Add(" + ID : " + DoorID);
			info.Add(" + Realm : " + (int) targetDoor.Realm + " : " + Realmname);
			info.Add(" + Level : " + targetDoor.Level);
			info.Add(" + Guild : " + targetDoor.GuildName);
			info.Add(" + Health : " + targetDoor.Health + " / " + targetDoor.MaxHealth);
			info.Add(" + Statut : " + statut);
			info.Add(" + Type : " + doorType);
			info.Add(" + X : " + targetDoor.X);
			info.Add(" + Y : " + targetDoor.Y);
			info.Add(" + Z : " + targetDoor.Z);
			info.Add(" + Heading : " + targetDoor.Heading);

			client.Out.SendCustomTextWindow("Door Information", info);
		}
Example #6
0
		private void heal(GameClient client, GameDoor targetDoor)
		{
			targetDoor.Health = targetDoor.MaxHealth;
			targetDoor.SaveIntoDatabase();
			client.Out.SendMessage("You change the door health to " + targetDoor.Health, eChatType.CT_System,
			                       eChatLoc.CL_SystemWindow);
		}
Example #7
0
		private void level(GameClient client, GameDoor targetDoor, string[] args)
		{
			byte level;

			try
			{
				level = Convert.ToByte(args[2]);
				targetDoor.Level = level;
				targetDoor.Health = targetDoor.MaxHealth;
				targetDoor.SaveIntoDatabase();
				client.Out.SendMessage("You changed the door level to " + targetDoor.Level, eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}
			catch (Exception)
			{
				DisplaySyntax(client, args[1]);
			}
		}
Example #8
0
		private void realm(GameClient client, GameDoor targetDoor, string[] args)
		{
			byte realm;

			try
			{
				realm = Convert.ToByte(args[2]);
				targetDoor.Realm = (eRealm) realm;
				targetDoor.SaveIntoDatabase();
				client.Out.SendMessage("You changed the door realm to " + targetDoor.Realm, eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}
			catch (Exception)
			{
				DisplaySyntax(client, args[1]);
			}
		}
Example #9
0
		private void sound(GameClient client, GameDoor targetDoor, string[] args)
		{
			uint doorSound = 0;

			try
			{
				if (args.Length > 2)
				{
					doorSound = Convert.ToUInt16(args[2]);
					targetDoor.Flag = doorSound;
					targetDoor.SaveIntoDatabase();
					client.Out.SendMessage("You set the door sound to " + doorSound, eChatType.CT_System, eChatLoc.CL_SystemWindow);
				}
				else
				{
					DisplaySyntax(client, args[1]);
				}
			}
			catch
			{
				DisplaySyntax(client, args[1]);
			}
		}
Example #10
0
		private void guild(GameClient client, GameDoor targetDoor, string[] args)
		{
			string guildName = "";

			if (args.Length > 2)
				guildName = String.Join(" ", args, 2, args.Length - 2);

			if (guildName != "")
			{
				targetDoor.GuildName = CheckGuildName(guildName, client);
				targetDoor.SaveIntoDatabase();
				client.Out.SendMessage("You changed the door guild to " + targetDoor.GuildName, eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}
			else
			{
				if (targetDoor.GuildName != "")
				{
					targetDoor.GuildName = "";
					targetDoor.SaveIntoDatabase();
					client.Out.SendMessage("Door guild removed", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				}
				else
					DisplaySyntax(client, args[1]);
			}
		}
Example #11
0
		private void name(GameClient client, GameDoor targetDoor, string[] args)
		{
			string doorName = "";

			if (args.Length > 2)
				doorName = String.Join(" ", args, 2, args.Length - 2);

			if (doorName != "")
			{
				targetDoor.Name = CheckName(doorName, client);
				targetDoor.SaveIntoDatabase();
				client.Out.SendMessage("You changed the door name to " + targetDoor.Name, eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}
			else
			{
				DisplaySyntax(client, args[1]);
			}
		}
Example #12
0
		private void delete(GameClient client, GameDoor targetDoor)
		{
			var DOOR = GameServer.Database.SelectObject<DBDoor>("InternalID = '" + DoorID + "'");

			if (DOOR != null)
			{
				GameServer.Database.DeleteObject(DOOR);
				client.Out.SendMessage("Door removed", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
			if (DOOR == null)
			{
				client.Out.SendMessage("This door doesn't exist in the database", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
		}
Example #13
0
		private void update(GameClient client, GameDoor targetDoor)
		{
			delete(client, targetDoor);

			if (targetDoor != null)
			{
				if (doorType != 7 && doorType != 9)
				{
					var door = new DBDoor();
					door.ObjectId = null;
					door.InternalID = DoorID;
					door.Name = "door";
					door.Type = DoorID/100000000;
					door.Level = targetDoor.Level;
					door.Realm = (byte) targetDoor.Realm;
					door.Health = targetDoor.Health;
					door.Locked = targetDoor.Locked;
					door.X = client.Player.X;
					door.Y = client.Player.Y;
					door.Z = client.Player.Z;
					door.Heading = client.Player.Heading;
					GameServer.Database.AddObject(door);
					(targetDoor).AddToWorld();
					client.Player.Out.SendMessage("Added door " + DoorID + " to the database", eChatType.CT_Important,
					                              eChatLoc.CL_SystemWindow);
					return;
				}
			}
		}
Example #14
0
		private void add(GameClient client, GameDoor targetDoor)
		{
			var DOOR = GameServer.Database.SelectObject<DBDoor>("InternalID = '" + DoorID + "'");

			if (DOOR != null)
			{
				client.Out.SendMessage("The door is already in the database", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
			if (DOOR == null)
			{
				if (doorType != 7 && doorType != 9)
				{
					var door = new DBDoor();
					door.ObjectId = null;
					door.InternalID = DoorID;
					door.Name = "door";
					door.Type = DoorID/100000000;
					door.Level = 20;
					door.Realm = 6;
					door.X = targetDoor.X;
					door.Y = targetDoor.Y;
					door.Z = targetDoor.Z;
					door.Heading = targetDoor.Heading;
					door.Health = 2545;
					GameServer.Database.AddObject(door);
					(targetDoor).AddToWorld();
					client.Player.Out.SendMessage("Added door ID:" + DoorID + "to the database", eChatType.CT_Important,
					                              eChatLoc.CL_SystemWindow);
					//DoorMgr.Init( );
					return;
				}
			}
		}
Example #15
0
		private void delete(GameClient client, GameDoor targetDoor)
		{
			var DOOR = GameServer.Database.SelectObjects<DBDoor>("`InternalID` = @InternalID", new QueryParameter("@InternalID", DoorID)).FirstOrDefault();

			if (DOOR != null)
			{
				GameServer.Database.DeleteObject(DOOR);
				client.Out.SendMessage("Door removed", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
			if (DOOR == null)
			{
				client.Out.SendMessage("This door doesn't exist in the database", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
		}