/// <summary> /// Loads a standard map /// </summary> /// <param name="mapID">The map id of the map to load</param> public static Map LoadStandardMap(DatabaseConnection dbConnection, string mapID) { DataManager.Maps.Map loadedMap = MapDataManager.LoadStandardMap(dbConnection.Database, mapID); Map map = new Map(loadedMap); //Extra checks on weather if (map.Indoors) { map.Weather = Enums.Weather.None; } else if (Globals.ServerWeather != Enums.Weather.Ambiguous) { map.Weather = Globals.ServerWeather; } //check from number 0 NPCs for (int i = 0; i < map.Npc.Count; i++) { if (map.Npc[i].NpcNum < 1) { map.Npc.RemoveAt(i); i--; } } return(map); }
public static void SaveStandardMap(MySql database, string mapID, Map map) { bool localTransaction = false; if (database.IsTransactionActive == false) { database.BeginTransaction(); localTransaction = true; } // Save the raw map SaveRawMap(database, mapID, map); // Save extra data associated with standard maps database.UpdateOrInsert("map_standard_data", new IDataColumn[] { database.CreateColumn(false, "MapID", mapID), database.CreateColumn(false, "Instanced", map.Instanced.ToIntString()) }); if (localTransaction) { database.EndTransaction(); } }
public static Map LoadStandardMap(MySql database, string mapID) { Map map = new Map(mapID); LoadRawMap(database, mapID, map); string query = "SELECT map_standard_data.Instanced FROM map_standard_data WHERE map_standard_data.MapID = \'" + database.VerifyValueString(mapID) + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { int counter = 0; map.Instanced = row[counter++].ValueString.ToBool(); } else { throw new Exception("Standard map data not found"); } return map; }