Add ClickObject command
This commit is contained in:
parent
a1041b2672
commit
eae3df809f
1 changed files with 49 additions and 0 deletions
49
Core/Commands/Self/CickObject.cs
Normal file
49
Core/Commands/Self/CickObject.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace BSB.Commands.Self
|
||||
{
|
||||
public class ClickObject : CoreCommand_1arg
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "UUID" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "Object UUID" }; } }
|
||||
public override string Helpfile { get { return "Makes the bot attempt to click a object"; } }
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
if(UUID.TryParse(args[0],out UUID ObjectUUID) == true)
|
||||
{
|
||||
Dictionary<uint, Primitive> objectsentrys = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||
bool found_object = false;
|
||||
foreach (KeyValuePair<uint,Primitive> entry in objectsentrys)
|
||||
{
|
||||
if(entry.Value.ID == ObjectUUID)
|
||||
{
|
||||
bot.GetClient.Objects.ClickObject(bot.GetClient.Network.CurrentSim, entry.Key);
|
||||
found_object = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found_object == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to see object");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("UUID not vaild");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue