From c2dd0cf5ffbfe5eaf40b1621ed1e5f25f06eb0eb Mon Sep 17 00:00:00 2001 From: Madpeter Date: Thu, 7 May 2020 04:26:43 +0100 Subject: [PATCH] New command: FriendFullPerms --- Core/Commands/Friends/FriendFullPerms.cs | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Core/Commands/Friends/FriendFullPerms.cs diff --git a/Core/Commands/Friends/FriendFullPerms.cs b/Core/Commands/Friends/FriendFullPerms.cs new file mode 100644 index 0000000..07c2d70 --- /dev/null +++ b/Core/Commands/Friends/FriendFullPerms.cs @@ -0,0 +1,42 @@ +using System; +using OpenMetaverse; +namespace BSB.Commands.Movement +{ + public class FriendFullPerms : CoreCommand_2arg + { + public override string[] ArgTypes { get { return new[] { "Avatar","True|False" }; } } + public override string[] ArgHints { get { return new[] { "Avatar UUID or Firstname Lastname","What status should it be" }; } } + public override string Helpfile { get { return "Updates the friend perms for avatar [Arg 1] to [Arg 2] (Online/Map/Modify)"; } } + public override bool CallFunction(string[] args) + { + if (base.CallFunction(args) == true) + { + if(UUID.TryParse(args[0],out UUID avatar) == true) + { + if(bool.TryParse(args[1],out bool status) == true) + { + if (bot.GetClient.Friends.FriendList.ContainsKey(avatar) == true) + { + if (status == true) + { + bot.GetClient.Friends.GrantRights(avatar, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects); + InfoBlob = "Friendship rights granted"; + } + else + { + bot.GetClient.Friends.GrantRights(avatar, FriendRights.None); + InfoBlob = "Friendship rights removed"; + } + return true; + } + return Failed("Avatar not on friends list or friends list has not updated yet"); + } + return Failed("Unable to process arg 2"); + } + return Failed("Unable to process avatar on arg 1"); + } + return false; + } + } + +}