public override void Use(Player p, string message) { string[] args = message.Split(' '); string path = args.Length == 1 ? LevelInfo.LevelPath(args[0]) : LevelInfo.BackupPath(args[0], args[1]); Server.s.Log(path); if (!File.Exists(path)) { Player.SendMessage(p, "Level or backup could not be found."); return; } Level lvl = LvlFile.Load(name, path); lvl.setPhysics(0); lvl.backedup = true; lvl.permissionbuild = LevelPermission.Admin; lvl.jailx = (ushort)(lvl.spawnx * 32); lvl.jaily = (ushort)(lvl.spawny * 32); lvl.jailz = (ushort)(lvl.spawnz * 32); lvl.jailrotx = lvl.rotx; lvl.jailroty = lvl.roty; p.Loading = true; CmdReveal.DespawnEntities(p); Level oldLevel = p.level; p.level = lvl; p.SendMotd(); if (!p.SendRawMap(oldLevel, lvl)) { return; } ushort x = (ushort)((0.5 + lvl.spawnx) * 32); ushort y = (ushort)((1 + lvl.spawny) * 32); ushort z = (ushort)((0.5 + lvl.spawnz) * 32); p.aiming = false; Player.GlobalSpawn(p, x, y, z, lvl.rotx, lvl.roty, true); p.ClearBlockchange(); p.Loading = false; if (args.Length == 1) { lvl.name = "&cMuseum " + Server.DefaultColor + "(" + args[0] + ")"; } else { lvl.name = "&cMuseum " + Server.DefaultColor + "(" + args[0] + " " + args[1] + ")"; } if (!p.hidden) { Player.GlobalMessage(p.ColoredName + " %Swent to the " + lvl.name); } }
bool GoToLevel(Player p, Level lvl, string message) { if (p.level == lvl) { Player.SendMessage(p, "You are already in \"" + lvl.name + "\"."); return(false); } if (Player.BlacklistCheck(p.name, message) || lvl.VisitBlacklist.CaselessContains(p.name)) { Player.SendMessage(p, "You are blacklisted from " + lvl.name + "."); return(false); } bool whitelisted = lvl.VisitWhitelist.CaselessContains(p.name); if (!p.ignorePermission && !whitelisted && p.group.Permission < lvl.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + lvl.name + "."); return(false); } if (!p.ignorePermission && !whitelisted && p.group.Permission > lvl.pervisitmax && !p.group.CanExecute("pervisitmax")) { Player.SendMessage(p, "Your rank must be " + lvl.pervisitmax + " or lower to go there!"); return(false); } if (File.Exists("text/lockdown/map/" + message.ToLower())) { Player.SendMessage(p, "The level " + message + " is locked."); return(false); } if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level)) { return(false); } p.Loading = true; CmdReveal.DespawnEntities(p); Level oldLevel = p.level; p.level = lvl; p.SendUserMOTD(); p.SendMap(oldLevel); ushort x = (ushort)((0.5 + lvl.spawnx) * 32); ushort y = (ushort)((1 + lvl.spawny) * 32); ushort z = (ushort)((0.5 + lvl.spawnz) * 32); SpawnEntities(p, x, y, z, lvl.rotx, lvl.roty); p.Loading = false; CheckGamesJoin(p, oldLevel); bool showJoin = p.level.ShouldSaveChanges() || (oldLevel != null && oldLevel.ShouldSaveChanges()); if (!p.hidden && showJoin) { Player.SendChatFrom(p, p.color + "*" + p.DisplayName + " %Swent to &b" + lvl.name, false); Server.IRC.Say(p.color + p.DisplayName + " %rwent to &8" + lvl.name, false, true); } return(true); }