aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs91
1 files changed, 69 insertions, 22 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 11897f8..7d2dadb 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -85,20 +85,27 @@ namespace OpenSim.Services.GridService
85 if (MainConsole.Instance != null) 85 if (MainConsole.Instance != null)
86 { 86 {
87 MainConsole.Instance.Commands.AddCommand("Regions", true, 87 MainConsole.Instance.Commands.AddCommand("Regions", true,
88 "deregister region", 88 "deregister region id",
89 "deregister region <Region UUID>", 89 "deregister region id <Region UUID>",
90 "Deregister a region manually.", 90 "Deregister a region manually.",
91 String.Empty, 91 String.Empty,
92 HandleDeregisterRegion); 92 HandleDeregisterRegion);
93 93
94 MainConsole.Instance.Commands.AddCommand("Regions", true, 94 MainConsole.Instance.Commands.AddCommand("Regions", true,
95 "show region", 95 "show region name",
96 "show region <Region name>", 96 "show region name <Region name>",
97 "Show details on a region", 97 "Show details on a region",
98 String.Empty, 98 String.Empty,
99 HandleShowRegion); 99 HandleShowRegion);
100 100
101 MainConsole.Instance.Commands.AddCommand("Regions", true, 101 MainConsole.Instance.Commands.AddCommand("Regions", true,
102 "show region at",
103 "show region at <x-coord> <y-coord>",
104 "Show details on a region at the given co-ordinate.",
105 "For example, show region at 1000 1000",
106 HandleShowRegionAt);
107
108 MainConsole.Instance.Commands.AddCommand("Regions", true,
102 "set region flags", 109 "set region flags",
103 "set region flags <Region name> <flags>", 110 "set region flags <Region name> <flags>",
104 "Set database flags for region", 111 "Set database flags for region",
@@ -504,13 +511,13 @@ namespace OpenSim.Services.GridService
504 511
505 private void HandleDeregisterRegion(string module, string[] cmd) 512 private void HandleDeregisterRegion(string module, string[] cmd)
506 { 513 {
507 if (cmd.Length != 3) 514 if (cmd.Length != 4)
508 { 515 {
509 MainConsole.Instance.Output("Syntax: degregister region <Region UUID>"); 516 MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>");
510 return; 517 return;
511 } 518 }
512 519
513 string rawRegionUuid = cmd[2]; 520 string rawRegionUuid = cmd[3];
514 UUID regionUuid; 521 UUID regionUuid;
515 522
516 if (!UUID.TryParse(rawRegionUuid, out regionUuid)) 523 if (!UUID.TryParse(rawRegionUuid, out regionUuid))
@@ -542,34 +549,74 @@ namespace OpenSim.Services.GridService
542 549
543 private void HandleShowRegion(string module, string[] cmd) 550 private void HandleShowRegion(string module, string[] cmd)
544 { 551 {
545 if (cmd.Length != 3) 552 if (cmd.Length != 4)
546 { 553 {
547 MainConsole.Instance.Output("Syntax: show region <region name>"); 554 MainConsole.Instance.Output("Syntax: show region name <region name>");
548 return; 555 return;
549 } 556 }
550 List<RegionData> regions = m_Database.Get(cmd[2], UUID.Zero); 557
558 string regionName = cmd[3];
559
560 List<RegionData> regions = m_Database.Get(regionName, UUID.Zero);
551 if (regions == null || regions.Count < 1) 561 if (regions == null || regions.Count < 1)
552 { 562 {
553 MainConsole.Instance.Output("Region not found"); 563 MainConsole.Instance.Output("No region with name {0} found", regionName);
554 return; 564 return;
555 } 565 }
556 566
557 foreach (RegionData r in regions) 567 OutputRegionsToConsole(regions);
568 }
569
570 private void HandleShowRegionAt(string module, string[] cmd)
571 {
572 if (cmd.Length != 5)
558 { 573 {
559 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); 574 MainConsole.Instance.Output("Syntax: show region at <x-coord> <y-coord>");
575 return;
576 }
560 577
561 ConsoleDisplayList dispList = new ConsoleDisplayList(); 578 int x, y;
562 dispList.AddRow("Region Name", r.RegionName); 579 if (!int.TryParse(cmd[3], out x))
563 dispList.AddRow("Region ID", r.RegionID); 580 {
564 dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); 581 MainConsole.Instance.Output("x-coord must be an integer");
565 dispList.AddRow("URI", r.Data["serverURI"]); 582 return;
566 dispList.AddRow("Owner ID", r.Data["owner_uuid"]); 583 }
567 dispList.AddRow("Flags", flags);
568 584
569 MainConsole.Instance.Output(dispList.ToString()); 585 if (!int.TryParse(cmd[4], out y))
586 {
587 MainConsole.Instance.Output("y-coord must be an integer");
588 return;
570 } 589 }
571 590
572 return; 591 RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero);
592 if (region == null)
593 {
594 MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
595 return;
596 }
597
598 OutputRegionToConsole(region);
599 }
600
601 private void OutputRegionToConsole(RegionData r)
602 {
603 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
604
605 ConsoleDisplayList dispList = new ConsoleDisplayList();
606 dispList.AddRow("Region Name", r.RegionName);
607 dispList.AddRow("Region ID", r.RegionID);
608 dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY));
609 dispList.AddRow("URI", r.Data["serverURI"]);
610 dispList.AddRow("Owner ID", r.Data["owner_uuid"]);
611 dispList.AddRow("Flags", flags);
612
613 MainConsole.Instance.Output(dispList.ToString());
614 }
615
616 private void OutputRegionsToConsole(List<RegionData> regions)
617 {
618 foreach (RegionData r in regions)
619 OutputRegionToConsole(r);
573 } 620 }
574 621
575 private int ParseFlags(int prev, string flags) 622 private int ParseFlags(int prev, string flags)