/
etc/
lib/
src/Abilities/
src/Abilities/Skills/
src/Abilities/Spells/
src/Abilities/Spells/Enums/
src/Affects/
src/ArtheaConsole/
src/ArtheaConsole/Properties/
src/ArtheaGUI/Properties/
src/Clans/Enums/
src/Commands/Communication/
src/Commands/ItemCommands/
src/Connections/
src/Connections/Colors/
src/Connections/Enums/
src/Connections/Players/
src/Connections/Players/Enums/
src/Continents/
src/Continents/Areas/
src/Continents/Areas/Characters/
src/Continents/Areas/Characters/Enums/
src/Continents/Areas/Items/
src/Continents/Areas/Items/Enums/
src/Continents/Areas/Rooms/
src/Continents/Areas/Rooms/Enums/
src/Continents/Areas/Rooms/Exits/
src/Creation/
src/Creation/Attributes/
src/Creation/Interfaces/
src/Database/
src/Database/Interfaces/
src/Environment/
src/Properties/
src/Scripts/Enums/
src/Scripts/Interfaces/
#region Arthea License

/***********************************************************************
*  Arthea MUD by R. Jennings (2007)      http://arthea.googlecode.com/ *
*  By using this code you comply with the Artistic and GPLv2 Licenses. *
***********************************************************************/

#endregion

using Arthea.Collections;
using Arthea.Connections.Players;
using Arthea.Environment;

namespace Arthea
{
    /// <summary>
    /// Implements a help "file".
    /// </summary>
    public class Help
    {
        #region [rgn] Fields (4)

        private StringList keywords = new StringList();
        private byte level;
        private HelpList seeAlso = new HelpList();
        private string text;

        #endregion [rgn]

        #region [rgn] Constructors (2)

        /// <summary>
        /// Initializes a new instance of the <see cref="Help"/> class.
        /// </summary>
        /// <param name="keyword">The keyword.</param>
        public Help(string keyword)
        {
            keywords.Add(keyword);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Help"/> class.
        /// </summary>
        public Help()
        {
        }

        #endregion [rgn]

        #region [rgn] Properties (4)

        /// <summary>
        /// Gets or sets the keywords.
        /// </summary>
        /// <value>The keywords.</value>
        public StringList Keywords
        {
            get { return keywords; }
            set { keywords = value; }
        }

        /// <summary>
        /// Gets or sets the level.
        /// </summary>
        /// <value>The level.</value>
        public byte Level
        {
            get { return level; }
            set { level = value; }
        }

        /// <summary>
        /// Gets or sets the see also.
        /// </summary>
        /// <value>The see also.</value>
        public HelpList SeeAlso
        {
            get { return seeAlso; }
            set { seeAlso = value; }
        }

        /// <summary>
        /// Gets or sets the text.
        /// </summary>
        /// <value>The text.</value>
        public string Text
        {
            get { return text; }
            set { text = value; }
        }

        #endregion [rgn]

        #region [rgn] Methods (4)

        // [rgn] Public Methods (4)

        /// <summary>
        /// Attaches this instance to the help list.
        /// </summary>
        public void Attach()
        {
            Lists.Helps.Add(this);
        }

        /// <summary>
        /// Creates an instance for editing by a player.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="argument">The argument.</param>
        public static void Create(Player player, String argument)
        {
            Help help = new Help(argument);

            help.Attach();

            player.WriteLine("Help created.");

            player.Connection.Edit(help);
        }

        /// <summary>
        /// Releases this instance from the help list.
        /// </summary>
        public void Release()
        {
            Lists.Helps.Remove(this);
        }

        /// <summary>
        /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
        /// </returns>
        public override string ToString()
        {
            if (keywords.Count > 0)
                return keywords[0].ToString();
            else
                return "<unknown>";
        }

        #endregion [rgn]
    }
}