예제 #1
0
파일: RoomBot.cs 프로젝트: jabbo/Jabbo
        public RoomBot(Room Room, int botID, int botTemplate)
        {
            _MyRoom = Room;
            _Sit = "";
            _MyAvatarID = botID - botID * 2;

            string[] botData = MySQL.runReadRow("SELECT name, mission, figure, x, y, z, freeroam, startdoor FROM roombots WHERE id = '" + botTemplate + "'");
            if (botData[0] != "")
            {
                _MyName = botData[0];
            }
            else
            {
                _MyName = "Bot " + botID;
            }
            _MyMission = botData[1];
            _MyFigure = botData[2];
            _CanRoam = (botData[6] == "1");
            startDoor = (botData[7] == "1");
            if (startDoor)
            {
                _MyX = Room.door_x;
                _MyY = Room.door_y;
                _MyZ = Room.door_dir*2;
            }
            else
            {
                _MyX = int.Parse(botData[3]);
                _MyY = int.Parse(botData[4]);
                _MyZ = int.Parse(botData[5]);
            }

            targetX = _MyX;
            targetY = _MyY;

            sayings = MySQL.runReadColumn("SELECT text FROM roombots_texts WHERE id = '" + botTemplate + "'", 0);

            string[] triggerWords = MySQL.runReadColumn("SELECT words FROM roombots_texts_triggers WHERE id = '" + botTemplate + "'", 0);
            if (triggerWords.Length > 0)
            {
                string[] triggerReplies = MySQL.runReadColumn("SELECT replies FROM roombots_texts_triggers WHERE id = '" + botTemplate + "'", 0);

                this.chatTriggers = new chatTrigger[triggerWords.Length];
                for (int i = 0; i < triggerWords.Length; i++)
                    this.chatTriggers[i] = new chatTrigger(triggerWords[i].Split('}'), triggerReplies[i].Split('}'));
            }

            if (sayings.Length > 0)
            {
                aiHandler = new Thread(new ThreadStart(AI));
                aiHandler.Priority = ThreadPriority.BelowNormal;
                aiHandler.Start();
            }
            walking = false;
        }
예제 #2
0
파일: RoomManager.cs 프로젝트: jabbo/Jabbo
 public static void addRoom(int roomID, Room Room)
 {
     _Rooms.Add(roomID, Room);
 }