mirror of
https://github.com/justinccdev/opensimulator-tools.git
synced 2026-08-14 01:07:50 +00:00
Add set home griduser service example program
This commit is contained in:
@@ -13,4 +13,17 @@ function GetGridUserInfo($serviceUri, $userId, $debug = FALSE)
|
||||
return PostToService($serviceUri, http_build_query($params), $debug);
|
||||
}
|
||||
|
||||
function SetHome($serviceUri, $userId, $regionId, $posX, $posY, $posZ, $lookAtX, $lookAtY, $debug = FALSE)
|
||||
{
|
||||
$params
|
||||
= array(
|
||||
'UserID' => $userId,
|
||||
'RegionID' => $regionId,
|
||||
'Position' => "<$posX,$posY,$posZ>",
|
||||
'LookAt' => "<$lookAtX,$lookAtY,0>",
|
||||
'METHOD' => "sethome");
|
||||
|
||||
return PostToService($serviceUri, http_build_query($params), $debug);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require_once 'Console/CommandLine.php';
|
||||
require_once "../../config.php";
|
||||
require_once "../../utils.php";
|
||||
require_once "$IP/connectors/grid-user-service-connector.php";
|
||||
|
||||
############
|
||||
### MAIN ###
|
||||
############
|
||||
|
||||
$parser = new Console_CommandLine();
|
||||
|
||||
$parser->addArgument('userID');
|
||||
$parser->addArgument('homeRegionID');
|
||||
$parser->addArgument('homePosX');
|
||||
$parser->addArgument('homePosY');
|
||||
$parser->addArgument('homePosZ');
|
||||
$parser->addArgument('homeLookAtX');
|
||||
$parser->addArgument('homeLookAtY');
|
||||
|
||||
try
|
||||
{
|
||||
$params = $parser->parse();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$parser->displayError($e->getMessage());
|
||||
}
|
||||
|
||||
$userId = $params->args['userID'];
|
||||
|
||||
if (!IsUuid($userId))
|
||||
{
|
||||
print "ERROR: [$userId] is not a well-formed user UUID.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$homeRegionId = $params->args['homeRegionID'];
|
||||
|
||||
if (!IsUuid($userId))
|
||||
{
|
||||
print "ERROR: [homeRegionID] is not a well-formed user UUID.\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$homePosX = $params->args['homePosX'];
|
||||
$homePosY = $params->args['homePosY'];
|
||||
$homePosZ = $params->args['homePosZ'];
|
||||
$lookAtX = $params->args['homeLookAtX'];
|
||||
$lookAtY = $params->args['homeLookAtY'];
|
||||
|
||||
SetHome($GRID_USER_SERVICE_URI, $userId, $homeRegionId, $homePosX, $homePosY, $homePosZ, $lookAtX, $lookAtY, TRUE);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user