internal void loadRoomBots() { List<List<string>> fieldValues = MySQL.readArray("SELECT id FROM roombots WHERE roomid='" + RoomID + "'"); for (int i = 0; i < fieldValues.Count; i++) { var thisField = fieldValues[i].ToArray(); try { int botID = ++botAmount; RoomBot roomBot = new RoomBot(this, botID, int.Parse(thisField[0])); this._Bots.Add(botID, roomBot); if (!roomBot.startDoor) { _sqUnit[roomBot._MyX, roomBot._MyY] = true; } } catch { Console.WriteLine("ERROR: UNABLE TO LOAD ROOMBOT!"); } } updateHeightmapping(); }
internal void loadBots(int amount) { string sendText = ""; int users = countUsers(); for (int i = 0; i < amount; i++) { if (users++ < max_users) { int botID = ++botAmount; RoomBot roomBot = new RoomBot(this, botID, 0); this._Bots.Add(botID, roomBot); if (!roomBot.startDoor) { _sqUnit[roomBot._MyX, roomBot._MyY] = true; } AddAvatarPacket avatars = new AddAvatarPacket(); avatars.I = roomBot._MyAvatarID; avatars.U = roomBot._MyName; avatars.M = roomBot._MyMission; avatars.C = roomBot._MyFigure; avatars.B = "7"; avatars.D = ""; avatars.Brb = 0; avatars.S = roomBot._Sit; avatars.X = roomBot._MyX; avatars.Y = roomBot._MyY; avatars.H = roomBot._MyZ; avatars.F = false; avatars.R = false; string stringavatars = JsonConvert.SerializeObject(avatars); sendText += "056" + stringavatars + "#"; } } foreach (ConnectedUser usr in _Users.Values) { usr.sendData(sendText); } }