本文整理汇总了C#中CmdRequest.TryGetValue方法的典型用法代码示例。如果您正苦于以下问题:C# CmdRequest.TryGetValue方法的具体用法?C# CmdRequest.TryGetValue怎么用?C# CmdRequest.TryGetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdRequest
的用法示例。
在下文中一共展示了CmdRequest.TryGetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
BotClient Client = TheBotClient;
if (Client.IsLoggedInAndReady) return Success("Already logged in");
{
string value;
if (args.TryGetValue("first", out value))
{
Client.BotLoginParams.FirstName = value;
}
if (args.TryGetValue("last", out value))
{
Client.BotLoginParams.LastName = value;
}
if (args.TryGetValue("pass", out value))
{
Client.BotLoginParams.Password = value;
}
if (args.TryGetValue("loginuri", out value))
{
Radegast.GridManager gm = new GridManager();
gm.LoadGrids();
string url = value;
string find = url.ToLower();
foreach (var grid in gm.Grids)
{
if (find == grid.Name.ToLower() || find == grid.ID.ToLower())
{
url = grid.LoginURI;
}
}
Client.BotLoginParams.URI = url;
}
if (args.TryGetValue("location", out value))
{
Client.BotLoginParams.Start = value;
}
if (!Client.Network.Connected && !Client.Network.LoginMessage.StartsWith("Logging"))
{
Client.Settings.LOGIN_SERVER = TheBotClient.BotLoginParams.URI;
// ClientManager.SingleInstance.config.simURL; // "http://127.0.0.1:8002/";
/// Client.Network.Login(Client.BotLoginParams.FirstName, Client.BotLoginParams.LastName, Client.BotLoginParams.Password, "OnRez", "UNR");
WriteLine("$bot beginning login");
Client.Login();
WriteLine("$bot started login");
}
else
return Success("$bot is already logged in.");
}
return Success("loging in...");
}
示例2: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 2)
return ShowUsage();
string str = Parser.Rejoin(args, 0);
int argcount;
float maxSeconds;
if (!args.TryGetValue("seconds", out maxSeconds))
{
maxSeconds = 60000;
}
SimPosition pos;
if (!args.TryGetValue("position", out pos))
{
return Failure(String.Format("Cannot {0} to {1}", Name, String.Join(" ", args)));
}
DateTime waitUntil = DateTime.Now.Add(TimeSpan.FromSeconds(maxSeconds));
double maxDistance = pos.GetSizeDistance();
if (maxDistance < 1) maxDistance = 1;
bool MadIt = false;
while (waitUntil > DateTime.Now)
{
var gp1 = pos.GlobalPosition;
var gp2 = TheSimAvatar.GlobalPosition;
if (Math.Abs(gp1.Z - gp2.Z) < 2) gp1.Z = gp2.Z;
// do it antyways
gp1.Z = gp2.Z;
double cdist = Vector3d.Distance(gp1, gp2);
if (cdist <= maxDistance)
{
MadIt = true;
break;
}
else
{
Thread.Sleep(100);
}
}
if (MadIt)
{
return Success(string.Format("SUCCESS {0}", str));
}
else
{
return Failure("FAILED " + str);
}
}
示例3: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length == 0)
{
return ShowUsage();
}
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
foreach (var o in PS)
{
//SimObject o = WorldSystem.GetSimObject(currentPrim);
Primitive.ObjectProperties Properties = o.Properties;
if (Properties == null)
{
Failure("Still waiting on properties for " + o);
continue;
}
GridClient client = TheBotClient;
client.Objects.BuyObject(o.GetSimulator(), o.LocalID, Properties.SaleType,
Properties.SalePrice, client.Self.ActiveGroup,
client.Inventory.FindFolderForType(AssetType.Object));
AddSuccess(Name + " on " + o);
}
return SuccessOrFailure();
}
示例4: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 1)
return ShowUsage(); // " siton UUID";
int argsUsed;
SimPosition pos;
if (!args.TryGetValue("on", out pos))
{
sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
return !sittingOnGround
? Failure("$bot did not yet sit on the ground.")
: Success("$bot sat on the ground.");
}
if (pos is SimObject)
{
if (WorldSystem.TheSimAvatar.SitOn(pos as SimObject)) Success("$bot sat on " + pos);
if (!args.IsTrue("down")) return Failure("$bot did not yet sit on " + pos);
}
else if (pos == null)
{
return Failure("$bot did not yet find " + args.str);
}
// @todo use autoppoiolot to the location andf then sit
TheSimAvatar.GotoTargetAStar(pos);
sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
if (sittingOnGround) return Success("$bot sat at " + pos);
return Failure("$bot did not sit at " + pos);
}
示例5: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
string verb = args.CmdName;
// base.acceptInput(verb, args);
UUID primID = UUID.Zero;
SimActor TheSimAvatar = this.TheSimAvatar;
if (verb == "stop-following")
{
// SimPosition ap = TheSimAvatar.ApproachPosition;
if (TheSimAvatar.CurrentAction is MoveToLocation)
{
TheSimAvatar.CurrentAction = null;
}
TheSimAvatar.SetMoveTarget(null, 10);
TheSimAvatar.StopMoving();
}
SimPosition position;
if (!args.TryGetValue("target", out position))
{
return Failure("$bot don't know who " + args.GetString("target") + " is.");
}
{
if (position != null)
{
String str = "" + Client + " start to follow " + position + ".";
WriteLine(str);
// The thread that accepts the Client and awaits messages
TheSimAvatar.CurrentAction = new FollowerAction(TheSimAvatar, position);
return Success("$bot started following " + position);
}
}
{
return Success("$bot ApproachPosition: " + TheSimAvatar.CurrentAction);
}
}
示例6: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length > 0)
{
try
{
string treeName = args[0].Trim(new char[] {' '});
Tree tree = (Tree) 0;
if (!args.TryGetValue("tree", out tree))
{
object value;
int argsUsed;
if (TryEnumParse(typeof (Tree), args, 0, out argsUsed, out value))
{
tree = (Tree) value;
}
}
Vector3 treePosition = GetSimPosition();
treePosition.Z += 3.0f;
Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
Client.Objects.AddTree(Client.Network.CurrentSim, size,
Quaternion.Identity, treePosition, tree, TheBotClient.GroupID, false);
return Success("Attempted to rez a " + treeName + " tree");
}
catch (Exception e)
{
return Failure("" + e);
}
}
return ShowUsage();
}
示例7: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
bool moveInsteadOfCopy = args.IsTrue("--move");
if (!args.ContainsKey("items") || !args.ContainsKey("to"))
{
return ShowUsage();
}
int argsUsed;
List<SimObject> allTargets;
if (!args.TryGetValue("to", out allTargets))
{
return Failure("Cannot find avatar/objects 'to' give to");
}
Success("Going to give to " + allTargets.Count + " avatar/objects");
var man = Client.BotInventory;
var found = man.FindAll(args.GetProperty("items"), false,
inventoryName => Failure("No inventory item named " + inventoryName + " found."));
int given = 0;
foreach (var dest in allTargets)
{
foreach (InventoryBase item in found)
{
GiveAll(man, item, dest, moveInsteadOfCopy);
}
}
return SuccessOrFailure();
}
示例8: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length == 0)
{
return ShowUsage();
}
SimObject o;
if (!args.TryGetValue("target", out o))
{
return Failure(string.Format("Cant find {0}", args.str));
}
bool isObject = !(o is SimAvatar);
UUID target = o.ID;
Primitive currentPrim = o.Prim;
if (currentPrim == null) return Failure(string.Format("No Prim localId for {0}", args.str));
Primitive.ObjectProperties props = o.Properties;
WorldObjects.EnsureSelected(currentPrim, WorldSystem.GetSimulator(currentPrim));
if (props == null) return Failure("no props on " + o + " yet try again");
GridClient client = TheBotClient;
string strA;
if (!args.TryGetValue("ammount", out strA))
{
return Success(string.Format("saletype {0} {1} {2}", o.ID, props.SalePrice, props.SaleType));
}
int amount;
strA = strA.Replace("$", "").Replace("L", "");
if (!int.TryParse(strA, out amount))
{
return Failure("Cant determine amount from: " + strA);
}
SaleType saletype;
if (!args.TryGetValue("saletype", out saletype))
{
saletype = SaleType.Original;
//return Failure("Cant determine SaleType: " + strA);
}
WriteLine("Setting Ammount={0} SaleType={1} for {2}", saletype, amount, o);
TheBotClient.Objects.SetSaleInfo(WorldSystem.GetSimulator(currentPrim), currentPrim.LocalID, saletype,
amount);
return Success(Name + " on " + o);
}
示例9: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 0)
return ShowUsage(); // " md5 [password]";
int padding;
if (!args.TryGetValue("--padding", out padding))
{
padding = 32;
}
return Success(MD5(args[0], padding));
}
示例10: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
SimPosition pos;
if (!args.TryGetValue("pos", out pos)) pos = TheSimAvatar;
SimPathStore R = pos.PathStore;
Vector3 v3 = pos.SimPosition;
WriteLine("SimZInfo: " + pos + " " + R.GetGroundLevel(v3.X, v3.Y));
SimWaypoint WP = R.GetWaypointOf(v3);
WriteLine("WaypointInfo: {0}", WP.OccupiedString(R.GetCollisionPlane(v3.Z)));
return Success("Ran " + Name);
}
示例11: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
int argcount;
SimPosition pos;
if (!args.TryGetValue("pos", out pos)) pos = TheSimAvatar;
Vector3d v3d = pos.GlobalPosition;
Vector3 v3 = pos.SimPosition;
SimAbstractMover sam = SimCollisionPlaneMover.CreateSimPathMover(WorldSystem.TheSimAvatar, pos,
pos.GetSizeDistance());
sam.BlockTowardsVector(v3);
return Success("SUCCESS ");
}
示例12: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
UUID masterUUID;
if (!args.TryGetValue("master", out masterUUID))
{
TheBotClient.MasterName = args.GetString("master");
}
else
{
TheBotClient.MasterKey = masterUUID;
}
return Success(string.Format("Master set to {0} ({1})", Client.MasterName, Client.MasterKey.ToString()));
}
示例13: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
int count = 0;
List<SimAsset> As;
if (args.TryGetValue("assets", out As))
{
foreach (var A in As)
{
WriteLine(A.DebugInfo());
count++;
continue;
}
}
return Success("Shown " + count + " assets");
}
示例14: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length == 0)
{
return ShowUsage();
}
SimObject o;
if (!args.TryGetValue("target", out o)) return Failure(string.Format("Cant find {0}", args.str));
bool isObject = !(o is SimAvatar);
UUID target = o.ID;
GridClient client = TheBotClient;
string strA;
if (!args.TryGetValue("ammount", out strA))
{
(new frmPay(TheBotClient.TheRadegastInstance, o.ID, o.GetName(), isObject)).ShowDialog();
}
else
{
int amount;
strA = strA.Replace("$", "").Replace("L", "");
if (!int.TryParse(strA, out amount))
{
return Failure("Cant determine amount from: " + strA);
}
if (!isObject)
{
client.Self.GiveAvatarMoney(target, amount);
}
else
{
client.Self.GiveObjectMoney(target, amount, o.Properties.Name);
}
}
return Success(Name + " on " + o);
}
示例15: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
bool asLocal = args.IsTrue("--local");
SimPosition pos, pos2;
if (!args.TryGetValue("start", out pos)) pos = TheSimAvatar;
if (!args.TryGetValue("end", out pos2)) pos = TheSimAvatar;
Vector3d from, to;
if (pos2 == null)
{
pos2 = pos;
pos = TheSimAvatar;
}
from = pos.GlobalPosition;
to = pos2.GlobalPosition;
Vector3d offset = Vector3d.Zero;
if (asLocal)
{
offset = pos.PathStore.GlobalStart;
}
bool onlyStart, faked;
var path = SimPathStore.GetPath(null, from, to, 1, out onlyStart, out faked);
WriteLine("onlyStart=" + onlyStart);
WriteLine("faked=" + faked);
WriteLine("start=" + VectorRoundString(from - offset));
WriteLine("end=" + VectorRoundString(to - offset));
WriteLine("pstart=" + pos);
WriteLine("pend=" + pos2);
WriteLine("len=" + path.Count);
int step = 0;
foreach (Vector3d vector3D in path)
{
WriteLine("p" + step + "=" + VectorRoundString(vector3D - offset));
step++;
}
return Success("SUCCESS " + Name);
}