Implemented an abstract BaseCommand
This commit is contained in:
parent
795b95f1b4
commit
a403b24a05
7 changed files with 34 additions and 70 deletions
28
MudEngine/Commands/BaseCommand.cs
Normal file
28
MudEngine/Commands/BaseCommand.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using MudEngine.GameManagement;
|
||||
using MudEngine.GameObjects.Characters;
|
||||
using MudEngine.GameObjects.Environment;
|
||||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
public abstract class BaseCommand : IGameCommand
|
||||
{
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
//public String Name { get; set; }
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
private Realm realm;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public BaseCommand()
|
||||
{
|
||||
Help = new List<string>();
|
||||
}
|
||||
|
||||
public abstract void Execute(String command, BaseCharacter player);
|
||||
}
|
||||
}
|
|
@ -13,21 +13,10 @@ using MudEngine.GameObjects.Environment;
|
|||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
public class CommandEditRealm : IGameCommand
|
||||
public class CommandEditRealm : BaseCommand
|
||||
{
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
public String Name { get; set; }
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
private Realm realm;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditRealm()
|
||||
{
|
||||
Help = new List<string>();
|
||||
|
||||
Help.Add("Use the Edit command to edit existing objects properties.");
|
||||
Help.Add("Usage: Edit ObjectType ObjectName");
|
||||
Help.Add("Usage: Edit ObjectType FullyQualifiedName");
|
||||
|
|
|
@ -13,21 +13,10 @@ using MudEngine.GameObjects.Environment;
|
|||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
public class CommandEditRoom : IGameCommand
|
||||
public class CommandEditRoom : BaseCommand
|
||||
{
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
public String Name { get; set; }
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
private Room room;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditRoom()
|
||||
{
|
||||
Help = new List<string>();
|
||||
|
||||
Help.Add("Use the Edit command to edit existing objects properties.");
|
||||
Help.Add("Usage: EditRoom Realm>Room>Room");
|
||||
Help.Add("Example: EditRoom MyRealmName>MyRoom>MyRoom");
|
||||
|
|
|
@ -13,21 +13,10 @@ using MudEngine.GameObjects.Environment;
|
|||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
public class CommandEditZone : IGameCommand
|
||||
public class CommandEditZone : BaseCommand
|
||||
{
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
public String Name { get; set; }
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
private Zone zone;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditZone()
|
||||
{
|
||||
Help = new List<string>();
|
||||
|
||||
Help.Add("Use the Edit command to edit existing objects properties.");
|
||||
Help.Add("Usage: EditZone Realm>Zone");
|
||||
Help.Add("Example: EditZone MyRealmName>MyZone");
|
||||
|
|
|
@ -19,32 +19,13 @@ namespace MudEngine.Commands
|
|||
/// by modifying the source.
|
||||
/// TODO: Update the engine to dynamically look for a Login script rather than relying on CommandLogin.
|
||||
/// </summary>
|
||||
public class CommandLogin : IGameCommand
|
||||
public class CommandLogin : BaseCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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.
|
||||
/// </summary>
|
||||
public String Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Class constructor
|
||||
/// </summary>
|
||||
public CommandLogin()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help.Add("Logs the player into their respective account.");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,16 +16,10 @@ using MudEngine.FileSystem;
|
|||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
class CommandRestart : IGameCommand
|
||||
class CommandRestart : BaseCommand
|
||||
{
|
||||
public String Name { get; set; }
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
public CommandRestart()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help.Add("Restarts the game server.");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,10 @@ using MudEngine.GameObjects.Environment;
|
|||
|
||||
namespace MudEngine.Commands
|
||||
{
|
||||
public class CommandSaveWorld : IGameCommand
|
||||
public class CommandSaveWorld : BaseCommand
|
||||
{
|
||||
public Boolean Override { get; set; }
|
||||
|
||||
public String Name { get; set; }
|
||||
public List<String> Help { get; set; }
|
||||
|
||||
public CommandSaveWorld()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help.Add("Saves the game world.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue