public void AddMember(Player p) { if (p.team != this) { if (p.team != null) { p.team.RemoveMember(p); } p.team = this; Player.GlobalDie(p, false); //p.CTFtempcolor = p.color; //p.CTFtempprefix = p.prefix; p.color = "&" + color; //p.carryingFlag = false; p.hasflag = null; p.prefix = p.color + "[" + c.Name("&" + color).ToUpper() + "] "; players.Add(p); mapOn.ChatLevel(p.color + p.prefix + p.name + Server.DefaultColor + " has joined the " + teamstring + "."); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); } }
public override void Use(Player p, string message) { if ((message.ToLower() == "set") && p != null) { p.level.jailx = p.pos[0]; p.level.jaily = p.pos[1]; p.level.jailz = p.pos[2]; p.level.jailrotx = p.rot[0]; p.level.jailroty = p.rot[1]; Player.SendMessage(p, "Set Jail point."); } else { Player who = Player.Find(message); if (who != null) { if (!who.jailed) { if (p != null) { if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; } } Player.GlobalDie(who, false); Player.GlobalSpawn(who, p.level.jailx, p.level.jaily, p.level.jailz, p.level.jailrotx, p.level.jailroty, true); who.jailed = true; Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &8jailed", false); } else { who.jailed = false; Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false); } } else { Player.SendMessage(p, "Could not find specified player."); } } }
public override void Use(Player p, string message) { if (message != "") { Help(p); return; } if (p.possess != "") { Player.SendMessage(p, "Stop your current possession first."); return; } p.hidden = !p.hidden; if (p.hidden) { Player.GlobalDie(p, true); Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.name + Server.DefaultColor + " disconnected.", false); } else { Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false, ""); Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.name + Server.DefaultColor + " joined the game.", false); } }
public void DisinfectPlayer(Player p) { if (p == null) { return; } try { infectd.Remove(p); } catch { } if (!alive.Contains(p)) { alive.Add(p); } p.infected = false; p.color = p.group.color; p.SetPrefix(); p.blockCount = Server.blocklimithuman; Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); if (infectd.Count == 0) { firstinfectdc(); } }
public override void Use(Player p, string message) { if (message == "") { message = p.name; } if (!p.aka) { p.aka = true; Player who = Player.Find(p.name); ushort x = (ushort)((p.pos[0])); ushort y = (ushort)((p.pos[1])); ushort z = (ushort)((p.pos[2])); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who.group.Permission > p.group.Permission && p != who) { Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; } who.Loading = true; foreach (Player pl in Player.players) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); if (!who.hidden) { if (who.infected) { Player.GlobalDie(who, false); Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { Player.GlobalDie(who, false); Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players) { if (pl.level == who.level && who != pl && !pl.hidden && !pl.referee) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; GC.Collect(); GC.WaitForPendingFinalizers(); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } else if (p.aka) { p.aka = false; Player who = Player.Find(p.name); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who.group.Permission > p.group.Permission && p != who) { Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; } ushort x = (ushort)((p.pos[0])); ushort y = (ushort)((p.pos[1])); ushort z = (ushort)((p.pos[2])); who.Loading = true; foreach (Player pl in Player.players) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); if (!who.hidden) { if (who.infected) { Player.GlobalDie(who, false); Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { Player.GlobalDie(who, false); Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players) { if (pl.level == who.level && who != pl && !pl.hidden && !pl.referee) { if (pl.infected) { who.SendSpawn(pl.id, c.red + "Undeaad", x, y, z, pl.level.rotx, pl.level.roty); } else { who.SendSpawn(pl.id, pl.color + pl.name, x, y, z, pl.level.rotx, pl.level.roty); } } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; GC.Collect(); GC.WaitForPendingFinalizers(); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } }
public override void Use(Player p, string message) { if (message == "" || message.Split(' ').Length > 2) { Help(p); return; } int pos = message.IndexOf(' '); if (pos != -1) { Player who = Player.Find(message.Substring(0, pos)); if (who == null) { Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return; } if (message.Substring(pos + 1) == "del") { MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + who.name + "'"); Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); return; } string color = c.Parse(message.Substring(pos + 1)); if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); } else if (color == who.color) { Player.SendMessage(p, who.name + " already has that color."); } else { //Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) + // " color to " + color + // c.Name(color) + "&e.", false); MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + who.name + "'"); Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); who.color = color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); } } else { if (message == "del") { MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + p.name + "'"); Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false); p.color = p.group.color; Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); return; } string color = c.Parse(message); if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); } else if (color == p.color) { Player.SendMessage(p, "You already have that color."); } else { MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + p.name + "'"); Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); p.color = color; Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); } } }
public override void Use(Player p, string message) { if (message == "") { message = p.name; } if (message.ToLower() == "all") { if (p.group.Permission < LevelPermission.Operator) { Player.SendMessage(p, "Reserved for OP+"); return; } foreach (Player who in Player.players) { if (who.level == p.level) { who.Loading = true; foreach (Player pl in Player.players) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; who.SendMessage("&bMap reloaded by " + p.name); Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } } GC.Collect(); GC.WaitForPendingFinalizers(); } else { Player who = Player.Find(message); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who.group.Permission > p.group.Permission && p != who) { Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; } who.Loading = true; foreach (Player pl in Player.players) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; GC.Collect(); GC.WaitForPendingFinalizers(); who.SendMessage("&bMap reloaded by " + p.name); Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } }
public override void Use(Player p, string message) { var split = message.Split(' '); if (split.Length < 2) { Help(p); return; } Player who = Player.Find(split[0]); Group newRank = Group.Find(split[1]); string msgGave = ""; string oldgroupstr = ""; if (who != null) { oldgroupstr = who.group.name; } else { Group hey = Group.findPlayerGroup(split[0]); oldgroupstr = hey.name; } if (message.Split(' ').Length > 2) { msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)); } else { msgGave = "Congratulations!"; } if (newRank == null) { Player.SendMessage(p, "Could not find specified rank."); return; } Group bannedGroup = Group.findPerm(LevelPermission.Banned); if (who == null) { string foundName = split[0]; if (Group.findPlayerGroup(foundName) == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (p != null) { if (Group.findPlayerGroup(foundName).Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher than you"); return; } } Group oldGroup = Group.findPlayerGroup(foundName); oldGroup.playerList.Remove(foundName); oldGroup.playerList.Save(); newRank.playerList.Add(foundName); newRank.playerList.Save(); Player.GlobalMessage(foundName + " &f(offline)" + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name); } else if (who == p) { Player.SendMessage(p, "Cannot change your own rank."); return; } else { if (p != null) { if (who.group == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (who.group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher to yourself."); return; } } Group.because(who, newRank); if (Group.cancelrank) { Group.cancelrank = false; return; } who.group.playerList.Remove(who.name); who.group.playerList.Save(); newRank.playerList.Add(who.name); newRank.playerList.Save(); Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name, false); Player.GlobalChat(who, "&6" + msgGave, false); who.group = newRank; who.color = who.group.color; Player.GlobalDie(who, false); who.SendMessage("You are now ranked " + newRank.color + newRank.name + Server.DefaultColor + ", type /help for your new set of commands."); who.SendUserType(Block.canPlace(who.group.Permission, Block.blackrock)); Boolean tryer = true; string year = DateTime.Now.Year.ToString(); string month = DateTime.Now.Month.ToString(); string day = DateTime.Now.Day.ToString(); string hour = DateTime.Now.Hour.ToString(); string minute = DateTime.Now.Minute.ToString(); string assigner; if (p == null) { assigner = "Console"; } else { assigner = p.name; } string allrankinfos = ""; foreach (string line in File.ReadAllLines("text/rankinfo.txt")) { if (!line.Contains(split[0])) { allrankinfos = allrankinfos + line + "\r\n"; } } File.WriteAllText("text/rankinfo.txt", allrankinfos); try { StreamWriter sw; sw = File.AppendText("text/rankinfo.txt"); sw.WriteLine(who.name + " " + assigner + " " + minute + " " + hour + " " + day + " " + month + " " + year + " " + split[1] + " " + oldgroupstr); sw.Close(); } catch { tryer = false; } if (!tryer) { Player.SendMessage(p, "&cAn error occurred!"); } Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); } }
public override void Use(Player p, string message) { string path; if (message.Split(' ').Length == 1) { path = "levels/" + message + ".lvl"; } else if (message.Split(' ').Length == 2) { try { path = @Server.backupLocation + "/" + message.Split(' ')[0] + "/" + int.Parse(message.Split(' ')[1]) + "/" + message.Split(' ')[0] + ".lvl"; } catch { Help(p); return; } } else { Help(p); return; } if (File.Exists(path)) { FileStream fs = File.OpenRead(path); try { GZipStream gs = new GZipStream(fs, CompressionMode.Decompress); byte[] ver = new byte[2]; gs.Read(ver, 0, ver.Length); ushort version = BitConverter.ToUInt16(ver, 0); ushort[] vars = new ushort[6]; byte[] rot = new byte[2]; if (version == 1874) { byte[] header = new byte[16]; gs.Read(header, 0, header.Length); vars[0] = BitConverter.ToUInt16(header, 0); vars[1] = BitConverter.ToUInt16(header, 2); vars[2] = BitConverter.ToUInt16(header, 4); vars[3] = BitConverter.ToUInt16(header, 6); vars[4] = BitConverter.ToUInt16(header, 8); vars[5] = BitConverter.ToUInt16(header, 10); rot[0] = header[12]; rot[1] = header[13]; //level.permissionvisit = (LevelPermission)header[14]; //level.permissionbuild = (LevelPermission)header[15]; } else { byte[] header = new byte[12]; gs.Read(header, 0, header.Length); vars[0] = version; vars[1] = BitConverter.ToUInt16(header, 0); vars[2] = BitConverter.ToUInt16(header, 2); vars[3] = BitConverter.ToUInt16(header, 4); vars[4] = BitConverter.ToUInt16(header, 6); vars[5] = BitConverter.ToUInt16(header, 8); rot[0] = header[10]; rot[1] = header[11]; } Level level = new Level(name, vars[0], vars[2], vars[1], "empty"); level.setPhysics(0); level.spawnx = vars[3]; level.spawnz = vars[4]; level.spawny = vars[5]; level.rotx = rot[0]; level.roty = rot[1]; byte[] blocks = new byte[level.width * level.height * level.depth]; gs.Read(blocks, 0, blocks.Length); level.blocks = blocks; gs.Close(); level.backedup = true; level.permissionbuild = LevelPermission.Admin; level.jailx = (ushort)(level.spawnx * 32); level.jaily = (ushort)(level.spawny * 32); level.jailz = (ushort)(level.spawnz * 32); level.jailrotx = level.rotx; level.jailroty = level.roty; p.Loading = true; foreach (Player pl in Player.players) { if (p.level == pl.level && p != pl) { p.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (p.level == b.level) { p.SendDie(b.id); } } Player.GlobalDie(p, true); p.level = level; p.SendMotd(); p.SendRaw(2); byte[] buffer = new byte[level.blocks.Length + 4]; BitConverter.GetBytes(IPAddress.HostToNetworkOrder(level.blocks.Length)).CopyTo(buffer, 0); //ushort xx; ushort yy; ushort zz; for (int i = 0; i < level.blocks.Length; ++i) { buffer[4 + i] = Block.Convert(level.blocks[i]); } buffer = buffer.GZip(); int number = (int)Math.Ceiling(((double)buffer.Length) / 1024); for (int i = 1; buffer.Length > 0; ++i) { short length = (short)Math.Min(buffer.Length, 1024); byte[] send = new byte[1027]; Player.HTNO(length).CopyTo(send, 0); Buffer.BlockCopy(buffer, 0, send, 2, length); byte[] tempbuffer = new byte[buffer.Length - length]; Buffer.BlockCopy(buffer, length, tempbuffer, 0, buffer.Length - length); buffer = tempbuffer; send[1026] = (byte)(i * 100 / number); p.SendRaw(3, send); Thread.Sleep(10); } buffer = new byte[6]; Player.HTNO((short)level.width).CopyTo(buffer, 0); Player.HTNO((short)level.depth).CopyTo(buffer, 2); Player.HTNO((short)level.height).CopyTo(buffer, 4); p.SendRaw(4, buffer); ushort x = (ushort)((0.5 + level.spawnx) * 32); ushort y = (ushort)((1 + level.spawny) * 32); ushort z = (ushort)((0.5 + level.spawnz) * 32); p.aiming = false; Player.GlobalSpawn(p, x, y, z, level.rotx, level.roty, true); p.ClearBlockchange(); p.Loading = false; if (message.IndexOf(' ') == -1) { level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + ")"; } else { level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + " " + message.Split(' ')[1] + ")"; } if (!p.hidden) { Player.GlobalMessage(p.color + p.prefix + p.name + Server.DefaultColor + " went to the " + level.name); } } catch (Exception ex) { Player.SendMessage(p, "Error loading level."); Server.ErrorLog(ex); return; } finally { fs.Close(); } } else { Player.SendMessage(p, "Level or backup could not be found."); return; } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } try { Level foundLevel = Level.Find(message); if (foundLevel != null) { Level startLevel = p.level; GC.Collect(); if (p.level == foundLevel) { Player.SendMessage(p, "You are already in \"" + foundLevel.name + "\"."); return; } if (!p.ignorePermission) { if (p.group.Permission < foundLevel.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + foundLevel.name + "."); return; } } { if (!File.Exists("text/lockdown/map/" + message + "")) { p.Loading = true; foreach (Player pl in Player.players) { if (p.level == pl.level && p != pl) { p.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (p.level == b.level) { p.SendDie(b.id); } } Player.GlobalDie(p, true); p.level = foundLevel; p.SendUserMOTD(); p.SendMap(); GC.Collect(); ushort x = (ushort)((0.5 + foundLevel.spawnx) * 32); ushort y = (ushort)((1 + foundLevel.spawny) * 32); ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32); if (!p.hidden) { Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true, ""); } else { unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); } } foreach (Player pl in Player.players) { if (pl.level == p.level && p != pl && !pl.hidden) { p.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == p.level) { p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } if (!p.hidden) { Player.GlobalChat(p, p.color + "*" + p.name + Server.DefaultColor + " went to &b" + foundLevel.name, false); } p.Loading = false; bool skipUnload = false; if (startLevel.unload && !startLevel.name.Contains("&cMuseum ")) { foreach (Player pl in Player.players) { if (pl.level == startLevel) { skipUnload = true; } } if (!skipUnload && Server.AutoLoad) { startLevel.Unload(); } } } else { Player.SendMessage(p, "The level " + message + " is locked."); } } } else if (Server.AutoLoad) { Command.all.Find("load").Use(p, message); foundLevel = Level.Find(message); if (foundLevel != null) { Use(p, message); } } else { Player.SendMessage(p, "There is no level \"" + message + "\" loaded."); } GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } bool stealth = false; bool totalBan = false; if (message[0] == '#') { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Stealth Ban Attempted"); } else if (message[0] == '@') { totalBan = true; message = message.Remove(0, 1).Trim(); } Player who = Player.Find(message); if (who == null) { if (!Player.ValidName(message)) { Player.SendMessage(p, "Invalid name \"" + message + "\"."); return; } if (Server.devs.Contains(message.ToLower())) { Player.SendMessage(p, "You can't ban a MCForge Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!"); } else { Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!"); } return; } Group foundGroup = Group.findPlayerGroup(message); if (foundGroup.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!"); return; } if (foundGroup.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } foundGroup.playerList.Remove(message); foundGroup.playerList.Save(); Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!"); Group.findPerm(LevelPermission.Banned).playerList.Add(message); } else { if (!Player.ValidName(who.name)) { Player.SendMessage(p, "Invalid name \"" + who.name + "\"."); return; } if (Server.devs.Contains(who.name.ToLower())) { Player.SendMessage(p, "You can't ban a MCForge Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!"); } else { Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!"); } return; } if (who.group.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + who.group.name + "!"); return; } if (who.group.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } who.group.playerList.Remove(message); who.group.playerList.Save(); if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH &8banned" + Server.DefaultColor + "!"); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!", false); } who.group = Group.findPerm(LevelPermission.Banned); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Add(who.name); } Group.findPerm(LevelPermission.Banned).playerList.Save(); IRCBot.Say(message + " was banned."); Server.s.Log("BANNED: " + message.ToLower()); if (totalBan == true) { Command.all.Find("undo").Use(p, message + " 0"); Command.all.Find("banip").Use(p, "@ " + message); } } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if (message.Split(' ').Length < 2) { Help(p); return; } Player who = Player.Find(message.Split(' ')[0]); Group newRank = Group.Find(message.Split(' ')[1]); string msgGave; if (message.Split(' ').Length > 2) { msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)); } else { msgGave = "Congratulations!"; } if (newRank == null) { Player.SendMessage(p, "Could not find specified rank."); return; } Group bannedGroup = Group.findPerm(LevelPermission.Banned); if (who == null) { string foundName = message.Split(' ')[0]; if (Group.findPlayerGroup(foundName) == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (p != null) { if (Group.findPlayerGroup(foundName).Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher than you"); return; } } Group oldGroup = Group.findPlayerGroup(foundName); oldGroup.playerList.Remove(foundName); oldGroup.playerList.Save(); newRank.playerList.Add(foundName); newRank.playerList.Save(); Player.GlobalMessage(foundName + " &f(offline)" + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name); } else if (who == p) { Player.SendMessage(p, "Cannot change your own rank."); return; } else { if (p != null) { if (who.group == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (who.group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher to yourself."); return; } } who.group.playerList.Remove(who.name); who.group.playerList.Save(); newRank.playerList.Add(who.name); newRank.playerList.Save(); Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name, false); Player.GlobalChat(null, "&6" + msgGave, false); who.group = newRank; who.color = who.group.color; Player.GlobalDie(who, false); who.SendMessage("You are now ranked " + newRank.color + newRank.name + Server.DefaultColor + ", type /help for your new set of commands."); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); } }
public void HandOutRewards() { Server.zombieRound = false; lastseconds = false; timer.Enabled = false; timeleftannouncer.Enabled = false; amountOfMilliseconds = 0; string playersString = ""; if (Server.gameStatus == 0) { return; } Level actuallevel = Level.Find(currentLevelName); if (alive.Count != 0) { actuallevel.humanswon++; Level.SaveSettings(actuallevel); Player.GlobalMessage(c.green + "----------------------------------"); Player.GlobalMessage(c.green + "Humans have won this round"); Player.GlobalMessage(c.green + "Congratulations to our survivor(s)"); Server.s.Log("Humans have won on map " + currentLevelName); try { for (int index = alive.Count(); index > 0; index--) { Player winner = alive[index - 1]; playersString += winner.group.color + winner.name + c.white + ", "; switch (winner.winstreakcount) { case 0: winner.money += 15; Player.SendMessage(winner, c.green + "You got 15 " + Server.moneys + " for surviving"); break; case 1: winner.money += 17; Player.SendMessage(winner, c.green + "You got 17 " + Server.moneys + " for surviving"); break; case 2: winner.money += 20; Player.SendMessage(winner, c.green + "You got 20 " + Server.moneys + " for surviving"); break; default: winner.money += 24; Player.SendMessage(winner, c.green + "You got 24 " + Server.moneys + " for surviving"); break; } winner.winstreakcount++; if (winner.maximumsurvived < winner.winstreakcount) { winner.maximumsurvived = winner.winstreakcount; } winner.roundssurvived++; if (!winner.canrevive) { winner.Achieve("Second Chance"); } if (winner.winstreakcount == 5) { winner.Achieve("Bear Grylls"); } if ((((actuallevel.humanswon + actuallevel.zombieswon) == 0 ? 100 : ((actuallevel.humanswon * 100) / (actuallevel.humanswon + actuallevel.zombieswon))) <= 10) && ((actuallevel.humanswon + actuallevel.zombieswon) >= 10)) { winner.Achieve("Impossible"); } if (alive.Count == 1) { alive[0].Achieve("Cant touch this"); } } } catch { Server.s.Log("ERROR: #001"); } Player.GlobalMessage(playersString); Player.GlobalMessage(c.green + "----------------------------------"); } else if (alive.Count == 0) { actuallevel.zombieswon++; Level.SaveSettings(actuallevel); Player.GlobalMessage(c.red + "----------------------------------"); Player.GlobalMessage(c.red + "Zombies have won this round."); Server.s.Log("Zombies have won on map " + currentLevelName); try { int maxinfect = infectd.Max(obj => obj.infectThisRound); var maxinfectList = infectd.Where(obj => obj.infectThisRound == maxinfect); string maxinfectname = ""; foreach (Player bestzombie in maxinfectList) { maxinfectname += bestzombie.name + ","; } Player.GlobalMessage("Best zombie(s): " + c.red + maxinfectname + Server.DefaultColor + " with " + c.red + maxinfect + Server.DefaultColor + " kills"); } catch { Server.s.Log("Error: #017"); } Player.GlobalMessage(c.red + "----------------------------------"); try { for (int index = Player.players.Count(); index > 0; index--) { Player player = Player.players[index - 1]; if (player.infected && player.infectThisRound > 0) { player.SendMessage(c.green + "You helped the zombies win, here is a little reward: 2 " + Server.moneys); player.money = player.money + 2; } } } catch { Server.s.Log("ERROR: #012"); } } try { alive.Clear(); } catch { Server.s.Log("ERROR: #003"); } try { infectd.Clear(); } catch { Server.s.Log("ERROR: #004"); } try { for (int index = Player.players.Count(); index > 0; index--) { Player player = Player.players[index - 1]; player.infected = false; player.color = player.group.color; player.SetPrefix(); player.blockCount = Server.blocklimithuman; player.infectThisRound = 0; player.infectedfrom = ""; player.revivesused = 0; Player.GlobalDie(player, false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); if (player.referee) { player.SendMessage("You gained 1 " + Server.moneys + " because you're a ref. Thank you!"); player.money += 1; } } } catch { Server.s.Log("ERROR: #002"); } try { if (lottery.Count > 1) { int number = rand.Next(lottery.Count - 1); Player lotterywinner = lottery[number]; Player.GlobalMessage(lotterywinner.name + " won the lottery with a price of: " + c.gold + Convert.ToString(9 * lotterycount) + Server.moneys); lotterywinner.money += 9 * lotterycount; Server.s.Log("Lottery winner " + lotterywinner.name + " with " + lottery.Count + " players"); if (lotterycount == 7) { lotterywinner.Achieve("Lucky Number 7"); } } else if (lottery.Count == 1) { Player.SendMessage(lottery[0], "Too less people joined the lottery, you get your money back"); Server.s.Log("Lottery aborted - too less players"); lottery[0].money += 10; } } catch { Server.s.Log("Error: #020"); } try { lottery.Clear(); lotterycount = 0; } catch { Server.s.Log("ERROR: #018"); } try { if ((actuallevel.humanswon + actuallevel.zombieswon) > 10) { int percantagewin = (actuallevel.humanswon * 100 / (actuallevel.humanswon + actuallevel.zombieswon)); if (percantagewin > 95) { actuallevel.roundtime = 12; } else if (percantagewin > 90) { actuallevel.roundtime = 10; } else if (percantagewin > 85) { actuallevel.roundtime = 9; } else if (percantagewin > 75) { actuallevel.roundtime = 8; } else if (percantagewin > 30) { actuallevel.roundtime = 7; } else if (percantagewin > 25) { actuallevel.roundtime = 6; } else if (percantagewin > 15) { actuallevel.roundtime = 6; } else { actuallevel.roundtime = 5; } Level.SaveSettings(actuallevel); } } catch { Server.s.Log("Error: #022"); } if (Math.Round((double)Process.GetCurrentProcess().PrivateMemorySize64 / 1048576) > 100) { Server.s.Log("Server restarting -> Memory overflow"); MCForge_.Gui.Program.ExitProgram(true); } return; }
private void MainGame() { if (Server.gameStatus == 0) { return; } GoBack: Player.GlobalMessage("Starting in %c30%e seconds"); Thread.Sleep(10000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c20%e seconds"); Thread.Sleep(10000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c10%e seconds"); Thread.Sleep(10000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c5%e seconds"); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c4%e seconds"); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c3%e seconds"); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c2%e seconds"); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("Starting in %c1%e second"); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } int playerscountminusref = 0; //Get players try { alive.Clear(); infectd.Clear(); } catch { } for (int index = Player.players.Count(); index > 0; index--) { Player playere = Player.players[index - 1]; playere.canrevive = true; playere.invisiblyused = 0; playere.infectThisRound = 0; playere.infected = false; playere.infectedfrom = ""; if (playere.referee) { Player.GlobalDie(playere, false); } else if (playere.level.name == currentLevelName) { if (!alive.Contains(playere)) { alive.Add(playere); } playerscountminusref += 1; } else { try { Command.all.Find("goto").Use(playere, currentLevelName); } catch { Server.s.Log("ERROR: #006"); } if (!alive.Contains(playere)) { alive.Add(playere); } playerscountminusref += 1; } } if (playerscountminusref < 2) { Server.s.Log("ERROR: #007"); Player.GlobalMessage(c.red + "ERROR: Need more than 2 players to play"); goto GoBack; } StartTime = DateTime.Now; //Choose the first Zombie to be infected Player player = null; if (Server.queZombie == true) { Server.queZombie = false; player = Player.Find(Server.nextZombie); } if (player == null || player.referee) { player = alive[new Random().Next(0, alive.Count())]; } // Timer Initializing Level actualevel = Level.Find(currentLevelName); //int amountOfMinutes = 1; int amountOfMinutes = actualevel.roundtime; //----------------------------------------------- //int amountOfMinutes = new Random().Next(Server.roundtime1, Server.roundtime2); Player.GlobalMessage("The round will last for %c" + amountOfMinutes + "%e minutes!"); amountOfMilliseconds = (60000 * amountOfMinutes); timer = new System.Timers.Timer(amountOfMilliseconds); timer.Elapsed += new ElapsedEventHandler(EndRound); timer.Enabled = true; Server.zombieRound = true; timeleftannouncer = new System.Timers.Timer(60000); timeleftannouncer.Elapsed += new ElapsedEventHandler(timleftannouncerfunction); timeleftannouncer.Enabled = true; Player.GlobalMessage(player.group.color + player.name + Server.DefaultColor + " started the infection!"); InfectPlayer(player); humangone(); //Main Loop for Game try { while (alive.Count > 0) { for (int index = infectd.Count(); index > 0; index--) { Player player1 = infectd[index - 1]; if (player1.color != c.red) { player1.color = c.red; player1.SetPrefix(); Player.GlobalDie(player1, false); Player.GlobalSpawn(player1, player1.pos[0], player1.pos[1], player1.pos[2], player1.rot[0], player1.rot[1], false); } for (int index2 = alive.Count(); index2 > 0; index2--) { Player player2 = alive[index2 - 1]; if (player2.color != c.white) { player2.color = c.white; player2.SetPrefix(); Player.GlobalDie(player2, false); Player.GlobalSpawn(player2, player2.pos[0], player2.pos[1], player2.pos[2], player2.rot[0], player2.rot[1], false); } // Hitbox Detection /*if (player2.pos[0] / 32 == player1.pos[0] / 32 || player2.pos[0] / 32 == player1.pos[0] / 32 + 1 || player2.pos[0] / 32 == player1.pos[0] / 32 - 1) * { * if (player2.pos[1] / 32 == player1.pos[1] / 32 || player2.pos[1] / 32 == player1.pos[1] / 32 - 1 || player2.pos[1] / 32 == player1.pos[1] / 32 + 1) * { * if (player2.pos[2] / 32 == player1.pos[2] / 32 || player2.pos[2] / 32 == player1.pos[2] / 32 + 1 || player2.pos[2] / 32 == player1.pos[2] / 32 - 1) * { */ if (Math.Abs(player2.pos[0] - player1.pos[0]) <= Server.hitboxrangex && Math.Abs(player2.pos[1] - player1.pos[1]) <= Server.hitboxrangey && Math.Abs(player2.pos[2] - player1.pos[2]) <= Server.hitboxrangez ) { if (!player2.infected && player1.infected && !player2.referee && !player1.referee && player1 != player2) { //Infection Combo + Award if (Server.lastPlayerToInfect == player1.name) { Server.infectCombo++; if (Server.infectCombo > 0) { switch (Server.infectCombo + 1) { case 2: combomessage = "is awesome - doublekill"; break; case 3: combomessage = "is epic - triplekill"; break; case 4: combomessage = "is pro - quadruplekill"; break; case 5: combomessage = "is crazy - quintuplekill"; break; case 6: combomessage = "is unstoppable - sextuplekill"; break; case 7: combomessage = "is unbeatable - septuplekill"; break; case 8: combomessage = "is legendary - octuplekill"; break; case 9: combomessage = "is god like - nonuplekill"; break; case 10: Player.Find(player1.name).Achieve("Chuck Norris"); break; } if ((Server.infectCombo + 1) < 10) { Player.GlobalMessage(c.red + player1.name + "%b " + combomessage); } else { Player.GlobalMessage(c.red + player1.name + "%b kills like Chuck Norris himself: " + (Server.infectCombo + 1) + " kills in a row"); } Player.SendMessage(player1, "%aYou got additional " + ((Server.infectCombo + 1)) + " " + Server.moneys + " for your killstreak"); player1.money += ((Server.infectCombo + 1) * 2); } } else { Server.infectCombo = 0; } if (player1.maximuminfected < Server.infectCombo + 1) { player1.maximuminfected = Server.infectCombo + 1; } Server.lastPlayerToInfect = player1.name; player1.infectThisRound++; player1.playersinfected++; if (player2.infectedfrom == player1.name) { player1.Achieve("Deja Vu"); } player2.infectedfrom = player1.name; if (alive.Count == 1) { player1.Achieve("Finisher"); } if (player2.winstreakcount >= 3) { player1.Achieve("Dream Destroyer"); } if (player2.autoafk) { player1.Achieve("Assassin"); } if (lastseconds) { player2.Achieve("Unlucky"); } Player.SendMessage(player1, "Brains eaten this round: %c" + player1.infectThisRound); if (Server.infectCombo == 0) { Player.SendMessage(player1, "%aYou gained 1 extra cookie for eating brains"); player1.money += 1; } Player.GlobalMessage(GetInfectedmessage(player1.name, player2.name)); Server.s.Log(player1.name + " infected " + player2.name); InfectPlayer(player2); humangone(); Thread.Sleep(300); //Thread.Sleep(200); //Thread.Sleep(200); } } // } //} } } Thread.Sleep(400); } } catch { Server.s.Log("Error: #016"); } if (Server.gameStatus == 0) { Server.gameStatus = 4; return; } else if (Server.zombieRound == true) { HandOutRewards(); } }
private void MainGame() { if (Server.gameStatus == 0) { return; } GoBack : Player.GlobalMessage("%4Round Start:%f 2:00"); Thread.Sleep(60000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("%4Round Start:%f 1:00"); Thread.Sleep(55000); if (!Server.ZombieModeOn) { return; } Server.s.Log(Convert.ToString(Server.ChangeLevels) + " " + Convert.ToString(Server.ZombieOnlyServer) + " " + Convert.ToString(Server.UseLevelList) + " " + string.Join(",", Server.LevelList.ToArray())); Player.GlobalMessage("%4Round Start:%f 5..."); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("%4Round Start:%f 4..."); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("%4Round Start:%f 3..."); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("%4Round Start:%f 2..."); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Player.GlobalMessage("%4Round Start:%f 1..."); Thread.Sleep(1000); if (!Server.ZombieModeOn) { return; } Server.zombieRound = true; int playerscountminusref = 0; List <Player> players = new List <Player>(); foreach (Player playere in Player.players) { if (playere.referee) { playere.color = playere.group.color; } else { if (playere.level.name == currentLevelName) { playere.color = playere.group.color; players.Add(playere); playerscountminusref++; } } } if (playerscountminusref < 2) { Player.GlobalMessage(c.red + "ERROR: Need more than 2 players to play"); goto GoBack; } theEnd: Random random = new Random(); int firstinfect = random.Next(players.Count()); Player player = null; if (Server.queZombie == true) { player = Player.Find(Server.nextZombie); } else { player = players[firstinfect]; } if (player.level.name != currentLevelName) { goto theEnd; } Player.GlobalMessage(player.color + player.name + Server.DefaultColor + " started the infection!"); player.infected = true; player.color = c.red; Player.GlobalDie(player, false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); Server.zombieRound = true; int amountOfMinutes = random.Next(5, 12); Player.GlobalMessage("The round will last for " + amountOfMinutes + " minutes!"); amountOfMilliseconds = (60000 * amountOfMinutes); timer = new System.Timers.Timer(amountOfMilliseconds); timer.Elapsed += new ElapsedEventHandler(EndRound); timer.Enabled = true; foreach (Player playaboi in Player.players) { if (playaboi != player) { alive.Add(playaboi); } } infectd.Clear(); if (Server.queZombie == true) { infectd.Add(Player.Find(Server.nextZombie)); } else { infectd.Add(player); } aliveCount = alive.Count; while (aliveCount > 0) { aliveCount = alive.Count; infectd.ForEach(delegate(Player player1) { if (player1.color != c.red) { player1.color = c.red; Player.GlobalDie(player1, false); Player.GlobalSpawn(player1, player1.pos[0], player1.pos[1], player1.pos[2], player1.rot[0], player1.rot[1], false); } alive.ForEach(delegate(Player player2) { if (player2.color != player2.group.color) { player2.color = player2.group.color; Player.GlobalDie(player2, false); Player.GlobalSpawn(player2, player2.pos[0], player2.pos[1], player2.pos[2], player2.rot[0], player2.rot[1], false); } if (player2.pos[0] / 32 == player1.pos[0] / 32 || player2.pos[0] / 32 == player1.pos[0] / 32 + 1 || player2.pos[0] / 32 == player1.pos[0] / 32 - 1) { if (player2.pos[1] / 32 == player1.pos[1] / 32 || player2.pos[1] / 32 == player1.pos[1] / 32 - 1 || player2.pos[1] / 32 == player1.pos[1] / 32 + 1) { if (player2.pos[2] / 32 == player1.pos[2] / 32 || player2.pos[2] / 32 == player1.pos[2] / 32 + 1 || player2.pos[2] / 32 == player1.pos[2] / 32 - 1) { if (!player2.infected && player1.infected && !player2.referee && !player1.referee && player1 != player2 && player1.level.name == currentLevelName && player2.level.name == currentLevelName) { player2.infected = true; infectd.Add(player2); alive.Remove(player2); players.Remove(player2); player2.blockCount = 25; if (Server.lastPlayerToInfect == player1.name) { Server.infectCombo++; if (Server.infectCombo >= 2) { player1.SendMessage("You gained " + (4 - Server.infectCombo) + " " + Server.moneys); player1.money = player1.money + 4 - Server.infectCombo; Player.GlobalMessage(player1.color + player1.name + " is on a rampage! " + (Server.infectCombo + 1) + " infections in a row!"); } } else { Server.infectCombo = 0; } Server.lastPlayerToInfect = player1.name; player1.infectThisRound++; int cazzar = random.Next(0, infectMessages.Length); if (infectMessages2[cazzar] == "") { Player.GlobalMessage(c.red + player1.name + c.yellow + infectMessages[cazzar] + c.red + player2.name); } else if (infectMessages[cazzar] == "") { Player.GlobalMessage(c.red + player2.name + c.yellow + infectMessages2[cazzar]); } else { Player.GlobalMessage(c.red + player1.name + c.yellow + infectMessages[cazzar] + c.red + player2.name + c.yellow + infectMessages2[cazzar]); } player2.color = c.red; player1.playersInfected = player1.playersInfected++; Player.GlobalDie(player2, false); Player.GlobalSpawn(player2, player2.pos[0], player2.pos[1], player2.pos[2], player2.rot[0], player2.rot[1], false); Thread.Sleep(500); } } } } }); }); Thread.Sleep(500); } if (Server.gameStatus == 0) { Server.gameStatus = 4; return; } else { HandOutRewards(); } }
public void HandOutRewards() { Server.zombieRound = false; amountOfMilliseconds = 0; if (Server.gameStatus == 0) { return; } Player.GlobalMessage(c.lime + "The game has ended!"); if (aliveCount == 0) { Player.GlobalMessage(c.maroon + "Zombies have won this round."); } else { Player.GlobalMessage(c.green + "Congratulations to our survivor(s)"); } timer.Enabled = false; string playersString = ""; if (aliveCount == 0) { foreach (Player winners in Player.players) { if (winners.level.name == currentLevelName) { winners.blockCount = 50; winners.infected = false; winners.infectThisRound = 0; if (winners.level.name == currentLevelName) { winners.color = winners.group.color; playersString += winners.group.color + winners.name + c.white + ", "; } } } } else { alive.ForEach(delegate(Player winners) { winners.blockCount = 50; winners.infected = false; winners.infectThisRound = 0; if (winners.level.name == currentLevelName) { winners.color = winners.group.color; playersString += winners.group.color + winners.name + c.white + ", "; } }); } Player.GlobalMessage(playersString); foreach (Player winners in Player.players) { if (!winners.CheckIfInsideBlock() && aliveCount == 0 && winners.level.name == currentLevelName) { Player.GlobalDie(winners, false); Player.GlobalSpawn(winners, winners.pos[0], winners.pos[1], winners.pos[2], winners.rot[0], winners.rot[1], false); Random random2 = new Random(); int randomInt = 0; if (winners.playersInfected > 5) { randomInt = random2.Next(1, winners.playersInfected); } else { randomInt = random2.Next(1, 5); } Player.SendMessage(winners, c.gold + "You gained " + randomInt + " " + Server.moneys); winners.blockCount = 50; winners.playersInfected = 0; winners.money = winners.money + randomInt; } else if (!winners.CheckIfInsideBlock() && (aliveCount == 1 && !winners.infected) && winners.level.name == currentLevelName) { Player.GlobalDie(winners, false); Player.GlobalSpawn(winners, winners.pos[0], winners.pos[1], winners.pos[2], winners.rot[0], winners.rot[1], false); Random random2 = new Random(); int randomInt = 0; randomInt = random2.Next(1, 15); Player.SendMessage(winners, c.gold + "You gained " + randomInt + " " + Server.moneys); winners.blockCount = 50; winners.playersInfected = 0; winners.money = winners.money + randomInt; } else if (winners.level.name == currentLevelName) { winners.SendMessage("You may not hide inside a block! No " + Server.moneys + " for you!"); } } try { alive.Clear(); infectd.Clear(); } catch { } foreach (Player player in Player.players) { player.infected = false; player.color = player.group.color; Player.GlobalDie(player, false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); if (player.level.name == currentLevelName) { if (player.referee) { player.SendMessage("You gained one " + Server.moneys + " because you're a ref. Would you like a medal as well?"); player.money++; } } } return; }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } bool totalUnban = false; if (message[0] == '@') { totalUnban = true; message = message.Remove(0, 1).Trim(); } Player who = Player.Find(message); if (who == null) { if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned)) { foreach (Server.TempBan tban in Server.tempBans) { if (tban.name.ToLower() == message.ToLower()) { Server.tempBans.Remove(tban); Player.GlobalMessage(message + " has had their temporary ban lifted."); return; } } Player.SendMessage(p, "Player is not banned."); return; } Player.GlobalMessage(message + " &8(banned)" + Server.DefaultColor + " is now " + Group.standard.color + Group.standard.name + Server.DefaultColor + "!"); Group.findPerm(LevelPermission.Banned).playerList.Remove(message); } else { if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned)) { foreach (Server.TempBan tban in Server.tempBans) { if (tban.name == who.name) { Server.tempBans.Remove(tban); Player.GlobalMessage(who.color + who.prefix + who.name + Server.DefaultColor + "has had their temporary ban lifted."); return; } } Player.SendMessage(p, "Player is not banned."); return; } Player.GlobalChat(who, who.color + who.prefix + who.name + Server.DefaultColor + " is now " + Group.standard.color + Group.standard.name + Server.DefaultColor + "!", false); who.group = Group.standard; who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Remove(message); } Group.findPerm(LevelPermission.Banned).playerList.Save(); if (totalUnban) { Command.all.Find("unbanip").Use(p, "@" + message); } }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } bool stealth = false; bool totalBan = false; if (message[0] == '#') { if (p == null) { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Stealth Ban Attempted by Console"); } else { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Stealth Ban Attempted by " + p.name); } } else if (message[0] == '@') { if (p == null) { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Total Ban Attempted by Console"); } else { totalBan = true; message = message.Remove(0, 1).Trim(); Server.s.Log("Total Ban Attempted by " + p.name); } } string reason = "-"; if (message.Split(' ').Length > 1) { reason = message; string newreason = reason.Remove(0, reason.Split(' ')[0].Length + 1); int removetrim = newreason.Length + 1; string newmessage = message.Remove(message.Length - removetrim, removetrim); reason = newreason; message = newmessage; } if (reason == "-") { reason = "&c-"; } reason = reason.Replace(" ", "%20"); Player who = Player.Find(message); if (who == null) { if (!Player.ValidName(message)) { Player.SendMessage(p, "Invalid name \"" + message + "\"."); return; } if (Server.devs.Contains(message.ToLower())) { Player.SendMessage(p, "You can't ban a MCForge Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!"); } else { Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!"); } return; } Group foundGroup = Group.findPlayerGroup(message); if ((int)foundGroup.Permission >= CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!"); return; } if (foundGroup.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } if (p != null && foundGroup.Permission >= p.group.Permission) { Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you."); return; } string oldgroup = foundGroup.name.ToString(); foundGroup.playerList.Remove(message); foundGroup.playerList.Save(); if (p != null) { Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); } else { Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console."); } Group.findPerm(LevelPermission.Banned).playerList.Add(message); Ban.Banplayer(p, message, reason, stealth, oldgroup); } else { if (!Player.ValidName(who.name)) { Player.SendMessage(p, "Invalid name \"" + who.name + "\"."); return; } if (Server.devs.Contains(who.name.ToLower())) { Player.SendMessage(p, "You can't ban an MCForge Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban an MCForge Developer!"); } else { Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban an MCForge Developer!"); } return; } if ((int)who.group.Permission >= CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You can't ban a " + who.group.name + "!"); return; } if (who.group.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } if (p != null && who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you."); return; } string oldgroup = who.group.name.ToString(); who.group.playerList.Remove(message); who.group.playerList.Save(); if (p != null) { if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!"); } else { Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!"); } } else { if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by console."); } else { Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console."); } } who.group = Group.findPerm(LevelPermission.Banned); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Add(who.name); Ban.Banplayer(p, who.name, reason, stealth, oldgroup); } Group.findPerm(LevelPermission.Banned).playerList.Save(); if (p != null) { Server.IRC.Say(message + " was banned by " + p.name + "."); Server.s.Log("BANNED: " + message.ToLower() + " by " + p.name); } else { Server.IRC.Say(message + " was banned by console."); Server.s.Log("BANNED: " + message.ToLower() + " by console."); } if (totalBan == true) { Command.all.Find("undo").Use(p, message + " 0"); Command.all.Find("banip").Use(p, "@ " + message); } } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if ((message.ToLower() == "set") && p != null) { p.level.jailx = p.pos[0]; p.level.jaily = p.pos[1]; p.level.jailz = p.pos[2]; p.level.jailrotx = p.rot[0]; p.level.jailroty = p.rot[1]; Player.SendMessage(p, "Set Jail point."); } else { Player who = Player.Find(message); if (who != null) { if (!who.jailed) { if (p != null) { if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; } else { if (Server.devs.Contains(who.name.ToLower()) == true) { p.SendMessage("You can't kick a MCForge Developer!"); return; } if (Server.gcmodhasprotection(who.name.ToLower()) == true) { p.SendMessage("You can't kick a Global Chat Moderator!"); return; } } } Player.GlobalDie(who, false); if (p != null) { Player.GlobalSpawn(who, p.level.jailx, p.level.jaily, p.level.jailz, p.level.jailrotx, p.level.jailroty, true); } else { Player.GlobalSpawn(who, who.level.jailx, who.level.jaily, who.level.jailz, who.level.jailrotx, who.level.jailroty, true); } who.jailed = true; if (p == null) { if (Server.devs.Contains(who.name.ToLower()) || Server.gcmodhasprotection(who.name.ToLower())) { return; } Player.SendMessage(p, who.name + " was jailed."); } Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " was &8jailed", false); } else { if (p == null) { if (Server.devs.Contains(who.name.ToLower()) || Server.gcmodhasprotection(who.name.ToLower())) { return; } Player.SendMessage(p, who.name + " was freed from jail."); } who.jailed = false; Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false); } } else { Player.SendMessage(p, "Could not find specified player."); } } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; } if (message == "") { Help(p); return; } try { Level foundLevel = Level.Find(message); if (foundLevel != null) { Level startLevel = p.level; GC.Collect(); if (p.level == foundLevel) { Player.SendMessage(p, "You are already in \"" + foundLevel.name + "\"."); return; } if (!p.ignorePermission) { if (p.group.Permission < foundLevel.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + foundLevel.name + "."); return; } } if (!p.ignorePermission) { if (p.group.Permission > foundLevel.pervisitmax) { if (!p.group.CanExecute(Command.all.Find("pervisitmax"))) { Player.SendMessage(p, "Your rank must be " + foundLevel.pervisitmax + " or lower to go there!"); } return; } } { if (!File.Exists("text/lockdown/map/" + message + "")) { p.Loading = true; foreach (Player pl in Player.players) { if (p.level == pl.level && p != pl) { p.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (p.level == b.level) { p.SendDie(b.id); } } Player.GlobalDie(p, true); p.level = foundLevel; p.SendUserMOTD(); p.SendMap(); GC.Collect(); ushort x = (ushort)((0.5 + foundLevel.spawnx) * 32); ushort y = (ushort)((1 + foundLevel.spawny) * 32); ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32); if (!p.hidden) { Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true, ""); } else { unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); } } foreach (Player pl in Player.players) { if (pl.level == p.level && p != pl && !pl.hidden) { p.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == p.level) { p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } if (!p.hidden) { Player.GlobalChat(p, p.color + "*" + p.name + Server.DefaultColor + " went to &b" + foundLevel.name, false); } p.Loading = false; bool skipUnload = false; if (startLevel.unload && !startLevel.name.Contains("&cMuseum ")) { foreach (Player pl in Player.players) { if (pl.level == startLevel) { skipUnload = true; break; } } if (!skipUnload && Server.AutoLoad) { startLevel.Unload(true); } } if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == foundLevel) { if (Server.lava.roundActive) { Server.lava.AnnounceRoundInfo(p); Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p); } else { Player.SendMessage(p, "Vote for the next map!"); Player.SendMessage(p, "Choices: " + Server.lava.VoteString); } } if (Server.zombie.GameInProgess()) { if (p.level.name == Server.zombie.currentLevelName) { Server.zombie.InfectedPlayerLogin(p); } } if (p.level.name != Server.zombie.currentLevelName) { if (ZombieGame.alive.Contains(p)) { ZombieGame.alive.Remove(p); } if (ZombieGame.infectd.Contains(p)) { ZombieGame.infectd.Remove(p); } } } else { Player.SendMessage(p, "The level " + message + " is locked."); } } } else if (Server.AutoLoad) { if (!File.Exists("levels/" + message + ".lvl")) { Player.SendMessage(p, "Level \"" + message + "\" doesn't exist!"); } else if (Level.Find(message) != null || Level.CheckLoadOnGoto(message)) { Command.all.Find("load").Use(p, message); foundLevel = Level.Find(message); if (foundLevel != null) { Use(p, message); } } else { Player.SendMessage(p, "Level \"" + message + "\" cannot be loaded using /goto!"); } } else { Player.SendMessage(p, "There is no level \"" + message + "\" loaded."); } GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; } if (message == "check") { if (p.hidden) { Player.SendMessage(p, "You are currently hidden!"); return; } else { Player.SendMessage(p, "You are not currently hidden!"); return; } } else if (message != "") { if (p.possess != "") { Player.SendMessage(p, "Stop your current possession first."); return; } } Command opchat = Command.all.Find("opchat"); Command adminchat = Command.all.Find("adminchat"); p.hidden = !p.hidden; if (p.hidden) { Player.GlobalDie(p, true); Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &finvisible" + Server.DefaultColor + "."); Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.name + Server.DefaultColor + " " + (File.Exists("text/logout/" + p.name + ".txt") ? File.ReadAllText("text/logout/" + p.name + ".txt") : "Disconnected."), false); Server.IRC.Say(p.name + " left the game (Disconnected.)"); if (!p.opchat) { opchat.Use(p, message); } //Player.SendMessage(p, "You're now &finvisible&e."); } else { Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &8visible" + Server.DefaultColor + "."); Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.name + Server.DefaultColor + " " + (File.Exists("text/login/" + p.name + ".txt") ? File.ReadAllText("text/login/" + p.name + ".txt") : "joined the game."), false); Server.IRC.Say(p.name + " joined the game"); if (p.opchat) { opchat.Use(p, message); } if (p.adminchat) { adminchat.Use(p, message); } //Player.SendMessage(p, "You're now &8visible&e."); } }
public override void Use(Player p, string message) { if (message == "") { message = p.name; } Level lvl; string[] text = new string[2]; text[0] = ""; text[1] = ""; try { text[0] = message.Split(' ')[0].ToLower(); text[1] = message.Split(' ')[1].ToLower(); } catch { } { if (p != null && p.level != null) { lvl = p.level; } else { lvl = Level.Find(text[1]); if (lvl == null) { Player.SendMessage(p, "Level not found!"); return; } } } if (text[0].ToLower() == "all") { if (p != null && (int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+"); return; } foreach (Player who in Player.players.ToArray()) { if (who.level == lvl) { who.Loading = true; foreach (Player pl in Player.players.ToArray()) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players.ToArray()) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; if (p != null && !p.hidden) { who.SendMessage("&bMap reloaded by " + p.name); } if (p != null && p.hidden) { who.SendMessage("&bMap reloaded"); } Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } } GC.Collect(); GC.WaitForPendingFinalizers(); } else { Player who = Player.Find(text[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who.group.Permission > p.group.Permission && p != who) { Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; } who.Loading = true; foreach (Player pl in Player.players.ToArray()) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players.ToArray()) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; GC.Collect(); GC.WaitForPendingFinalizers(); who.SendMessage("&bMap reloaded by " + p.name); Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } bool totalUnban = false; if (message[0] == '@') { totalUnban = true; message = message.Remove(0, 1).Trim(); } Player who = Player.Find(message); if (who == null) { if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned)) { foreach (Server.TempBan tban in Server.tempBans) { if (tban.name.ToLower() == message.ToLower()) { if (p != null) { Server.tempBans.Remove(tban); Player.GlobalMessage(message + " has had their temporary ban lifted by " + p.color + p.name + Server.DefaultColor + "."); Server.s.Log("UNBANNED: by " + p.name); Server.IRC.Say(message + " was unbanned by " + p.name + "."); return; } else { Server.tempBans.Remove(tban); Player.GlobalMessage(message + " has had their temporary ban lifted by console."); Server.s.Log("UNBANNED: by console"); Server.IRC.Say(message + " was unbanned by console."); return; } } } Player.SendMessage(p, "Player is not banned."); return; } if (Group.findPlayerGroup(message) == Group.findPerm(LevelPermission.Banned)) { if (p != null) { Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); Server.s.Log("UNBANNED: by " + p.name); Server.IRC.Say(message + " was unbanned by " + p.name + "."); } else { Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by console."); Server.s.Log("UNBANNED: by console"); Server.IRC.Say(message + " was unbanned by console."); } Group.findPerm(LevelPermission.Banned).playerList.Remove(message); if (Ban.Deleteban(message)) { Player.SendMessage(p, "deleted ban information about " + message + "."); } else { Player.SendMessage(p, "no info found about " + message + "."); } } } else { if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned)) { foreach (Server.TempBan tban in Server.tempBans) { if (tban.name == who.name) { if (p != null) { Server.tempBans.Remove(tban); Player.GlobalMessage(message + " has had their temporary ban lifted by " + p.color + p.name + Server.DefaultColor + "."); Server.s.Log("UNBANNED: by " + p.name); Server.IRC.Say(message + " was unbanned by " + p.name + "."); return; } else { Server.tempBans.Remove(tban); Player.GlobalMessage(message + " has had their temporary ban lifted by console."); Server.s.Log("UNBANNED: by console"); Server.IRC.Say(message + " was unbanned by console."); return; } } } Player.SendMessage(p, "Player is not banned."); return; } if (Group.findPlayerGroup(message) == Group.findPerm(LevelPermission.Banned)) { if (p != null) { Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); Server.s.Log("UNBANNED: by " + p.name); Server.IRC.Say(message + " was unbanned by " + p.name + "."); } else { Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by console."); Server.s.Log("UNBANNED: by console"); Server.IRC.Say(message + " was unbanned by console."); } who.group = Group.standard; who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Remove(message); } } Group.findPerm(LevelPermission.Banned).playerList.Save(); if (totalUnban) { Command.all.Find("unbanip").Use(p, "@" + message); } }