/// /// This command creates a Room within the players current Realm>Zone. /// Admins using this command will not need to supply a fully qualified path like the 'Create' command requires. /// However, they are restricted to creating Rooms only within their current Realm>Zone. /// class CommandCreateRoom : IGameCommand { /// /// Used by the Command Engine to allow for overriding any other commands that contain the same name. /// TODO: Does Overriding Commands still work? This is part of some old code I wrote several years back and might be broke. /// public Boolean Override { get; set; } /// /// The name of the command. /// If Override is set to true, this command will override any other command that contains the same name. /// public String Name { get; set; } /// /// A collection of strings that contains helpfull information for this Command. /// When the user enteres 'Help Exit' the game will print the content of this collection. /// This is treated like a virtual book, each entry in the collection is printed as a new line. /// public List Help { get; set; } /// /// Constructor for the class. /// public CommandCreateRoom() { Help = new List(); Help.Add("Creates a Room within the Admin's current Realm>Zone"); } public void Execute(String command, BaseCharacter player) { if ((player.Role == SecurityRoles.Admin) || (player.Role == SecurityRoles.GM)) { String roomname = command.Substring("Createroom".Length).Trim(); if (String.IsNullOrEmpty(roomname)) { player.Send("You must supply a Room name! Refer to 'Help CreateRoom' for usage examples."); return; } if ((String.IsNullOrEmpty(player.CurrentRoom.Realm)) || (String.IsNullOrEmpty(player.CurrentRoom.Zone))) { player.Send("You are not currently within a pre-existing Zone."); player.Send("Use the Teleport command to teleport yourself into a valid Zone before using the CreateRoom command."); return; } Room r = new Room(player.ActiveGame); r.Realm = player.CurrentRoom.Realm; r.Zone = player.CurrentRoom.Zone; r.Name = roomname; player.ActiveGame.World.GetRealm(r.Realm).GetZone(r.Zone)[0].AddRoom(r); player.Send(r.Name + " created within " + r.Realm + ">" + r.Zone + "."); Log.Write(player.Name + " created a new Room in " + r.RoomLocation); } } }