Пример #1
0
        public static InstancedMap LoadInstancedMap(DatabaseConnection dbConnection, string mapID)
        {
            DataManager.Maps.InstancedMap loadedMap = MapDataManager.LoadInstancedMap(dbConnection.Database, mapID);
            InstancedMap map = new InstancedMap(loadedMap);

            return(map);
        }
Пример #2
0
        public static InstancedMap LoadInstancedMap(MySql database, string mapID)
        {
            InstancedMap map = new InstancedMap(mapID);

            LoadMapDump(database, mapID, map);

            string query             = "SELECT map_instanced_data.MapBase FROM map_instanced_data WHERE map_instanced_data.MapID = \'" + database.VerifyValueString(mapID) + "\'";
            DataColumnCollection row = database.RetrieveRow(query);

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

            return(map);
        }
Пример #3
0
        public static void SaveInstancedMap(MySql database, string mapID, InstancedMap 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_instanced_data", new IDataColumn[] {
                database.CreateColumn(false, "MapID", mapID),
                database.CreateColumn(false, "MapBase", map.MapBase.ToString())
            });

            if (localTransaction)
            {
                database.EndTransaction();
            }
        }
Пример #4
0
        public static InstancedMap LoadInstancedMap(MySql database, string mapID)
        {
            InstancedMap map = new InstancedMap(mapID);
            LoadMapDump(database, mapID, map);

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

            return map;
        }
Пример #5
0
        public static void SaveInstancedMap(MySql database, string mapID, InstancedMap 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_instanced_data", new IDataColumn[] {
                database.CreateColumn(false, "MapID", mapID),
                database.CreateColumn(false, "MapBase", map.MapBase.ToString())
            });

            if (localTransaction) {
                database.EndTransaction();
            }
        }