Removed old forms and prepared for new designer layouts MudEngine: Server - Now starts and runs, however sending information to the client crashes telnet clients for some reason. BaseCharacter - Removed OnConnect() source code and changed method into an abstract method. This is now implemented via MudGame.MudCharacter BaseCommand - BaseCommand.Name now implemented. Constructor defaults to the Type name. Note all command names must begin with 'Command' BaseGame - Now has a Server propety BaseServer - Added IsRunning property ICharacter - Added Send() method ICommunicate - Added Shutdown() method for use with servers. CommandSystem - Bug fix. Was checking to see if the command was an Interface rather than checking if it inherits from one. CommandSystem - Bug fix. No longer attempts to add abstract commands to collection ScriptSystem - Bug fix. Corrected the name of the Mud Compiler during compiler loading. MudGame: Added initial MudCharacter class. Will be the standard class that all characters will inherit from. Added CommandLogin for processing user server logins. MudGame - Now calls Server.Initialize during Game.Initialize() MudGame - Uses Server.IsRunning property checks rather than Server.EnableServer MudGame - Added initial code for player connections.
103 lines
2.9 KiB
C#
103 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Text;
|
|
|
|
namespace MudEngine.Core
|
|
{
|
|
/// <summary>
|
|
/// Collection of Roles that can be assigned to a character, either controlled or non-controlled.
|
|
/// </summary>
|
|
public enum CharacterRoles
|
|
{
|
|
Admin,
|
|
Immortal,
|
|
GM,
|
|
QuestGiver,
|
|
Player,
|
|
NPC
|
|
}
|
|
|
|
public struct CharacterStats
|
|
{
|
|
public int Strength { get; set; }
|
|
public int Dexterity { get; set; }
|
|
public int Constitution { get; set; }
|
|
public int Intelligence { get; set; }
|
|
public int Wisdom { get; set; }
|
|
public int Charisma { get; set; }
|
|
public int Experience { get; set; }
|
|
}
|
|
|
|
public abstract class BaseCharacter : BaseObject, ICharacter
|
|
{
|
|
private TcpClient _ConnectedClient;
|
|
|
|
/// <summary>
|
|
/// Gets the currently active game.
|
|
/// </summary>
|
|
[Browsable(false)]
|
|
public BaseGame ActiveGame { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets the Role that this character has in the game.
|
|
/// </summary>
|
|
[Browsable(false)]
|
|
public CharacterRoles Role { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the current stats for this character.
|
|
/// </summary>
|
|
[Browsable(false)]
|
|
public CharacterStats Stats { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets the password used to log into this character
|
|
/// </summary>
|
|
[Browsable(false)]
|
|
public string Password { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets if this character can move about the world or not.
|
|
/// </summary>
|
|
public bool IsStatic { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets if this character is controlled by Human or AI
|
|
/// </summary>
|
|
public bool IsAI { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the current location of this character within the world.
|
|
/// </summary>
|
|
public IEnvironment CurrentLocation { get; private set; }
|
|
|
|
public BaseCharacter(BaseGame game)
|
|
{
|
|
this.ActiveGame = game;
|
|
this.ID = this.ActiveGame.GetAvailableID();
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public abstract void OnConnect(TcpClient client);
|
|
|
|
public abstract void OnTravel(World.AvailableTravelDirections travelDirection);
|
|
|
|
public abstract void OnTalk(string message, ICharacter instigator);
|
|
|
|
|
|
public abstract void Send(string message);
|
|
}
|
|
}
|