当前位置: 首页>>代码示例>>C#>>正文


C# CharData.GetChar方法代码示例

本文整理汇总了C#中MUDEngine.CharData.GetChar方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.GetChar方法的具体用法?C# CharData.GetChar怎么用?C# CharData.GetChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MUDEngine.CharData的用法示例。


在下文中一共展示了CharData.GetChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StatClass

        public static void StatClass(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int circle;
            int level;

            CharData realChar = ch.GetChar();
            int num = (int)realChar.CharacterClass.ClassNumber;

            /*
            * Set default arguments.
            */
            CharClass cclass = realChar.CharacterClass;

            if (str.Length != 0 && !String.IsNullOrEmpty(str[0]))
            {
                // If it's not a number try it as a class name.
                if (Int32.TryParse(str[0], out num))
                {
                    cclass = CharClass.ClassList[num];
                }
                else
                {
                    /*
                    * Look for class to turn on.
                    */
                    for (int iClass = 0; iClass < CharClass.ClassList.Length; iClass++)
                    {
                        if (CharClass.ClassList[iClass].Name.StartsWith(str[0], StringComparison.CurrentCultureIgnoreCase))
                        {
                            num = iClass;
                            cclass = CharClass.ClassList[iClass];
                            break;
                        }
                    }
                }
            }

            if (cclass == null)
            {
                ch.SendText("No such class.\r\n");
                return;
            }

            string text = String.Format("Class: {0} ({1})  Class Number: &n&+W{2}&n\r\n",
                                       cclass.Name, cclass.WholistName, num);
            string buf1 = text;

            text = String.Format("File: {0}  Prime Attribute: {1}\r\n",
                    cclass.Filename, StringConversion.AffectApplyString(cclass.PrimeAttribute));
            buf1 += text;

            text = String.Format("Save Modifiers: {0} {1} {2} {3} {4}", cclass.SaveModifiers[0], cclass.SaveModifiers[1],
                cclass.SaveModifiers[2], cclass.SaveModifiers[3], cclass.SaveModifiers[4] );

            text = String.Format("Thac0Lvl0: {0}  Thac0Lvl40: {1}  Experience Modifier:  {2}\r\n",
                    MUDString.PadInt(cclass.HitrollLevel0, 5), cclass.HitrollLevel40, cclass.ExperienceModifier);
            buf1 += text;

            text = String.Format("Hp Min/Hp Max: {0}/{1}  Mana: {2}  Weapon: {3}  Mount: {4}\r\n",
                    cclass.MinHpGain, cclass.MaxHpGain, cclass.GainsMana ? "yes" : "no", cclass.FirstWeapon,
                    cclass.CanSummonMountNumber);
            buf1 += text;

            buf1 += "\r\nSkills available for this class.\r\n";
            buf1 += "Lv          Abilities\r\n";

            for (level = 0; level < Limits.LEVEL_AVATAR; level++)
            {
                foreach (KeyValuePair<String, Skill> kvp in Skill.SkillList)
                {
                    if (kvp.Value.ClassAvailability[num] != level)
                        continue;

                    text = String.Format("&+c{0}:&n {1}\r\n", MUDString.PadInt(level, 2), kvp.Value.Name);
                    buf1 += text;

                }
            }

            buf1 += "\r\nSpells available for this class.\r\n";
            buf1 += "Circle      Spells\r\n";

            for (circle = 0; circle < Limits.MAX_CIRCLE; circle++)
            {
                foreach (KeyValuePair<String, Spell> kvp in Spell.SpellList)
                {
                    if (kvp.Value.SpellCircle[num] != circle)
                        continue;

                    text = String.Format("&+c{0}:&n {1}\r\n", MUDString.PadInt(circle, 2), kvp.Key);
                    buf1 += text;
                }
            }

            realChar.SendText(buf1);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:99,代码来源:Command.cs

示例2: Ban

        /// <summary>
        /// Immortal command to ban a site from the game.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Ban(CharData ch, string[] str)
        {
            if( ch == null ) return;

            BanData ban;

            if (ch.IsNPC())
            {
                return;
            }

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("ban"))
            {
                return;
            }

            if (str.Length == 0)
            {
                string text = "Banned sites:\r\n";
                foreach (BanData it in Database.BanList)
                {
                    ban = it;
                    text += ban.Name;
                    text += "\r\n";
                }
                ch.SendText(text);
                return;
            }

            foreach (BanData it in Database.BanList)
            {
                ban = it;

                if (!MUDString.StringsNotEqual(str[0], ban.Name))
                {
                    ch.SendText("That site is already banned!\r\n");
                    return;
                }
            }

            ban = new BanData();

            ban.Name = str[0];
            Database.BanList.Add(ban);
            ch.SendText("Done.\r\n");
            Event.UpdateBans();
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:55,代码来源:Command.cs

示例3: GroupStat

        public static void GroupStat(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;
            CharData groupChar;
            CharData leader;
            string text;
            string arg = String.Empty;
            string buf1;

            CharData realChar = ch.GetChar();

            if (arg.Length > 0)
            {
                victim = realChar.GetCharRoom(arg);
                if (!victim)
                {
                    victim = realChar.GetCharWorld(arg);
                }
                if (!victim)
                {
                    realChar.SendText("You can't find that person anywhere.\r\n");
                    return;
                }
                if (!victim.GroupLeader)
                {
                    realChar.SendText("They aren't in a group.\r\n");
                    return;
                }
                leader = victim.GroupLeader;
                buf1 = String.Format("&+G{0}'s group:&n\r\n", leader.Name);
                for (groupChar = leader; groupChar; groupChar = groupChar.NextInGroup)
                {
                    text = String.Format("     &+G{0}&n\r\n", groupChar.Name);
                    buf1 += text;
                }
                realChar.SendText(buf1);
                return;
            }
            buf1 = String.Empty;
            foreach (CharData it in Database.CharList)
            {
                victim = it;
                if (victim != victim.GroupLeader)
                {
                    continue;
                }
                leader = victim.GroupLeader;
                text = String.Format("&+G{0}'s group:&n\r\n", leader.Name);
                buf1 += text;
                for (groupChar = leader; groupChar; groupChar = groupChar.NextInGroup)
                {
                    text = String.Format("     &+G{0}&n\r\n", groupChar.Name);
                    buf1 += text;
                }
            }
            realChar.SendText(buf1);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:60,代码来源:Command.cs

示例4: FindMobile

        /// <summary>
        /// Finds a mob or list of mobiles in the area or in the world.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void FindMobile(CharData ch, string[] str)
        {
            if( ch == null ) return;

            MobTemplate mobTemplate;
            int indexNumber;
            int bottom;
            int top;
            bool fRace = false;
            bool fTeacher = false;
            bool fClass = false;
            int race = 0;
            ModernMUD.CharClass.Names charclass = 0;

            ch.GetChar();

            if (str.Length < 2 || (MUDString.StringsNotEqual(str[0], "world") && MUDString.StringsNotEqual(str[0], "area")
                                    && MUDString.StringsNotEqual(str[0], "race") && MUDString.StringsNotEqual(str[0], "teacher")))
            {
                ch.SendText("Syntax: find m world <mobile>|all\r\n");
                ch.SendText("or:     find m area  <mobile>|all\r\n");
                ch.SendText("        find m race  <racename> <class>\r\n");
                ch.SendText("        find m teacher race|class|all <race|class>\r\n");
                return;
            }

            if (String.IsNullOrEmpty(str[1]))
            {
                ch.SendText("Find what mob?\r\n");
                return;
            }

            bool all = !MUDString.StringsNotEqual(str[1], "all");
            bool found = false;
            Area area = ch.InRoom.Area;
            bool world = !MUDString.StringsNotEqual(str[0], "world");
            if (!MUDString.StringsNotEqual(str[0], "race"))
            {
                int value;
                fRace = true;
                world = true;
                bool result = Int32.TryParse(str[1], out value);
                if (result != false)
                {
                    race = Race.RaceLookup(str[1]);
                }
                if (race == -1)
                {
                    ch.SendText("Lookup mobs of what race?\r\n");
                    return;
                }
                if (!MUDString.StringsNotEqual(str[1], "class") && str.Length > 2)
                {
                    fClass = true;
                    charclass = CharClass.ClassLookup(str[2]);
                }
            }
            if (world)
            {
                bottom = 0;
                top = Database.HighestMobIndexNumber;
            }
            else
            {
                bottom = area.LowMobIndexNumber;
                top = area.HighMobIndexNumber + 1;
            }

            /*
            * Yeah, so iterating over all index numbers takes one loop for each index.
            */
            for (indexNumber = bottom; indexNumber < top; indexNumber++)
            {
                mobTemplate = Database.GetMobTemplate(indexNumber);
                if (!mobTemplate)
                    continue;

                if (!world && area != mobTemplate.Area)
                    continue;

                if (all || MUDString.NameContainedIn(str[1], mobTemplate.PlayerName))
                {
                    if (all || MUDString.NameContainedIn(str[1], mobTemplate.PlayerName)
                            || (fRace && mobTemplate.Race == race) ||
                            (fClass && mobTemplate.CharacterClass.ClassNumber == charclass))
                    {
                        if (fTeacher && !mobTemplate.HasActBit(MobTemplate.ACT_TEACHER))
                            continue;

                        found = true;
                        string buf = String.Format("[{0}] {1}&n\r\n", MUDString.PadInt(mobTemplate.IndexNumber, 5), mobTemplate.ShortDescription.ToUpper());
                        ch.SendText(buf);
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例5: Force

        /// <summary>
        /// Immortal command to force someone to do something.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Force(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("force"))
                return;

            if (str.Length < 2)
            {
                ch.SendText("Force whom to do what?\r\n");
                return;
            }

            /*
            * Look for command in command table.
            */
            int trust = ch.GetTrust();
            foreach (CommandType cmd in CommandType.CommandTable)
            {
                if ( !MUDString.IsPrefixOf(str[0], cmd.Name)
                        && (cmd.MinLevel > trust))
                {
                    ch.SendText("You can't even do that yourself!\r\n");
                    return;
                }
            }

            string action = String.Join(" ", str, 1, (str.Length - 1));

            if (!MUDString.StringsNotEqual(str[0], "all"))
            {
                foreach (CharData worldChar in Database.CharList)
                {
                    if (!worldChar.IsNPC() && worldChar.GetTrust() < ch.GetTrust())
                    {
                        SocketConnection.Act("$n forces you to '$t'.", ch, action, worldChar, SocketConnection.MessageTarget.victim);
                        CommandType.Interpret(worldChar, action);
                    }
                }
            }
            else
            {
                CharData victim;

                if (!(victim = ch.GetCharWorld(str[0])))
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }

                if (victim == ch)
                {
                    ch.SendText("Aye aye, right away!\r\n");
                    return;
                }

                if (victim.GetTrust() >= ch.GetTrust())
                {
                    ch.SendText("Do it yourself!\r\n");
                    return;
                }

                SocketConnection.Act("$n forces you to '$t'.", ch, action, victim, SocketConnection.MessageTarget.victim);
                CommandType.Interpret(victim, action);
            }

            ch.SendText("Done.\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:76,代码来源:Command.cs

示例6: Disconnect

        /// <summary>
        /// Disconnect a character from the game.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Disconnect(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();
            SocketConnection socket;

            if (!realChar.Authorized("disconnect"))
            {
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Disconnect whom?\r\n");
                return;
            }

            CharData victim = ch.GetCharWorld(str[0]);
            if (!victim)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (!victim.Socket)
            {
                SocketConnection.Act("$N doesn't have a socket.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            foreach (SocketConnection it in Database.SocketList)
            {
                socket = it;

                if (socket == victim.Socket)
                {
                    socket.CloseSocket();
                    ch.SendText("Done.\r\n");
                    return;
                }
            }

            Log.Error("Disconnect: Socket not found.", 0);
            ch.SendText("Socket not found!\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:52,代码来源:Command.cs

示例7: Echo

        /// <summary>
        /// Immortal command to echo content to the whole MUD.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Echo(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("echo"))
            {
                return;
            }

            if (str.Length == 0 || String.IsNullOrEmpty(str[0]))
            {
                ch.SendText("Echo what?\r\n");
                return;
            }

            string colorCode = String.Empty;
            if (!ch.IsNPC() && ((PC)ch).ImmortalData != null)
                colorCode = ((PC)ch).ImmortalData.ImmortalColor;

            string content = colorCode + String.Join(" ", str) + "&n\r\n";

            SocketConnection.SendToAllChar(content);

            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:32,代码来源:Command.cs

示例8: Terminate

        /// <summary>
        /// Deletes/destroys a character and removes them from the game.  Reserved for use
        /// on real grade-A jerks.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Terminate(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;
            SocketConnection socket;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("terminate"))
            {
                return;
            }

            if (str.Length == 0 )
            {
                ch.SendText("Terminate whom?\r\n");
                return;
            }

            if (!(victim = realChar.GetCharWorld(str[0])))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (!victim.Socket)
            {
                SocketConnection.Act("$N&n doesn't have a descriptor.", ch, null, victim, SocketConnection.MessageTarget.character);
            }

            if (realChar == victim)
            {
                ch.SendText("You may not terminate yourself, use RETIRE.\r\n");
                return;
            }

            if (realChar.Level <= victim.Level && realChar != victim)
            {
                ch.SendText("You may not terminate your peer nor your superior.\r\n");
                return;
            }

            foreach (SocketConnection it in Database.SocketList)
            {
                socket = it;

                if (socket == victim.Socket)
                {
                    /* By saving first i assure i am not removing a non existing file
                    * i know it's stupid and probably useless but...
                    */
                    victim.SendText("&+RYour soul has been revoked by the gods!&n\r\n");
                    SocketConnection.Act("&+R$n&+R grabs ahold of $N&+R's soul and tears it to shreds.&n\r\n" +
                        "&+R$n&+R then proceeds to jump all over the little pieces while cackling fiendishly.&n", realChar, null, victim, SocketConnection.MessageTarget.room);
                    Log.Trace("Terminate: Saving");
                    CharData.SavePlayer(victim);
                    Log.Trace("Terminate: Backing Up");
                    CharData.BackupPlayer(victim);
                    Log.Trace("Terminate: Deleting");
                    CharData.DeletePlayer(victim);
                    Log.Trace("Terminate: Extracting");
                    CharData.ExtractChar(victim, true);
                    Log.Trace("Terminate: Closing Socket");
                    socket.CloseSocket();
                    realChar.SendText("&+RVic&+rtim des&+Rtro&+ryed&+R!&n\r\n");
                    return;
                }
            }

            ch.SendText("Termination target not found!\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:79,代码来源:Command.cs

示例9: AppearanceMessage

        public static void AppearanceMessage(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("appearmsg") || ch.IsImmortal() )
                return;

            if (str.Length == 0)
            {
                ch.SendText("What do you want your appear message to say?\r\n");
            }

            if (!ch.IsNPC())
            {
                if (ch.StringTooLong(str[0]))
                {
                    return;
                }
                ((PC)ch).ImmortalData.AppearMessage = str[0];
                ch.SendText("Done.\r\n");
            }
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:25,代码来源:Command.cs

示例10: Switch

        /// <summary>
        /// Lets an immortal take control of (possess) a mob.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Switch(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("switch"))
            {
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Switch into whom?\r\n");
                return;
            }

            if (ch.Socket == null)
            {
                return;
            }

            if (ch.Socket.Original)
            {
                ch.SendText("You are already switched.\r\n");
                return;
            }

            if (!(victim = ch.GetCharWorld(str[0])))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (victim == ch)
            {
                ch.SendText("Done.\r\n");
                return;
            }

            /*
            * Pointed out by Da Pub (What Mud)
            */
            if (!victim.IsNPC())
            {
                ch.SendText("You cannot switch into a player!\r\n");
                return;
            }

            if (victim.Socket)
            {
                ch.SendText("Character in use.\r\n");
                return;
            }

            ((PC)ch).IsSwitched = true;
            ch.Socket.Character = victim;
            ch.Socket.Original = ch;
            victim.Socket = ch.Socket;
            ch.Socket = null;
            victim.SendText("Done.\r\n");
            string buf = String.Format("{0} switched into {1}", realChar.Name, victim.ShortDescription);
            ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SWITCHES, realChar.GetTrust(), buf);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:72,代码来源:Command.cs

示例11: Terminat

        public static void Terminat(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("terminate"))
            {
                return;
            }

            ch.SendText("If you want to TERMINATE someone, spell it out.\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:14,代码来源:Command.cs

示例12: StatSpell

        /// <summary>
        /// Shows statistics for a given spell or group of spells.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void StatSpell(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg = String.Join(" ", str);

            ch.GetChar();

            if (str.Length == 0)
            {
                ch.SendText("Stat what spell?\r\nYou can use 'stat spell all', 'stat spell <type>', types being 'ignore', 'offensive', 'object', or 'defensive'.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(arg, "all") || !MUDString.StringsNotEqual(arg, "offensive") || !MUDString.StringsNotEqual(arg, "none"))
            {
                TargetType type = TargetType.none;
                bool specificType = false;

                if ("offensive".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase))
                {
                    specificType = true;
                    type = TargetType.singleCharacterOffensive;
                }
                else if ("ignore".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase))
                {
                    specificType = true;
                    type = TargetType.none;
                }
                else if ("defensive".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase))
                {
                    specificType = true;
                    type = TargetType.singleCharacterDefensive;
                }
                else if ("object".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase))
                {
                    specificType = true;
                    type = TargetType.objectInInventory;
                }

                foreach (Spell spll in Spell.SpellList.Values)
                {
                    if (String.IsNullOrEmpty(spll.Name))
                        continue;

                    if (specificType && type != spll.ValidTargets)
                        continue;

                    ch.SendText(String.Format("Spell: '{0}'. ", spll.Name));
                    if (specificType)
                    {
                        ch.SendText(String.Format("Lag: {0}. Castable in battle: {1}. School: {2}.\r\n",
                                spll.CastingTime,
                                spll.CanCastInCombat ? "Yes." : "No. ",
                                StringConversion.SpellSchoolString(spll.School)));
                    }
                    else
                    {
                        ch.SendText("\r\n");
                    }
                }
            }
            else
            {
                try
                {
                    Spell sn = Spell.SpellList[arg];

                    ch.SendText(sn.ToString());
                }
                catch (KeyNotFoundException)
                {
                    ch.SendText("No such spell.\r\n");
                    return;
                }
            }

            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:84,代码来源:Command.cs

示例13: StatRace

        /// <summary>
        /// Immortal command to display info about a reace.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void StatRace(CharData ch, string[] str)
        {
            int num;
            CharData realChar = ch.GetChar();

            if (str.Length == 0)
            {
                num = (int)realChar.CharacterClass.ClassNumber;
            }
            else if (MUDString.IsNumber(str[0]))
            {
                Int32.TryParse(str[0], out num);
            }
            else
            {
                num = Race.RaceLookup(str[0]);
            }

            if (num < 0 || num >= Race.RaceList.Length)
            {
                ch.SendText("Invalid race number!\r\n");
                return;
            }

            string buf1 = String.Format("&+WRacial stats for race {0}&n\r\n\r\n", num);

            string text = String.Format("Name:  {0}  ANSI Name: {1}\r\n",
                                       Race.RaceList[num].Name,
                                       Race.RaceList[num].ColorName);
            buf1 += text;

            text = String.Format("Key:  {0}  Size:  {1}\r\n",
                    Race.RaceList[num].Key,
                    Race.RaceList[num].DefaultSize);
            buf1 += text;

            text = String.Format("Height:  {0} inches.  Weight:  {1} pounds.  Base Alignment:  {2} ({3})\r\n",
                    Race.RaceList[num].Height,
                    Race.RaceList[num].Weight,
                    Race.RaceList[num].BaseAlignment,
                    StringConversion.AlignmentString(Race.RaceList[num].BaseAlignment));
            buf1 += text;

            text = String.Format("&+WStat modifiers: (Max. stats):&n\r\n");
            buf1 += text;

            text = String.Format("Str: {0}  Int: {1}  Wis: {2}  Dex: {3}  Con: {4}\r\nAgi: {5}  Cha: {6}  Pow: {7}  Luk: {8}\r\n",
                    Race.RaceList[num].StrModifier,
                    Race.RaceList[num].IntModifier,
                    Race.RaceList[num].WisModifier,
                    Race.RaceList[num].DexModifier,
                    Race.RaceList[num].ConModifier,
                    Race.RaceList[num].AgiModifier,
                    Race.RaceList[num].ChaModifier,
                    Race.RaceList[num].PowModifier,
                    Race.RaceList[num].LukModifier);
            buf1 += text;

            text = String.Format("HP Gain (unused):  {0}  Mana Gain: {1}  Move Gain (unused): {2}\r\n",
                    Race.RaceList[num].HpGain,
                    Race.RaceList[num].ManaGain,
                    Race.RaceList[num].MoveGain);
            buf1 += text;

            text = String.Format("Thirst Mod (unused):  {0}  Hunger Mod (unused): {1}\r\nDamage Message: {2}  Walk Message: {3}\r\n",
                    Race.RaceList[num].ThirstModifier,
                    Race.RaceList[num].HungerModifier,
                    Race.RaceList[num].DamageMessage,
                    Race.RaceList[num].WalkMessage);
            buf1 += text;

            text = String.Format("Hatred:  {0}.\r\nParts:  {1}.\r\nResist:  {2}.  Immune:  {3}.\r\nSusceptible: {4}.  Vulnerable: {5}.\r\n",
                    Race.RaceList[num].Hate,
                    Race.RaceList[num].BodyParts,
                    Race.RaceList[num].Resistant,
                    Race.RaceList[num].Immune,
                    Race.RaceList[num].Susceptible,
                    Race.RaceList[num].Vulnerable);
            buf1 += text;

            text = String.Format("Racewar Side: {0}  Language:  {1}  Base Age: {2}  Max Age: {3}\r\n",
                    Race.RaceList[num].WarSide,
                    Race.RaceList[num].PrimaryLanguage,
                    Race.RaceList[num].BaseAge,
                    Race.RaceList[num].MaxAge);
            buf1 += text;

            realChar.SendText(buf1);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:95,代码来源:Command.cs

示例14: StatObject

        /// <summary>
        /// Immortal command to get the stats of an object.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void StatObject(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj = null;
            int value;
            string buf1 = String.Empty;

            ch.GetChar();

            if (str.Length == 0)
            {
                ch.SendText("Ostat what?\r\n");
                return;
            }

            Int32.TryParse(str[0], out value);
            // Non numeric, search for object as a string.
            if (value == 0 && !(obj = Object.GetObjectInWorld(ch, str[0])))
            {
                ch.SendText("Nothing like '" + str[0] +  "' in this universe.\r\n");
                return;
            }
            // Nothing found or numeric supplied, look for index number.
            if (!obj)
            {
                ObjTemplate objTemplate;
                if (!(objTemplate = Database.GetObjTemplate(value)))
                {
                    ch.SendText("Invalid object index number.\r\n");
                    return;
                }
                if (!(obj = Object.GetFirstObjectOfTemplateType(objTemplate)))
                {
                    ch.SendText("None of those in game.\r\n");
                    return;
                }
            }

            string text = String.Format("Name: {0}.\r\n", obj.Name);
            buf1 += text;

            text = String.Format("IndexNumber: {0}.  Type: {1} - {2}.\r\n",
                      obj.ObjIndexData.IndexNumber, obj.ItemType, StringConversion.ItemTypeString(obj));
            buf1 += text;

            text = String.Format("Short description: {0}&n.\r\nLong description: {1}&n\r\n",
                      obj.ShortDescription, obj.FullDescription);
            buf1 += text;

            text = String.Format("Wear bits: {0}.  Extra bits: {1} ({2} {3}).\r\n",
                      obj.WearFlags[0], Object.ItemString(obj), obj.ExtraFlags[0],
                      obj.ExtraFlags[1]);
            buf1 += text;

            buf1 += String.Format("Number: {0}/{1}.  Weight: {2}/{3}.  Size: {4}.  Volume: {5}.\r\n",
                      1, Object.GetObjectQuantity(obj),
                      obj.Weight, obj.GetWeight(),
                      obj.Size, obj.Volume);

            text = String.Format("Material Type: {0}. ({1}).  Craftsmanship: {2}.  Scarcity: {3}.\n",
                      obj.Material,
                      Material.Table[(int)obj.Material].ShortDescription,
                      obj.Craftsmanship, obj.ObjIndexData.Scarcity);
            buf1 += text;

            text = String.Format("Cost: {0}.  Timer: {1}.  Level: {2}.  Number Loaded: {3}.\r\n",
                      obj.Cost, obj.Timer, obj.Level, obj.ObjIndexData.QuantityLoaded);
            buf1 += text;

            /* Added wear_location in text, not int format. */
            text = String.Format(
                      "In room: {0}.  In object: {1}.  Carried by: {2}.  WearLoc: {3}.\r\n",
                      obj.InRoom ? obj.InRoom.IndexNumber : 0,
                      obj.InObject ? obj.InObject.ShortDescription : "(none)",
                      obj.CarriedBy ? obj.CarriedBy.Name : "(none)",
                      obj.WearLocation); // Had to change this - V
            buf1 += text;

            /* Added all eight values. */
            text = String.Format("Values: {0} {1} {2} {3} {4} {5} {6} {7}.\r\n",
                      obj.Values[0], obj.Values[1], obj.Values[2],
                      obj.Values[3], obj.Values[4], obj.Values[5],
                      obj.Values[6], obj.Values[7]);
            buf1 += text;

            if (obj.ExtraDescription.Count > 0 || obj.ObjIndexData.ExtraDescriptions.Count > 0)
            {
                buf1 += "Extra description keywords: ";

                bool first = true;
                foreach (ExtendedDescription ed in obj.ExtraDescription)
                {
                    if (!first)
                    {
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例15: Deny

        /// <summary>
        /// Deny a player access to the game.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Deny(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("deny"))
            {
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Deny whom?\r\n");
                return;
            }

            CharData victim = ch.GetCharWorld(str[0]);
            if (victim == null)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (victim.IsNPC())
            {
                ch.SendText("Not on NPC's.\r\n");
                return;
            }

            if (victim.GetTrust() >= ch.GetTrust())
            {
                ch.SendText("You failed.\r\n");
                return;
            }

            victim.SetActionBit(PC.PLAYER_DENY);
            victim.SendText("You are denied access!\r\n");
            ch.SendText("Done.\r\n");
            if (victim.Level <= 1)
            {
                CommandType.Interpret(victim, "quit");
            }
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:50,代码来源:Command.cs


注:本文中的MUDEngine.CharData.GetChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。