* ConnectionManager now has a helper method for returning a Connected Character that matches the supplied name

* Added a new Command. SetRole allows Admins to assign a Server Role (Admin, Player, GM etc) to a specified character.  Server.ServerOwner is the only Character that can use this command regardless of server role.  Any other Character must have a Role of Admin in order to use it.
* StandardCharacter now checks if the character is connected as well as being enabled during execution of commands.
* Re-organized how the StandardCharacter save code was invoked during disconnection from server.
* StandardCharacter.Role is now saved and loaded from file.
This commit is contained in:
Scionwest_cp 2012-03-04 00:29:02 -08:00
parent f2c5b594c5
commit 2622c2d8c7
4 changed files with 170 additions and 6 deletions

View file

@ -39,8 +39,18 @@ namespace MudEngine.Networking
this._ConnectedThreads.Add(new Thread(ReceiveDataThread));
Int32 index = this._ConnectedThreads.Count - 1;
this._ConnectedThreads[index].Name = character.Name;
this._ConnectedThreads[index].Start(index);
}
public StandardCharacter GetConnectedCharacter(String characterName)
{
var v = from player in this._ConnectedCharacters
where characterName == player.Name.ToLower()
select player;
return v.First();
}
public StandardCharacter[] GetConnectedCharacters()
{
@ -76,7 +86,6 @@ namespace MudEngine.Networking
/// <param name="character"></param>
public void RemoveConnection(StandardCharacter character)
{
character.Save(character.Filename);
character.Disconnect();
foreach (StandardCharacter c in this._ConnectedCharacters)
{