static bool LoadOfflineLevel(Player p, string map) { string propsPath = LevelInfo.PropsPath(map); LevelConfig cfg = new LevelConfig(); cfg.Load(propsPath); if (!cfg.LoadOnGoto) { p.Message("Level \"{0}\" cannot be loaded using %T/Goto.", map); return(false); } AccessController visitAccess = new LevelAccessController(cfg, map, true); bool skip = p.summonedMap != null && p.summonedMap.CaselessEq(map); LevelPermission plRank = skip ? LevelPermission.Nobody : p.Rank; if (!visitAccess.CheckDetailed(p, plRank)) { return(false); } LevelActions.Load(p, map, false); Level lvl = LevelInfo.FindExact(map); if (lvl != null) { return(GotoLevel(p, lvl)); } p.Message("Level \"{0}\" failed to be auto-loaded.", map); return(false); }
static void LoadMainLevel(SchedulerTask task) { try { mainLevel = LevelActions.Load(Player.Console, Server.Config.MainLevel, false); if (mainLevel == null) { GenerateMain(); } } catch (Exception ex) { Logger.LogError("Error loading main level", ex); } }
static void LoadAutoloadMaps(SchedulerTask task) { AutoloadMaps = PlayerExtList.Load("text/autoload.txt", '='); List <string> maps = AutoloadMaps.AllNames(); foreach (string map in maps) { if (map.CaselessEq(Server.Config.MainLevel)) { continue; } LevelActions.Load(Player.Console, map, false); } }
public static bool SetMainLevel(string map) { string main = mainLevel != null ? mainLevel.name : Server.Config.MainLevel; if (map.CaselessEq(main)) { return(false); } Level lvl = LevelInfo.FindExact(map); if (lvl == null) { lvl = LevelActions.Load(Player.Console, map, false); } if (lvl == null) { return(false); } SetMainLevel(lvl); return(true); }