using System; using System.Collections.Generic; using System.Linq; using System.Text; using ParticleFramework.Communication; using ParticleFramework.Storage; using ParticleFramework; using Mobiles.Pathfinding; using MySql.Data.MySqlClient; namespace Mobiles.Rooms { class RoomLoader { public static void initializeRooms() { //Count the rooms int roomCount = Convert.ToInt32(DBManager.database.getString("SELECT `id` FROM `rooms` ORDER BY `id` DESC LIMIT 1")); //Select all rooms MySqlDataReader mysqlRead = DBManager.database.getCommand("SELECT * FROM `rooms` ORDER BY `id` ASC").ExecuteReader(); //Create the room list RoomManager.roomData = new List(roomCount); RoomManager.seatMaps = new List(roomCount); RoomManager.roomData.Add(null); RoomManager.seatMaps.Add(null); RoomManager.setupThreads(); string[] tmpString; int roomID; while (mysqlRead.Read()) { tmpString = new string[7]; roomID = Convert.ToInt32(mysqlRead["id"].ToString()); tmpString[0] = mysqlRead["layout"].ToString(); tmpString[1] = mysqlRead["maxusers"].ToString(); tmpString[2] = mysqlRead["decorid"].ToString(); tmpString[3] = mysqlRead["doorx"].ToString(); tmpString[4] = mysqlRead["doory"].ToString(); tmpString[5] = mysqlRead["doorz"].ToString(); tmpString[6] = mysqlRead["objects"].ToString(); //Parse heightmap RoomManager.parseHeightmap(roomID, mysqlRead["heightmap"].ToString()); //Parse objects ObjectManager.parseObjects(tmpString[6], roomID, (RoomManager.mPathFinder[roomID] as PathFinder)); RoomManager.roomData.Add(tmpString); Console.WriteLine("\tInitialized room " + mysqlRead["id"].ToString() + " [" + tmpString[0] + "]"); } DBManager.database.closeClient(); } } }