public static void InitializeWorld() { foreach (var world in database.worlds) { if (world.worldID == Main.worldID) { currentDatabaseWorld = world; } } if (currentDatabaseWorld == null) { currentDatabaseWorld = new DatabaseWorld() { worldID = Main.worldID, name = Main.worldName }; database.worlds.Add(currentDatabaseWorld); SaveSetting(); } Waypoints.ClearPoints(); foreach (var waypoint in currentDatabaseWorld.waypoints) { Waypoints.AddWaypoint(waypoint.name, new Vector2(waypoint.x, waypoint.y)); } Network.GravestonesAllowed = !currentDatabaseWorld.GraveStonesDisabled; ItemBanner.ItemsBanned = currentDatabaseWorld.BanDestructiveExplosives; EnemyToggler.EnemiesAllowed = !currentDatabaseWorld.NPCSpawnsDiabled; TimeWeatherChanger.TimePaused = currentDatabaseWorld.TimePaused; if (TimeWeatherChanger.TimePaused) { TimeWeatherChanger.PausedTime = currentDatabaseWorld.TimePausedTime; // TimeWeatherChanger.PausedTimeDayTime = currentDatabaseWorld.TimePausedIsDay; } if (Main.netMode == 0) { GeneralMessages.ProcessCurrentTogglesSP(EnemyToggler.EnemiesAllowed, Network.GravestonesAllowed, ItemBanner.ItemsBanned, TimeWeatherChanger.TimePaused); } }
private static void ResetDatabase() { database = new HEROsModDatabase(); database.players = new List <DatabasePlayer>(); database.groups = new List <DatabaseGroup>(); database.worlds = new List <DatabaseWorld>(); currentDatabaseWorld = null; //database.regions = new List<DatabaseRegion>(); }