Exemple #1
0
        private void ViewRaceDescription(string race)
        {
            var raceToView = race.Replace("view ", string.Empty);

            var cultureInfo = Thread.CurrentThread.CurrentCulture;
            var textInfo    = cultureInfo.TextInfo;

            var properCaseRace = textInfo.ToTitleCase(raceToView);

            var foundRace = (from r in gameRaces
                             where r.Name == properCaseRace
                             select r).FirstOrDefault();

            if (foundRace != null)
            {
                var output = new OutputBuilder();
                output.AppendSeparator('=', "yellow", true);
                output.AppendLine($"Description for {foundRace.Name}");
                output.AppendSeparator('-', "yellow");
                output.AppendLine($"<%b%><%white%>{foundRace.Description}<%n%>");
                output.AppendSeparator('=', "yellow", true);
                Session.Write(output);
            }
            else
            {
                WrmChargenCommon.SendErrorMessage(Session, "That race does not exist.");
            }
        }
Exemple #2
0
        public override OutputBuilder Render()
        {
            var topics = HelpManager.Instance.GetHelpTopics().Where(topic => topic.Aliases.Count > 0);

            var output = new OutputBuilder();

            if (!topics.Any())
            {
                output.AppendLine("There are no help topics written yet.");
                return(output);
            }

            // Format the first column to the number of characters to fit the longest topic, then have the description to the right of that.
            var lineFormat = "{0," + -1 * HelpManager.Instance.MaxPrimaryAliasLength + "} {1}";

            output.AppendLine("Available help topics:");
            output.AppendSeparator(color: "yellow");
            foreach (var topic in topics)
            {
                var primaryAlias = topic.Aliases.FirstOrDefault();
                output.AppendLine(string.Format(lineFormat, primaryAlias, "TODO: Topic Short Description Support Here"));
            }
            output.AppendSeparator(color: "yellow");

            output.AppendLine();
            output.AppendLine("<%yellow%>NOTE:<%n%> You can also use the \"<%green%>commands<%n%>\" command to list out commands, and you can get help for a specific command with \"<%green%>help <command name><%n%>\".");
            return(output);
        }
        public override OutputBuilder Render(TerminalOptions terminalOptions, HelpTopic helpTopic)
        {
            var output = new OutputBuilder();

            // TODO: What was this !element doing? Does it still work? Test with zMUD or something and re-read MXP specs?
            if (terminalOptions.UseMXP)
            {
                output.AppendLine($"{AnsiSequences.MxpSecureLine}<!element see '<send href=\"help &cref;\">' att='cref' open>");
            }

            output.AppendSeparator(color: "yellow", design: '=');
            output.AppendLine($"HELP TOPIC: {helpTopic.Aliases.First()}");
            output.AppendSeparator(color: "yellow");

            if (terminalOptions.UseMXP)
            {
                var lines = helpTopic.Contents.Split(new string[] { AnsiSequences.NewLine }, StringSplitOptions.None);
                foreach (var line in lines)
                {
                    output.AppendLine($"{AnsiSequences.MxpOpenLine}{line}<%n%>");
                }
            }
            else
            {
                output.AppendLine($"{helpTopic.Contents}");
            }

            output.AppendSeparator(color: "yellow", design: '=');
            return(output);
        }
Exemple #4
0
        private void RefreshScreen()
        {
            var output = new OutputBuilder();

            output.AppendLine();
            output.AppendLine("You may pick three starting skills for your character.");
            int n = 1;

            foreach (var skill in selectedSkills)
            {
                output.AppendLine($"Skill #{n} : {skill.Name}");
                n++;
            }
            output.AppendLine();
            output.AppendLine("<%green%>Please select 3 from the list below:<%n%>");
            FormatSkillText(output);
            output.AppendLine($"<%green%>You have {3 - selectedSkills.Count} skills left.<%n%>");
            output.AppendSeparator('=', "yellow", true);
            output.AppendLine("To pick a skill, type the skill's name. Example: unarmed");
            output.AppendLine("To view a skill's description use the view command. Example: view unarmed");
            output.AppendLine("To see this screen again type list.");
            output.AppendLine("When you are done picking your three skills, type done.");
            output.AppendSeparator('=', "yellow", true);

            Session.Write(output);
        }
Exemple #5
0
        /// <summary>Sends the error message to the player.</summary>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        public static void SendErrorMessage(Session session, string message)
        {
            var wrappedMessage = new OutputBuilder();

            wrappedMessage.AppendSeparator('=', "red", true, message.Length);
            wrappedMessage.AppendLine(message);
            wrappedMessage.AppendSeparator('=', "red", true, message.Length);

            session.Write(wrappedMessage);
        }
Exemple #6
0
        private void RefreshScreen()
        {
            var output = new OutputBuilder();

            output.AppendLine();
            output.AppendLine("<%green%>Please select 1 from the list below:<%n%>");
            FormatRaceText(output);
            output.AppendSeparator('=', "yellow");
            output.AppendLine("To pick a race, just type the race's name. Example: human");
            output.AppendLine("To view a races' description use the view command. Example: view orc");
            output.AppendLine("To see this screen again type 'list'.");
            output.AppendSeparator('=', "yellow");
            Session.Write(output);
        }
Exemple #7
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            var session = actionInput.Session;

            if (session == null)
            {
                return;                  // This action only makes sense for player sessions.
            }
            var output = new OutputBuilder();

            //// TODO Reference to config file
            var appName = "WheelMUD.vshost.exe";

            output.AppendSeparator('=', "red", true);
            output.AppendLine("System Status:");
            output.AppendSeparator('-', "red");

            ////ManagementObjectCollection queryCollection1 = query1.Get();

            var query1           = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
            var queryCollection1 = query1.Get();

            foreach (ManagementObject mo in queryCollection1)
            {
                output.Append($"Manufacturer : {mo["manufacturer"]}");
                output.AppendLine($"Model : {mo["model"]}");
                output.AppendLine($"Physical Ram : {(ulong)mo["totalphysicalmemory"] / 1024}");
            }

            output.AppendSeparator('-', "red");
            query1           = new ManagementObjectSearcher("SELECT * FROM Win32_process where NAME = '" + appName + "'");
            queryCollection1 = query1.Get();
            foreach (ManagementObject mo in queryCollection1)
            {
                foreach (var item in mo.Properties)
                {
                    output.AppendLine($"<%b%><%red%>{item.Name}<%b%><%yellow%>{item.Value}<%n%>");
                }
            }

            output.AppendSeparator('-', "red");
            query1           = new ManagementObjectSearcher("SELECT * FROM Win32_timezone");
            queryCollection1 = query1.Get();
            foreach (ManagementObject mo in queryCollection1)
            {
                output.AppendLine($"This Server lives in:{mo["caption"]}");
            }

            session.Write(output);
        }
        private void RefreshScreen()
        {
            var output = new OutputBuilder();

            output.AppendLine();
            output.AppendLine("You may pick one starting talent for your character.");
            output.AppendLine("<%green%>Please select 1 from the list below:<%n%>");
            FormatTalentText(output);
            output.AppendSeparator('=', "yellow");
            output.AppendLine("To pick a talent, type the talent's name. Example: sailor");
            output.AppendLine("To view a talent's description use the view command. Example: view sailor");
            output.AppendLine("To see this screen again type list.");
            output.AppendSeparator('=', "yellow");
            Session.Write(output);
        }
Exemple #9
0
        private void RefreshScreen()
        {
            var output = new OutputBuilder();

            output.AppendLine();
            output.AppendLine("You have the following gender choices:");
            foreach (var gender in GameSystemController.Instance.GameGenders)
            {
                output.AppendLine(gender.Name);
            }
            output.AppendLine();
            output.AppendSeparator('-', "yellow");
            output.AppendLine("Type your gender selection.");
            output.AppendSeparator('-', "yellow");
            Session.Write(output);
        }
Exemple #10
0
        public override OutputBuilder Render(TerminalOptions terminalOptions, Thing activePlayer)
        {
            string mudNameLine = "                                "; // TODO: Dynamic centering instead, if we want centering!
            string plural      = string.Empty;
            var    output      = new OutputBuilder();

            string plural1 = "is";

            // TODO: Should query for players who can be known about by this player (e.g. omit wiz-inviz players, if any?)
            if (PlayerManager.Instance.Players.Count > 1)
            {
                plural  = "s";
                plural1 = "are";
            }

            // TODO: A game-system specific renderer could be used to includ race/class info and so on, if desired.
            // TODO: Dividing lines could be influenced by activePlayer connection Terminal.Width.
            mudNameLine += GameConfiguration.Name;
            output.AppendLine();
            output.AppendSeparator();
            output.AppendLine(mudNameLine);
            output.AppendSeparator();
            output.AppendLine();
            output.AppendLine($"The following player{plural} {plural1} currently online:");
            foreach (PlayerBehavior player in PlayerManager.Instance.Players)
            {
                var playerName  = player.Parent.Name;
                var playerState = GetPlayerState(player);
                if (terminalOptions.UseMXP)
                {
                    // TODO: "tell {0}" is not a good menu command; possibly friend add/remove, invite to group, hailing, and so on.
                    // TODO: #107: Fix handling of MXP Secure Lines...  (This wasn't being built in a safe way, and does not render correctly now.)
                    output.AppendLine($"<%mxpsecureline%><send \"finger {playerName}|tell {playerName}\" \"|finger|tell\">{playerName}</send> - {player.Parent.FullName} {playerState}");
                }
                else
                {
                    output.AppendLine($"{playerName} - {player.Parent.FullName} {playerState}");
                }
            }

            output.AppendLine();
            output.AppendSeparator();
            output.AppendLine($"Counted {PlayerManager.Instance.Players.Count} player{plural} online.");
            output.AppendLine();
            output.AppendSeparator();
            return(output);
        }
Exemple #11
0
        private void ViewSkillDescription(string skillName)
        {
            GameSkill foundSkill = GetSkill(skillName);

            if (foundSkill == null)
            {
                WrmChargenCommon.SendErrorMessage(Session, "That skill does not exist.");
                return;
            }

            var output = new OutputBuilder();

            output.AppendSeparator('=', "yellow", true);
            output.AppendLine($"Description for {foundSkill.Name}");
            output.AppendSeparator('-', "yellow");
            output.AppendLine($"<%b%><%white%>{foundSkill.Description}");
            output.AppendSeparator('=', "yellow", true);
            Session.Write(output);
        }
Exemple #12
0
        private void ViewTalentDescription(string talent)
        {
            var foundTalent = GetTalent(talent);

            if (foundTalent != null)
            {
                var output = new OutputBuilder();
                output.AppendSeparator('=', "yellow", true);
                output.AppendLine($"Description for {foundTalent.Name}");
                output.AppendSeparator('-', "yellow");
                output.AppendLine($"<%b%><%white%>{foundTalent.Description}");
                output.AppendSeparator('=', "yellow", true);

                Session.Write(output);
            }
            else
            {
                WrmChargenCommon.SendErrorMessage(Session, "That talent does not exist.");
            }
        }