예제 #1
0
        static bool GotoMap(Player p, string name, bool ignorePerms)
        {
            Level lvl = LevelInfo.FindExact(name);

            if (lvl != null)
            {
                return(GotoLevel(p, lvl, ignorePerms));
            }

            if (Server.AutoLoad)
            {
                // First try exactly matching unloaded levels
                if (LevelInfo.ExistsOffline(name))
                {
                    return(LoadOfflineLevel(p, name, ignorePerms));
                }
                lvl = LevelInfo.Find(name);
                if (lvl != null)
                {
                    return(GotoLevel(p, lvl, ignorePerms));
                }

                string matches = LevelInfo.FindMapMatches(p, name);
                if (matches == null)
                {
                    return(false);
                }
                return(LoadOfflineLevel(p, matches, ignorePerms));
            }
            else
            {
                lvl = LevelInfo.Find(name);
                if (lvl == null)
                {
                    Player.Message(p, "There is no level \"{0}\" loaded. Did you mean..", name);
                    Command.all.Find("search").Use(p, "levels " + name);
                    return(false);
                }
                return(GotoLevel(p, lvl, ignorePerms));
            }
        }