public static void placeBlock(Level l, Player p, ushort x, ushort y, ushort z, ushort type) { if (p == null) l.Blockchange(x, y, z, type); else l.Blockchange(p, x, y, z, type); }
public void AddCactus(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true) { byte height = (byte)Rand.Next(3, 6); ushort yy; for (yy = 0; yy <= height; yy++) { if (overwrite || Lvl.GetTile(z, (ushort)(y + yy), z) == Block.air) if (blockChange) Lvl.Blockchange(x, (ushort)(y + yy), z, Block.green); else Lvl.skipChange(x, (ushort)(y + yy), z, Block.green); } int inX = 0, inZ = 0; switch (Rand.Next(1, 3)) { case 1: inX = -1; break; case 2: default: inZ = -1; break; } for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++) { if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air) if (blockChange) Lvl.Blockchange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green); else Lvl.skipChange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green); } for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++) { if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air) if (blockChange) Lvl.Blockchange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green); else Lvl.skipChange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green); } }
/// <summary> /// Register this event /// </summary> /// <param name="method">This is the delegate that will get called when this event occurs</param> /// <param name="priority">The priority (imporantce) of this call</param> /// <param name="plugin">The plugin object that is registering the event</param> public static void Register(Level.OnLevelUnload method, Priority priority, Plugin plugin) { if (Find(plugin) != null) throw new Exception("The user tried to register 2 of the same event!"); events.Add(new OnLevelUnloadEvent(method, priority, plugin)); Organize(); }
/// <summary> /// Register this event /// </summary> /// <param name="method">This is the delegate that will get called when this event occurs</param> /// <param name="priority">The priority (imporantce) of this call</param> /// <param name="plugin">The plugin object that is registering the event</param> /// <param name="bypass">Register more than one of the same event</param> public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false) { if (Find(plugin) != null) if (!bypass) throw new Exception("The user tried to register 2 of the same event!"); events.Add(new OnLevelLoadedEvent(method, priority, plugin)); Organize(); }
/// <summary> /// Cancel Level event /// </summary> /// <param name="e">The event to cancel</param> /// <param name="l">The level to cancel the event on</param> public static void CancelLevelEvent(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: break; } }
public static Level Find(string levelName) { net.mcforge.world.Level temp = MCForge.Gui.Program.console.getServer().getLevelHandler().findLevel(levelName); if (temp == null) return null; Level l = new Level(temp); return l; }
public string FoundCheck(Level level, bool check) { if (gettinginfo == false) { Level.SaveSettings(level); } if (check) return "&aON"; else return "&cOFF"; }
public static void Call(ushort x, ushort y, ushort z, byte time, string extra, Level l) { events.ForEach(delegate(OnPhysicsUpdateEvent p1) { try { p1.method(x, y, z, time, extra, l); } catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); } }); }
public static void Call(Level l) { events.ForEach(delegate(OnLevelLoadedEvent p1) { try { p1.method(l); } catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); } }); }
/// <summary> /// Cancel Level event /// </summary> /// <param name="e">The event to cancel</param> /// <param name="l">The level to cancel the event on</param> public static void CancelLevelEvent(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: l.cancelunload = true; break; case LevelEvents.LevelSave: l.cancelsave1 = true; break; } }
public PlayerBot(string n, Level l) { Server.s.Log("adding " + n + " bot"); name = n; color = "&1"; id = FreeId(); level = l; ushort x = (ushort)((0.5 + level.spawnx) * 32); ushort y = (ushort)((1 + level.spawny) * 32); ushort z = (ushort)((0.5 + level.spawnz) * 32); pos = new ushort[3] { x, y, z }; rot = new byte[2] { level.rotx, level.roty }; GlobalSpawn(); }
public void Start() { StartTimer = new System.Timers.Timer(1000); ZombieLevel = Level.Find("main"); int loop = 6; StartTimer.Start(); StartTimer.Elapsed += delegate { Server.s.Log(loop + ""); if (loop != 0) { int amountOfPlayers = PlayerCount(); Player.players.ForEach(delegate(Player p) { if (p.referee) amountOfPlayers--; }); //if (amountOfPlayers >= 2) //{ MoreThanTwoPlayers = true; loop--; Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival starts in " + loop + " seconds on level " + ZombieLevel.name + c.gray + " - "); /*} else { if (MoreThanTwoPlayers) Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival requires more than 2 non-referee players online to play" + c.gray + " - "); MoreThanTwoPlayers = false; }*/ } else { loop = 6; Server.ZombieRound = true; int randomMinutes = Random.Next(1, 4); Player.GlobalMessage(c.gray + " - " + "Zombie Survival has started on level " + ZombieLevel.name + " for " + randomMinutes + " minutes! Type /g " + ZombieLevel.name + " to join! " + c.gray + " - "); EndRoundTimer = new System.Timers.Timer((60000 * randomMinutes) - 30000); EndRoundTimer.Start(); EndRoundTimer.Elapsed += delegate { EndRound(); }; StartTimer.Stop(); StartTimer.Dispose(); } }; }
//Forces the edge of a map to slope lower for island map types float NegateEdge(ushort x, ushort y, Level Lvl) { float tempx = 0.0f, tempy = 0.0f; float temp; if (x != 0) { tempx = ((float)x / (float)Lvl.width) * 0.5f; } if (y != 0) { tempy = ((float)y / (float)Lvl.height) * 0.5f; } tempx = Math.Abs(tempx - 0.25f); tempy = Math.Abs(tempy - 0.25f); if (tempx > tempy) { temp = tempx - 0.15f; } else { temp = tempy - 0.15f; } //s.Log("temp = " + temp.ToString()); if (temp > 0.0f) { return temp; } return 0.0f; }
internal OnLevelLoadedEvent(Level.OnLevelLoaded method, Priority priority, Plugin plugin) { this.plugin = plugin; this.priority = priority; this.method = method; }
public static void addLevel(Level level) { levels.Add(level); }
public static void GlobalBlockchange(Level level, ushort x, ushort y, ushort z, byte type) { players.ForEach(delegate(Player p) { if (p.level == level) { p.SendBlockchange(x, y, z, type); } }); }
internal static void Init() { StartListening(); Mainlevel = Level.CreateLevel(new Point3(256, 256, 64), Level.LevelTypes.Flat); UpdateTimer = new System.Timers.Timer(100); UpdateTimer.Elapsed += delegate { Update(); }; UpdateTimer.Start(); HeartbeatTimer = new System.Timers.Timer(30000); //every 30 seconds HeartbeatTimer.Elapsed += delegate { Heartbeat.sendHeartbeat(); }; HeartbeatTimer.Start(); LoadAllDlls.Init(); Log("[Important]: Server Started.", ConsoleColor.Black, ConsoleColor.White); Started = true; CmdReloadCmds reload = new CmdReloadCmds(); reload.Initialize(); //Create the directories we need... if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); Log("Created text directory...", ConsoleColor.White, ConsoleColor.Black); } if (!File.Exists("text/agreed.txt")) { File.Create("text/agreed.txt").Close(); Log("[File] Created agreed.txt", ConsoleColor.White, ConsoleColor.Black); } if (!File.Exists("text/jokermessages.txt")) { File.Create("text/jokermessages.txt").Close(); Log("[File] Created jokermessages.txt", ConsoleColor.White, ConsoleColor.Black); string text = "I am a pony" + Environment.NewLine + "Rainbow Dash <3" + Environment.NewLine + "I like trains!"; File.WriteAllText("text/jokermessages.txt", text); Log("[File] Added default messages to jokermessages.txt", ConsoleColor.White, ConsoleColor.Black); } try { string[] lines = File.ReadAllLines("text/agreed.txt"); foreach (string pl in lines) { agreed.Add(pl); } } catch { Log("[Error] Error reading agreed players!", ConsoleColor.Red, ConsoleColor.Black); } }
public PlayerBot(string n, Level l, ushort x, ushort y, ushort z, byte rotx, byte roty) { name = n; color = "&1"; id = FreeId(); DisplayName = n; SkinName = n; level = l; pos = new ushort[3] { x, y, z }; rot = new byte[2] { rotx, roty }; GlobalSpawn(); foreach (Player p in Player.players) { if (p.level == level) { Player.SendMessage(p, color + name + Server.DefaultColor + ", the bot, has been added."); } } botTimer.Elapsed += delegate { int currentNum, foundNum = (32 * 75); // Random rand = new Random(); x = (ushort)Math.Round((decimal)pos[0] / (decimal)32); y = (ushort)((pos[1] - 33) / 32); z = (ushort)Math.Round((decimal)pos[2] / (decimal)32); if (kill) { foreach (Player p in Player.players) { if ((ushort)(p.pos[0] / 32) == x) { if (Math.Abs((ushort)(p.pos[1] / 32) - y) < 2) { if ((ushort)(p.pos[2] / 32) == z) { p.HandleDeath(Block.Zero); } } } } } if (Waypoints.Count < 1) { if (hunt) Player.players.ForEach(delegate(Player p) { if (p.level == level && !p.invincible) { currentNum = Math.Abs(p.pos[0] - pos[0]) + Math.Abs(p.pos[1] - pos[1]) + Math.Abs(p.pos[2] - pos[2]); if (currentNum < foundNum) { foundNum = currentNum; foundPos = p.pos; foundRot = p.rot; movement = true; rot[1] = (byte)(Block.maxblocks - foundRot[1]); if (foundRot[0] < 128) rot[0] = (byte)(foundRot[0] + 128); else rot[0] = (byte)(foundRot[0] - 128); } } }); } else { bool skip = false; movement = false; retry: switch (Waypoints[currentPoint].type) { case "walk": foundPos[0] = Waypoints[currentPoint].x; foundPos[1] = Waypoints[currentPoint].y; foundPos[2] = Waypoints[currentPoint].z; movement = true; if ((ushort)(pos[0] / 32) == (ushort)(Waypoints[currentPoint].x / 32)) { if ((ushort)(pos[2] / 32) == (ushort)(Waypoints[currentPoint].z / 32)) { rot[0] = Waypoints[currentPoint].rotx; rot[1] = Waypoints[currentPoint].roty; currentPoint++; movement = false; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } } } break; case "teleport": pos[0] = Waypoints[currentPoint].x; pos[1] = Waypoints[currentPoint].y; pos[2] = Waypoints[currentPoint].z; rot[0] = Waypoints[currentPoint].rotx; rot[1] = Waypoints[currentPoint].roty; currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; return; case "wait": if (countdown != 0) { countdown--; if (countdown == 0) { currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } } } else { countdown = Waypoints[currentPoint].seconds; } return; case "nod": if (countdown != 0) { countdown--; if (nodUp) { if (rot[1] > 32 && rot[1] < 128) nodUp = !nodUp; else { if (rot[1] + (byte)Waypoints[currentPoint].rotspeed > Block.maxblocks) rot[1] = 0; else rot[1] += (byte)Waypoints[currentPoint].rotspeed; } } else { if (rot[1] > 128 && rot[1] < 224) nodUp = !nodUp; else { if (rot[1] - (byte)Waypoints[currentPoint].rotspeed < 0) rot[1] = 255; else rot[1] -= (byte)Waypoints[currentPoint].rotspeed; } } if (countdown == 0) { currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } } } else { countdown = Waypoints[currentPoint].seconds; } return; case "spin": if (countdown != 0) { countdown--; if (rot[0] + (byte)Waypoints[currentPoint].rotspeed > Block.maxblocks) rot[0] = 0; else if (rot[0] + (byte)Waypoints[currentPoint].rotspeed < 0) rot[0] = 255; else rot[0] += (byte)Waypoints[currentPoint].rotspeed; if (countdown == 0) { currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } } } else { countdown = Waypoints[currentPoint].seconds; } return; case "speed": movementSpeed = (int)Math.Round((decimal)((decimal)24 / (decimal)100 * (decimal)Waypoints[currentPoint].seconds)); if (movementSpeed == 0) movementSpeed = 1; currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } return; case "reset": currentPoint = 0; return; case "remove": removeBot(); return; case "linkscript": if (File.Exists("bots/" + Waypoints[currentPoint].newscript)) { Command.all.Find("botset").Use(null, this.name + " " + Waypoints[currentPoint].newscript); return; } currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } return; case "jump": jumpTimer.Elapsed += delegate { currentjump++; switch (currentjump) { case 1: case 2: pos[1] += 24; break; case 3: break; case 4: pos[1] -= 24; break; case 5: pos[1] -= 24; jumping = false; currentjump = 0; jumpTimer.Stop(); break; } }; jumpTimer.Start(); currentPoint++; if (currentPoint == Waypoints.Count) currentPoint = 0; if (!skip) { skip = true; goto retry; } break; } if (currentPoint == Waypoints.Count) currentPoint = 0; } if (!movement) { if (rot[0] < 245) rot[0] += 8; else rot[0] = 0; if (rot[1] > 32 && rot[1] < 64) rot[1] = 224; else if (rot[1] > 250) rot[1] = 0; else rot[1] += 4; } }; botTimer.Start(); moveTimer.Elapsed += delegate { moveTimer.Interval = Server.updateTimer.Interval / movementSpeed; if (!movement) return; int newNum;// Random rand = new Random(); if ((pos[1] - 19) % 32 != 0 && !jumping) { pos[1] = (ushort)((pos[1] + 19) - (pos[1] % 32)); } x = (ushort)Math.Round((decimal)(pos[0] - 16) / (decimal)32); y = (ushort)((pos[1] - 64) / 32); z = (ushort)Math.Round((decimal)(pos[2] - 16) / (decimal)32); ushort b = Block.Convert(level.GetTile(x, y, z)); ushort b1, b2, b3;//, b4; if (Block.Walkthrough(b) && !jumping) { pos[1] = (ushort)(pos[1] - 32); } y = (ushort)((pos[1] - 64) / 32); //Block below feet newNum = level.PosToInt((ushort)(x + Math.Sign(foundPos[0] - pos[0])), y, (ushort)(z + Math.Sign(foundPos[2] - pos[2]))); b = Block.Convert(level.GetTile(newNum)); b1 = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 1, 0))); b2 = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 2, 0))); b3 = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 3, 0))); if (Block.Walkthrough(b2) && Block.Walkthrough(b3) && !Block.Walkthrough(b1)) { //Get ready to go up step pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]); pos[1] += (ushort)32; pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]); } else if (Block.Walkthrough(b1) && Block.Walkthrough(b2)) { //Stay on current level pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]); pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]); } else if (Block.Walkthrough(b) && Block.Walkthrough(b1)) { //Drop a level pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]); pos[1] -= (ushort)32; pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]); } x = (ushort)Math.Round((decimal)(pos[0] - 16) / (decimal)32); y = (ushort)((pos[1] - 64) / 32); z = (ushort)Math.Round((decimal)(pos[2] - 16) / (decimal)32); b1 = Block.Convert(level.GetTile(x, (ushort)(y + 1), z)); b2 = Block.Convert(level.GetTile(x, (ushort)(y + 2), z)); b3 = Block.Convert(level.GetTile(x, y, z)); /* if ((ushort)(foundPos[1] / 32) > y) { if (b1 == Block.water || b1 == Block.waterstill || b1 == Block.lava || b1 == Block.lavastill) { if (Block.Walkthrough(b2)) { pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1]))); } } else if (b2 == Block.water || b2 == Block.waterstill || b2 == Block.lava || b2 == Block.lavastill) { pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1]))); } } else if ((ushort)(foundPos[1] / 32) < y) { if (b3 == Block.water || b3 == Block.waterstill || b3 == Block.lava || b3 == Block.lavastill) { pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1]))); } }*/ }; moveTimer.Start(); }
public static void Setup(Level level, bool resetTeams = false) { if (resetTeams) { CTFTeam tempRed = redTeam; CTFTeam tempBlue = blueTeam; redTeam = new CTFTeam("&c", Block.red); blueTeam = new CTFTeam("&9", Block.deepblue); tempRed.Replace(redTeam); tempBlue.Replace(blueTeam); } currLevel = level; redTeam.spawn = currLevel.redSpawn; redTeam.spawnrot = currLevel.redRotation; redTeam.flagBase = currLevel.redFlag; blueTeam.spawn = currLevel.blueSpawn; blueTeam.spawnrot = currLevel.blueRotation; blueTeam.flagBase = currLevel.blueFlag; redTeam.flagLocation = redTeam.flagBase; blueTeam.flagLocation = blueTeam.flagBase; Server.s.Log("CTF set up, waiting for players..."); GameStart(); }
//return true if tree is near private bool TreeCheck(Level Lvl, ushort x, ushort z, ushort y, short dist) { byte foundTile; for (short xx = (short)-dist; xx <= +dist; ++xx) { for (short yy = (short)-dist; yy <= +dist; ++yy) { for (short zz = (short)-dist; zz <= +dist; ++zz) { foundTile = Lvl.GetTile((ushort)(x + xx), (ushort)(z + zz), (ushort)(y + yy)); if (foundTile == Block.trunk || foundTile == Block.green) { return true; } } } } return false; }
//Ok actually i deleted this.......................... but it's still needed for the other stuff (like cliking on the cell etc.) private void editPropertiesToolStripMenuItem_Click(object sender, EventArgs e) { Level l = GetSelectedLevelTab(); if (l != null) { prpertiesoflvl = l; MOTDtxt.Text = l.motd; physlvlnumeric.Value = l.physics; grasschk.Checked = l.GrassGrow; chatlvlchk.Checked = l.worldChat; Killerbloxchk.Checked = l.Killer; SurvivalStyleDeathchk.Checked = l.Death; finitechk.Checked = l.finite; edgewaterchk.Checked = l.edgeWater; if (Server.UseTextures) WoM.Enabled = true; if (l.ai == true) { Aicombo.SelectedItem = "Hunt"; } else { Aicombo.SelectedItem = "Flee"; } Gunschk.Checked = l.guns; Fallnumeric.Value = l.fall; drownNumeric.Value = l.drown; LoadOnGotoChk.Checked = l.loadOnGoto; UnloadChk.Checked = l.unload; chkRndFlow.Checked = l.randomFlow; leafDecayChk.Checked = l.leafDecay; TreeGrowChk.Checked = l.growTrees; AutoLoadChk.Checked = false; if (File.Exists("text/autoload.txt")) { using (StreamReader r = new StreamReader("text/autoload.txt")) { string line; while ((line = r.ReadLine()) != null) { if (line.Contains(l.name) || line.Contains(l.name.ToLower())) { AutoLoadChk.Checked = true; } } } } } else WoM.Enabled = false; UpdateMapList("'"); return; }
public void AddNotchBigTree(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true, Player p = null) { throw new NotImplementedException(); }
public static void GlobalBlockchange(Level level, int b, byte type) { ushort x, y, z; level.IntToPos(b, out x, out y, out z); GlobalBlockchange(level, x, y, z, type); }
/// <summary> /// Load a map into CTF /// </summary> /// <param name="map">The map to load</param> public void LoadMap(string map) { mapname = map; string[] lines = File.ReadAllLines("CTF/" + mapname + ".config"); foreach (string l in lines) { switch (l.Split('=')[0]) { case "base.red.x": redbase.x = ushort.Parse(l.Split('=')[1]); break; case "base.red.y": redbase.y = ushort.Parse(l.Split('=')[1]); break; case "game.maxpoints": maxpoints = int.Parse(l.Split('=')[1]); break; case "game.tag.points-gain": tagpoint = int.Parse(l.Split('=')[1]); break; case "game.tag.points-lose": taglose = int.Parse(l.Split('=')[1]); break; case "game.capture.points-gain": cappoint = int.Parse(l.Split('=')[1]); break; case "game.capture.points-lose": caplose = int.Parse(l.Split('=')[1]); break; case "auto.setup": look = bool.Parse(l.Split('=')[1]); break; case "base.red.z": redbase.z = ushort.Parse(l.Split('=')[1]); break; case "base.red.block": redbase.block = Block.Byte(l.Split('=')[1]); break; case "base.blue.block": bluebase.block = Block.Byte(l.Split('=')[1]); break; case "base.blue.spawnx": bluebase.spawnx = ushort.Parse(l.Split('=')[1]); break; case "base.blue.spawny": bluebase.spawny = ushort.Parse(l.Split('=')[1]); break; case "base.blue.spawnz": bluebase.spawnz = ushort.Parse(l.Split('=')[1]); break; case "base.red.spawnx": redbase.spawnx = ushort.Parse(l.Split('=')[1]); break; case "base.red.spawny": redbase.spawny = ushort.Parse(l.Split('=')[1]); break; case "base.red.spawnz": redbase.spawnz = ushort.Parse(l.Split('=')[1]); break; case "base.blue.x": bluebase.x = ushort.Parse(l.Split('=')[1]); break; case "base.blue.y": bluebase.y = ushort.Parse(l.Split('=')[1]); break; case "base.blue.z": bluebase.z = ushort.Parse(l.Split('=')[1]); break; case "map.line.z": zline = ushort.Parse(l.Split('=')[1]); break; } } Command.all.Find("unload").Use(null, "ctf"); if (File.Exists("levels/ctf.lvl")) File.Delete("levels/ctf.lvl"); File.Copy("CTF/maps/" + mapname + ".lvl", "levels/ctf.lvl"); Command.all.Find("load").Use(null, "ctf"); mainlevel = Level.Find("ctf"); }
public static void GlobalMessageLevel(Level l, string message) { players.ForEach(delegate(Player p) { if (p.level == l && p.Chatroom == null) Player.SendMessage(p, message); }); }
/// <summary> /// Stop the CTF game (if its running) /// </summary> public void Stop() { tagging.Stop(); tagging.Dispose(); mainlevel = null; started = false; if (Level.Find("ctf") != null) Command.all.Find("unload").Use(null, "ctf"); }
public static ushort writeLetter(Level l, Player p, char c, ushort x, ushort y, ushort z, ushort b, int directionToGo) { switch (c) { case 'A': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'B': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'C': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'D': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'E': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'F': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'G': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'H': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'I': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'J': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'K': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'L': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case 'M': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'N': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'O': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'P': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'Q': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'R': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case 'S': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'T': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'U': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'V': placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'W': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'X': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'Y': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case 'Z': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '0': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '1': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case '2': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '3': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '4': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); break; case '5': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '6': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '7': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '8': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '9': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case ':': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '\\': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case '/': placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '.': placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case '!': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case ',': placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); break; case '\'': placeBlock(l, p, x, (ushort)(y + 4), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '"': placeBlock(l, p, x, (ushort)(y + 4), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case ' ': break; case '+': placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); break; case '-': placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); break; case '_': placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case '=': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '(': placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case ')': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '{': placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case '}': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); break; case '<': placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '>': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); break; case '|': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '`': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case '[': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 4), z, b); placeBlock(l, p, x, (ushort)(y + 0), z, b); break; case ']': placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 0), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); placeBlock(l, p, x, (ushort)(y + 2), z, b); placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 4), z, b); break; case '~': placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 2), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); break; case ';': placeBlock(l, p, x, (ushort)(y + 4), z, b); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock(l, p, x, (ushort)(y + 3), z, b); placeBlock(l, p, x, (ushort)(y + 1), z, b); break; case '?': placeBlock( l, p, x, (ushort)( y + 4 ), z, b ); if ( directionToGo == 0 ) x++; else if ( directionToGo == 1 ) x--; else if ( directionToGo == 2 ) z++; else z--; placeBlock( l, p, x, (ushort)( y + 0 ), z, b ); placeBlock( l, p, x, (ushort)( y + 2 ), z, b ); placeBlock( l, p, x, (ushort)( y + 4 ), z, b ); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; placeBlock( l, p, x, (ushort)( y + 3 ), z, b ); break; default: Player.SendMessage(p, "\"" + c + "\" is currently not supported. Space left"); if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; if (directionToGo == 0) x++; else if (directionToGo == 1) x--; else if (directionToGo == 2) z++; else z--; break; } if (directionToGo == 0) return (ushort)(x + 2); else if (directionToGo == 1) return (ushort)(x - 2); else if (directionToGo == 2) return (ushort)(z + 2); else return (ushort)(z - 2); }
void mainlevel_LevelUnload(Level l) { if (started && l == mainlevel) { Server.s.Log("Failed!, A ctf game is curretnly going on!"); Plugin.CancelLevelEvent(LevelEvents.LevelUnload, l); } }
public void Start() { shuttingDown = false; Log("Starting Server"); if (!Directory.Exists("properties")) Directory.CreateDirectory("properties"); if (!Directory.Exists("bots")) Directory.CreateDirectory("bots"); if (!Directory.Exists("text")) Directory.CreateDirectory("text"); if (!Directory.Exists("extra")) Directory.CreateDirectory("extra"); if (!Directory.Exists("extra/undo")) Directory.CreateDirectory("extra/undo"); if (!Directory.Exists("extra/undoPrevious")) Directory.CreateDirectory("extra/undoPrevious"); if (!Directory.Exists("extra/copy/")) { Directory.CreateDirectory("extra/copy/"); } if (!Directory.Exists("extra/copyBackup/")) { Directory.CreateDirectory("extra/copyBackup/"); } try { if (File.Exists("server.properties")) File.Move("server.properties", "properties/server.properties"); if (File.Exists("rules.txt")) File.Move("rules.txt", "text/rules.txt"); if (File.Exists("welcome.txt")) File.Move("welcome.txt", "text/welcome.txt"); if (File.Exists("messages.txt")) File.Move("messages.txt", "text/messages.txt"); if (File.Exists("externalurl.txt")) File.Move("externalurl.txt", "text/externalurl.txt"); if (File.Exists("autoload.txt")) File.Move("autoload.txt", "text/autoload.txt"); if (File.Exists("IRC_Controllers.txt")) File.Move("IRC_Controllers.txt", "ranks/IRC_Controllers.txt"); if (Server.useWhitelist) if (File.Exists("whitelist.txt")) File.Move("whitelist.txt", "ranks/whitelist.txt"); } catch { } if (File.Exists("text/custom$s.txt")) { using (StreamReader r = new StreamReader("text/custom$s.txt")) { string line; while ((line = r.ReadLine()) != null) { if (!line.StartsWith("//")) { var split = line.Split(new char[] { ':' }, 2); if (split.Length == 2 && !String.IsNullOrEmpty(split[0])) { customdollars.Add(split[0], split[1]); } } } } } else { Log("custom$s.txt does not exist, creating"); using (StreamWriter SW = File.CreateText("text/custom$s.txt")) { SW.WriteLine("// This is used to create custom $s"); SW.WriteLine("// If you start the line with a // it wont be used"); SW.WriteLine("// It should be formatted like this:"); SW.WriteLine("// $website:mcforge.net"); SW.WriteLine("// That would replace '$website' in any message to 'mcforge.net'"); SW.WriteLine("// It must not start with a // and it must not have a space between the 2 sides and the colon (:)"); SW.Close(); } } Properties.Load("properties/server.properties"); Updater.Load("properties/update.properties"); Group.InitAll(); Command.InitAll(); GrpCommands.fillRanks(); Block.SetBlocks(); Awards.Load(); if (File.Exists("text/emotelist.txt")) { foreach (string s in File.ReadAllLines("text/emotelist.txt")) { Player.emoteList.Add(s); } } else { File.Create("text/emotelist.txt"); } ProfanityFilter.Init(); timeOnline = DateTime.Now; try { MySQL.executeQuery("CREATE DATABASE if not exists `" + MySQLDatabaseName + "`", true); } catch (Exception e) { Server.s.Log("MySQL settings have not been set! Please reference the MySQL_Setup.txt file on setting up MySQL!"); Server.ErrorLog(e); //process.Kill(); return; } MySQL.executeQuery("CREATE TABLE if not exists Players (ID MEDIUMINT not null auto_increment, Name VARCHAR(20), IP CHAR(15), FirstLogin DATETIME, LastLogin DATETIME, totalLogin MEDIUMINT, Title CHAR(20), TotalDeaths SMALLINT, Money MEDIUMINT UNSIGNED, totalBlocks BIGINT, totalKicked MEDIUMINT, color VARCHAR(6), title_color VARCHAR(6), PRIMARY KEY (ID));"); // Check if the color column exists. DataTable colorExists = MySQL.fillData("SHOW COLUMNS FROM Players WHERE `Field`='color'"); if (colorExists.Rows.Count == 0) { MySQL.executeQuery("ALTER TABLE Players ADD COLUMN color VARCHAR(6) AFTER totalKicked"); } colorExists.Dispose(); // Check if the title color column exists. DataTable tcolorExists = MySQL.fillData("SHOW COLUMNS FROM Players WHERE `Field`='title_color'"); if (tcolorExists.Rows.Count == 0) { MySQL.executeQuery("ALTER TABLE Players ADD COLUMN title_color VARCHAR(6) AFTER color"); } tcolorExists.Dispose(); if (levels != null) foreach (Level l in levels) { l.Unload(); } ml.Queue(delegate { try { levels = new List<Level>(Server.maps); MapGen = new MapGenerator(); Random random = new Random(); if (File.Exists("levels/" + Server.level + ".lvl")) { mainLevel = Level.Load(Server.level); mainLevel.unload = false; if (mainLevel == null) { if (File.Exists("levels/" + Server.level + ".lvl.backup")) { Log("Attempting to load backup."); File.Copy("levels/" + Server.level + ".lvl.backup", "levels/" + Server.level + ".lvl", true); mainLevel = Level.Load(Server.level); if (mainLevel == null) { Log("BACKUP FAILED!"); Console.ReadLine(); return; } } else { Log("mainlevel not found"); mainLevel = new Level(Server.level, 128, 64, 128, "flat"); mainLevel.permissionvisit = LevelPermission.Guest; mainLevel.permissionbuild = LevelPermission.Guest; mainLevel.Save(); } } } else { Log("mainlevel not found"); mainLevel = new Level(Server.level, 128, 64, 128, "flat"); mainLevel.permissionvisit = LevelPermission.Guest; mainLevel.permissionbuild = LevelPermission.Guest; mainLevel.Save(); } addLevel(mainLevel); // fenderrock - Make sure the level does have a physics thread if (mainLevel.physThread == null) mainLevel.physThread = new Thread(new ThreadStart(mainLevel.Physics)); mainLevel.physThread.Start(); } catch (Exception e) { Server.ErrorLog(e); } }); ml.Queue(delegate { bannedIP = PlayerList.Load("banned-ip.txt", null); ircControllers = PlayerList.Load("IRC_Controllers.txt", null); muted = PlayerList.Load("muted.txt", null); foreach (Group grp in Group.GroupList) grp.playerList = PlayerList.Load(grp.fileName, grp); if (Server.useWhitelist) whiteList = PlayerList.Load("whitelist.txt", null); }); ml.Queue(delegate { if (File.Exists("text/autoload.txt")) { try { string[] lines = File.ReadAllLines("text/autoload.txt"); foreach (string line in lines) { //int temp = 0; string _line = line.Trim(); try { if (_line == "") { continue; } if (_line[0] == '#') { continue; } int index = _line.IndexOf("="); string key = _line.Split('=')[0].Trim(); string value; try { value = _line.Split('=')[1].Trim(); } catch { value = "0"; } if (!key.Equals(mainLevel.name)) { Command.all.Find("load").Use(null, key + " " + value); Level l = Level.FindExact(key); } else { try { int temp = int.Parse(value); if (temp >= 0 && temp <= 3) { mainLevel.setPhysics(temp); } } catch { Server.s.Log("Physics variable invalid"); } } } catch { Server.s.Log(_line + " failed."); } } } catch { Server.s.Log("autoload.txt error"); } GC.Collect(); GC.WaitForPendingFinalizers(); } else { Log("autoload.txt does not exist"); } }); ml.Queue(delegate { Log("Creating listening socket on port " + Server.port + "... "); if (Setup()) { s.Log("Done."); } else { s.Log("Could not create socket connection. Shutting down."); return; } }); ml.Queue(delegate { updateTimer.Elapsed += delegate { Player.GlobalUpdate(); PlayerBot.GlobalUpdatePosition(); }; updateTimer.Start(); }); // Heartbeat code here: ml.Queue(delegate { try { Heart.Init(); } catch (Exception e) { Server.ErrorLog(e); } }); // END Heartbeat code /* Thread processThread = new Thread(new ThreadStart(delegate { try { PCCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); ProcessCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName); PCCounter.BeginInit(); ProcessCounter.BeginInit(); PCCounter.NextValue(); ProcessCounter.NextValue(); } catch { } })); processThread.Start(); */ ml.Queue(delegate { messageTimer.Elapsed += delegate { RandomMessage(); }; messageTimer.Start(); process = System.Diagnostics.Process.GetCurrentProcess(); if (File.Exists("text/messages.txt")) { StreamReader r = File.OpenText("text/messages.txt"); while (!r.EndOfStream) messages.Add(r.ReadLine()); r.Dispose(); } else File.Create("text/messages.txt").Close(); if (Server.irc) { new IRCBot(); } // string CheckName = "FROSTEDBUTTS"; // if (Server.name.IndexOf(CheckName.ToLower())!= -1){ Server.s.Log("FROSTEDBUTTS DETECTED");} new AutoSaver(Server.backupInterval); //2 and a half mins blockThread = new Thread(new ThreadStart(delegate { while (true) { Thread.Sleep(blockInterval * 1000); foreach (Level l in levels) { try { l.saveChanges(); } catch (Exception e) { Server.ErrorLog(e); } } } })); blockThread.Start(); locationChecker = new Thread(new ThreadStart(delegate { while (true) { Thread.Sleep(3); for (int i = 0; i < Player.players.Count; i++) { try { Player p = Player.players[i]; if (p.frozen) { unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]); } continue; } else if (p.following != "") { Player who = Player.Find(p.following); if (who == null || who.level != p.level) { p.following = ""; if (!p.canBuild) { p.canBuild = true; } if (who != null && who.possess == p.name) { who.possess = ""; } continue; } if (p.canBuild) { unchecked { p.SendPos((byte)-1, who.pos[0], (ushort)(who.pos[1] - 16), who.pos[2], who.rot[0], who.rot[1]); } } else { unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); } } } else if (p.possess != "") { Player who = Player.Find(p.possess); if (who == null || who.level != p.level) p.possess = ""; } ushort x = (ushort)(p.pos[0] / 32); ushort y = (ushort)(p.pos[1] / 32); ushort z = (ushort)(p.pos[2] / 32); if (p.level.Death) p.RealDeath(x, y, z); p.CheckBlock(x, y, z); p.oldBlock = (ushort)(x + y + z); } catch (Exception e) { Server.ErrorLog(e); } } } })); locationChecker.Start(); Log("Finished setting up server"); }); }
public void SendToSpawn(Level mainlevel, Auto_CTF game, Player p1) { Random rand = new Random(); if (spawnx == 0 && spawny == 0 && spawnz == 0) { ushort xx = (ushort)(rand.Next(0, mainlevel.width)); ushort yy = (ushort)(rand.Next(0, mainlevel.depth)); ushort zz = (ushort)(rand.Next(0, mainlevel.height)); while (mainlevel.GetTile(xx, yy, zz) != Block.air && game.OnSide((ushort)(zz * 32), this)) { xx = (ushort)(rand.Next(0, mainlevel.width)); yy = (ushort)(rand.Next(0, mainlevel.depth)); zz = (ushort)(rand.Next(0, mainlevel.height)); } unchecked { p1.SendPos((byte)-1, (ushort)(xx * 32), (ushort)(yy * 32), (ushort)(zz * 32), p1.rot[0], p1.rot[1]); } } else unchecked { p1.SendPos((byte)-1, spawnx, spawny, spawnz, p1.rot[0], p1.rot[1]); } }