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; return false;
} }
@ -205,7 +202,7 @@ namespace MudEngine.Core
if (commandsFound.Count > 0) if (commandsFound.Count > 0)
return commandsFound.ToArray(); return commandsFound.ToArray();
else else
return null; return new List<ICommand>().ToArray() ;
} }
/// <summary> /// <summary>

View file

@ -123,10 +123,18 @@ namespace MudEngine.Core
/// <returns></returns> /// <returns></returns>
public BaseScript this[Int32 index] public BaseScript this[Int32 index]
{ {
//TODO: Perform some exception handling here. get
//TODO: Don't allow setting if isReadOnly=true {
get { return (BaseScript)this.scriptCollection[index]; } if (index <= this.Count - 1)
set { this.scriptCollection[index] = value; } 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 #endregion

View file

@ -45,7 +45,10 @@ namespace MudEngine.Game.Characters
/// </summary> /// </summary>
public CharacterStats Stats { get; protected set; } 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; } public String Password { get; set; }
/// <summary> /// <summary>
@ -83,9 +86,6 @@ namespace MudEngine.Game.Characters
/// </summary> /// </summary>
public Boolean Connected { get; set; } public Boolean Connected { get; set; }
//TODO: Add current location to characters
//public IEnvironment CurrentLocation
protected CommandSystem Commands { get; private set; } protected CommandSystem Commands { get; private set; }
public Room CurrentRoom { get; private set; } public Room CurrentRoom { get; private set; }
@ -181,9 +181,14 @@ namespace MudEngine.Game.Characters
/// <returns></returns> /// <returns></returns>
public virtual Boolean ExecuteCommand(string command) public virtual Boolean ExecuteCommand(string command)
{ {
Boolean result = false;
if (this.Enabled && this.Connected) 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("");
SendMessage("Command:", false); SendMessage("Command:", false);
@ -191,7 +196,9 @@ namespace MudEngine.Game.Characters
return result; return result;
} }
else else
{
return false; return false;
}
} }
/// <summary> /// <summary>
@ -313,8 +320,8 @@ namespace MudEngine.Game.Characters
this.SendMessage(String.Empty); this.SendMessage(String.Empty);
//Log the user in. //Log the user in.
//TODO: What happens if result = false?
Boolean result = this.ExecuteSilentCommand("Login"); Boolean result = this.ExecuteSilentCommand("Login");
this.SendMessage(String.Empty); this.SendMessage(String.Empty);
//Flags the character as fully logged in. //Flags the character as fully logged in.

View file

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

View file

@ -10,7 +10,7 @@ using MudEngine.Core;
namespace MudEngine.Game.Environment namespace MudEngine.Game.Environment
{ {
public class Zone : BaseScript, IGameComponent, ISavable, IUpdatable public class Zone : Environment
{ {
/// <summary> /// <summary>
/// Gets or Sets the what stats /// Gets or Sets the what stats
@ -26,26 +26,6 @@ namespace MudEngine.Game.Environment
this._RoomCollection = new List<Room>(); 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) public Room CreateRoom(String name, String description)
{ {
Room room = new Room(this.Game, name, description, this); Room room = new Room(this.Game, name, description, this);

View file

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

View file

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

View file

@ -51,14 +51,13 @@ namespace MudEngine.GameScripts.Commands
StandardCharacter target = game.Server.ConnectionManager.GetConnectedCharacter(names[0].ToLower()); StandardCharacter target = game.Server.ConnectionManager.GetConnectedCharacter(names[0].ToLower());
this.ApplyRole(character, target); this.ApplyRole(character, target);
return true;
} }
else else
{ {
character.SendMessage("Invalid Command Used."); return false;
return true;
} }
return false;
} }
public void ApplyRole(StandardCharacter admin, StandardCharacter target) 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, //Since a non-admin character attempted this command,
//tell them they used a invalid command //tell them they used a invalid command
character.SendMessage("Invalid command used.");
return false; return false;
} }
} }

View file

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