public static void Goto(string waypoint, Player p) { if (!Exists(waypoint, p)) { return; } Waypoint wp = Find(waypoint, p); Level lvl = LevelInfo.Find(wp.lvlname); if (wp == null) { return; } if (lvl != null) { if (p.level != lvl) { Command.all.Find("goto").Use(p, lvl.name); } p.SendPos(0xFF, wp.x, wp.y, wp.z, wp.rotx, wp.roty); Player.SendMessage(p, "Sent you to waypoint"); } else { Player.SendMessage(p, "The map that that waypoint is on isn't loaded right now (" + wp.lvlname + ")"); return; } }
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)); } }
public static Level Find(string name) { return(LevelInfo.Find(name)); }