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


C# CharData.RemoveFromRoom方法代码示例

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


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

示例1: Enter


//.........这里部分代码省略.........
                if (!location)
                {
                    ch.SendText("That boat is broken.  You may not board it.\r\n");
                    return;
                }
            }

            if (location.IsPrivate())
            {
                ch.SendText("There is no room for you on the other side.\r\n");
                return;
            }

            if (!ship)
            {
                SocketConnection.Act("$n&n steps into $p&n.", ch, portal, null, SocketConnection.MessageTarget.room);
                if (Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_RANDOM)
                        || Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_BUGGY))
                {
                    SocketConnection.Act("You walk through $p&n and find yourself somewhere else...",
                         ch, portal, null, SocketConnection.MessageTarget.character);
                }
                else
                {
                    SocketConnection.Act("You enter $p&n.", ch, portal, null, SocketConnection.MessageTarget.character);
                }
            }
            else
            {
                SocketConnection.Act("$n&n boards $p&n.", ch, portal, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("You board $p&n.", ch, portal, null, SocketConnection.MessageTarget.character);
            }

            ch.RemoveFromRoom();
            ch.AddToRoom(location);

            if (!ship)
            {
                if (Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_RANDOM)
                        || Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_BUGGY))
                {
                    SocketConnection.Act("$n&n has arrived from elsewhere.", ch, portal, null, SocketConnection.MessageTarget.room);
                }
                else
                {
                    SocketConnection.Act("$n&n steps out of $p&n.", ch, portal, null, SocketConnection.MessageTarget.room);
                }
            }
            else
            {
                SocketConnection.Act("$n&n has boarded.", ch, portal, null, SocketConnection.MessageTarget.room);
            }

            CommandType.Interpret(ch, "look auto");

            if (!ship)
            {
                if (portal.Values[2] > 0)   /*
                                                  * This way i prevent an underflow
                                                  */
                    portal.Values[2]--;

                if (portal.Values[2] == 0)/*
                                                * If there are no more charges; remove
                                                */
                {
开发者ID:ramseur,项目名称:ModernMUD,代码行数:67,代码来源:Command.cs

示例2: Fly


//.........这里部分代码省略.........
                                SocketConnection.Act("$n&n flies up.", follower, null, null, SocketConnection.MessageTarget.room);
                                follower.FlightLevel++;
                                follower.SendText("You fly up.\r\n");
                                SocketConnection.Act("$n&n flies in from below.", follower, null, null, SocketConnection.MessageTarget.room);
                            }
                        }
                    }
                }
                else
                {
                    // If in a zone then fly out.
                    if (!ch.InRoom.Area.HasFlag(Area.AREA_WORLDMAP))
                    {
                        int lower = ch.InRoom.Area.LowRoomIndexNumber;
                        int higher = ch.InRoom.Area.HighRoomIndexNumber;
                        int iroom;
                        for (iroom = lower; iroom <= higher; iroom++)
                        {
                            troom = Room.GetRoom(iroom);
                            if (!troom)
                                continue;
                            // Now check all exits.
                            int i;
                            for (i = 0; i < Limits.MAX_DIRECTION; i++)
                            {
                                texit = troom.ExitData[i];
                                if (!texit || !(texit.TargetRoom))
                                    continue;
                                if (texit.TargetRoom.Area.HasFlag(Area.AREA_WORLDMAP))
                                {
                                    // Found a way out. Should check for exit zone being flyable.
                                    ch.SendText("You fly up.\r\n");
                                    SocketConnection.Act("$n&n flies up higher.", ch, null, null, SocketConnection.MessageTarget.room);
                                    ch.RemoveFromRoom();
                                    ch.AddToRoom(Room.GetRoom(texit.IndexNumber));
                                    ch.FlightLevel = CharData.FlyLevel.low;
                                    CommandType.Interpret(ch, "look auto");
                                    return;
                                }
                            }
                        }
                        ch.SendText("You can't fly out of this zone.\r\n"); // Glitch or no exits to worldmap.
                    }
                    ch.SendText("If you were any higher you'd be Woody Harrelson.\r\n");
                }
            }
            else if (!MUDString.IsPrefixOf(str[0], "down"))
            {
                if (ch.FlightLevel > 0)
                {
                    SocketConnection.Act("$n&n flies down lower.", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.FlightLevel--;
                    SocketConnection.Act("$n&n flies in from above.", ch, null, null, SocketConnection.MessageTarget.room);
                    if (ch.FlightLevel == 0)
                    {
                        ch.SendText("You fly down to the ground.\r\n");
                    }
                    else
                    {
                        ch.SendText("You fly down.\r\n");
                    }
                    CommandType.Interpret(ch, "look auto");
                    foreach (CharData follower in ch.InRoom.People)
                    {
                        if (follower == ch)
                        {
开发者ID:ramseur,项目名称:ModernMUD,代码行数:67,代码来源:Command.cs

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

示例4: At

        /// <summary>
        /// Perform a command at another location.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void At(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

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

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

            Room location = Room.FindLocation(ch, str[0]);
            if (!location)
            {
                ch.SendText("No such location.\r\n");
                return;
            }

            if (location.IsPrivate())
            {
                ch.SendText("That room is private right now.\r\n");
                return;
            }

            Room original = ch.InRoom;
            ch.RemoveFromRoom();
            ch.AddToRoom(location);

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

            /*
            * See if 'ch' still exists before continuing!
            * Handles 'at XXXX quit' case.
            */
            foreach (CharData worldChar in Database.CharList)
            {
                if (worldChar == ch)
                {
                    ch.RemoveFromRoom();
                    ch.AddToRoom(original);
                    break;
                }
            }

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

示例5: Rent

        /// <summary>
        /// Leave the game at an inn.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Rent(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Room room = null;
            CharData worldChar;

            if (ch.IsNPC())
                return;

            if (!ch.InRoom || !ch.InRoom.HasFlag(Room.ROOM_INN))
            {
                ch.SendText("You must be within an inn to rent.\r\n");
                return;
            }

            if (ch.CurrentPosition == Position.fighting || ch.Fighting)
            {
                ch.SendText("No way! You are fighting.\r\n");
                return;
            }

            if (ch.CurrentPosition < Position.stunned)
            {
                ch.SendText("You're not &+RD&n&+rE&+RA&n&+rD&n yet.\r\n");
                return;
            }

            ch.SendText("The innkeeper grabs a &+Lkey&n from the &n&+yrack&n, and shows you to your room.\r\n\r\n");
            SocketConnection.Act("$n&n has left the realm.", ch, null, null, SocketConnection.MessageTarget.room);
            Log.Trace(String.Format("{0} has rented.", ch.Name));

            ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_LOGINS, ch.GetTrust(), String.Format("{0} has rented.", ch.Name));

            /*
            * After CharData.ExtractChar the ch is no longer valid
            * that is why we aren't extracting the character but rather
            * sending them to our version of the "menu".
            */

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

            ch.DieFollower(ch.Name);

            // I can't see any reason why ch would not have an .in_room, but that
            // may just be shortsighted of me - Xangis
            if (ch.InRoom)
            {
                room = ch.InRoom;
            }

            ch.RemoveFromRoom();
            if (room)
            {
                ch.InRoom = room;
            }

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

            foreach (CharData it in Database.CharList)
            {
                worldChar = it;
                if (worldChar.ReplyTo == ch)
                {
                    worldChar.ReplyTo = null;
                }
            }

            ch.RemoveActionBit(PC.PLAYER_CAMPING);
            ((PC)ch).LastRentLocation = ch.InRoom.IndexNumber;
            CharData.SavePlayer(ch);

            // Remove them from the character list.
            for( int i = Database.CharList.Count -1; i >= 0; --i )
            {
                if (Database.CharList[i] == ch)
                {
                    Database.CharList.RemoveAt(i);
                }
            }

            // ConnectionState.menu is when they enter
            // the game... this shows menu
            // before they enter the game
            ch.Socket.ShowScreen(Screen.MainMenuScreen);
            ch.Socket.ConnectionStatus = SocketConnection.ConnectionState.menu;

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

示例6: Disembark

        /// <summary>
        /// Disembark (exit) from a ship or vehicle.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Disembark(CharData ch, string[] str)
        {
            if (ch == null || !ch.InRoom)
            {
                return;
            }

            foreach (Vehicle vehicle in Database.VehicleList)
            {
                if (!vehicle.ParentObject)
                    continue;
                if (ch.InRoom.IndexNumber == vehicle.EntryRoomTemplateNumber)
                {
                    if (vehicle.ParentObject.InRoom)
                    {
                        ch.RemoveFromRoom();
                        ch.AddToRoom(vehicle.ParentObject.InRoom);
                        SocketConnection.Act("$n&n disembarks from $p&n.", ch, vehicle.ParentObject, null, SocketConnection.MessageTarget.room);
                        SocketConnection.Act("You disembark from $p&n.", ch, vehicle.ParentObject, null, SocketConnection.MessageTarget.character);
                        return;
                    }
                }
            }

            ch.SendText("You don't realize you're not on a boat right now?\r\n");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:31,代码来源:Command.cs

示例7: LookCommand


//.........这里部分代码省略.........
                    door = 9;
                else if ("nw".StartsWith(args[0], StringComparison.CurrentCultureIgnoreCase))
                    door = 6;
                else if ("sw".StartsWith(args[0], StringComparison.CurrentCultureIgnoreCase))
                    door = 7;
                else if ("ne".StartsWith(args[0], StringComparison.CurrentCultureIgnoreCase))
                    door = 8;
                else if ("se".StartsWith(args[0], StringComparison.CurrentCultureIgnoreCase))
                    door = 9;
            }
            if (door != -1)
            {
                // If no exit data, then return.
                exit = ch.InRoom.ExitData[door];
                if (!exit)
                {
                    ch.SendText("There's nothing to see in that direction.\r\n");
                    return;
                }

                if (exit.HasFlag(Exit.ExitFlag.walled))
                {
                    ch.SendText("There's a wall in the way.\r\n");
                    return;
                }

                // Check for farsee
                if ((ch.IsAffected( Affect.AFFECT_FARSEE) || ch.HasActionBit(PC.PLAYER_GODMODE))
                        && !exit.HasFlag(Exit.ExitFlag.closed))
                {
                    if (exit.TargetRoom)
                    {
                        Room room = ch.InRoom;
                        ch.RemoveFromRoom();
                        ch.AddToRoom(Room.GetRoom(exit.IndexNumber));
                        CommandType.Interpret(ch, "look");
                        ch.RemoveFromRoom();
                        ch.AddToRoom(room);
                        return;
                    }
                    ch.SendText("Nothing special there.\r\n");
                }

                if (exit.Description.Length != 0)
                {
                    ch.SendText(exit.Description);
                }
                else
                {
                    ch.SendText("Nothing special there.\r\n");
                }

                if (exit.Keyword.Length != 0)
                {
                    if (exit.HasFlag(Exit.ExitFlag.bashed))
                        SocketConnection.Act("The $d has been bashed from its &n&+whinges&n.",
                             ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    else if (exit.HasFlag(Exit.ExitFlag.closed))
                        SocketConnection.Act("The $d is closed.", ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    else if (exit.HasFlag(Exit.ExitFlag.secret))
                        SocketConnection.Act("The $d is secret.", ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    else if (exit.HasFlag(Exit.ExitFlag.blocked))
                        SocketConnection.Act("The $d is blocked.", ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                }
                else
                {
开发者ID:ramseur,项目名称:ModernMUD,代码行数:67,代码来源:Command.cs

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

示例9: StopIdling

        /// <summary>
        /// Used with AFK folks -- resets a player's idle timer and displays a string
        /// saying that they are back at keys.
        /// </summary>
        /// <param name="ch"></param>
        private static void StopIdling( CharData ch )
        {
            if (!ch || !ch.Socket || ch.Socket.ConnectionStatus != ConnectionState.playing
                || !ch.WasInRoom || ch.InRoom != Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO")))
            {
                return;
            }

            ch.Timer = 0;
            ch.RemoveFromRoom();
            ch.AddToRoom( ch.WasInRoom );

            ch.WasInRoom = null;
            Act( "$n&+L has returned from the &+RA&n&+rb&+Rys&n&+rs&+L.&n", ch, null, null, MessageTarget.room );
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:21,代码来源:SocketConnection.cs

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

示例11: KillingBlow


//.........这里部分代码省略.........

            if( victim.Riding )
            {
                SocketConnection.Act( "$n&n topples from you, &+Ldead&n.", victim, null, victim.Riding, SocketConnection.MessageTarget.victim );
                victim.Riding.Rider = null;
                victim.Riding = null;
            }

            if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_VAMP_BITE))
            {
                victim.SetPermRace( Race.RACE_VAMPIRE );
            }

            for (int i = (victim.Affected.Count - 1); i >= 0; i--)
            {
                /* Keep the ghoul affect */
                if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_WRAITHFORM))
                {
                    continue;
                }

                victim.RemoveAffect(victim.Affected[i]);
            }

            if( victim.IsNPC() )
            {
                victim.MobileTemplate.NumberKilled++;
                // This may invalidate the char list.
                CharData.ExtractChar( victim, true );
                return;
            }
            CharData.ExtractChar( victim, false );
            //save corpses, don't wait til next save_corpse event
            Database.CorpseList.Save();
            // Character has died in combat, extract them to repop point and put
            // them at the menu.
            /*
                 * Pardon crimes once justice system is complete
                 */
            // This is where we send them to the menu.
            victim.DieFollower( victim.Name );

            if( victim.InRoom )
            {
                room = victim.InRoom;
            }
            else
            {
                List<RepopulationPoint> repoplist = victim.GetAvailableRepops();
                if( repoplist.Count < 1 )
                {
                    victim.SendText( "There is no RepopPoint entry for your race and class.  Sending you to limbo.\r\n" );
                    room = Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_START") );
                }
                else
                {
                    // Drop them at the first repop point in the list.  We may want to be fancier about this later, such as dropping them
                    // at the repop for class none if their particular class isn't found.
                    room = Room.GetRoom(repoplist[0].Room);
                    if( !room )
                    {
                        victim.SendText( "The repop point for your race/class does not exist.  Please bug this.  Sending you to limbo.\r\n" );
                        room = Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_START") );
                    }
                    if( !victim.IsNPC() && Room.GetRoom( ( (PC)victim ).CurrentHome ) )
                    {
                        room = Room.GetRoom( ( (PC)victim ).CurrentHome );
                    }
                }
            }
            victim.RemoveFromRoom();
            if( room )
            {
                victim.InRoom = room;
            }

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

            // Reset reply pointers - handled by CharData.ExtractChar.

            CharData.SavePlayer( victim );

            // Remove from char list: handled by CharData.ExtractChar.

            victim.Socket.ShowScreen(ModernMUD.Screen.MainMenuScreen);

            if( victim.Socket != null )
            {
                victim.Socket.ConnectionStatus = SocketConnection.ConnectionState.menu;
            }

            // Just died flag used for safe time after re-login.
            victim.SetActionBit( PC.PLAYER_JUST_DIED );

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

示例12: ExtractChar


//.........这里部分代码省略.........
                    {
                        worldChar.StopConsenting(ch);
                        SocketConnection.Act("You stop consenting $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
                    }
                    if (worldChar.IsIgnoring(ch))
                    {
                        worldChar.StopIgnoring(ch);
                        SocketConnection.Act("You stop ignoring $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
                    }
                    if (!worldChar.IsNPC() && ((PC)worldChar).Guarding == ch)
                    {
                        ((PC)worldChar).Guarding = null;
                        SocketConnection.Act("You stop guarding $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
                    }
                    if (worldChar.IsHating(ch))
                        worldChar.StopHating(ch);
                    if (worldChar.Hunting && worldChar.Hunting.Who == ch)
                        Combat.StopHunting(worldChar);
                    if (worldChar.Fearing && worldChar.Fearing.Who == ch)
                        Combat.StopFearing(worldChar);
                    // Remove from the active character list.
                    // BUG: TODO: FIXME: This invalidates the list for anyone iterating through
                    // a list that may kill characters, such as violence_update.
                    // it = CharList.erase( it );
                }

                if (ch.InRoom)
                {
                    // This was placed *after* the act strings to be safe.
                    for (int iwch = ch.InRoom.People.Count - 1; iwch >= 0; iwch--)
                    {
                        if (ch.InRoom.People[iwch] == ch)
                        {
                            ch.RemoveFromRoom();
                            break;
                        }
                    }
                }

                // They're not being yanked from game, probably just dead and going to the menu.
                if (!delete)
                {
                    Room location;

                    if (ch.Level < 5 || Macros.IsSet((int)Database.SystemData.ActFlags, (int)Sysdata.MudFlags.alwaysequip))
                        ch.ReceiveNewbieEquipment();

                    if (!ch.IsNPC() && (ch.GetOrigRace() < Limits.MAX_PC_RACE) && ((int)ch.CharacterClass.ClassNumber < CharClass.ClassList.Length))
                    {
                        // Get the default respawn location based on currhome, then race/class default.
                        location = Room.GetRoom(((PC)ch).CurrentHome);
                        if (location == null)
                        {
                            int place;
                            List<RepopulationPoint> repoplist = ch.GetAvailableRepops();
                            if (repoplist.Count < 1)
                            {
                                place = StaticRooms.GetRoomNumber("ROOM_NUMBER_START");
                            }
                            else
                            {
                                place = repoplist[0].RoomIndexNumber;
                            }
                            location = Room.GetRoom(place);
                            if (location == null)
                            {
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:CharData.cs

示例13: CheckFall

        /// <summary>
        /// Check for falling. Called from room update and movement.
        /// </summary>
        /// <param name="room"></param>
        /// <param name="target"></param>
        /// <param name="ch"></param>
        public static void CheckFall( Room room, Room target, CharData ch )
        {
            int chance;

            if( !room || !target || !ch )
                return;
            if( room.TerrainType != TerrainType.air &&
                    room.TerrainType != TerrainType.plane_of_air &&
                    room.TerrainType != TerrainType.underground_no_ground )
            {
                if( MUDMath.NumberPercent() > room.FallChance )
                    return;
            }

            if( ch.CanFly() || ch.IsAffected( Affect.AFFECT_LEVITATE ) )
                return;

            if( ch.InRoom.People != null )
            {
                SocketConnection.Act( "You are falling down!", ch, null, null, SocketConnection.MessageTarget.character );
                SocketConnection.Act( "$n&n falls away.", ch, null, null, SocketConnection.MessageTarget.room );
            }

            ch.RemoveFromRoom();
            ch.AddToRoom( target );

            if( !ch.HasSkill( "safe_fall" ) )
                chance = 0;
            else if( ch.IsNPC() )
                chance = ( ( ch.Level * 3 ) / 2 ) + 15;
            else
                chance = ( (PC)ch ).SkillAptitude[ "safe fall" ];

            // People with high agility have a small chance to safe fall, and those with
            // the skill already get a bonus.
            chance += ( ch.GetCurrAgi() / 20 );

            // Minimum 1% chance of a bad fall.
            if( chance > 99 )
            {
                chance = 99;
            }

            // Safe fall added by Xangis
            if( target.FallChance == 0 || !target.ExitData[ 5 ]
                    || !target.ExitData[ 5 ].TargetRoom )
            {
                if( MUDMath.NumberPercent() < chance )
                {
                    // Decent chance of skill increase - people don't fall very often.
                    ch.PracticeSkill( "safe fall" );
                    ch.PracticeSkill( "safe fall" );
                    ch.PracticeSkill( "safe fall" );
                    ch.PracticeSkill( "safe fall" );
                    ch.SendText( "You fall to the ground!\r\n" );

                    if( MUDMath.NumberPercent() < chance )
                    {
                        SocketConnection.Act( "$n&n falls from above and lands gracefully.", ch, null, null, SocketConnection.MessageTarget.room );
                        ch.SendText( "You land gracefully, avoiding any injury.\r\n" );
                    }
                    else
                    {
                        SocketConnection.Act( "$n&n falls from above and lands on $s arse.", ch, null, null, SocketConnection.MessageTarget.room );
                        if( Race.MAX_SIZE > 0 && !ch.IsNPC() )
                        {
                            Combat.InflictDamage(ch, ch, MUDMath.NumberRange(2, 4), String.Empty, ObjTemplate.WearLocation.none, AttackType.DamageType.none);
                            ch.CurrentPosition = Position.sitting;
                            ch.WaitState( 3 );
                        }
                    }
                }
                else
                {
                    ch.SendText( "You slam into the ground!\r\n" );
                    ch.CurrentPosition = Position.sitting;
                    ch.WaitState( 8 );
                    SocketConnection.Act( "$n&n comes crashing in from above.", ch, null, null, SocketConnection.MessageTarget.room );
                    if( Race.MAX_SIZE > 0 && !ch.IsNPC() )
                    {
                        Combat.InflictDamage( ch, ch, ( ( MUDMath.NumberPercent() * (int)ch.CurrentSize ) / Race.MAX_SIZE ),
                                String.Empty, ObjTemplate.WearLocation.none, AttackType.DamageType.none);
                    }
                }
            }
            else if( ch && ch.InRoom )
            {
                if( ch.InRoom.People.Count > 0 )
                {
                    SocketConnection.Act( "$n&n falls by.", ch, null, null, SocketConnection.MessageTarget.room );
                }
            }

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

示例14: Goto

        /// <summary>
        /// Teleport to another location.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Goto(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData realChar = ch.GetChar();

            if (!realChar.Authorized("goto") || !ch.IsImmortal())
            {
                return;
            }

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

            Room location = Room.FindLocation(ch, str[0]);
            if (!location)
            {
                ch.SendText("No such location.\r\n");
                return;
            }

            if (location.IsPrivate())
            {
                ch.SendText("That room is private right now.\r\n");
                return;
            }

            if (ch.Fighting)
            {
                Combat.StopFighting(ch, true);
            }
            if (!ch.HasActionBit(PC.PLAYER_WIZINVIS))
            {
                if (!ch.IsNPC() && ((PC)ch).ImmortalData.DisappearMessage.Length > 0)
                {
                    SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.DisappearMessage, SocketConnection.MessageTarget.room);
                }
                else
                {
                    SocketConnection.Act("$n disappears in a puff of smoke.", ch, null, null, SocketConnection.MessageTarget.room);
                }
            }

            ch.RemoveFromRoom();
            ch.AddToRoom(location);

            if (!ch.HasActionBit(PC.PLAYER_WIZINVIS))
            {
                if (!ch.IsNPC() && ((PC)ch).ImmortalData.AppearMessage.Length > 0)
                {
                    SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.AppearMessage, SocketConnection.MessageTarget.room);
                }
                else
                {
                    SocketConnection.Act("$n appears in a swirling mist", ch, null, null, SocketConnection.MessageTarget.room);
                }
            }

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

示例15: LookOut

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

            Vehicle vehicle;

            if (ch.InRoom == null)
                return;

            foreach (Vehicle it in Database.VehicleList)
            {
                vehicle = it;
                if (vehicle.ParentObject == null)
                    continue;
                if (ch.InRoom.IndexNumber == vehicle.EntryRoomTemplateNumber)
                {
                    if (vehicle.ParentObject.InRoom)
                    {
                        // Copied from farsee code - Xangis
                        Room room = ch.InRoom;
                        ch.RemoveFromRoom();
                        ch.AddToRoom(vehicle.ParentObject.InRoom);
                        CommandType.Interpret(ch, "look");
                        ch.RemoveFromRoom();
                        ch.AddToRoom(room);
                        return;
                    }
                }
            }

            ch.SendText("You do not see that here.\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:33,代码来源:Command.cs


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