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


C# CharData.GetCharWorld方法代码示例

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


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

示例1: PlayerTell

        /// <summary>
        /// Command for gods to respond to the players.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void PlayerTell(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (!ch.Authorized("ptell"))
            {
                ch.SendText("&+LYou cannot respond to &+Bpetitions&+L.&n\r\n");
                return;
            }

            if (str.Length < 2)
            {
                ch.SendText("Tell what to who?\r\n");
            }

            /*
            * Can tell to PC's anywhere, but NPC's only in same room.
            */
            CharData victim = ch.GetCharWorld(str[0]);
            if (!victim)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (!victim.Socket)
            {
                SocketConnection.Act("$N&n is &+Llinkdead&n.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            string text = String.Join(" ", str, 1, (str.Length - 1));
            text = DrunkSpeech.MakeDrunk(text, ch);

            SocketConnection.Act("&n&+rYou tell $N&n&+r '&+R$t&n&+r'&n", ch, text, victim, SocketConnection.MessageTarget.character);
            int position = victim.CurrentPosition;
            victim.CurrentPosition = Position.standing;
            SocketConnection.Act("&n&+r$n&n&+r responds to your petition with '&+R$t&n&+r'&n", ch, text, victim, SocketConnection.MessageTarget.victim);
            string buf = String.Format("&+r{0} responds to {1}'s petition with '&+R{2}&n&+r'&n", ch.Name, victim.Name, text);
            ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_PETITION, Limits.LEVEL_AVATAR, buf);
            victim.CurrentPosition = position;
            victim.ReplyTo = ch;

            if (victim.HasActionBit(PC.PLAYER_AFK))
                SocketConnection.Act("Just so you know, $E is &+RAFK&n.", ch, null, victim, SocketConnection.MessageTarget.character);
            else if (victim.HasActionBit(PC.PLAYER_BOTTING))
                SocketConnection.Act("Just so you know, $E is a &+YBOT&n", ch, null, victim, SocketConnection.MessageTarget.character);

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

示例2: Finger

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

            CharData victim;
            SocketConnection victDD;
            bool loggedIn;

            if (ch.IsNPC())
                return;

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

            /* Look for the character logged in. */
            if ((victim = ch.GetCharWorld(str[0])))
            {
                if (victim.IsNPC())
                {
                    ch.SendText("Don't finger mobs.\r\n");
                    return;
                }
                if (!victim.Socket)
                {
                    ch.SendText("Character is linkdead.\r\n");
                    if (!CharData.LoadPlayer((victDD = new SocketConnection()), str[0]))
                    {
                        /* If not in save files, they don't exist. */
                        ch.SendText("This character does not exist.\r\n");
                        return;
                    }
                    loggedIn = false;
                }
                else
                {
                    loggedIn = true;
                    ch.SendText("This character is logged in.\r\n");
                    victDD = victim.Socket;
                }
            }   /* If not, then load from save files. */
            else
            {
                loggedIn = false;

                if (!(CharData.LoadPlayer((victDD = new SocketConnection()), str[0].ToUpper())))
                {
                    /* If not in save files, they don't exist. */
                    ch.SendText("This character does not exist.\r\n");
                    return;
                }
                else
                    ch.SendText("This character is not logged in.\r\n");
                victim = victDD.Original ? victDD.Original : victDD.Character;
            }

            /* Display general character info. */
            string buf = String.Format("Name: {0}. Title: {1}&n.\r\n",
                                       victDD.Original ? victDD.Original.Name :
                                                                                     victDD.Character ? victDD.Character.Name : "(none)",
                                       (!victim.IsNPC() && ((PC)victim).Title.Length != 0)
                                           ? ((PC)victim).Title : "(none)");
            ch.SendText(buf);
            buf = String.Format("Guild: {0}&n. Level: {1}&n.\r\n",
                    (!victim.IsNPC() && ((PC)victim).GuildMembership != null)
                    ? ((PC)victim).GuildMembership.Name : "(none)",
                    victim.Level);
            ch.SendText(buf);
            buf = String.Format("Class: {0}&n. Room: {1}&n.  Race: {2}&n.\r\n",
                    (victim.CharacterClass != null ?
                    victim.CharacterClass.WholistName : "(Undefined)"),
                    victim.InRoom ? victim.InRoom.IndexNumber : -1,
                    (victim.GetRace() < Race.RaceList.Length && victim.GetRace() >= 0) ?
                    Race.RaceList[victim.GetRace()].ColorName : "(Undefined)");
            ch.SendText(buf);

            /* Messages specific to whether a player is logged in. */
            if (loggedIn)
            {
                if (victim.InRoom)
                {
                    buf = String.Format("In room: {0}&n ({1}).\r\n",
                            victim.InRoom.Title.Length != 0 ? victim.InRoom.Title : "(none)",
                            victim.InRoom.IndexNumber);
                    ch.SendText(buf);
                }
                buf = String.Format("On since: {0}", victim.LogonTime);
            }
            else
                buf = String.Format("Created: {0}  Birthdate: {1}", ((PC)victim).Created, ((PC)victim).Birthdate);
            ch.SendText(buf);

            if (loggedIn)
            {
                buf = String.Format("Last save: {0}", victim.SaveTime);
                ch.SendText(buf);
            }
            else
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例3: Freeze

        /// <summary>
        /// Immortal command to paralyze a player.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Freeze(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;
            CharData realChar = ch.GetChar();

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

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

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

            if (ch == victim && ch.HasActionBit(PC.PLAYER_FREEZE))
            {
                ch.RemoveActionBit(PC.PLAYER_FREEZE);
            }

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

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

            if (victim.HasActionBit(PC.PLAYER_FREEZE))
            {
                victim.RemoveActionBit(PC.PLAYER_FREEZE);
                ch.SendText("FREEZE bit removed.\r\n");
                victim.SendText("You can play again.\r\n");
            }
            else
            {
                victim.SetActionBit(PC.PLAYER_FREEZE);
                ch.SendText("FREEZE bit set.\r\n");
                victim.SendText("You can't do anything!\r\n");
            }

            CharData.SavePlayer(victim);

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

示例4: 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

示例5: Attributes

        /// <summary>
        /// Shows a character's attribute screen.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Attributes(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string buf1 = String.Empty;

            if (ch.IsNPC())
            {
                ch.SendText("&nYour attributes are as would be expected for an NPC.\r\n");
                return;
            }

            if (ch.IsImmortal() && str.Length != 0)
            {
                CharData worldChar = ch.GetCharWorld(str[0]);
                if (!worldChar)
                {
                    ch.SendText("No such person.\r\n");
                    return;
                }
                if (worldChar.IsNPC())
                {
                    ch.SendText("NPCs don't have skills!\r\n");
                    return;
                }
            }

            string buf = String.Format(
                "&+WName: &+G{0}&n    &+WLevel: {1}&n\r\n",
                MUDString.PadStr(ch.Name, 17),
                ch.Level);
            buf1 += buf;

            buf = String.Format(
                      "&+WRace:&n {0}          &+WClass:&n {1}     &n&+WSex:&n {2}\r\n",
                      MUDString.PadStr(Race.RaceList[ch.GetRace()].ColorName, 16),
                      MUDString.PadStr(ch.CharacterClass.WholistName, 16),
                      System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(ch.GetSexString()));
            buf1 += buf;

            // Break a player's size into strings when we get around to it
            // -- Xangis
            if (!ch.IsNPC())
            {
                buf = String.Format(
                          "&+WHeight:&n {0} inches         &+WWeight:&n {1} pounds    &+WSize:&n {2}\r\n",
                          MUDString.PadInt(((PC)ch).Height, 3),
                          MUDString.PadInt(((PC)ch).Weight, 5),
                          Race.SizeString(ch.CurrentSize));
            }
            else
            {
                buf = String.Format("&+WSize:&n  {0}\r\n", ch.CurrentSize);
            }
            buf1 += buf;

            TimeSpan time = TimeSpan.FromTicks(ch.TimePlayed.Ticks) + (DateTime.Now - ch.LogonTime);
            int days = (int)time.TotalHours / 24;
            time = (time - TimeSpan.FromDays(days));
            int hours = (int)time.TotalHours;
            time = (time - TimeSpan.FromHours(hours));
            int minutes = (int)time.TotalMinutes;

            // Age is a hack until we get it coded - Xangis
            buf = String.Format(
                      "\r\n&+BAge:&n {0} years.             &+BPlaying Time:&n {1} days {2} hours {3} minutes.\r\n",
                      MUDString.PadInt(ch.GetAge(), 3), days, hours, minutes);
            buf1 += buf;

            // Need to create a function to display character status strings
            buf = String.Format("&+BStatus:&n  {0}", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Position.PositionString(ch.CurrentPosition)));
            if (!ch.IsNPC() && ch.IsAffected(Affect.AFFECT_BERZERK))
            {
                buf += ", &+Rberzerk&n";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
            {
                buf += ", Memorizing";
            }
            if (ch.IsAffected(Affect.AFFECT_CASTING))
            {
                buf += ", Casting";
            }
            if (ch.IsAffected(Affect.AFFECT_SINGING))
            {
                buf += ", Singing";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
            {
                buf += ", Meditating";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_CAMPING))
            { /* This is ugly and should be moved to its own function */
                buf += ", Camping";
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例6: Trophy

        /// <summary>
        /// Tropy command.  Shows kill data and whether certain mobs are "boring" and worth less experience.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Trophy(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int count;
            CharData targetChar;

            if (str.Length == 0 || !ch.IsImmortal())
            {
                targetChar = ch;
            }
            else
            {
                targetChar = ch.GetCharWorld(str[0]);
                if (!targetChar)
                {
                    ch.SendText("No such person.\r\n");
                    return;
                }
            }

            if (targetChar.IsNPC())
            {
                ch.SendText("Mobs don't have Trophy.\r\n");
                return;
            }

            if (targetChar.Level < 5)
            {
                ch.SendText("You don't need to worry about trophy yet.\r\n");
                return;
            }

            ch.SendText("&+BTrophy data:\r\n");
            for (count = 0; count < Limits.MAX_LEVEL; ++count)
            {
                if (((PC)targetChar).TrophyData[count].MobIndexNumber == 0)
                    continue;
                if (((PC)targetChar).TrophyData[count].NumberKilled == 0)
                    continue;
                /* Added else for mobs which are removed from game. (Earlier, Trophy would
                crash the mud on no-longer existant mobs.) */
                // TODO: Fix format of float value.
                string buf;
                if (Database.GetMobTemplate(((PC)targetChar).TrophyData[count].MobIndexNumber) != null)
                {
                    buf = String.Format("   &n&+b(&+y{0:0000.00}&+b)&n {1}&n\r\n",
                              ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100),
                              (Database.GetMobTemplate(((PC)targetChar).TrophyData[count].MobIndexNumber)).ShortDescription);
                }
                else if (((PC)targetChar).TrophyData[count].MobIndexNumber != 0)
                {
                    buf = String.Format("   &n&+b(&+y{0:0000.00}&+b)&n ({1}) \r\n",
                              ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100),
                              ((PC)targetChar).TrophyData[count].MobIndexNumber);
                }
                else
                {
                    buf = String.Format("   &n&+b(&+y{0:0000.00}&+b)&n (null) \r\n",
                              ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100));
                }
                ch.SendText(buf);
            }
            ch.SendText("\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:71,代码来源:Command.cs

示例7: Wizify

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

            CharData victim;
            string arg1 = String.Empty;

            CharData realChar = ch.GetChar();

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

            if (String.IsNullOrEmpty(arg1))
            {
                ch.SendText("Syntax: wizify <_name>\r\n");
                return;
            }
            if (!(victim = ch.GetCharWorld(arg1)))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }
            if (victim.IsNPC())
            {
                ch.SendText("Not on mobs.\r\n");
                return;
            }

            if (!victim.HasActionBit(PC.PLAYER_WIZBIT))
            {
                victim.SetActionBit(PC.PLAYER_WIZBIT);
                SocketConnection.Act("$N wizified.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n has wizified you!", ch, null, victim, SocketConnection.MessageTarget.victim);
            }
            else
            {
                victim.RemoveActionBit(PC.PLAYER_WIZBIT);
                SocketConnection.Act("$N dewizzed.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n has dewizzed you!", ch, null, victim, SocketConnection.MessageTarget.victim);
            }

            CommandType.Interpret(ch, "save");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:44,代码来源:Command.cs

示例8: SetMob

        /// <summary>
        /// Change something on a mob or a player.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void SetMob(CharData ch, string[] str)
        {
            if( ch == null ) return;

            ch = ch.GetChar();

            if (str.Length < 3)
            {
                ch.SendText("Syntax: set mob <victim> <field>  <value>\r\n");
                ch.SendText("or:     set mob <victim> <string> <value>\r\n");
                ch.SendText("\r\n");
                ch.SendText("Field being one of:\r\n");
                ch.SendText("  str int wis dex con agi cha pow luck size\r\n");
                ch.SendText("  class hp mana move align wait height weight\r\n");
                ch.SendText("  sex race level thirst hunger drunk full security\r\n");
                ch.SendText("  copper silver gold platinum position exp faction\r\n");
                ch.SendText("  resistant immune susceptible vulnerable\r\n");
                ch.SendText("String being one of:\r\n");
                ch.SendText("  name short long title spec guild rank\r\n");
                return;
            }

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

            /*
            * Snarf the value (which need not be numeric).
            */
            int value;
            bool ok = Int32.TryParse(str[2], out value);
            if (!ok)
            {
                value = -1;
            }

            string text = String.Empty;

            /*
            * Set something.
            */
            if ("strength".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase))
            {
                if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE)
                {
                    text += "Strength range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n";
                    ch.SendText(text);
                    return;
                }

                victim.PermStrength = value;
                ch.SendText("Ok.\r\n");
                return;
            }

            if ("intelligence".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase))
            {
                if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE)
                {
                    text += "Intelligence range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n";
                    ch.SendText(text);
                    return;
                }

                victim.PermIntelligence = value;
                ch.SendText("Ok.\r\n");
                return;
            }

            if ("wisdom".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase))
            {
                if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE)
                {
                    text += "Wisdom range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n";
                    ch.SendText(text);
                    return;
                }

                victim.PermWisdom = value;
                ch.SendText("Ok.\r\n");
                return;
            }

            if ("dexterity".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase))
            {
                if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE)
                {
                    text += "Dexterity range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n";
                    ch.SendText(text);
                    return;
                }

//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例9: SetSkill

        /// <summary>
        /// Set a skill to the specified value.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void SetSkill(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (str.Length < 3 ||  String.IsNullOrEmpty(str[0]) || String.IsNullOrEmpty(str[1]) || String.IsNullOrEmpty(str[2]))
            {
                ch.SendText("Syntax: set skill <victim> <skill> <value>\r\n");
                ch.SendText("or:     set skill <victim> all     <value>\r\n");
                ch.SendText("Skill being any skill.\r\n");
                return;
            }

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

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

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

            bool all = (str[1].Equals("all", StringComparison.CurrentCultureIgnoreCase));
            Skill skl = null;
            if (!all && ((skl = Skill.SkillLookup(str[1])) == null))
            {
                ch.SendText("No such skill.\r\n");
                return;
            }

            if (!MUDString.IsNumber(str[2]))
            {
                ch.SendText("Value must be numeric.\r\n");
                return;
            }

            int value = 0;
            Int32.TryParse(str[2], out value);
            if (value < 0 || value > Limits.MAX_SKILL_ADEPT)
            {
                ch.SendText("Value range is 0 to " + Limits.MAX_SKILL_ADEPT.ToString() + ".\r\n");
                return;
            }

            if (all)
            {
                if (ch.GetTrust() < Limits.LEVEL_OVERLORD)
                {
                    ch.SendText("Only immortals level " + Limits.LEVEL_OVERLORD.ToString() + " and up may set all skills.\r\n");
                    return;
                }
                foreach( SkillEntry entry in ch.CharacterClass.Skills )
                {
                    if( entry.Level < victim.GetTrust() )
                    {
                        ((PC)victim).SkillAptitude[entry.Name] = value;
                    }
                    else
                    {
                        ((PC)victim).SkillAptitude[entry.Name] = 1;
                    }
                }
            }
            else
            {
                ((PC)victim).SkillAptitude[skl.Name] = value;
            }

            ch.SendText("Ok.\r\n");

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

示例10: Restore

        /// <summary>
        /// Immortal command to restore players to a fully rested state with full hits, moves, and mana.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Restore(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;
            string text;

            CharData realChar = ch.GetChar();

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

            if (str.Length == 0 || !MUDString.StringsNotEqual(str[0], "room"))
            {
                foreach (CharData roomChar in ch.InRoom.People)
                {
                    if (roomChar.IsNPC())
                    {
                        continue;
                    }
                    ch.Restore(roomChar);
                }
                text = String.Format("{0} has restored room {1}.", realChar.Name, ch.InRoom.IndexNumber);
                ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text);
                ch.SendText("Room restored.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(str[0], "all"))
            {
                foreach (CharData it in Database.CharList)
                {
                    victim = it;
                    if (!victim.InRoom || victim.IsNPC())
                    {
                        continue;
                    }
                    ch.Restore(victim);
                }
                text = String.Format("{0} has restored the whole mud.", ch.Name);
                ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text);
                ch.SendText("Aww...how sweet :)...Done.\r\n");
            }
            else
            {
                if (!(victim = ch.GetCharWorld(str[0])))
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }
                ch.Restore(victim);
                text = String.Format("{0} has restored {1}.", ch.Name, victim.Name);
                ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text);
                ch.SendText("Done.\r\n");
            }

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

示例11: SetLanguage

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

            string buf = String.Empty;
            int num;

            if (str.Length == 0)
            {
                ch.SendText("Syntax: set language <char> <language> <number>.\r\n");
                return;
            }

            if (!(ch.GetCharWorld(buf)))
                ch.SendText("You don't see that person.\r\n");

            Race.Language lang = StringLookup.LanguageLookup(ch, buf);
            if (lang == 0)
            {
                ch.SendText("Syntax: set language <char> &+r<language>&n <number>.\r\n");
                return;
            }

            Int32.TryParse(buf, out num);
            if (num == 0)
            {
                ch.SendText("Syntax: set language <char> <language> &+r<number>&n\r\n");
                return;
            }
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:30,代码来源:Command.cs

示例12: ResetLanguages

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

            CharData victim;

            if (str.Length == 0)
            {
                ch.SendText("Try supplying more information with your command.\r\n");
                return;
            }

            if (!(victim = ch.GetCharWorld(str[0])))
            {
                ch.SendText("You don't see that person.\r\n");
            }
            else
            {
                if (victim.IsNPC())
                {
                    ch.SendText("Not on NPCS!\r\n");
                    return;
                }

                victim.InitializeLanguages();
                string buf = String.Format("{0} has had their languages Reset.\r\n", victim.Name);
                ch.SendText(buf);

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

示例13: Rename

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

            CharData realChar = ch.GetChar();
            CharData victim;

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

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

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

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

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

            if (!SocketConnection.CheckPlayerName(str[1]))
            {
                ch.SendText("That name is not allowed here, please try again.\r\n");
                return;
            }

            if (victim.IsNPC())
            {
                ch.SendText("You can't rename NPCs, you fool!");
                return;
            }

            Log.Trace("Rename: Saving");
            CharData.SavePlayer(victim);
            Log.Trace("Rename: Backing Up");
            CharData.BackupPlayer(victim);
            Log.Trace("Rename: Deleting");
            CharData.DeletePlayer(victim);

            Log.Trace("Rename: Giving New Name to Player");
            string oldname = victim.Name;
            victim.Name = str[1].ToUpper();

            Log.Trace("Rename: Saving Renamed Player");
            CharData.SavePlayer(victim);
            ch.SendText("Done.\r\n");
            string text = String.Format("Your new _name is {0}.\r\n", victim.Name);
            victim.SendText(text);

            text = String.Format("{0} has just renamed {1} to {2}.", ch.Name, oldname, victim.Name);
            ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SECURE, realChar.GetTrust(), text);
            Log.Trace(text);

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

示例14: Purge

        /// <summary>
        /// Immortal command to clear the room of junk (mobs and objects).
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Purge(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

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

            if (str.Length == 0)
            {
                /* 'purge' */
                for( int i = (ch.InRoom.People.Count - 1); i >= 0; i-- )
                {
                    if (ch.InRoom.People[i].IsNPC() && ch.InRoom.People[i] != ch)
                    {
                        CharData.ExtractChar(ch.InRoom.People[i], true);
                    }
                }

                for( int i = (ch.InRoom.Contents.Count - 1); i >= 0; i-- )
                {
                    ch.InRoom.Contents[i].RemoveFromWorld();
                }

                ch.SendText("Done.\r\n");
                SocketConnection.Act("$n purges the room!", ch, null, null, SocketConnection.MessageTarget.room);
                return;
            }

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

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

            SocketConnection.Act("$n&n purges $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            CharData.ExtractChar(victim, true);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:54,代码来源:Command.cs

示例15: TrackCommand

        /// <summary>
        /// Player track command.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void TrackCommand(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;

            if (ch.IsAffected(Affect.AFFECT_TRACK))
            {
                ch.SendText("You stop tracking.\r\n");
                Combat.StopHunting(ch);
                ch.RemoveAffect(Affect.AFFECT_TRACK);
                return;
            }

            if (!ch.HasSkill("track"))
            {
                ch.SendText("You couldn't track an &+Lelephant&n in your own bedroom.\r\n");
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Whom are you trying to track?\r\n");
                return;
            }

            if (ch.Riding)
            {
                ch.SendText("You can't sniff a trail mounted.\r\n");
                return;
            }

            if (ch.FlightLevel != 0)
            {
                ch.SendText("You find tracks on the _ground_!\r\n");
                return;
            }

            if (ch.InRoom.IsWater())
            {
                ch.SendText("You can't track through water.\r\n");
                return;
            }

            if (ch.CurrentPosition != Position.standing)
            {
                if (ch.CurrentPosition == Position.fighting)
                    ch.SendText("You're too busy fighting .\r\n");
                else
                    ch.SendText("You must be standing to track!\r\n");
                return;
            }

            /* only imps can hunt to different areas */
            bool area = (ch.GetTrust() < Limits.LEVEL_OVERLORD);

            if (area)
            {
                victim = ch.GetCharInArea(str[0]);
            }
            else
            {
                victim = ch.GetCharWorld(str[0]);
            }

            if (!victim || (!victim.IsNPC() && (ch.IsRacewar(victim)) && !ch.IsImmortal()))
            {
                ch.SendText("You can't find a trail of anyone like that.\r\n");
                return;
            }

            if (ch.InRoom == victim.InRoom)
            {
                SocketConnection.Act("You're already in $N&n's room!", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            /*
            * Deduct some movement.
            */
            if (ch.CurrentMoves > 2)
            {
                ch.CurrentMoves -= 3;
            }
            else
            {
                ch.SendText("You're too exhausted to hunt anyone!\r\n");
                return;
            }

            SocketConnection.Act("$n carefully sniffs the air.", ch, null, null, SocketConnection.MessageTarget.room);
            ch.WaitState(Skill.SkillList["track"].Delay);
            Exit.Direction direction = Track.FindPath(ch.InRoom.IndexNumber, victim.InRoom.IndexNumber, ch, -40000, area);

            if (direction == Exit.Direction.invalid)
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs


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