private List <Line> CreateOutline(string[] commandArgs, Position position, List <SavedPosition> savedPositions, List <Line> lines) { IGenerator generator; ISquareOptions walls = new Options(); walls.Fill = false; switch (commandArgs.Length) { // width height block [postition] case 5: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; walls.CenterX = position.X; walls.CenterY = position.Y; walls.CenterZ = position.Z; break; case 6: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; var center = savedPositions.Single(a => a.Name.Equals(commandArgs[5])).Position; walls.CenterX = center.X; walls.CenterY = center.Y; walls.CenterZ = center.Z; break; case 8: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; walls.CenterX = commandArgs[5].ToInt(); walls.CenterY = commandArgs[6].ToInt(); walls.CenterZ = commandArgs[7].ToInt(); break; default: var help = "create outline length width height block - center at current position\n" + "create outline length width height block [named position]\n" + "create outline length width height block x y z"; _minecraft.Status(help); return(new List <Line>()); } generator = new BoxGenerator(); lines = generator.Run((Options)walls); return(lines); }
private static List <Line> CreateBox(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions, bool fill) { ISquareOptions box = new Options { Fill = fill }; var command = commandArgs[0].ToLowerInvariant(); commandArgs = ProcessFillArgument(commandArgs, (Options)box); var location = position; switch (commandArgs.Length) { // width(X) length(Z) height(Y) block [postition] case 5: box.Width = commandArgs[1].ToInt(); box.Length = commandArgs[2].ToInt(); box.Height = commandArgs[3].ToInt(); box.Block = commandArgs[4]; break; case 6: // width(X) length(Z) height(Y) block savedposition case 8: // width(X) length(Z) height(Y) block x y z box.Width = commandArgs[1].ToInt(); box.Length = commandArgs[2].ToInt(); box.Height = commandArgs[3].ToInt(); box.Block = commandArgs[4]; location = location.GetAbsolutePosition(commandArgs.Skip(5).Take(3), savedPositions); break; default: var help = $"\nCREATE {command.ToUpper()} - {(fill ? "filled" : "not filled")} by default\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block - center at current position\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block [named position]\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block [x y z]"; commandService.Status(help); return(new List <Line>()); } box.Start = location.ToPoint(); IGenerator generator = new BoxGenerator(); return(generator.Run((Options)box)); }
private static List <Line> CreateFloor(string[] commandArgs, Position position, List <SavedPosition> savedPositions, List <Line> lines) { IGenerator generator; ISquareOptions walls = new Options(); walls.Fill = true; switch (commandArgs.Length) { // width height block [postition] case 4: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; walls.CenterX = position.X; walls.CenterY = position.Y; walls.CenterZ = position.Z; break; case 5: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; var center = savedPositions.Single(a => a.Name.Equals(commandArgs[4])).Position; walls.CenterX = center.X; walls.CenterY = center.Y; walls.CenterZ = center.Z; break; case 7: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; walls.CenterX = commandArgs[4].ToInt(); walls.CenterY = commandArgs[5].ToInt(); walls.CenterZ = commandArgs[6].ToInt(); break; } generator = new BoxGenerator(); lines = generator.Run((Options)walls); return(lines); }
private static List <Line> CreateFloor(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions) { ISquareOptions floor = new Options { Fill = true }; commandArgs = ProcessFillArgument(commandArgs, (Options)floor); var location = position; switch (commandArgs.Length) { case 4: // width(X) length(Z) block @ current position floor.Width = commandArgs[1].ToInt(); floor.Length = commandArgs[2].ToInt(); floor.Height = 1; floor.Block = commandArgs[3]; break; case 5: // width(X) length(Z) block savedposition case 7: // width(X) length(Z) block x y z floor.Width = commandArgs[1].ToInt(); floor.Length = commandArgs[2].ToInt(); floor.Height = 1; floor.Block = commandArgs[3]; location = location.GetAbsolutePosition(commandArgs.Skip(4).Take(3), savedPositions); break; default: var help = "\nCREATE FLOOR\n" + "create floor [nofill] width(X) length(Z) block - center at current position\n" + "create floor [nofill] width(X) length(Z) block [named position]\n" + "create floor [nofill] width(X) length(Z) block [x y z]"; commandService.Status(help); return(new List <Line>()); } floor.Start = location.ToPoint(); IGenerator generator = new BoxGenerator(); return(generator.Run((Options)floor)); }