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


C# CharData.RemoveActionBit方法代码示例

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


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

示例1: ColorCommand

        /// <summary>
        /// Lets a player turn ANSI color on and off.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void ColorCommand(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (!ch.HasActionBit(PC.PLAYER_COLOR))
            {
                ch.SetActionBit(PC.PLAYER_COLOR);
                ch.SendText("&+LThe world becomes more &n&+mco&+Ml&+Wor&+Cf&n&+cul&+L.&n\r\n");
            }
            else
            {
                SocketConnection.SendToCharBW("The color drains.\r\n", ch);
                ch.RemoveActionBit(PC.PLAYER_COLOR);
            }
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:21,代码来源:Command.cs

示例2: Camp

        /// <summary>
        /// The camp function now simply creates a camp event.
        /// The Command.Quit function handles quitters and campers, based
        /// on the camping bit.  The only goofy side effect of this is
        /// that an immortal who is camping can quit and get the
        /// "you roll up in your bedroll" message.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Camp(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
                return;

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

            if (ch.FlightLevel != 0)
            {
                ch.SendText("Perhaps it would be more comfortable on the ground.\r\n");
                return;
            }

            if (ch.HasActionBit(PC.PLAYER_CAMPING))
            {
                ch.SendText("Your preparations are not quite complete.\r\n");
                return;
            }

            if (ch.CurrentPosition < Position.stunned)
            {
                ch.SendText("Just lie still and finish &+RBle&+reding&n!\r\n");
                return;
            }

            SocketConnection.Act("$n&n starts to set up camp.", ch, null, null, SocketConnection.MessageTarget.room);
            ch.SendText("You start to set up camp.\r\n");
            ch.SetActionBit(PC.PLAYER_CAMPING);
            // Pass the character, the room they started camping in, and the
            // number of cycles to camp for
            // Pulse camp is 5 seconds, so make them wait for 1.5 minutes
            Event.CreateEvent(Event.EventType.camp, Event.TICK_CAMP, ch, ch.InRoom, 18);

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

示例3: Toggle


//.........这里部分代码省略.........
                else if (("brief".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_BRIEF;
                else if (("casttick".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_CAST_TICK;
                else if (("combine".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_COMBINE;
                else if (("color".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                {
                    if (ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED)
                    {
                        ch.SendText("You cannot turn color off when using the enhanced client.\r\n");
                        return;
                    }
                    bit = PC.PLAYER_COLOR;
                }
                else if (("colorcon".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_COLOR_CON;
                else if (("msp".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_MSP;
                else if (("pager".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_PAGER;
                else if (("shout".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_SHOUT;
                else if (("prompt".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_PROMPT;
                else if (("telnetga".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_TELNET_GA;
                else if (("tell".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_TELL;
                else if (("vicious".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_VICIOUS;
                else if (("map".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_MAP;
                else if (("vicious".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_VICIOUS;
                else if (("compact".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
                    bit = PC.PLAYER_BLANK;
                else if (word.Contains("wimpy"))
                {
                    CommandType.Interpret(ch, "wimpy " + word.Substring((word.IndexOf("wimpy") + 5)));
                    return;
                }
                else if ("mccp".StartsWith(word, StringComparison.CurrentCultureIgnoreCase))
                {
                    ch.Socket.MCCPEnabled = !ch.Socket.MCCPEnabled;
                    if (ch.Socket.MCCPEnabled)
                    {
                        ch.SendText("MCCP is now enabled.");
                    }
                    else
                    {
                        ch.SendText("MCCP is now disabled.");
                    }
                    return;
                }
                else
                {
                    ch.SendText("&nConfig which option?\r\n");
                    return;
                }

                if (ch.IsClass(CharClass.Names.paladin) && bit == PC.PLAYER_VICIOUS)
                {
                    ch.SendText("Paladins may not toggle vicious.\r\n");
                    /* Just to make sure they don't have it toggled on. */
                    ch.RemoveActionBit(bit);
                    return;
                }

                if (fSet == 1)
                {
                    if (bit != PC.PLAYER_NONE)
                    {
                        ch.SetActionBit(bit);
                    }
                    ch.SendText( (String.Format("&n{0} is now ON.\r\n", word.ToUpper())));
                }
                else if (fSet == 0)
                {
                    if (bit != PC.PLAYER_NONE)
                    {
                        ch.RemoveActionBit(bit);
                    }
                    ch.SendText((String.Format("&n{0} is now OFF.\r\n", word.ToUpper())));
                }
                else if (fSet == 2)
                {
                    if (bit != PC.PLAYER_NONE)
                    {
                        ch.ToggleActionBit(bit);
                    }
                    if (ch.HasActionBit(bit))
                        ch.SendText((String.Format("&n{0} is now ON.\r\n", word.ToUpper())));
                    else
                        ch.SendText((String.Format("&n{0} is now OFF.\r\n", word.ToUpper())));
                }
            }

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

示例4: Sleep

        /// <summary>
        /// Command to fall asleep.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Sleep(CharData ch, string[] str)
        {
            if( ch == null ) return;
            switch (ch.CurrentPosition)
            {
                case Position.sleeping:
                    ch.SendText("You are already sleeping.\r\n");
                    break;

                case Position.reclining:
                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 sleep.\r\n");
                    SocketConnection.Act("$n&n sleeps.", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.CurrentPosition = Position.sleeping;
                    break;

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

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

示例5: Stand

        /// <summary>
        /// Command to stand up.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Stand(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;
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEMORIZING);
                ch.SendText("You abandon your studies.\r\n");
            }

            switch (ch.CurrentPosition)
            {
                case Position.sleeping:
                    if (ch.IsAffected( Affect.AFFECT_SLEEP))
                    {
                        ch.SendText("You can't wake up!\r\n");
                        return;
                    }

                    ch.SendText("You wake and stand up.\r\n");
                    SocketConnection.Act("$n&n wakes and stands up.", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.CurrentPosition = Position.standing;
                    break;

                case Position.sitting:
                case Position.kneeling:
                case Position.reclining:
                case Position.resting:
                    ch.SendText("You stand up.\r\n");
                    SocketConnection.Act("$n&n stands up.", ch, null, null, SocketConnection.MessageTarget.room);
                    if (ch.Fighting)
                    {
                        ch.CurrentPosition = Position.fighting;
                    }
                    else
                    {
                        ch.CurrentPosition = Position.standing;
                    }
                    break;

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

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

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

示例7: Interpret

        /// <summary>
        /// The main entry point for executing commands.
        /// Can be recursively called from 'at', 'order', 'force'.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="argument"></param>
        public static void Interpret(CharData ch, string argument)
        {
            // Get rid of leading and trailing spaces.
            argument = argument.Trim();

            // Strip leading spaces.
            argument.Trim();
            if (argument.Length == 0)
            {
                return;
            }

            // Remove AFK
            if (!ch.IsNPC())
            {
                ch.RemoveActionBit(PC.PLAYER_AFK);
            }

            // Implement freeze command.
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_FREEZE))
            {
                ch.SendText("You're totally frozen!\r\n");
                return;
            }

            // Grab the command word.  Special parsing so ' can be a command,
            // also no spaces needed after punctuation.
            string command;
            Object obj;
            Room room;
            int cmd;
            string logline = argument;
            int argptr = 0;
            if (!Char.IsLetter(argument[0]) && !Char.IsDigit(argument[0]))
            {
                command = argument.Substring(0, 1);
                argptr++;
                while (argument.Length > argptr && Char.IsWhiteSpace(argument[argptr]))
                {
                    argument = argument.Remove(0, 1);
                }
            }
            else
            {
                command = MUDString.OneArgument(argument, ref argument);
                argument.Trim(); // Clean up the remainder of the command.
            }

            // Nothing to do if command is empty.  Just send them a newline and bail.
            if (string.IsNullOrEmpty(command) && string.IsNullOrEmpty(argument))
            {
                ch.SendText("\r\n");
                return;
            }

            // Look for an item with a teleport trigger in the room.
            // and check to see if the command is a teleport trigger
            if (ch.InRoom && (obj = ch.GetObjHere(argument)))
            {
                if (obj.ItemType == ObjTemplate.ObjectType.teleport)
                {
                    if (CheckCommandTrigger(command, obj.Values[1]) && obj.Values[2] != 0)
                    {
                        if (obj.Values[2] != -1)
                        {
                            obj.Values[2]--;
                        }
                        room = Room.GetRoom(obj.Values[0]);
                        if (room)
                        {
                            SocketConnection.Act("$n&n vanishes suddenly.", ch, null, null, SocketConnection.MessageTarget.room);
                            string text = String.Format("You {0} $p&n.\r\n", command);
                            SocketConnection.Act(text, ch, obj, null, SocketConnection.MessageTarget.character);
                            Log.Trace(String.Format("{0} activated keyword and was teleported by object.", ch.Name));
                            ch.RemoveFromRoom();
                            ch.AddToRoom(room);
                            Interpret(ch, "look auto");
                            SocketConnection.Act("$n&n arrives suddenly.", ch, null, null, SocketConnection.MessageTarget.room);
                        }
                        else
                        {
                            ch.SendText("BUG: The target room for this teleporter does not exist.\r\n");
                            Log.Error("Target room for object {0} does not exist.", obj.ObjIndexData.IndexNumber);
                        }
                        return;
                    }
                }
                else if (obj.ItemType == ObjTemplate.ObjectType.switch_trigger)
                {
                    Exit exit;
                    string cbuf = String.Format("Checking {0} against command no. {1} for {2}.", command, obj.Values[0], obj.Name);
                    ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, cbuf);
                    if (CheckCommandTrigger(command, obj.Values[0]))
                    {
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:CommandType.cs

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

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

示例10: Meditate

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

            if (ch.IsNPC())
                return;

            if (!ch.HasSkill("meditate"))
            {
                ch.SendText("You don't know how to meditate.\r\n");
                return;
            }

            if (ch.HasActionBit(PC.PLAYER_MEDITATING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEDITATING);
                ch.SendText("You stop meditating.\r\n");
            }

            if (ch.CurrentPosition != Position.resting)
            {
                ch.SendText("You must be resting in order to meditate.\r\n");
                return;
            }

            if (ch.Fighting != null)
            {
                ch.SendText("Meditation during battle leads to permenant inner peace.\r\n");
                return;
            }

            ch.SetActionBit(PC.PLAYER_MEDITATING);
            ch.WaitState(Skill.SkillList["meditate"].Delay);
            ch.PracticeSkill("meditate");
            ch.SendText("You start meditating...\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:42,代码来源:Command.cs

示例11: AFK

        /// <summary>
        /// Command to set yourself as being away from keyboard.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void AFK(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
                return;

            if (ch.HasActionBit(PC.PLAYER_AFK))
            {
                ch.RemoveActionBit(PC.PLAYER_AFK);
                ch.SendText("&nYou are back at your keyboard.\r\n");
                SocketConnection.Act("$n&n has returned to $s keyboard.", ch, null, ch, SocketConnection.MessageTarget.room);
            }
            else
            {
                ch.SetActionBit(PC.PLAYER_AFK);
                ch.SendText("&nYou are away from keyboard.\r\n");
                SocketConnection.Act("$n&n has left $s keyboard.", ch, null, ch, SocketConnection.MessageTarget.room);
            }

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

示例12: Invis

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

            if (ch.IsNPC())
                return;

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

            if (ch.HasActionBit(PC.PLAYER_WIZINVIS))
            {
                ch.RemoveActionBit(PC.PLAYER_WIZINVIS);
                ch.SendText("You slowly fade back into existence.\r\n");
                SocketConnection.Act("$n slowly fades into existence.", ch, null, null, SocketConnection.MessageTarget.room);
            }
            else
            {
                ch.SendText("You slowly vanish into thin air.\r\n");
                SocketConnection.Act("$n slowly fades into thin air.", ch, null, null, SocketConnection.MessageTarget.room);
                ch.SetActionBit(PC.PLAYER_WIZINVIS);
            }

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

示例13: Quit

        /// <summary>
        /// Called when a player quits or when camping preparations are complete.
        /// </summary>
        public static void Quit(CharData ch)
        {
            if (ch == null)
            {
                Log.Error("Quit: Called with null character.");
                return;
            }

            try
            {
                if (ch.HasActionBit(PC.PLAYER_CAMPING))
                {
                    ch.RemoveActionBit(PC.PLAYER_CAMPING);
                    Act("You climb into your bedroll and leave the realm.", ch, null, null, MessageTarget.character);
                    if (ch.Gender == MobTemplate.Sex.male)
                        Act("$n&n climbs into his bedroll and leaves the realm.", ch, null, null, MessageTarget.room);
                    else if (ch.Gender == MobTemplate.Sex.female)
                        Act("$n&n climbs into her bedroll and leaves the realm.", ch, null, null, MessageTarget.room);
                    else
                        Act("$n&n climbs into its bedroll and leaves the realm.", ch, null, null, MessageTarget.room);

                    string text = String.Format("{0} has camped out.", ch.Name);
                    Log.Trace(text);
                    ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_LOGINS, ch.GetTrust(), text);
                }
                else
                {
                    ch.SendText("You leave the realm.\r\n\r\n");
                    Act("$n&n has left the realm.", ch, null, null, MessageTarget.room);
                    Log.Trace(String.Format("{0} has camped out.", ch.Name));
                    ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_LOGINS, ch.GetTrust(), String.Format("{0} has camped out.", ch.Name));
                }

                // I know we checked for position fighting, but I'm paranoid...
                if (ch.Fighting)
                {
                    Combat.StopFighting(ch, true);
                }

                ch.DieFollower(ch.Name);

                Room room = null;
                if (ch.InRoom)
                {
                    room = ch.InRoom;
                }

                ch.RemoveFromRoom();
                if (room != null)
                {
                    ch.InRoom = room;
                    ((PC)ch).LastRentLocation = ch.InRoom.IndexNumber;
                }

                // Put them in the correct body
                if (ch && ch.Socket && ch.Socket.Original)
                {
                    CommandType.Interpret(ch, "return");
                }

                CharData.SavePlayer(ch);

                Database.CharList.Remove(ch);

                if (ch && ch.Socket)
                {
                    ch.Socket.ShowScreen(Screen.MainMenuScreen);
                    ch.Socket.ConnectionStatus = ConnectionState.menu;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in SocketConnection.Quit: " + ex.ToString());
            }

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

示例14: CampUpdate

 /// <summary>
 /// Camping timer ticking away.
 /// 
 /// Uses a single event for each person that is actively camping.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="room"></param>
 /// <returns></returns>
 static bool CampUpdate( CharData ch, Room room )
 {
     if( !ch || !room || ch.CurrentPosition <= Position.incapacitated )
         return false;
     if( !ch.HasActionBit(PC.PLAYER_CAMPING ) )
         return false;
     if( ch.CurrentPosition == Position.fighting || ch.Fighting || ch.InRoom != room )
     {
         ch.SendText( "So much for that camping effort.\r\n" );
         ch.RemoveActionBit(PC.PLAYER_CAMPING);
         return false;
     }
     return true;
 }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:22,代码来源:Event.cs

示例15: Drag

        /// <summary>
        /// Used for dragging corpses into another room.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Drag(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj;
            Object obj2;

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

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

            if (str.Length == 0)
            {
                ch.SendText("You need to specify a direction.\r\n");
                return;
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEMORIZING);
                ch.SendText("You abandon your studies.\r\n");
            }

            if (!(obj = ch.GetObjHere(str[0])))
            {
                ch.SendText("You do not see that here.\r\n");
                return;
            }

            if (obj.ItemType != ObjTemplate.ObjectType.npc_corpse && obj.ItemType != ObjTemplate.ObjectType.pc_corpse)
            {
                ch.SendText("You can only drag corpses.\r\n");
                return;
            }

            if (str.Length > 2 && str[1] == "enter")
            {
                if ((obj2 = ch.GetObjHere(str[3])))
                {
                    switch (obj2.ItemType)
                    {
                        case ObjTemplate.ObjectType.teleport:
                        case ObjTemplate.ObjectType.portal:
                            if (obj2.ItemType == ObjTemplate.ObjectType.teleport && !CommandType.CheckCommandTrigger("enter", obj2.Values[1]))
                            {
                                ch.SendText("Nothing happens.\r\n");
                                return;
                            };
                            Room location;
                            if (Macros.IsSet(obj2.Values[3], ObjTemplate.PORTAL_RANDOM))
                            {
                                location = Movement.GetRandomRoom();
                            }
                            else
                            {
                                location = Room.GetRoom(obj2.Values[0]);
                            }
                            if (!location)
                            {
                                ch.SendText("That portal doesn't seem to go anywhere.\r\n");
                                return;
                            }
                            SocketConnection.Act("You drag the $p&n into $P&n.", ch, obj, obj2, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$n&n drags the $p&n into $P&n.", ch, obj, obj2, SocketConnection.MessageTarget.room);
                            if (obj2.Values[2] >= 0)
                            {
                                obj2.Values[2] -= 2;
                                if (obj2.Values[2] <= 0)
                                {
                                    SocketConnection.Act("$p&n fades into nothingness.", ch, obj2, null, SocketConnection.MessageTarget.room);
                                    obj2.RemoveFromRoom();
                                }
                            }
                            obj.RemoveFromRoom();
                            ch.RemoveFromRoom();
                            ch.AddToRoom(location);
                            obj.AddToRoom(location);
                            if (obj2.ItemType == ObjTemplate.ObjectType.portal)
                            {
                                SocketConnection.Act("$n&n steps out of $P&n dragging the $p&n.", ch, obj, obj2, SocketConnection.MessageTarget.room);
                            }
                            else
                            {
                                SocketConnection.Act("$n&n appears from elsewhere, dragging the $p&n.", ch, obj, null, SocketConnection.MessageTarget.room);
                            }
                            CommandType.Interpret(ch, "look auto");
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs


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