public static void HSphere(Player p, ushort x, ushort y, ushort z, int radius, byte type) { List <Player.CopyPos> buffer = new List <Player.CopyPos>(); for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) { continue; } for (short k = Convert.ToInt16(-radius); k <= radius; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) { continue; } for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) { continue; } short maxValue = (short)Math.Sqrt((double)(((j * j) + (k * k)) + (m * m))); if (maxValue < (radius + 1) && maxValue >= (radius - 1)) { try { ushort x2 = (ushort)(x + j); ushort y2 = (ushort)(y + k); ushort z2 = (ushort)(z + m); if (x2 <= p.level.width && y2 <= p.level.depth && z2 <= p.level.length) { byte that = p.level.GetTile((ushort)(x + j), (ushort)((y + k)), (ushort)(z + m)); if (that != 7) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)(x + j); temp.y = (ushort)(y + k); temp.z = (ushort)(z + m); temp.type = type; buffer.Add(temp); //p.level.Blockchange(p, (ushort)(x + j), (ushort)((y + k)), (ushort)(z + m), type); } } } catch { } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried HSphering " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; }
public static void Valcano(Player p, ushort x, ushort y, ushort z, int height, int radius) { //foreach (Player p in Player.players) if (p.level == l) p.SendBlockchange(x, y, z, 0); List <Player.CopyPos> buffer = new List <Player.CopyPos>(); double origionalhypotenuse = sqrt((height * height) + (radius * radius)); for (short k = 0; k <= height; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) { continue; } for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) { continue; } for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) { continue; } int ox = x; int oy = y; int oz = z; int cx = (x + j); int cy = (y + k); int cz = (z + m); double currentheight = height - k; double currentradius; if (currentheight == 0) { } else { currentradius = (double)((double)radius * (double)((double)currentheight / (double)height)); int absx = Math.Abs(j); int absz = Math.Abs(m); double pointradius = sqrt((absx * absx) + (absz * absz)); if (pointradius <= currentradius && pointradius >= (currentradius - 1)) { byte ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = Block.grass; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, Block.grass); } } else if (pointradius <= currentradius) { byte ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = Block.lava; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, Block.lava); } } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried Valcanoing " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; }
public static void HIPyramid(Player p, ushort x, ushort y, ushort z, int height, int radius, byte block) { //foreach (Player p in Player.players) if (p.level == l) p.SendBlockchange(x, y, z, 0); List <Player.CopyPos> buffer = new List <Player.CopyPos>(); for (short k = 0; k <= height; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) { continue; } for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) { continue; } for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) { continue; } int ox = x; int oy = y; int oz = z; int cx = (x + j); int cy = (y + k); int cz = (z + m); double currentheight = k; double currentradius; if (currentheight == 0) { } else { currentradius = (double)((double)radius * (double)((double)currentheight / (double)height)); int absx = Math.Abs(j); int absz = Math.Abs(m); if (absx > currentradius || absz > currentradius) { continue; } if (absx < (currentradius - 1) && absz < (currentradius - 1)) { continue; } byte ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = block; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, block); } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried HIPyramiding " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; if ((y + height) <= p.level.depth) { p.level.Blockchange(p, x, (ushort)(y), z, block); } }
public static void Volcano(Player p, ushort x, ushort y, ushort z, int height, int radius) { //foreach (Player p in Player.players) if (p.level == l) p.SendBlockchange(x, y, z, 0); List<Player.CopyPos> buffer = new List<Player.CopyPos>(); //double originalhypotenuse = sqrt((height * height) + (radius * radius)); for (short k = 0; k <= height; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) continue; for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) continue; for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) continue; // int ox = x; // int oy = y; // int oz = z; int cx = (x + j); int cy = (y + k); int cz = (z + m); double currentheight = height - k; double currentradius; if (currentheight == 0) { } else { currentradius = (double)((double)radius * (double)((double)currentheight / (double)height)); int absx = Math.Abs(j); int absz = Math.Abs(m); double pointradius = sqrt((absx * absx) + (absz * absz)); if (pointradius <= currentradius && pointradius >= (currentradius - 1)) { ushort ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = Block.grass; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, Block.grass); } } else if (pointradius <= currentradius) { ushort ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = Block.lava; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, Block.lava); } } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried Valcanoing " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; }
public static void Sphere(Player p, ushort x, ushort y, ushort z, int radius, ushort type) { List<Player.CopyPos> buffer = new List<Player.CopyPos>(); for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) continue; for (short k = Convert.ToInt16(-radius); k <= radius; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) continue; for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) continue; short maxValue = (short)Math.Sqrt((double)(((j * j) + (k * k)) + (m * m))); if ((maxValue < (radius + 1))) { try { ushort x2 = (ushort)(x + j); ushort y2 = (ushort)(y + k); ushort z2 = (ushort)(z + m); if (x2 <= p.level.width && y2 <= p.level.depth && z2 <= p.level.length) { ushort that = p.level.GetTile((ushort)(x + j), (ushort)((y + k)), (ushort)(z + m)); if (that != 7) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)(x + j); temp.y = (ushort)(y + k); temp.z = (ushort)(z + m); temp.type = type; buffer.Add(temp); //p.level.Blockchange(p, (ushort)(x + j), (ushort)((y + k)), (ushort)(z + m), type); } } } catch { } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried Sphering " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; }
//For the pyramid commands, Radius still refers to the distance from the center point, but is axis independant, rather than a referance to both axes public static void Pyramid(Player p, ushort x, ushort y, ushort z, int height, int radius, ushort block) { //foreach (Player p in Player.players) if (p.level == l) p.SendBlockchange(x, y, z, 0); List<Player.CopyPos> buffer = new List<Player.CopyPos>(); for (short k = 0; k <= height; k = (short)(k + 1)) { if ((y + k) < 0 || (y + k) > p.level.depth) continue; for (short j = Convert.ToInt16(-radius); j <= radius; j = (short)(j + 1)) { if ((x + j) < 0 || (x + j) > p.level.width) continue; for (short m = Convert.ToInt16(-radius); m <= radius; m = (short)(m + 1)) { if ((z + m) < 0 || (z + m) > p.level.length) continue; /* int ox = x; int oy = y; int oz = z;*/ int cx = (x + j); int cy = (y + k); int cz = (z + m); double currentheight = height - k; double currentradius; if (currentheight == 0) { } else { currentradius = (double)((double)radius * (double)((double)currentheight / (double)height)); int absx = Math.Abs(j); int absz = Math.Abs(m); if (absx > currentradius) continue; if (absz > currentradius) continue; ushort ctile = p.level.GetTile((ushort)cx, (ushort)cy, (ushort)cz); if (ctile == 0) { Player.CopyPos temp = new Player.CopyPos(); temp.x = (ushort)cx; temp.y = (ushort)cy; temp.z = (ushort)cz; temp.type = block; buffer.Add(temp); //p.level.Blockchange(p, (ushort)cx, (ushort)cy, (ushort)cz, block); } } } } } if (buffer.Count > p.group.maxBlocks) { Player.SendMessage(p, "You tried Pyramiding " + buffer.Count + " blocks, your limit is " + p.group.maxBlocks); buffer = null; return; } buffer.ForEach(delegate(Player.CopyPos pos) { p.level.Blockchange(p, pos.x, pos.y, pos.z, pos.type); }); buffer = null; if ((y + height) <= p.level.depth) p.level.Blockchange(p, x, (ushort)(y + height), z, block); }