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


C# CharData.HasActionBit方法代码示例

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


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

示例1: Prompt

        /// <summary>
        /// Defines how a player's prompt is displayed.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Prompt(CharData ch, string[] str)
        {
            string buf = String.Empty;

            /* Unswitched NPC's get kicked out */
            if (ch.Socket == null)
                return;

            /* Will always have a pc ch after this */
            ch = (ch.Socket.Original != null ? ch.Socket.Original : ch.Socket.Character);

            if (str.Length == 0)
            {
                if (ch.HasActionBit(PC.PLAYER_PROMPT))
                {
                    buf = "-prompt";
                }
                else
                {
                    buf = "+prompt";
                }
                CommandType.Interpret(ch, "toggle " + buf);
                return;
            }

            if (str[0].Equals("raw", StringComparison.CurrentCultureIgnoreCase))
                buf += "&n&+g<%h&n&+g/%H&n&+ghp %mm %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%D&n %B&+g>&n ";
            else if (str[0].Equals("dark", StringComparison.CurrentCultureIgnoreCase))
                buf += "&+L<&n&+m%h&+L/&n&+m%H&+Lhp &n&+m%v&+L/&n&+m%V&+Lmv>\r\n&+L<&n%T&n %E&+L>&n ";
            else if (str[0].Equals("meter", StringComparison.CurrentCultureIgnoreCase))
                if (ch.IsClass(CharClass.Names.psionicist) || ch.IsClass(CharClass.Names.bard))
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp %mm/%MM %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%d&n %b&+g>&n ";
                else
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%d&n %b&+g>&n ";
            else if (str[0].Equals("chains", StringComparison.CurrentCultureIgnoreCase))
                buf += "&+L<&n&+m%h&+L/&n&+m%H&+Lhp &n&+m%v&+L/&n&+m%V&+Lmv>\r\n&+L<&n%t&n %e&+L>&n ";
            else if (str[0].Equals("status", StringComparison.CurrentCultureIgnoreCase))
                buf += "&n&+g<%l&+g:%h&n&+g/%H&n&+ghp %mm %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%D&n %B&+g>&n ";
            else if (str[0].Equals("all", StringComparison.CurrentCultureIgnoreCase))
                if (ch.IsClass(CharClass.Names.psionicist) || ch.IsClass(CharClass.Names.bard))
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp %m/%Mm %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%D&n %B&+g>&n ";
                else
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp %v&n&+g/%V&n&+gmv>\r\n&n&+g<&n%D&n %B&+g>&n ";
            else if (str[0].Equals("fancy", StringComparison.CurrentCultureIgnoreCase))
                if (ch.IsClass(CharClass.Names.psionicist) || ch.IsClass(CharClass.Names.bard))
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp %m/%Mm &+g%v&n&+g/%V&n&+gmv %a>\r\n&n%n&+g< &n%l&n &n%d&n %b&+g>&n ";
                else
                    buf += "&n&+g<%h&n&+g/%H&n&+ghp &+g%v&n&+g/%V&n&+gmv %a>\r\n&n%n&+g< &n%l&n &n%d&n %b&+g>&n";
            else
            {
                string text = String.Join(" ", str);
                if (text.Length > 70)
                    text = text.Substring(0, 70);
                buf = text;
            }

            ((PC)ch).Prompt = buf;
            ch.SendText("&nOk.\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:65,代码来源:Command.cs

示例2: Fog

        /// <summary>
        /// Fog: Immortal command to turn combat vulnerability on or off.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Fog(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
            {
                return;
            }
            if (!ch.Authorized("fog"))
            {
                return;
            }
            ch.ToggleActionBit(PC.PLAYER_FOG);
            if (ch.HasActionBit(PC.PLAYER_FOG))
            {
                ch.SendText("Fog is now on.\r\n");
            }
            else
            {
                ch.SendText("Fog is now off.\r\n");
            }
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:28,代码来源:Command.cs

示例3: GodMode

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

            if (ch.IsNPC())
                return;

            if (!ch.Authorized("godmode"))
                return;

            if (ch.HasActionBit(PC.PLAYER_GODMODE))
            {
                ch.RemoveActionBit(PC.PLAYER_GODMODE);
                ch.SendText("God mode off.\r\n");
            }
            else
            {
                ch.SetActionBit(PC.PLAYER_GODMODE);
                ch.SendText("God mode on.\r\n");
            }

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

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

示例5: Exits

        /// <summary>
        /// Shows available room exits.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Exits(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Exit exit;
            int door;

            bool auto = (str.Length != 0 && !MUDString.StringsNotEqual(str[0], "auto"));

            if (ch.IsBlind() || !ch.InRoom)
            {
                return;
            }

            string text;
            if (!ch.IsNPC() && ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED && auto)
            {
                text = "<exits>";
            }
            else
            {
                text = auto ? "&+cExits: &n" : "&+cVisible exits:&n\r\n";
            }

            bool found = false;

            // Show the direction with an asterisk if it
            // has a closed door, and in exits command it shows up as a
            // closed <whatever>.
            for (door = 0; door < Limits.MAX_DIRECTION; ++door)
            {
                exit = ch.InRoom.ExitData[door];
                if (exit && exit.TargetRoom)
                {
                    if (exit.HasFlag(Exit.ExitFlag.secret))
                    {
                        /* Mortals do not see secret exits. */
                        if (ch.Level < Limits.LEVEL_AVATAR)
                            continue;
                        /* Mark secret exits for immortals. */
                        text += "&+LS&n&+c";
                    }
                    if (exit.HasFlag(Exit.ExitFlag.blocked))
                    {
                        /* Mortals do not see secret exits. */
                        if (ch.Level < Limits.LEVEL_AVATAR)
                            continue;
                        /* Mark secret exits for immortals. */
                        text += "&+yB&n&+c";
                    }
                    found = true;
                    if (auto)
                    {
                        if (exit.HasFlag(Exit.ExitFlag.walled) && exit.HasFlag(Exit.ExitFlag.illusion))
                            continue;
                        if (exit.HasFlag(Exit.ExitFlag.closed))
                            text += "&n&+y#&n&+c";
                        // Don't show exits to impassable rooms.
                        // Show a yellow exclamation point to those with holylight on though.
                        if (exit.TargetRoom && exit.TargetRoom.TerrainType == TerrainType.underground_impassable)
                        {
                            if (!ch.HasActionBit(PC.PLAYER_GODMODE))
                            {
                                continue;
                            }
                            text += "&+Y!&n";
                        }
                        text += door.ToString();
                        text += " ";
                    }
                    else
                    {
                        if (exit.HasFlag(Exit.ExitFlag.walled))
                        {
                            text += String.Format("&n{0} - (Walled)&n\r\n",
                                MUDString.PadStr(door.ToString().ToUpper(), 5));
                        }
                        else if (!exit.HasFlag(Exit.ExitFlag.closed))
                        {
                            // gods with holylight on can go to useless exits.
                            if (exit.TargetRoom && exit.TargetRoom.TerrainType == TerrainType.underground_impassable)
                            {
                                if (!ch.HasActionBit(PC.PLAYER_GODMODE))
                                {
                                    continue;
                                }
                                text += "&+Y!&n";
                            }
                            text += String.Format("&n {0} - {1}&n\r\n", MUDString.PadStr(door.ToString().ToUpper(), 5),
                                    (!ch.HasInnate(Race.RACE_ULTRAVISION) && Room.GetRoom(exit.IndexNumber).IsDark())
                                      ? "&nToo dark to tell" : exit.TargetRoom.Title);
                        }
                        else
                        {
                            text += String.Format("&+y#&n{0} - Closed {1}\r\n",
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例6: Combine

        /// <summary>
        /// Command to toggle list combine mode.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Combine(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string buf;

            if (ch.HasActionBit(PC.PLAYER_COMBINE))
                buf = String.Format("-combine");
            else
                buf = String.Format("+combine");

            CommandType.Interpret(ch, "toggle " + buf);

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

示例7: Disengage

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

            if (!ch.Fighting)
            {
                ch.SendText("You're not fighting anyone!\r\n");
                if (ch.CurrentPosition == Position.fighting)
                    ch.CurrentPosition = Position.standing;
                return;
            }

            if (ch.Fighting.Fighting && ch.Fighting.Fighting == ch
                    && ch.HasActionBit(PC.PLAYER_VICIOUS))
            {
                ch.SendText("You're a little busy getting beat on at the moment.\r\n");
                return;
            }

            ch.SendText("You disengage from the fight!\r\n");
            ch.WaitState(8);
            Combat.StopFighting(ch, false);

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

示例8: Shoot

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

            Object newobj;
            Exit exit;
            Room toRoom;
            string msg;
            string arg1 = String.Empty; // Target.
            string arg2 = String.Empty; // Direction.
            string arg3 = String.Empty; // Distance.
            int range = 3;
            int dir;
            int n;
            bool inBattle = false;

            if (ch.IsNPC() && ch.HasActionBit(MobTemplate.ACT_PET))
                return;

            /* Target specified => arg2 has direction. */
            for (dir = 0; dir < Limits.MAX_DIRECTION; dir++)
            {
                if (dir == Limits.MAX_DIRECTION)
                {
                    ch.SendText("Invalid direction.\r\n");
                    return;
                }
                /* If a _targetType was specified as arg1. */
                if (!MUDString.IsPrefixOf(arg2, dir.ToString()))
                    break;
            }
            if (dir == Limits.MAX_DIRECTION)
                dir = 0;
            /* If arg2 wasn't a direction, then check if arg1 is. */
            if (MUDString.IsPrefixOf(arg2, dir.ToString()))
                for (dir = 0; dir <= Limits.MAX_DIRECTION; dir++)
                {
                    if (dir == Limits.MAX_DIRECTION)
                    {
                        ch.SendText("Invalid direction.\r\n");
                        return;
                    }
                    /* If arg1 is the direction, no _targetType specified. */
                    if (!MUDString.IsPrefixOf(arg1, dir.ToString()))
                    {
                        if (arg2.Length != 0)         // If there is a distance,
                        {
                            arg3 = arg2;     // Copy distance into arg3.
                        }
                        arg2 = arg1;     // Copy direction into arg2.
                        arg1 = String.Empty;     // Set _targetType to null;
                        break;
                    }
                }

            if (String.IsNullOrEmpty(arg2) || dir < 0)
            {
                ch.SendText("&+LSyntax:  &+RShoot &+L<&n&+rDirection&+L> [&n&+rRange&+L]&n\r\n");
                return;
            }

            Object obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
            if (!obj)
            {
                ch.SendText("You aren't using a missile weapon.\r\n");
                return;
            }

            if (obj.ItemType != ObjTemplate.ObjectType.ranged_weapon || obj.Values[1] < 0 || obj.Values[2] < 0)
            {
                ch.SendText("You can't do that without a ranged weapon.\r\n");
                return;
            }

            if (obj.Values[4] == 0)
            {
                ch.SendText("Its payload is empty.\r\n");
                return;
            }

            if (obj.Values[3] == ObjTemplate.RNG_CATAPULT)
            {
                if (!String.IsNullOrEmpty(arg3))
                    Int32.TryParse(arg3, out range);

                if (range <= 0)
                {
                    ch.SendText("Try shooting it away from you.\r\n");
                    return;
                }

                if (range > obj.Values[0])
                {
                    if (obj.Values[0] > 0)
                        range = obj.Values[0];
                    else
                        range = 1;
                }
            }

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

示例9: Sing

        /// <summary>
        /// Sing -- using a bard song without an instrument.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Sing(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (!ch.IsClass(CharClass.Names.bard) && !ch.IsImmortal())
            {
                ch.SendText("You don't know how to sing.\r\n");
                return;
            }

            if (ch.IsAffected(Affect.AFFECT_MINOR_PARA) ||
                    ch.IsAffected(Affect.AFFECT_HOLD))
            {
                ch.SendText("You can't Sing when you're paralyzed!\r\n");
                return;
            }

            if (ch.HasActionBit(Affect.AFFECT_MUTE))
            {
                ch.SendText("You have no voice!\r\n");
                return;
            }

            if (str.Length == 0)
            {
                if (ch.IsAffected(Affect.AFFECT_SINGING))
                {
                    ch.RemoveAffect(Affect.AFFECT_SINGING);
                    ch.SendText("You stop singing.\r\n");
                }
                else
                {
                    ch.SendText("Sing what?\r\n");
                }
                return;
            }

            Magic.Cast(ch, String.Join(" ", str));
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:44,代码来源:Command.cs

示例10: Reply

        /// <summary>
        /// Reply to the last 'tell' that you received.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Reply(CharData ch, string[] str)
        {
            if( ch == null ) return;
            if (!ch.CanSpeak())
            {
                ch.SendText("Your lips move but no sound comes out.\r\n");
                return;
            }

            CharData victim = ch.ReplyTo;
            if (!victim)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if ((!ch.IsNPC() && (ch.HasActionBit(PC.PLAYER_SILENCE)
                      || !ch.HasActionBit(PC.PLAYER_TELL) || (!victim.IsNPC() &&
                     !victim.HasActionBit(PC.PLAYER_TELL)))) || victim.InRoom.HasFlag(RoomTemplate.ROOM_SILENT))
            {
                ch.SendText("Your message didn't get through.\r\n");
                return;
            }

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

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

            if (!ch.IsImmortal() && !victim.IsAwake())
            {
                SocketConnection.Act("$E can't hear you.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            if (victim.IsIgnoring(ch))
            {
                SocketConnection.Act("$E is ignoring you.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

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

            SocketConnection.Act("&+WYou tell $N&+W '$t&+W'&n", ch, text, victim, SocketConnection.MessageTarget.character);
            int position = victim.CurrentPosition;
            victim.CurrentPosition = Position.standing;
            SocketConnection.Act("&+W$n&+W tells you '$t&+W'&n", ch, SocketConnection.TranslateText(text, ch, victim), victim, SocketConnection.MessageTarget.victim);
            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,代码行数:74,代码来源:Command.cs

示例11: Bot

        /// <summary>
        /// Used to flag a player as running or not running a bot.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Bot(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
                return;

            if (ch.HasActionBit(PC.PLAYER_BOTTING))
            {
                ch.RemoveActionBit(PC.PLAYER_BOTTING);
                ch.SendText("&nYou are no longer running a bot.\r\n");
                SocketConnection.Act("$n&n's soul has returned to $s body.", ch, null, ch, SocketConnection.MessageTarget.room);
            }
            else
            {
                ch.SetActionBit(PC.PLAYER_BOTTING);
                ch.SendText("&nYou are now running a bot.\r\n");
                SocketConnection.Act("$n&n's soul has left $s body.", ch, null, ch, SocketConnection.MessageTarget.room);
            }

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

示例12: Reload

        /// <summary>
        ///  Weapons #'s:             Ammo #'s:
        /// 0: Range of weapon      0:
        /// 1: Max ammo that can be held    1:
        /// 2: Unused           2:
        /// 3: Type of ammo loadable    3: Type of ammo.
        /// 4: Amount of ammo loaded atm    4:
        /// 5: index number of ammo loaded atm  5:
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Reload(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object quiver;
            Object ammo = null;

            if (ch.IsNPC() && ch.HasActionBit(MobTemplate.ACT_PET))
            {
                return;
            }

            Object weapon = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
            if (!weapon)
            {
                ch.SendText("I don't see that weapon here.\r\n");
                return;
            }

            if (weapon.ItemType != ObjTemplate.ObjectType.ranged_weapon)
            {
                ch.SendText("That is not a missile weapon.\r\n");
                return;
            }

            foreach (Object ammoobj in ch.Carrying)
            {
                if (ammoobj.ObjIndexData.IndexNumber == weapon.Values[5])
                {
                    ammo = ammoobj;
                    break;
                }
                if (weapon.Values[4] == 0
                        && ammoobj.ItemType == ObjTemplate.ObjectType.missile_weapon
                        && ammoobj.Values[3] == weapon.Values[3])
                {
                    ammo = ammoobj;
                    break;
                }
            }

            if (!ammo && (quiver = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.quiver)))
            {
                foreach (Object ammo2 in quiver.Contains)
                {
                    if (ammo2.ObjIndexData.IndexNumber == weapon.Values[5])
                    {
                        ammo = ammo2;
                        break;
                    }
                    if (weapon.Values[4] == 0
                            && ammo2.ItemType == ObjTemplate.ObjectType.missile_weapon
                            && ammo2.Values[3] == weapon.Values[3])
                    {
                        ammo = ammo2;
                        break;
                    }
                }
            }

            if (!ammo)
            {
                if (weapon.Values[4] <= 0)
                    ch.SendText("You do not have ammo for this weapon.\r\n");
                else
                    ch.SendText("You can't load two types of ammo into one weapon.");
                return;
            }

            if (weapon.Values[4] >= weapon.Values[1])
            {
                string buf = String.Format("{0} is already fully loaded.\r\n", weapon.ShortDescription);
                ch.SendText(buf);
                return;
            }

            weapon.Values[5] = ammo.ObjIndexData.IndexNumber;
            weapon.Values[4]++;

            SocketConnection.Act("You get $p&n.", ch, ammo, weapon, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n gets $p&n.", ch, ammo, weapon, SocketConnection.MessageTarget.room);

            SocketConnection.Act("You load $P&n with $p&n.", ch, ammo, weapon, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n loads $P&n with $p&n.", ch, ammo, weapon, SocketConnection.MessageTarget.room);

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

示例13: Recline

        /// <summary>
        /// Command to recline.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Recline(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsAffected(Affect.AFFECT_HOLD) || ch.IsAffected(Affect.AFFECT_MINOR_PARA))
            {
                ch.SendText("You're paralyzed!\r\n");
                return;
            }

            switch (ch.CurrentPosition)
            {
                case Position.sleeping:
                    ch.SendText("You are sleeping.\r\n");
                    break;

                case Position.reclining:
                    ch.SendText("You are already reclining.\r\n");
                    break;

                case Position.fighting:
                    ch.SendText("Not while you're fighting!\r\n");
                    break;

                case Position.sitting:
                case Position.kneeling:
                case Position.resting:
                case Position.standing:
                    if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
                    {
                        ch.RemoveActionBit(PC.PLAYER_MEMORIZING);
                        ch.SendText("You abandon your studies.\r\n");
                    }
                    ch.SendText("You recline.\r\n");
                    SocketConnection.Act("$n&n reclines.", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.CurrentPosition = Position.reclining;
                    break;
            }

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

示例14: Quit

        // This code is basically a hack, and I'm adding a boatload of log
        // messages until I am satisfied that this code works and is stable.
        // When messing with code like this, it is easy to have players that
        // don't enter or leave the game completely, causing ghost images,
        // player duplicates, weird dangling pointers, etc., so we have to
        // be especially careful.  If anyone happens upon this and has a
        // suggestion for how to handle anything better than I have it will
        // be greatly appreciated.
        public static void Quit(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
                return;

            // If they're not an immortal, assume they want to rent or camp and be smart
            // enough to try renting first.
            if (!ch.IsImmortal())
            {
                if (ch.InRoom != null && ch.InRoom.HasFlag(RoomTemplate.ROOM_INN))
                {
                    Rent(ch, str);
                    return;
                }
                Camp(ch, str);
                return;
            }

            if (ch.CurrentPosition == Position.fighting || ch.Fighting)
            {
                if (ch.HasActionBit(PC.PLAYER_CAMPING))
                {
                    ch.SendText("You're not gifted enough to make camp and fight at the same time.\r\n");
                    ch.RemoveActionBit(PC.PLAYER_CAMPING);
                    return;
                }
                ch.SendText("No way! You are fighting.\r\n");
                return;
            }

            if (ch.CurrentPosition < Position.stunned)
            {
                if (MUDMath.NumberRange(1, 2) == 1)
                {
                    ch.SendText("You're not &+RD&n&+rE&+RA&n&+rD&n yet.\r\n");
                    return;
                }
                ch.SendText("Just lie still and finish &+RBle&+reding&n!\r\n");
                return;
            }

            SocketConnection.Quit(ch);
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:53,代码来源:Command.cs

示例15: Channels

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

            if (str.Length == 0 || String.IsNullOrEmpty(str[0]))
            {
                if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_SILENCE))
                {
                    ch.SendText("&nYou are silenced, cur.\r\n");
                    return;
                }

                ch.SendText("Channels:");

                ch.SendText(ch.IsListening(TalkChannel.shout)
                              ? " +SHOUT"
                              : " -shout");

                ch.SendText(ch.IsListening(TalkChannel.yell)
                              ? " +YELL"
                              : " -yell");

                if (ch.IsGuild())
                {
                    ch.SendText(ch.IsListening(TalkChannel.guild)
                                  ? " +guild"
                                  : " -guild");
                }

                if (ch.IsHero())
                {
                    ch.SendText(ch.IsListening(TalkChannel.immortal)
                                  ? " +IMMTALK"
                                  : " -immtalk");
                }

                ch.SendText(".\r\n");
            }
            else
            {
                TalkChannel bit;
                bool fClear;

                if (str[0][0] == '+')
                    fClear = true;
                else if (str[0][0] == '-')
                    fClear = false;
                else
                {
                    ch.SendText("&nChannels -channel or +channel?\r\n");
                    return;
                }

                string tmparg = String.Format("{0}", str[0]);
                if (!MUDString.StringsNotEqual(tmparg + 1, "immtalk"))
                    bit = TalkChannel.immortal;
                else if (!MUDString.StringsNotEqual(tmparg + 1, "guild"))
                    bit = TalkChannel.guild;
                else if (!MUDString.StringsNotEqual(tmparg + 1, "shout"))
                    bit = TalkChannel.shout;
                else if (!MUDString.StringsNotEqual(tmparg + 1, "yell"))
                    bit = TalkChannel.yell;
                else
                {
                    ch.SendText("&nSet or clear which channel?\r\n");
                    return;
                }

                if (fClear)
                    ch.SetListening(bit, true);
                else
                    ch.SetListening(bit, false);

                ch.SendText("&nOk.\r\n");
            }

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


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