Primarily a bug fix check-in

This commit is contained in:
Scionwest_cp 2012-03-10 14:23:13 -08:00
parent bcd9f46b0a
commit 9b475691d5
10 changed files with 35 additions and 48 deletions

View file

@ -125,9 +125,6 @@ namespace MudEngine.Core
}
}
//Let the player know that it was not a valid command.
//TODO: Implement another way of performing this. I don't want game related classes tied to the system.
character.SendMessage("Invalid Command Used.");
return false;
}
@ -205,7 +202,7 @@ namespace MudEngine.Core
if (commandsFound.Count > 0)
return commandsFound.ToArray();
else
return null;
return new List<ICommand>().ToArray() ;
}
/// <summary>

View file

@ -123,10 +123,18 @@ namespace MudEngine.Core
/// <returns></returns>
public BaseScript this[Int32 index]
{
//TODO: Perform some exception handling here.
//TODO: Don't allow setting if isReadOnly=true
get { return (BaseScript)this.scriptCollection[index]; }
set { this.scriptCollection[index] = value; }
get
{
if (index <= this.Count - 1)
return (BaseScript)this.scriptCollection[index];
else //If the index is out of bounds, just return the last item in the collection.
return (BaseScript)this.scriptCollection[this.scriptCollection.Count - 1];
}
set
{
if (!this.IsReadOnly)
this.scriptCollection[index] = value;
}
}
#endregion

View file

@ -45,7 +45,10 @@ namespace MudEngine.Game.Characters
/// </summary>
public CharacterStats Stats { get; protected set; }
//TODO: Should be Private/Protected?
/// <summary>
/// User account password
/// </summary>
//TODO: Character passwords should be a private set.
public String Password { get; set; }
/// <summary>
@ -83,9 +86,6 @@ namespace MudEngine.Game.Characters
/// </summary>
public Boolean Connected { get; set; }
//TODO: Add current location to characters
//public IEnvironment CurrentLocation
protected CommandSystem Commands { get; private set; }
public Room CurrentRoom { get; private set; }
@ -181,9 +181,14 @@ namespace MudEngine.Game.Characters
/// <returns></returns>
public virtual Boolean ExecuteCommand(string command)
{
Boolean result = false;
if (this.Enabled && this.Connected)
{
Boolean result = Commands.Execute(command, this);
result = Commands.Execute(command, this);
if (!result)
this.SendMessage("Invalid Command used.");
SendMessage("");
SendMessage("Command:", false);
@ -191,8 +196,10 @@ namespace MudEngine.Game.Characters
return result;
}
else
{
return false;
}
}
/// <summary>
/// Executes the spcified command if it exists in the Command library.
@ -313,8 +320,8 @@ namespace MudEngine.Game.Characters
this.SendMessage(String.Empty);
//Log the user in.
//TODO: What happens if result = false?
Boolean result = this.ExecuteSilentCommand("Login");
this.SendMessage(String.Empty);
//Flags the character as fully logged in.

View file

@ -10,7 +10,7 @@ using MudEngine.Game.Characters;
using MudEngine.GameScripts;
namespace MudEngine.Game.Environment
{
public class Room : BaseScript, IUpdatable
public class Room : Environment
{
public Zone Zone { get; private set; }
@ -26,11 +26,6 @@ namespace MudEngine.Game.Environment
this.Zone = zone;
}
public void Update()
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>

View file

@ -10,7 +10,7 @@ using MudEngine.Core;
namespace MudEngine.Game.Environment
{
public class Zone : BaseScript, IGameComponent, ISavable, IUpdatable
public class Zone : Environment
{
/// <summary>
/// Gets or Sets the what stats
@ -26,26 +26,6 @@ namespace MudEngine.Game.Environment
this._RoomCollection = new List<Room>();
}
public void Initialize()
{
throw new NotImplementedException();
}
public void Destroy()
{
throw new NotImplementedException();
}
public string Filename
{
get { throw new NotImplementedException(); }
}
public void Update()
{
throw new NotImplementedException();
}
public Room CreateRoom(String name, String description)
{
Room room = new Room(this.Game, name, description, this);

View file

@ -46,7 +46,6 @@ namespace MudEngine.GameScripts.Commands
//character creation process.
if (callingType != "Login")
{
character.SendMessage("Invalid Command Used.");
return false;
}

View file

@ -25,7 +25,7 @@ namespace MudEngine.GameScripts.Commands
public bool Execute(string command, StandardCharacter character)
{
return false;
return true;
}
}
}

View file

@ -51,15 +51,14 @@ namespace MudEngine.GameScripts.Commands
StandardCharacter target = game.Server.ConnectionManager.GetConnectedCharacter(names[0].ToLower());
this.ApplyRole(character, target);
return true;
}
else
{
character.SendMessage("Invalid Command Used.");
return true;
}
return false;
}
}
public void ApplyRole(StandardCharacter admin, StandardCharacter target)
{

View file

@ -40,7 +40,6 @@ namespace MudEngine.GameScripts.Commands
{
//Since a non-admin character attempted this command,
//tell them they used a invalid command
character.SendMessage("Invalid command used.");
return false;
}
}

View file

@ -35,6 +35,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\Log4Net\V1.2.11\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />