Example #1
0
        public static RDungeonMap LoadRDungeonMap(DatabaseConnection dbConnection, string mapID)
        {
            DataManager.Maps.RDungeonMap loadedMap = MapDataManager.LoadRDungeonMap(dbConnection.Database, mapID);
            RDungeonMap map = new RDungeonMap(loadedMap);

            return(map);
        }
Example #2
0
        public static void SaveRDungeonMap(MySql database, string mapID, RDungeonMap map)
        {
            bool localTransaction = false;

            if (database.IsTransactionActive == false)
            {
                database.BeginTransaction();
                localTransaction = true;
            }

            SaveMapDump(database, mapID, map);

            // Save extra data associated with instanced maps
            database.UpdateOrInsert("map_rdungeon_data", new IDataColumn[] {
                database.CreateColumn(false, "MapID", mapID),
                database.CreateColumn(false, "RDungeonIndex", map.RDungeonIndex.ToString()),
                database.CreateColumn(false, "RDungeonFloor", map.RDungeonFloor.ToString()),
                database.CreateColumn(false, "StartX", map.StartX.ToString()),
                database.CreateColumn(false, "StartY", map.StartY.ToString())
            });

            if (localTransaction)
            {
                database.EndTransaction();
            }
        }
Example #3
0
        public static RDungeonMap LoadRDungeonMap(MySql database, string mapID)
        {
            RDungeonMap map = new RDungeonMap(mapID);

            LoadMapDump(database, mapID, map);

            string query             = "SELECT map_rdungeon_data.RDungeonIndex, map_rdungeon_data.RDungeonFloor, map_rdungeon_data.StartX, map_rdungeon_data.StartY FROM map_rdungeon_data WHERE map_rdungeon_data.MapID = \'" + database.VerifyValueString(mapID) + "\'";
            DataColumnCollection row = database.RetrieveRow(query);

            if (row != null)
            {
                int counter = 0;
                map.RDungeonIndex = Convert.ToInt32(row[counter++].Value);
                map.RDungeonFloor = Convert.ToInt32(row[counter++].Value);
                map.StartX        = Convert.ToInt32(row[counter++].Value);
                map.StartY        = Convert.ToInt32(row[counter++].Value);
            }
            else
            {
                throw new Exception("RDungeon map data not found");
            }

            return(map);
        }
Example #4
0
        public static void SaveRDungeonMap(MySql database, string mapID, RDungeonMap map)
        {
            bool localTransaction = false;
            if (database.IsTransactionActive == false) {
                database.BeginTransaction();
                localTransaction = true;
            }

            SaveMapDump(database, mapID, map);

            // Save extra data associated with instanced maps
            database.UpdateOrInsert("map_rdungeon_data", new IDataColumn[] {
                database.CreateColumn(false, "MapID", mapID),
                database.CreateColumn(false, "RDungeonIndex", map.RDungeonIndex.ToString()),
                database.CreateColumn(false, "RDungeonFloor", map.RDungeonFloor.ToString()),
                database.CreateColumn(false, "StartX", map.StartX.ToString()),
                database.CreateColumn(false, "StartY", map.StartY.ToString())
            });

            if (localTransaction) {
                database.EndTransaction();
            }
        }
Example #5
0
        public static RDungeonMap LoadRDungeonMap(MySql database, string mapID)
        {
            RDungeonMap map = new RDungeonMap(mapID);
            LoadMapDump(database, mapID, map);

            string query = "SELECT map_rdungeon_data.RDungeonIndex, map_rdungeon_data.RDungeonFloor, map_rdungeon_data.StartX, map_rdungeon_data.StartY FROM map_rdungeon_data WHERE map_rdungeon_data.MapID = \'" + database.VerifyValueString(mapID) + "\'";
            DataColumnCollection row = database.RetrieveRow(query);
            if (row != null) {
                int counter = 0;
                map.RDungeonIndex = Convert.ToInt32(row[counter++].Value);
                map.RDungeonFloor = Convert.ToInt32(row[counter++].Value);
                map.StartX = Convert.ToInt32(row[counter++].Value);
                map.StartY = Convert.ToInt32(row[counter++].Value);
            } else {
                throw new Exception("RDungeon map data not found");
            }

            return map;
        }