diff --git a/Core/Commands/Avatars/NearMe.cs b/Core/Commands/Avatars/NearMe.cs new file mode 100644 index 0000000..abed94f --- /dev/null +++ b/Core/Commands/Avatars/NearMe.cs @@ -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 collection = new Dictionary(); + 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 entrys = new Dictionary(); + 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; + } + } +} diff --git a/Core/Commands/Self/PayAvatar.cs b/Core/Commands/Avatars/PayAvatar.cs similarity index 97% rename from Core/Commands/Self/PayAvatar.cs rename to Core/Commands/Avatars/PayAvatar.cs index d2b8427..e87706a 100644 --- a/Core/Commands/Self/PayAvatar.cs +++ b/Core/Commands/Avatars/PayAvatar.cs @@ -5,7 +5,7 @@ using System.Linq; using OpenMetaverse; -namespace BSB.Commands.Self +namespace BSB.Commands.Avatars { public class PayAvatar : CoreCommand_2arg {