Add "show region at" command to grid service to get the details of a region at a specific location. "show region" command becomes "show region name" to disambiguate
This is the same format as used by "show object name", etc. "deregister region" also becomes "deregister region id"0.7.3-extended
parent
03fc8cf155
commit
02fe1a676e
|
@ -85,19 +85,26 @@ namespace OpenSim.Services.GridService
|
||||||
if (MainConsole.Instance != null)
|
if (MainConsole.Instance != null)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||||
"deregister region",
|
"deregister region id",
|
||||||
"deregister region <Region UUID>",
|
"deregister region id <Region UUID>",
|
||||||
"Deregister a region manually.",
|
"Deregister a region manually.",
|
||||||
String.Empty,
|
String.Empty,
|
||||||
HandleDeregisterRegion);
|
HandleDeregisterRegion);
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||||
"show region",
|
"show region name",
|
||||||
"show region <Region name>",
|
"show region name <Region name>",
|
||||||
"Show details on a region",
|
"Show details on a region",
|
||||||
String.Empty,
|
String.Empty,
|
||||||
HandleShowRegion);
|
HandleShowRegion);
|
||||||
|
|
||||||
|
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||||
|
"show region at",
|
||||||
|
"show region at <x-coord> <y-coord>",
|
||||||
|
"Show details on a region at the given co-ordinate.",
|
||||||
|
"For example, show region at 1000 1000",
|
||||||
|
HandleShowRegionAt);
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||||
"set region flags",
|
"set region flags",
|
||||||
"set region flags <Region name> <flags>",
|
"set region flags <Region name> <flags>",
|
||||||
|
@ -504,13 +511,13 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
private void HandleDeregisterRegion(string module, string[] cmd)
|
private void HandleDeregisterRegion(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
if (cmd.Length != 3)
|
if (cmd.Length != 4)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Syntax: degregister region <Region UUID>");
|
MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string rawRegionUuid = cmd[2];
|
string rawRegionUuid = cmd[3];
|
||||||
UUID regionUuid;
|
UUID regionUuid;
|
||||||
|
|
||||||
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
|
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
|
||||||
|
@ -542,34 +549,74 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
private void HandleShowRegion(string module, string[] cmd)
|
private void HandleShowRegion(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
if (cmd.Length != 3)
|
if (cmd.Length != 4)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Syntax: show region <region name>");
|
MainConsole.Instance.Output("Syntax: show region name <region name>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<RegionData> regions = m_Database.Get(cmd[2], UUID.Zero);
|
|
||||||
|
string regionName = cmd[3];
|
||||||
|
|
||||||
|
List<RegionData> regions = m_Database.Get(regionName, UUID.Zero);
|
||||||
if (regions == null || regions.Count < 1)
|
if (regions == null || regions.Count < 1)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Region not found");
|
MainConsole.Instance.Output("No region with name {0} found", regionName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (RegionData r in regions)
|
OutputRegionsToConsole(regions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleShowRegionAt(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
if (cmd.Length != 5)
|
||||||
{
|
{
|
||||||
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
MainConsole.Instance.Output("Syntax: show region at <x-coord> <y-coord>");
|
||||||
|
return;
|
||||||
ConsoleDisplayList dispList = new ConsoleDisplayList();
|
|
||||||
dispList.AddRow("Region Name", r.RegionName);
|
|
||||||
dispList.AddRow("Region ID", r.RegionID);
|
|
||||||
dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY));
|
|
||||||
dispList.AddRow("URI", r.Data["serverURI"]);
|
|
||||||
dispList.AddRow("Owner ID", r.Data["owner_uuid"]);
|
|
||||||
dispList.AddRow("Flags", flags);
|
|
||||||
|
|
||||||
MainConsole.Instance.Output(dispList.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
int x, y;
|
||||||
|
if (!int.TryParse(cmd[3], out x))
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output("x-coord must be an integer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(cmd[4], out y))
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output("y-coord must be an integer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero);
|
||||||
|
if (region == null)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputRegionToConsole(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OutputRegionToConsole(RegionData r)
|
||||||
|
{
|
||||||
|
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
||||||
|
|
||||||
|
ConsoleDisplayList dispList = new ConsoleDisplayList();
|
||||||
|
dispList.AddRow("Region Name", r.RegionName);
|
||||||
|
dispList.AddRow("Region ID", r.RegionID);
|
||||||
|
dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY));
|
||||||
|
dispList.AddRow("URI", r.Data["serverURI"]);
|
||||||
|
dispList.AddRow("Owner ID", r.Data["owner_uuid"]);
|
||||||
|
dispList.AddRow("Flags", flags);
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(dispList.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OutputRegionsToConsole(List<RegionData> regions)
|
||||||
|
{
|
||||||
|
foreach (RegionData r in regions)
|
||||||
|
OutputRegionToConsole(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ParseFlags(int prev, string flags)
|
private int ParseFlags(int prev, string flags)
|
||||||
|
|
Loading…
Reference in New Issue