Exemplo n.º 1
0
        /// <summary>
        /// Gets the scan info for the provided room.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="room"></param>
        /// <param name="buffer"></param>
        /// <param name="flyLevel"></param>
        /// <returns></returns>
        public static int ScanThisRoom(CharData ch, Room room, string buffer, CharData.FlyLevel flyLevel)
        {
            int    numberFound = 0;
            string levelMsg;

            int diff = flyLevel - ch.FlightLevel;

            switch (diff)
            {
            case -3:
                levelMsg = String.Format("&n who is very far beneath you.");
                break;

            case -2:
                levelMsg = String.Format("&n who is not far beneath you.");
                break;

            case -1:
                levelMsg = String.Format("&n who is close by beneath you.");
                break;

            case 1:
                levelMsg = String.Format("&n who is flying close by above you.");
                break;

            case 2:
                levelMsg = String.Format("&n who is flying not far above you.");
                break;

            case 3:
                levelMsg = String.Format("&n who is flying very far above you.");
                break;

            default:
                levelMsg = String.Format("&n who is an unknown distance away from you.");
                break;
            }

            foreach (CharData target in room.People)
            {
                if (target.FlightLevel == flyLevel)
                {
                    Visibility visibility = Look.HowSee(ch, target);
                    switch (visibility)
                    {
                    case Visibility.sense_hidden:
                    case Visibility.invisible:
                    case Visibility.too_dark:
                    default:
                        break;

                    case Visibility.visible:
                        buffer += (target.ShowNameTo(ch, true));
                        buffer += levelMsg;
                        buffer += "&n\r\n";
                        numberFound++;
                        break;

                    case Visibility.sense_infravision:
                        buffer += "&+rYou sense a being within the darkness";
                        buffer += levelMsg;
                        buffer += "&n\r\n";
                        numberFound++;
                        break;
                    }
                }
            }
            return(numberFound);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Scanning function.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="room"></param>
        /// <param name="text"></param>
        /// <param name="distance"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        public static int ScanRoom(CharData ch, Room room, ref string text, int distance, int dir)
        {
            int    numberFound = 0;
            string distanceMsg;

            if (dir < 0 || dir >= Limits.MAX_DIRECTION)
            {
                Log.Error("ScanRoom: direction {0} out of bounds!", dir);
                ch.SendText("Bug while scanning, direction out of bounds!\r\n");
                return(0);
            }

            // Not going to find anything in a room that is unscannable - Xangis
            if (room.HasFlag(RoomTemplate.ROOM_NO_SCAN))
            {
                return(0);
            }

            switch (distance)
            {
            case 1:
                distanceMsg = String.Format("&n who is close by to the ");
                break;

            case 2:
                distanceMsg = String.Format("&n who is not far off to the ");
                break;

            case 3:
                distanceMsg = String.Format("&n who is a brief walk away to the ");
                break;

            default:
                distanceMsg = String.Format("&n who is an unknown distance to the ");
                break;
            }

            foreach (CharData target in room.People)
            {
                if (ch.FlightLevel == target.FlightLevel)
                {
                    Visibility visibility = Look.HowSee(ch, target);
                    switch (visibility)
                    {
                    case Visibility.sense_hidden:
                    case Visibility.invisible:
                    case Visibility.too_dark:
                    default:
                        break;

                    case Visibility.visible:
                        text += (target.ShowNameTo(ch, true));
                        text += distanceMsg;
                        text += dir.ToString();
                        text += ".&n\r\n";
                        numberFound++;
                        break;

                    case Visibility.sense_infravision:
                        text += "&+rYou sense a being within the darkness";
                        text += distanceMsg;
                        text += dir.ToString();
                        text += ".&n\r\n";
                        numberFound++;
                        break;
                    }
                }
            }
            return(numberFound);
        }