Moves PayAvatar to under the Avatar collection, adds new command NearMe
This commit is contained in:
parent
a9851d3c71
commit
aab017de0b
2 changed files with 36 additions and 1 deletions
35
Core/Commands/Avatars/NearMe.cs
Normal file
35
Core/Commands/Avatars/NearMe.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using OpenMetaverse;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BSB.Commands.Avatars
|
||||
{
|
||||
class NearMe : CoreCommand_SmartReply_1arg
|
||||
{
|
||||
public override string Helpfile { get { return "Gets a list of avatars near the bot"; } }
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
Dictionary<string, string> collection = new Dictionary<string, string>();
|
||||
foreach(Avatar av in bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy().Values)
|
||||
{
|
||||
Vector3 pos = new Vector3(1, 1, 1);
|
||||
if(bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(av.ID) == true)
|
||||
{
|
||||
pos = bot.GetClient.Network.CurrentSim.AvatarPositions[av.ID];
|
||||
}
|
||||
Dictionary<string, string> entrys = new Dictionary<string, string>();
|
||||
entrys.Add("Username",av.Name);
|
||||
entrys.Add("Pos", pos.X.ToString() + "," + pos.Y.ToString() + "," + pos.Z.ToString());
|
||||
collection.Add(av.ID.ToString(), JsonConvert.SerializeObject(entrys));
|
||||
}
|
||||
return bot.GetCommandsInterface.SmartCommandReply(true, args[0], "ok", CommandName, collection);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace BSB.Commands.Self
|
||||
namespace BSB.Commands.Avatars
|
||||
{
|
||||
public class PayAvatar : CoreCommand_2arg
|
||||
{
|
||||
Loading…
Reference in a new issue