mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-18 03:39:04 -04:00
Cleanup /draw.
This commit is contained in:
parent
3bebd876b5
commit
321ce469e6
@ -1,405 +1,177 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
not use this file except in compliance with the Licenses. You may
|
not use this file except in compliance with the Licenses. You may
|
||||||
obtain a copy of the Licenses at
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
http://www.opensource.org/licenses/ecl2.php
|
http://www.opensource.org/licenses/ecl2.php
|
||||||
http://www.gnu.org/licenses/gpl-3.0.html
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the Licenses are distributed on an "AS IS"
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands
|
||||||
{
|
{
|
||||||
public sealed class CmdDraw : Command
|
public sealed class CmdDraw : Command
|
||||||
{
|
{
|
||||||
public override string name { get { return "draw"; } }
|
public override string name { get { return "draw"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
public override string shortcut { get { return ""; } }
|
||||||
public override string type { get { return CommandTypes.Building; } }
|
public override string type { get { return CommandTypes.Building; } }
|
||||||
public override bool museumUsable { get { return false; } }
|
public override bool museumUsable { get { return false; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
public CmdDraw() { }
|
public CmdDraw() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message)
|
public override void Use(Player p, string message) {
|
||||||
{
|
if (p == null) {
|
||||||
int height;
|
Player.SendMessage(p, "This command can only be used in-game!"); return;
|
||||||
int radius;
|
}
|
||||||
|
if (p.level.permissionbuild > p.group.Permission) {
|
||||||
|
p.SendMessage("You can not edit this map."); return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p != null)
|
string[] parts = message.Split(' ');
|
||||||
{
|
Player.BlockchangeEventHandler newHandler = null;
|
||||||
if (p.level.permissionbuild > p.group.Permission)
|
bool help;
|
||||||
{
|
|
||||||
p.SendMessage("You can not edit this map.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string[] message2 = message.Split(' ');
|
|
||||||
|
|
||||||
#region cones
|
switch (parts[0].ToLower()) {
|
||||||
if (message2[0].ToLower() == "cone")
|
case "cone":
|
||||||
{
|
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeCone); break;
|
||||||
if (message2.Length != 3)
|
case "hcone":
|
||||||
goto Help;
|
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeHCone); break;
|
||||||
|
case "icone":
|
||||||
|
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeICone); break;
|
||||||
|
case "hicone":
|
||||||
|
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeHICone); break;
|
||||||
|
|
||||||
try
|
case "pyramid":
|
||||||
{
|
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
newHandler = new Player.BlockchangeEventHandler(BlockchangePyramid); break;
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
case "hpyramid":
|
||||||
p.BcVar = new int[2] { height, radius };
|
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
|
||||||
}
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeHPyramid); break;
|
||||||
catch
|
case "ipyramid":
|
||||||
{
|
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
|
||||||
goto Help;
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeIPyramid); break;
|
||||||
}
|
case "hipyramid":
|
||||||
|
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeHIPyramid); break;
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
case "sphere":
|
||||||
p.ClearBlockchange();
|
if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; }
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeCone);
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeSphere); break;
|
||||||
|
case "hsphere":
|
||||||
|
if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeHSphere); break;
|
||||||
|
case "volcano":
|
||||||
|
if (!CheckTwoArgs(p, 4, parts, out help)) { if (help) Help(p); return; }
|
||||||
|
newHandler = new Player.BlockchangeEventHandler(BlockchangeVolcano); break;
|
||||||
|
}
|
||||||
|
Player.SendMessage(p, "Place a block");
|
||||||
|
p.ClearBlockchange();
|
||||||
|
p.Blockchange += newHandler;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
bool CheckTwoArgs(Player p, int addition, string[] parts, out bool help) {
|
||||||
}
|
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
|
||||||
if (message2[0].ToLower() == "hcone")
|
Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
|
||||||
{
|
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
|
help = false; return false;
|
||||||
if (message2.Length != 3)
|
}
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
help = true;
|
||||||
{
|
if (parts.Length != 3)
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
return false;
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
ushort height, radius;
|
||||||
p.BcVar = new int[2] { height, radius };
|
if (!ushort.TryParse(parts[1], out height) || !ushort.TryParse(parts[2], out radius))
|
||||||
}
|
return false;
|
||||||
catch
|
p.BcVar = new int[] { height, radius };
|
||||||
{
|
return true;
|
||||||
goto Help;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
bool CheckOneArg(Player p, int addition, string[] parts, out bool help) {
|
||||||
p.ClearBlockchange();
|
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHCone);
|
Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
|
||||||
|
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
|
||||||
|
help = false; return false;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
help = true;
|
||||||
}
|
if (parts.Length != 2)
|
||||||
|
return false;
|
||||||
|
ushort radius;
|
||||||
|
if (!ushort.TryParse(parts[1], out radius))
|
||||||
|
return false;
|
||||||
|
p.BcVar = new int[] { 0, radius };
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (message2[0].ToLower() == "icone")
|
public void BlockchangeCone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
{
|
RevertAndClearState(p, x, y, z);
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
|
Util.SCOGenerator.Cone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
if (message2.Length != 3)
|
}
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
{
|
RevertAndClearState(p, x, y, z);
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
Util.SCOGenerator.HCone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
}
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
public void BlockchangeICone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
p.ClearBlockchange();
|
RevertAndClearState(p, x, y, z);
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeICone);
|
Util.SCOGenerator.ICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
public void BlockchangeHICone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
}
|
RevertAndClearState(p, x, y, z);
|
||||||
if (message2[0].ToLower() == "hicone")
|
Util.SCOGenerator.HICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
{
|
}
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
public void BlockchangePyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
{
|
RevertAndClearState(p, x, y, z);
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
Util.SCOGenerator.Pyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
}
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
public void BlockchangeHPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
p.ClearBlockchange();
|
RevertAndClearState(p, x, y, z);
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHICone);
|
Util.SCOGenerator.HPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
public void BlockchangeIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
}
|
RevertAndClearState(p, x, y, z);
|
||||||
#endregion
|
Util.SCOGenerator.IPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
#region pyramids
|
}
|
||||||
if (message2[0].ToLower() == "pyramid")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
public void BlockchangeHIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
{
|
RevertAndClearState(p, x, y, z);
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
Util.SCOGenerator.HIPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
}
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
public void BlockchangeSphere(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
p.ClearBlockchange();
|
RevertAndClearState(p, x, y, z);
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangePyramid);
|
Util.SCOGenerator.Sphere(p, x, y, z, p.BcVar[1], type);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
public void BlockchangeHSphere(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
}
|
RevertAndClearState(p, x, y, z);
|
||||||
if (message2[0].ToLower() == "hpyramid")
|
Util.SCOGenerator.HSphere(p, x, y, z, p.BcVar[1], type);
|
||||||
{
|
}
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
public void BlockchangeVolcano(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||||
{
|
RevertAndClearState(p, x, y, z);
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
Util.SCOGenerator.Volcano(p, x, y, z, p.BcVar[0], p.BcVar[1]);
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
}
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
public override void Help(Player p) {
|
||||||
p.ClearBlockchange();
|
p.SendMessage("/draw <shape> <height> <baseradius> - Draw an object in game- Valid Types cones, spheres, and pyramids, hspheres (hollow sphere), and hpyramids (hollow pyramid)");
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHPyramid);
|
}
|
||||||
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (message2[0].ToLower() == "ipyramid")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
|
||||||
p.ClearBlockchange();
|
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeIPyramid);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (message2[0].ToLower() == "hipyramid")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
|
||||||
p.ClearBlockchange();
|
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHIPyramid);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region spheres
|
|
||||||
if (message2[0].ToLower() == "sphere")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; }
|
|
||||||
if (message2.Length != 2)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
radius = Convert.ToUInt16(message2[1].Trim());
|
|
||||||
p.BcVar = new int[2] { 0, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
|
||||||
p.ClearBlockchange();
|
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeSphere);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (message2[0].ToLower() == "hsphere")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; }
|
|
||||||
if (message2.Length != 2)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
radius = Convert.ToUInt16(message2[1].Trim());
|
|
||||||
p.BcVar = new int[2] { 0, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
|
||||||
p.ClearBlockchange();
|
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHSphere);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region other
|
|
||||||
if (message2[0].ToLower() == "volcano")
|
|
||||||
{
|
|
||||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 4)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 4)).name + "+"); return; }
|
|
||||||
if (message2.Length != 3)
|
|
||||||
goto Help;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
height = Convert.ToUInt16(message2[1].Trim());
|
|
||||||
radius = Convert.ToUInt16(message2[2].Trim());
|
|
||||||
p.BcVar = new int[2] { height, radius };
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
goto Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SendMessage("Place a block");
|
|
||||||
p.ClearBlockchange();
|
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeVolcano);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
Help:
|
|
||||||
Help(p);
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
Player.SendMessage(p, "This command can only be used in-game!");
|
|
||||||
}
|
|
||||||
public override void Help(Player p)
|
|
||||||
{
|
|
||||||
p.SendMessage("/draw <shape> <height> <baseradius> - Draw an object in game- Valid Types cones, spheres, and pyramids, hspheres (hollow sphere), and hpyramids (hollow pyramid)");
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Cone Blockchanges
|
|
||||||
public void BlockchangeCone(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.Cone(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.HCone(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeICone(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.ICone(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeHICone(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.HICone(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Pyramid Blockchanges
|
|
||||||
public void BlockchangePyramid(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.Pyramid(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeHPyramid(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.HPyramid(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeIPyramid(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.IPyramid(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeHIPyramid(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.HIPyramid(p, x, y, z, height, radius, type);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Sphere Blockchanges
|
|
||||||
public void BlockchangeSphere(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.Sphere(p, x, y, z, radius, type);
|
|
||||||
}
|
|
||||||
public void BlockchangeHSphere(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.HSphere(p, x, y, z, radius, type);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Special Blockchanges
|
|
||||||
public void BlockchangeVolcano(Player p, ushort x, ushort y, ushort z, byte type)
|
|
||||||
{
|
|
||||||
int height = p.BcVar[0];
|
|
||||||
int radius = p.BcVar[1];
|
|
||||||
RevertAndClearState(p, x, y, z);
|
|
||||||
Util.SCOGenerator.Volcano(p, x, y, z, height, radius);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -37,22 +37,18 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public sealed class RainbowBrush : Brush {
|
public sealed class RainbowBrush : Brush {
|
||||||
readonly Random rnd;
|
byte curBlock = Block.red;
|
||||||
|
|
||||||
public RainbowBrush() {
|
|
||||||
rnd = new Random();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RainbowBrush(int seed) {
|
|
||||||
rnd = new Random(seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override byte NextBlock() {
|
public override byte NextBlock() {
|
||||||
return (byte)rnd.Next(Block.red, Block.darkgrey);
|
byte block = curBlock;
|
||||||
|
curBlock++;
|
||||||
|
if (curBlock > Block.darkpink)
|
||||||
|
curBlock = Block.red;
|
||||||
|
return block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class RandomBrush : Brush {
|
public sealed class RandomBrush : Brush {
|
||||||
readonly Random rnd = new Random();
|
readonly Random rnd = new Random();
|
||||||
readonly byte block;
|
readonly byte block;
|
||||||
|
|
||||||
@ -64,4 +60,20 @@ namespace MCGalaxy {
|
|||||||
return (byte)rnd.Next(1, 11) <= 5 ? block : Block.Zero;
|
return (byte)rnd.Next(1, 11) <= 5 ? block : Block.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class RandomRainbowBrush : Brush {
|
||||||
|
readonly Random rnd;
|
||||||
|
|
||||||
|
public RandomRainbowBrush() {
|
||||||
|
rnd = new Random();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RandomRainbowBrush(int seed) {
|
||||||
|
rnd = new Random(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override byte NextBlock() {
|
||||||
|
return (byte)rnd.Next(Block.red, Block.darkgrey);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,13 +211,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = height - k;
|
double currentheight = height - k;
|
||||||
|
|
||||||
@ -273,13 +267,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = height - k;
|
double currentheight = height - k;
|
||||||
|
|
||||||
@ -335,13 +323,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = k;
|
double currentheight = k;
|
||||||
|
|
||||||
@ -396,13 +378,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = k;
|
double currentheight = k;
|
||||||
|
|
||||||
@ -457,13 +433,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = height - k;
|
double currentheight = height - k;
|
||||||
|
|
||||||
@ -515,13 +485,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = height - k;
|
double currentheight = height - k;
|
||||||
|
|
||||||
@ -573,13 +537,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = k;
|
double currentheight = k;
|
||||||
|
|
||||||
@ -631,13 +589,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = k;
|
double currentheight = k;
|
||||||
|
|
||||||
@ -781,13 +733,7 @@ namespace MCGalaxy.Util
|
|||||||
{
|
{
|
||||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||||
|
|
||||||
int ox = x;
|
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||||
int oy = y;
|
|
||||||
int oz = z;
|
|
||||||
|
|
||||||
int cx = (x + j);
|
|
||||||
int cy = (y + k);
|
|
||||||
int cz = (z + m);
|
|
||||||
|
|
||||||
double currentheight = height - k;
|
double currentheight = height - k;
|
||||||
|
|
||||||
@ -840,51 +786,6 @@ namespace MCGalaxy.Util
|
|||||||
buffer = null;
|
buffer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Stuff that's not used in MCGalaxy (at least not yet)
|
|
||||||
//public void ToAirMethod(List<string> toair)
|
|
||||||
//{
|
|
||||||
// if (toair.Count >= 1)
|
|
||||||
// {
|
|
||||||
// foreach (string s in toair)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// string[] k = s.Split('^');
|
|
||||||
// Level l = Level.Find(k[0]);
|
|
||||||
// ushort x = Convert.ToUInt16(k[1]);
|
|
||||||
// ushort y = Convert.ToUInt16(k[2]);
|
|
||||||
// ushort z = Convert.ToUInt16(k[3]);
|
|
||||||
// l.Blockchange(x, y, z, 0);
|
|
||||||
// }
|
|
||||||
// catch { }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public void TNTthreader() //We may leave this because i cant think of an efficient way to do this.
|
|
||||||
//{
|
|
||||||
// while (true)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// foreach (string t in TNTCHAIN.ToArray())
|
|
||||||
// {
|
|
||||||
// TNTCHAIN.Remove(t); //do first so if it fails its not there anymore :D
|
|
||||||
|
|
||||||
// string[] t2 = t.Split('^');
|
|
||||||
// Level l = Level.Find(t2[0]);
|
|
||||||
// ushort x = Convert.ToUInt16(t2[1]);
|
|
||||||
// ushort y = Convert.ToUInt16(t2[2]);
|
|
||||||
// ushort z = Convert.ToUInt16(t2[3]);
|
|
||||||
// TNT(l, x, y, z);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch { }
|
|
||||||
// Thread.Sleep(100);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region utilities
|
#region utilities
|
||||||
static private double sqrt(double x)
|
static private double sqrt(double x)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user