diff --git a/SecondBotEvents/Commands/Animation.cs b/SecondBotEvents/Commands/Animation.cs index 5475efc..b4e699f 100644 --- a/SecondBotEvents/Commands/Animation.cs +++ b/SecondBotEvents/Commands/Animation.cs @@ -19,10 +19,10 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return BasicReply("avatar lookup", "AddToAllowAnimations", new [] { avatar }); + return BasicReply("avatar lookup", new [] { avatar }); } // @todo accept storage - return Failure("@todo", "AddToAllowAnimations"); + return Failure("@todo"); } [About("Attempts to play a gesture")] @@ -33,11 +33,11 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(gesture, out UUID gestureUUID) == false) { - return BasicReply("Error with gesture", "PlayGesture", new [] { gesture }); + return BasicReply("Error with gesture", new [] { gesture }); } InventoryItem itm = getClient().Inventory.FetchItem(gestureUUID, getClient().Self.AgentID, (3 * 1000)); getClient().Self.PlayGesture(itm.AssetUUID); - return BasicReply("Accepted", "PlayGesture", new [] { gesture }); + return BasicReply("Accepted", new [] { gesture }); } [About("Resets the animation stack for the bot")] @@ -45,7 +45,7 @@ namespace SecondBotEvents.Commands public object ResetAnimations() { // @todo Reset animations function from old version - return Failure("@todo", "ResetAnimations"); + return Failure("@todo"); } } diff --git a/SecondBotEvents/Commands/Chat.cs b/SecondBotEvents/Commands/Chat.cs index 8c94ee2..e50e205 100644 --- a/SecondBotEvents/Commands/Chat.cs +++ b/SecondBotEvents/Commands/Chat.cs @@ -27,15 +27,15 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.isempty(message) == true) { - return Failure("Message empty", "Say", new [] { channel, message }); + return Failure("Message empty", new [] { channel, message }); } if(int.TryParse(channel,out int channelnum) == false) { - return Failure("Invaild channel", "Say", new [] { channel, message }); + return Failure("Invaild channel", new [] { channel, message }); } if(channelnum < 0) { - return Failure("Invaild channel", "Say", new [] { channel, message }); + return Failure("Invaild channel", new [] { channel, message }); } getClient().Self.Chat(message, channelnum, ChatType.Normal); return BasicReply("ok"); @@ -53,14 +53,14 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("avatar lookup", "IM", new [] { avatar, message }); + return Failure("avatar lookup", new [] { avatar, message }); } if (SecondbotHelpers.isempty(message) == true) { - return Failure("Message empty", "IM", new [] { avatar, message }); + return Failure("Message empty", new [] { avatar, message }); } master.botClient.SendIM(avataruuid, message); - return BasicReply("ok", "IM", new [] { avatar, message }); + return BasicReply("ok", new [] { avatar, message }); } [About("gets a full list of all avatar chat windows")] diff --git a/SecondBotEvents/Commands/Core.cs b/SecondBotEvents/Commands/Core.cs index 3fa3bca..daaf416 100644 --- a/SecondBotEvents/Commands/Core.cs +++ b/SecondBotEvents/Commands/Core.cs @@ -11,7 +11,7 @@ namespace SecondBotEvents.Commands [ReturnHints("world")] public object Hello() { - return BasicReply("world", "Hello"); + return BasicReply("world"); } } diff --git a/SecondBotEvents/Commands/Dialogs.cs b/SecondBotEvents/Commands/Dialogs.cs index da21aa2..a7ef234 100644 --- a/SecondBotEvents/Commands/Dialogs.cs +++ b/SecondBotEvents/Commands/Dialogs.cs @@ -30,7 +30,7 @@ namespace SecondBotEvents.Commands { if (int.TryParse(dialogid, out int dialogidnum) == false) { - return Failure("bad dialog id", "DialogResponce", new [] { dialogid, buttontext }); + return Failure("bad dialog id", new [] { dialogid, buttontext }); } return Failure("@todo dialog relay"); } @@ -43,7 +43,7 @@ namespace SecondBotEvents.Commands { if (bool.TryParse(status, out bool statuscode) == false) { - return Failure("bad status", "DialogTrack", new [] { status }); + return Failure("bad status", new [] { status }); } return Failure("@todo dialog relay"); } diff --git a/SecondBotEvents/Commands/Discord.cs b/SecondBotEvents/Commands/Discord.cs index 73953d6..7589d9f 100644 --- a/SecondBotEvents/Commands/Discord.cs +++ b/SecondBotEvents/Commands/Discord.cs @@ -19,7 +19,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.addRoleToMember(serverid, roleid, memberid).Result.ToString(), "Discord_AddRole", new [] { serverid, roleid, memberid }); + return BasicReply(master.DiscordService.addRoleToMember(serverid, roleid, memberid).Result.ToString(), new [] { serverid, roleid, memberid }); } [About("Adds the selected user to the ban list - Disallows rejoining untill they are removed from the list")] @@ -37,9 +37,9 @@ namespace SecondBotEvents.Commands } if (SecondbotHelpers.notempty(why) == false) { - return Failure("Why empty", "Discord_BanMember", new [] { serverid, memberid, why }); + return Failure("Why empty", new [] { serverid, memberid, why }); } - return BasicReply(master.DiscordService.BanMember(serverid, memberid, why).Result.ToString(), "Discord_BanMember", new [] { serverid, memberid, why }); + return BasicReply(master.DiscordService.BanMember(serverid, memberid, why).Result.ToString(), new [] { serverid, memberid, why }); } [About("Clears messages on the server sent by the member in the last 13 days, 22hours 59mins")] @@ -53,8 +53,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - SuccessNoReturn("Discord_BulkClear_Messages", new [] { serverid, memberid }); - return master.DiscordService.ClearMessages(serverid, memberid).Result; + return BasicReply(master.DiscordService.ClearMessages(serverid, memberid).Result.ToString(), new[] { serverid, memberid }); } [About("Sends a message directly to the user [They must be in the server]\n This command requires the SERVER MEMBERS INTENT found in discord app dev")] @@ -69,7 +68,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.MessageMember(serverid, memberid, message).Result.ToString(), "Discord_Dm_Member", new [] { serverid, memberid, message }); + return BasicReply(master.DiscordService.MessageMember(serverid, memberid, message).Result.ToString(), new [] { serverid, memberid, message }); } [About("Returns a list of members in a server \n collection is userid: username \n if the user has set a nickname: userid: nickname|username \n" + @@ -84,8 +83,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - SuccessNoReturn("Discord_MembersList", new [] { serverid }); - return master.DiscordService.ListMembers(serverid).Result; + return BasicReply(master.DiscordService.ListMembers(serverid).Result.ToString(), new[] { serverid }); } [About("Sends a message to the selected channel - Optional TTS usage")] @@ -104,9 +102,9 @@ namespace SecondBotEvents.Commands } if (SecondbotHelpers.notempty(message) == false) { - return Failure("message empty", "Discord_MessageChannel", new [] { serverid, channelid, tts, message }); + return Failure("message empty", new [] { serverid, channelid, tts, message }); } - return BasicReply(master.DiscordService.MessageChannel(serverid, channelid, message, tts).Result.ToString(), "Discord_MessageChannel", new [] { serverid, channelid, tts, message }); + return BasicReply(master.DiscordService.MessageChannel(serverid, channelid, message, tts).Result.ToString(), new [] { serverid, channelid, tts, message }); } [About("Sends a message to the selected channel - Optional TTS usage")] @@ -121,7 +119,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.MuteMember(serverid, memberid, mode).Result.ToString(), "Discord_MuteMember", new [] { serverid, memberid, mode }); + return BasicReply(master.DiscordService.MuteMember(serverid, memberid, mode).Result.ToString(), new [] { serverid, memberid, mode }); } [About("returns a collection of settings for the given role \n This command requires Discord full client mode enabled and connected")] @@ -136,8 +134,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - SuccessNoReturn("Discord_Role_GetSettings", new [] { serverid, roleid }); - return master.DiscordService.RoleSettings(serverid,roleid); + return BasicReply(master.DiscordService.RoleSettings(serverid, roleid).ToString(), new [] { serverid, roleid }); } [About("Updates perm flags for the selected role \n example CSV format: Speak=True,SendMessages=False \n for a full list of perms see output of Discord_Role_GetSettings \n" + @@ -153,7 +150,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString(), "Discord_Role_UpdatePerms", new [] { serverid, roleid, flagscsv }); + return BasicReply(master.DiscordService.UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString(), new [] { serverid, roleid, flagscsv }); } [About("Updates perm flags for the selected role \n example CSV format: Speak=True,SendMessages=False \n for a full list of perms see output of Discord_Role_GetSettings \n" + @@ -168,8 +165,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - SuccessNoReturn("Discord_RoleCreate", new [] { serverid, role }); - return master.DiscordService.CreateRole(serverid,role).Result; + return BasicReply(master.DiscordService.CreateRole(serverid, role).Result.ToString(), new[] { serverid, role }); } [About("Returns a list of roles and their ids in collection \n This command requires Discord full client mode enabled and connected")] @@ -182,7 +178,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.ListRoles(serverid).ToString(), "Discord_RoleList", new [] { serverid }); + return BasicReply(master.DiscordService.ListRoles(serverid).ToString(), new [] { serverid }); } [About("Remove a role from a server \n This command requires Discord full client mode enabled and connected")] @@ -195,7 +191,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return BasicReply(master.DiscordService.RemoveRole(serverid, roleid).Result.ToString(), "Discord_RoleRemove", new [] { serverid, roleid }); + return BasicReply(master.DiscordService.RemoveRole(serverid, roleid).Result.ToString(), new [] { serverid, roleid }); } [About("Returns a list of text channels in a server")] @@ -208,7 +204,7 @@ namespace SecondBotEvents.Commands { return Failure("Discord client not ready"); } - return master.DiscordService.ListTextChannels(serverid); + return BasicReply(master.DiscordService.ListTextChannels(serverid).ToString()); } } } diff --git a/SecondBotEvents/Commands/Estate.cs b/SecondBotEvents/Commands/Estate.cs index 0a3768e..7bafdbd 100644 --- a/SecondBotEvents/Commands/Estate.cs +++ b/SecondBotEvents/Commands/Estate.cs @@ -21,13 +21,13 @@ namespace SecondBotEvents.Commands { if (getClient().Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager here", "SimRestart", new [] { delay, mode }); + return Failure("Not an estate manager here", new [] { delay, mode }); } bool.TryParse(mode, out bool modeflag); if (modeflag == false) { getClient().Estate.CancelRestart(); - return BasicReply("canceled", "SimRestart", new [] { delay, mode }); + return BasicReply("canceled", new [] { delay, mode }); } int delay_restart = 60; int.TryParse(delay, out delay_restart); @@ -36,7 +36,7 @@ namespace SecondBotEvents.Commands delay_restart = 240; } getClient().Estate.RestartRegion(delay_restart); - return BasicReply("restarting", "SimRestart", new [] { delay, mode }); + return BasicReply("restarting", new [] { delay, mode }); } [About("Sends the message to the current sim")] @@ -48,14 +48,14 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(message) == false) { - return Failure("Message empty", "SimMessage", new [] { message }); + return Failure("Message empty", new [] { message }); } if (getClient().Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager here", "SimMessage", new [] { message }); + return Failure("Not an estate manager here", new [] { message }); } getClient().Estate.SimulatorMessage(message); - return BasicReply("ok", "SimMessage", new [] { message }); + return BasicReply("ok", new [] { message }); } [About("Fetchs the regions map tile")] @@ -66,9 +66,9 @@ namespace SecondBotEvents.Commands { if (getClient().Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false) { - return Failure("Unable to find region", "GetSimTexture", new [] { regionname }); + return Failure("Unable to find region", new [] { regionname }); } - return BasicReply(region.MapImageID.ToString(), "GetSimTexture", new [] { regionname }); + return BasicReply(region.MapImageID.ToString(), new [] { regionname }); } [About("Reclaims ownership of the current parcel")] @@ -93,7 +93,7 @@ namespace SecondBotEvents.Commands { if (getClient().Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false) { - return Failure("Unable to find region", "GetSimGlobalPos", new [] { regionname }); + return Failure("Unable to find region", new [] { regionname }); } Dictionary reply = new Dictionary(); reply.Add("region", regionname); @@ -123,25 +123,25 @@ namespace SecondBotEvents.Commands { if (getClient().Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager on region " + getClient().Network.CurrentSim.Name, "UpdateEstateBanlist", new [] { avatar, mode, global }); + return Failure("Not an estate manager on region " + getClient().Network.CurrentSim.Name, new [] { avatar, mode, global }); } UUID avataruuid = UUID.Zero; if (UUID.TryParse(avatar, out avataruuid) == false) { - return Failure("Unable to find avatar UUID", "UpdateEstateBanlist", new [] { avatar, mode, global }); + return Failure("Unable to find avatar UUID", new [] { avatar, mode, global }); } bool globalban = false; if (bool.TryParse(global, out globalban) == false) { - return Failure("Unable to process global value please use true or false", "UpdateEstateBanlist", new [] { avatar, mode, global }); + return Failure("Unable to process global value please use true or false", new [] { avatar, mode, global }); } if (mode != "add") { getClient().Estate.UnbanUser(avataruuid, globalban); - return BasicReply("Unban request accepted", "UpdateEstateBanlist", new [] { avatar, mode, global }); + return BasicReply("Unban request accepted", new [] { avatar, mode, global }); } getClient().Estate.BanUser(avataruuid, globalban); - return BasicReply("Ban request accepted", "UpdateEstateBanlist", new [] { avatar, mode, global }); + return BasicReply("Ban request accepted", new [] { avatar, mode, global }); } } } diff --git a/SecondBotEvents/Commands/Friends.cs b/SecondBotEvents/Commands/Friends.cs index 08a1964..432f9ca 100644 --- a/SecondBotEvents/Commands/Friends.cs +++ b/SecondBotEvents/Commands/Friends.cs @@ -31,24 +31,24 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup", "FriendFullPerms", new [] { avatar, state }); + return Failure("avatar lookup", new [] { avatar, state }); } bool status = false; if (bool.TryParse(state, out status) == false) { - return Failure("state invaild", "FriendFullPerms", new [] { avatar, state }); + return Failure("state invaild", new [] { avatar, state }); } if (getClient().Friends.FriendList.ContainsKey(avataruuid) == false) { - return Failure("Not A friend", "FriendFullPerms", new [] { avatar, state }); + return Failure("Not A friend", new [] { avatar, state }); } if (status == true) { getClient().Friends.GrantRights(avataruuid, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects); - return BasicReply("granted", "FriendFullPerms", new [] { avatar, state }); + return BasicReply("granted", new [] { avatar, state }); } getClient().Friends.GrantRights(avataruuid, FriendRights.None); - return BasicReply("removed", "FriendFullPerms", new [] { avatar, state }); + return BasicReply("removed", new [] { avatar, state }); } [About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")] @@ -65,27 +65,27 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup", "FriendRequest", new [] { avatar, state }); + return Failure("avatar lookup", new [] { avatar, state }); } bool status = false; if (bool.TryParse(state, out status) == false) { - return Failure("state invaild", "FriendRequest", new [] { avatar, state }); + return Failure("state invaild", new [] { avatar, state }); } if (getClient().Friends.FriendList.ContainsKey(avataruuid) == true) { if (status == false) { getClient().Friends.TerminateFriendship(avataruuid); - return BasicReply("Removed", "FriendRequest", new [] { avatar, state }); + return BasicReply("Removed", new [] { avatar, state }); } } if (status == false) { - return Failure("Not in friendslist", "FriendRequest", new [] { avatar, state }); + return Failure("Not in friendslist", new [] { avatar, state }); } getClient().Friends.OfferFriendship(avataruuid); - return BasicReply("Request sent", "FriendRequest", new [] { avatar, state }); + return BasicReply("Request sent", new [] { avatar, state }); } } diff --git a/SecondBotEvents/Commands/Funds.cs b/SecondBotEvents/Commands/Funds.cs index 9dc55e9..e335c94 100644 --- a/SecondBotEvents/Commands/Funds.cs +++ b/SecondBotEvents/Commands/Funds.cs @@ -16,10 +16,10 @@ namespace SecondBotEvents.Commands { if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) { - return Failure("Funds commands are disabled", "Balance"); + return Failure("Funds commands are disabled"); } getClient().Self.RequestBalance(); - return BasicReply(getClient().Self.Balance.ToString(), "Balance"); + return BasicReply(getClient().Self.Balance.ToString()); } [About("Makes the bot pay a avatar")] @@ -34,23 +34,23 @@ namespace SecondBotEvents.Commands { if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) { - return Failure("Transfer funds to avatars disabled", "PayAvatar", new [] { avatar, amount }); + return Failure("Transfer funds to avatars disabled", new [] { avatar, amount }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return BasicReply("avatar lookup", "PayAvatar", new [] { avatar, amount }); + return BasicReply("avatar lookup", new [] { avatar, amount }); } if (int.TryParse(amount, out int amountvalue) == false) { - return Failure("Invaild amount", "PayAvatar", new [] { avatar, amount }); + return Failure("Invaild amount", new [] { avatar, amount }); } if ((amountvalue < 0) || (amountvalue > getClient().Self.Balance)) { - return Failure("Amount out of range", "PayAvatar", new [] { avatar, amount }); + return Failure("Amount out of range", new [] { avatar, amount }); } getClient().Self.GiveAvatarMoney(avataruuid, amountvalue); - return BasicReply("Accepted", "PayAvatar", new [] { avatar, amount }); + return BasicReply("Accepted", new [] { avatar, amount }); } [About("Makes the bot pay a object")] @@ -67,26 +67,26 @@ namespace SecondBotEvents.Commands { if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) { - return Failure("Funds commands are disabled", "PayObject", new [] { objectuuid, primname, amount }); + return Failure("Funds commands are disabled", new [] { objectuuid, primname, amount }); } if (UUID.TryParse(objectuuid, out UUID objectUUID) == false) { - return Failure("Invaild object UUID", "PayObject", new [] { objectuuid, primname, amount }); + return Failure("Invaild object UUID", new [] { objectuuid, primname, amount }); } if (int.TryParse(amount, out int amountvalue) == false) { - return Failure("Invaild amount", "PayObject", new [] { objectuuid, primname, amount }); + return Failure("Invaild amount", new [] { objectuuid, primname, amount }); } if((amountvalue < 0) || (amountvalue > getClient().Self.Balance)) { - return Failure("Amount out of range", "PayObject", new [] { objectuuid, primname, amount }); + return Failure("Amount out of range", new [] { objectuuid, primname, amount }); } if(SecondbotHelpers.notempty(primname) == false) { - return Failure("Primname is empty", "PayObject", new [] { objectuuid, primname, amount }); + return Failure("Primname is empty", new [] { objectuuid, primname, amount }); } getClient().Self.GiveObjectMoney(objectUUID, amountvalue, primname); - return BasicReply("ok", "PayObject", new [] { objectuuid, primname, amount }); + return BasicReply("ok", new [] { objectuuid, primname, amount }); } } } diff --git a/SecondBotEvents/Commands/Group.cs b/SecondBotEvents/Commands/Group.cs index d93f58c..b1948f4 100644 --- a/SecondBotEvents/Commands/Group.cs +++ b/SecondBotEvents/Commands/Group.cs @@ -23,7 +23,7 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "IsGroupMember", new [] { group, avatar }); + return Failure("Invaild group UUID", new [] { group, avatar }); } ProcessAvatar(avatar); return BasicReply(master.DataStoreService.IsGroupMember(groupuuid, avataruuid).ToString()); @@ -40,7 +40,7 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GetGroupMembers", new [] { group }); + return Failure("Invaild group UUID", new [] { group }); } return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupMembers(groupuuid))); } @@ -59,16 +59,16 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupBan", new[] { group, avatar, state }); + return Failure("Invaild group UUID", new[] { group, avatar, state }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupBan", new[] { group, avatar, state }); + return Failure("Unknown group", new[] { group, avatar, state }); } ProcessAvatar(avatar); if(avataruuid == null) { - return Failure("Unknown avatar", "GroupBan", new[] { group, avatar, state }); + return Failure("Unknown avatar", new[] { group, avatar, state }); } GroupBanAction Action = GroupBanAction.Ban; if (state == "false") @@ -97,16 +97,16 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupEject", new [] { group, avatar }); + return Failure("Invaild group UUID", new [] { group, avatar }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupEject", new[] { group, avatar }); + return Failure("Unknown group", new[] { group, avatar }); } ProcessAvatar(avatar); if (avataruuid == null) { - return Failure("Unknown avatar", "GroupEject", new[] { group, avatar}); + return Failure("Unknown avatar", new[] { group, avatar}); } getClient().Groups.EjectUser(groupuuid, avataruuid); return BasicReply("Accepted"); @@ -126,15 +126,15 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupAddRole", new [] { group, avatar }); + return Failure("Invaild group UUID", new [] { group, avatar }); } if (UUID.TryParse(role, out UUID roleuuid) == false) { - return Failure("Invaild role UUID", "GroupAddRole", new [] { group, avatar }); + return Failure("Invaild role UUID", new [] { group, avatar }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupAddRole", new[] { group, avatar, role }); + return Failure("Unknown group", new[] { group, avatar, role }); } ProcessAvatar(avatar); if(master.DataStoreService.IsGroupMember(groupuuid, avataruuid) == false) @@ -161,16 +161,16 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupInvite", new [] { group, avatar, role }); + return Failure("Invaild group UUID", new [] { group, avatar, role }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupInvite", new[] { group, avatar, role }); + return Failure("Unknown group", new[] { group, avatar, role }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup", "GroupInvite", new [] { group, avatar, role }); + return Failure("avatar lookup", new [] { group, avatar, role }); } List roles = new List(); roles.Add(UUID.Zero); @@ -179,12 +179,12 @@ namespace SecondBotEvents.Commands UUID roleuuid = UUID.Zero; if (UUID.TryParse(role, out roleuuid) == false) { - return Failure("Unable to process role UUID", "GroupInvite", new[] { group, avatar, role }); + return Failure("Unable to process role UUID", new[] { group, avatar, role }); } roles.Add(roleuuid); } getClient().Groups.Invite(groupuuid, roles, avataruuid); - return BasicReply("Invite sent", "GroupInvite", new [] { group, avatar, role }); + return BasicReply("Invite sent", new [] { group, avatar, role }); } [About("Sends a group notice (No attachments please use GroupnoticeWithAttachment to attach items!)")] @@ -201,26 +201,26 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "Groupnotice", new [] { group, title, message }); + return Failure("Invaild group UUID", new [] { group, title, message }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "Groupnotice", new [] { group, title, message }); + return Failure("Unknown group", new [] { group, title, message }); } if (SecondbotHelpers.notempty(title) == false) { - return Failure("Title empty", "Groupnotice", new [] { group, title, message }); + return Failure("Title empty", new [] { group, title, message }); } if (SecondbotHelpers.notempty(message) == false) { - return Failure("Message empty", "Groupnotice", new [] { group, title, message }); + return Failure("Message empty", new [] { group, title, message }); } GroupNotice NewNotice = new GroupNotice(); NewNotice.Subject = title; NewNotice.Message = message; NewNotice.OwnerID = getClient().Self.AgentID; getClient().Groups.SendGroupNotice(groupuuid, NewNotice); - return BasicReply("Sending notice", "Groupnotice", new [] { group, title, message }); + return BasicReply("Sending notice", new [] { group, title, message }); } [About("Activates the selected title")] @@ -234,18 +234,18 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupActiveTitle", new [] { group, role }); + return Failure("Invaild group UUID", new [] { group, role }); } if (UUID.TryParse(role, out UUID roleuuid) == false) { - return Failure("Invaild role UUID", "GroupActiveTitle", new [] { group, role }); + return Failure("Invaild role UUID", new [] { group, role }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupActiveTitle", new [] { group, role }); + return Failure("Unknown group", new [] { group, role }); } getClient().Groups.ActivateTitle(groupuuid, roleuuid); - return BasicReply("Switching title", "GroupActiveTitle", new [] { group, role }); + return BasicReply("Switching title", new [] { group, role }); } [About("Sets the selected group to the active group")] @@ -257,14 +257,14 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupActiveGroup", new [] { group }); + return Failure("Invaild group UUID", new [] { group }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupActiveGroup", new[] { group }); + return Failure("Unknown group", new[] { group }); } getClient().Groups.ActivateGroup(groupuuid); - return BasicReply("Switching active group", "GroupActiveGroup", new [] { group }); + return BasicReply("Switching active group", new [] { group }); } [About("Sends a group notice with an attachment")] @@ -283,23 +283,23 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return Failure("Invaild group UUID", new [] { group, title, message, attachment }); } if (UUID.TryParse(attachment, out UUID inventoryuuid) == false) { - return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return Failure("Invaild inventory UUID", new [] { group, title, message, attachment }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return Failure("Unknown group", new [] { group, title, message, attachment }); } if (SecondbotHelpers.notempty(title) == false) { - return Failure("Title empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return Failure("Title empty", new [] { group, title, message, attachment }); } if (SecondbotHelpers.notempty(message) == false) { - return Failure("Message empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return Failure("Message empty", new [] { group, title, message, attachment }); } GroupNotice NewNotice = new GroupNotice(); NewNotice.Subject = title; @@ -307,7 +307,7 @@ namespace SecondBotEvents.Commands NewNotice.OwnerID = getClient().Self.AgentID; NewNotice.AttachmentID = inventoryuuid; getClient().Groups.SendGroupNotice(groupuuid, NewNotice); - return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); + return BasicReply("Sending notice with attachment", new [] { group, title, message, attachment }); } @@ -328,11 +328,11 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID", "GetGroupRoles", new [] { group }); + return Failure("Invaild group UUID", new [] { group }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Unknown group", "GetGroupRoles", new [] { group }); + return Failure("Unknown group", new [] { group }); } return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupRoles(groupuuid))); } @@ -354,11 +354,11 @@ namespace SecondBotEvents.Commands UUID groupUUID = UUID.Zero; if(UUID.TryParse(group,out groupUUID) == false) { - return Failure("group value is invaild", "GroupchatGroupHasUnread", new [] { group }); + return Failure("group value is invaild", new [] { group }); } if(getClient().Groups.GroupName2KeyCache.ContainsKey(groupUUID) == false) { - return Failure("Unknown group", "GroupchatGroupHasUnread", new [] { group }); + return Failure("Unknown group", new [] { group }); } return BasicReply(master.DataStoreService.GetGroupChatHasUnread(groupUUID).ToString()); } @@ -387,7 +387,7 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(group, out UUID groupUUID) == false) { - return Failure("Group UUID invaild", "GroupchatHistory", new [] { group }); + return Failure("Group UUID invaild", new [] { group }); } return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupChatHistory(groupUUID))); } @@ -403,15 +403,15 @@ namespace SecondBotEvents.Commands UUID groupUUID = UUID.Zero; if (UUID.TryParse(group, out groupUUID) == false) { - return Failure("group value is invaild", "Groupchat", new [] { group, message }); + return Failure("group value is invaild", new [] { group, message }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupUUID) == false) { - return Failure("Unknown group", "Groupchat", new [] { group, message }); + return Failure("Unknown group", new [] { group, message }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupUUID) == false) { - return Failure("Unknown group", "Groupchat", new[] { group }); + return Failure("Unknown group", new[] { group }); } getClient().Self.InstantMessageGroup(groupUUID, message); return BasicReply("Sending"); diff --git a/SecondBotEvents/Commands/Inventory.cs b/SecondBotEvents/Commands/Inventory.cs index 4b15e87..152e06d 100644 --- a/SecondBotEvents/Commands/Inventory.cs +++ b/SecondBotEvents/Commands/Inventory.cs @@ -49,7 +49,7 @@ namespace SecondBotEvents.Commands S.Encode(); getClient().Inventory.RequestCreateItemFromAsset(S.AssetData, inventoryName, "", AssetType.Sound, InventoryType.Sound, AA.UUID, null); - return BasicReply("ok", "UploadMediaWave"); + return BasicReply("ok"); } @@ -62,15 +62,15 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID targetitem) == false) { - return Failure("Invaild item UUID: "+ item, "RezObject", new [] { item }); + return Failure("Invaild item UUID: "+ item, new [] { item }); } InventoryItem itm = getClient().Inventory.FetchItem(targetitem, getClient().Self.AgentID, (5 * 1000)); if (itm == null) { - return Failure("Unable to find item: " + item, "RezObject", new [] { item }); + return Failure("Unable to find item: " + item, new [] { item }); } UUID rezedobject = getClient().Inventory.RequestRezFromInventory(getClient().Network.CurrentSim, getClient().Self.SimRotation, getClient().Self.RelativePosition, itm); - return BasicReply(rezedobject.ToString(), "RezObject", new [] { item }); + return BasicReply(rezedobject.ToString(), new [] { item }); } @@ -85,20 +85,20 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID target) == false) { - return Failure("invaild item uuid", "RenameInventory", new [] { item, newname }); + return Failure("invaild item uuid", new [] { item, newname }); } if (newname.Length < 3) { - return Failure("Item name is to short", "RenameInventory", new [] { item, newname }); + return Failure("Item name is to short", new [] { item, newname }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), target); if (realitem == null) { - return Failure("Unable to find inventory item", "RenameInventory", new [] { item, newname }); + return Failure("Unable to find inventory item", new [] { item, newname }); } realitem.Name = newname; getClient().Inventory.RequestUpdateItem(realitem); - return BasicReply("Ok", "RenameInventory", new [] { item, newname }); + return BasicReply("Ok", new [] { item, newname }); } [About("Attempts to Remove the given inventory item")] @@ -109,10 +109,10 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID target) == false) { - return Failure("invaild item uuid", "DeleteInventoryItem", new [] { item }); + return Failure("invaild item uuid", new [] { item }); } getClient().Inventory.Remove(new List() { target }, new List()); - return BasicReply("Ok", "DeleteInventoryItem", new [] { item }); + return BasicReply("Ok", new [] { item }); } [About("Attempts to Remove the given inventory folder")] @@ -123,10 +123,10 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(folder, out UUID target) == false) { - return Failure("invaild folder uuid", "DeleteInventoryFolder", new [] { folder }); + return Failure("invaild folder uuid", new [] { folder }); } getClient().Inventory.Remove(new List(), new List() { target }); - return BasicReply("Ok", "DeleteInventoryFolder", new [] { folder }); + return BasicReply("Ok", new [] { folder }); } [About("Attempts to attach the given inventory item")] @@ -137,11 +137,11 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item,out UUID itemuuid) == false) { - return Failure("invaild item uuid", "Attach", new [] { item }); + return Failure("invaild item uuid", new [] { item }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid); getClient().Appearance.AddAttachments(new List() { realitem }, false, false); - return BasicReply("Ok", "Attach", new [] { item }); + return BasicReply("Ok", new [] { item }); } [About("Attempts to Remove the given inventory folder")] @@ -152,11 +152,11 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID itemuuid) == false) { - return Failure("invaild item uuid", "Detach", new [] { item }); + return Failure("invaild item uuid", new [] { item }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid); getClient().Appearance.RemoveFromOutfit(realitem); - return BasicReply("Ok", "Detach", new [] { item }); + return BasicReply("Ok", new [] { item }); } [About("Replaces the current avatar outfit with the Clothing/[NAME] folder
Please note: This does not use the outfits folder!
Please do not use links in the folder!")] @@ -170,7 +170,7 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(name) == false) { - return Failure("Named folder value is empty", "Outfit", new [] { name }); + return Failure("Named folder value is empty", new [] { name }); } // uses the Clothing folder // must be a full outfit (shapes/eyes ect) @@ -187,7 +187,7 @@ namespace SecondBotEvents.Commands } if (AA == null) { - return Failure("Cant find Clothing folder", "Outfit", new [] { name }); + return Failure("Cant find Clothing folder", new [] { name }); } T = getClient().Inventory.Store.GetContents(AA); AA = null; @@ -201,13 +201,13 @@ namespace SecondBotEvents.Commands } if (AA == null) { - return Failure("Cant find target folder", "Outfit", new [] { name }); + return Failure("Cant find target folder", new [] { name }); } List contents = getClient().Inventory.FolderContents(AA.UUID, getClient().Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000); List wareables = new List(); if (contents == null) { - return Failure("target folder is empty or so full I cant get it in 5 secs...", "Outfit", new [] { name }); + return Failure("target folder is empty or so full I cant get it in 5 secs...", new [] { name }); } foreach (InventoryBase item in contents) { @@ -217,7 +217,7 @@ namespace SecondBotEvents.Commands } } getClient().Appearance.ReplaceOutfit(wareables, false); - return BasicReply("ok", "Outfit", new [] { name }); + return BasicReply("ok", new [] { name }); } @@ -239,7 +239,7 @@ namespace SecondBotEvents.Commands } if (NotecardFolder != null) { - return Failure("Unable to find notecard folder", "InventoryPurgeNotecards"); + return Failure("Unable to find notecard folder"); } List purge_notecards = new List(); List contents = getClient().Inventory.FolderContents(NotecardFolder.UUID, getClient().Self.AgentID, true, true, InventorySortOrder.ByDate, 40 * 1000); @@ -259,7 +259,7 @@ namespace SecondBotEvents.Commands { getClient().Inventory.Remove(purge_notecards, new List()); } - return BasicReply("Ok", "InventoryPurgeNotecards"); + return BasicReply("Ok"); } [About("converts a inventory uuid to a realworld uuid
Needed for texture preview")] @@ -270,10 +270,10 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID itemUUID) == false) { - return Failure("Invaild item uuid", "getRealUUID", new [] { item }); + return Failure("Invaild item uuid", new [] { item }); } UUID reply = HelperInventory.GetAssetUUID(getClient(), itemUUID); - return BasicReply(reply.ToString(), "getRealUUID", new [] { item }); + return BasicReply(reply.ToString(), new [] { item }); } [About("sends a item to an avatar")] @@ -289,19 +289,19 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid", "SendItem", new [] { item, avatar }); + return Failure("Invaild avatar uuid", new [] { item, avatar }); } if (UUID.TryParse(item, out UUID targetitem) == false) { - return Failure("Invaild item uuid", "SendItem", new [] { item, avatar }); + return Failure("Invaild item uuid", new [] { item, avatar }); } InventoryItem itm = getClient().Inventory.FetchItem(targetitem, getClient().Self.AgentID, (3 * 1000)); if (itm == null) { - return Failure("Unable to find item", "SendItem", new [] { item, avatar }); + return Failure("Unable to find item", new [] { item, avatar }); } getClient().Inventory.GiveItem(itm.UUID, itm.Name, itm.AssetType, avataruuid, false); - return BasicReply("ok", "SendItem", new [] { item, avatar }); + return BasicReply("ok", new [] { item, avatar }); } [About("Sends a folder to an avatar")] @@ -317,19 +317,19 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid", "SendFolder", new [] { folder, avatar }); + return Failure("Invaild avatar uuid", new [] { folder, avatar }); } if (UUID.TryParse(folder, out UUID targetfolder) == true) { - return Failure("Invaild folder uuid", "SendFolder", new [] { folder, avatar }); + return Failure("Invaild folder uuid", new [] { folder, avatar }); } InventoryBase FindFolderHelper = HelperInventory.FindFolder(getClient(), getClient().Inventory.Store.RootFolder, targetfolder); if (FindFolderHelper == null) { - return Failure("Unable to find folder", "SendFolder", new [] { folder, avatar }); + return Failure("Unable to find folder", new [] { folder, avatar }); } getClient().Inventory.GiveFolder(FindFolderHelper.UUID, FindFolderHelper.Name, avataruuid, false); - return BasicReply("ok", "SendFolder", new [] { folder, avatar }); + return BasicReply("ok", new [] { folder, avatar }); } [About("Transfers a item [ARG 2] to a objects inventory [ARG 1] (And if set with the script running state [ARG 3])")] @@ -347,21 +347,21 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID itemuuid) == false) { - return Failure("Invaild item uuid", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return Failure("Invaild item uuid", new [] { item, objectuuid, running }); } if (UUID.TryParse(objectuuid, out UUID objectUUID) == false) { - return Failure("Invaild object uuid", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return Failure("Invaild object uuid", new [] { item, objectuuid, running }); } if (bool.TryParse(running, out bool runscript) == false) { - return Failure("Invaild running", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return Failure("Invaild running", new [] { item, objectuuid, running }); } InventoryItem itm = getClient().Inventory.FetchItem(itemuuid, getClient().Self.AgentID, (3 * 1000)); if (itm == null) { - return Failure("Unable to find inventory", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return Failure("Unable to find inventory", new [] { item, objectuuid, running }); } Dictionary objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy(); KeyValuePair RealObject = new KeyValuePair(0,null); @@ -375,7 +375,7 @@ namespace SecondBotEvents.Commands } if (RealObject.Value == null) { - return Failure("Unable to find object", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return Failure("Unable to find object", new [] { item, objectuuid, running }); } bool scriptState = runscript; if (itm.AssetType != AssetType.LSLText) @@ -385,10 +385,10 @@ namespace SecondBotEvents.Commands if (itm.AssetType == AssetType.LSLText) { getClient().Inventory.CopyScriptToTask(RealObject.Key, itm, scriptState); - return BasicReply("Transfering script [state: "+scriptState.ToString()+"]", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return BasicReply("Transfering script [state: "+scriptState.ToString()+"]", new [] { item, objectuuid, running }); } getClient().Inventory.UpdateTaskInventory(RealObject.Key, itm); - return BasicReply("Transfering inventory", "TransferInventoryToObject", new [] { item, objectuuid, running }); + return BasicReply("Transfering inventory", new [] { item, objectuuid, running }); } [About("Requests the inventory folder layout as a json object InventoryMapFolder
Formated as follows
InventoryMapItem
  • id: UUID
  • name: String
  • subfolders: InventoryMapFolder[]
")] @@ -397,8 +397,8 @@ namespace SecondBotEvents.Commands public object InventoryFolders() { string reply = HelperInventory.MapFolderJson(getClient()); - if (reply != null) return BasicReply(reply, "InventoryFolders"); - return Failure("Error", "InventoryFolders"); + if (reply != null) return BasicReply(reply); + return Failure("Error"); } [About("Requests folders limited to selected folder")] @@ -408,8 +408,8 @@ namespace SecondBotEvents.Commands public object InventoryFoldersLimited(string targetfolder) { string reply = HelperInventory.MapFolderJson(getClient(), targetfolder,false); - if (reply != null) return BasicReply(reply, "InventoryFoldersLimited"); - return Failure("Error", "InventoryFoldersLimited"); + if (reply != null) return BasicReply(reply); + return Failure("Error"); } [About("Requests the contents of a folder as an array of InventoryMapItem
Formated as follows
InventoryMapItem
  • id: UUID
  • name: String
  • typename: String
")] @@ -420,9 +420,9 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(folderUUID, out UUID folder) == false) { - return Failure("Invaild folder UUID", "InventoryContents", new [] { folderUUID }); + return Failure("Invaild folder UUID", new [] { folderUUID }); } - return BasicReply(HelperInventory.MapFolderInventoryJson(getClient(), folder), "InventoryContents", new [] { folderUUID }); + return BasicReply(HelperInventory.MapFolderInventoryJson(getClient(), folder), new [] { folderUUID }); } [About("creates a folder in a folder")] @@ -435,15 +435,15 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(parentFolder, out UUID parentFolderUUID) == false) { - return Failure("invaild parent folder UUID", "CreateInventoryFolder", new[] { parentFolder }); + return Failure("invaild parent folder UUID", new[] { parentFolder }); } if (folderName.Length < 3) { - return Failure("new folder name is too short, must be longer than 3 characters.", "CreateInventoryFolder", new[] { folderName }); + return Failure("new folder name is too short, must be longer than 3 characters.", new[] { folderName }); } UUID folder = getClient().Inventory.CreateFolder(parentFolderUUID, folderName); string uuid = folder.ToString(); - return BasicReply("Ok", "CreateInventoryFolder", new string[] { uuid }); + return BasicReply("Ok", new string[] { uuid }); } @@ -457,14 +457,14 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(item, out UUID itemUUID) == false) { - return Failure("invaild item uuid", "MoveInventoryItem", new[] { item, folder }); + return Failure("invaild item uuid", new[] { item, folder }); } if (UUID.TryParse(folder, out UUID folderUUID) == false) { - return Failure("invaild folder uuid", "MoveInventoryItem", new[] { item, folder }); + return Failure("invaild folder uuid", new[] { item, folder }); } getClient().Inventory.MoveItem(itemUUID, folderUUID); - return BasicReply("Ok", "MoveInventoryItem", new string[] { item }); + return BasicReply("Ok", new string[] { item }); } [About("moves a folder to another folder")] @@ -477,14 +477,14 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(sourceFolder, out UUID sourceFolderUUID) == false) { - return Failure("invaild source folder uuid", "MoveInventoryFolder", new[] { sourceFolder, destFolder }); + return Failure("invaild source folder uuid", new[] { sourceFolder, destFolder }); } if (UUID.TryParse(destFolder, out UUID destFolderUUID) == false) { - return Failure("invaild dest folder uuid", "MoveInventoryFolder", new[] { sourceFolder, destFolder }); + return Failure("invaild dest folder uuid", new[] { sourceFolder, destFolder }); } getClient().Inventory.MoveFolder(sourceFolderUUID, destFolderUUID); - return BasicReply("Ok", "MoveInventoryFolder", new string[] { sourceFolder, destFolder }); + return BasicReply("Ok", new string[] { sourceFolder, destFolder }); } } } diff --git a/SecondBotEvents/Commands/Movement.cs b/SecondBotEvents/Commands/Movement.cs index b83abd9..88d51e2 100644 --- a/SecondBotEvents/Commands/Movement.cs +++ b/SecondBotEvents/Commands/Movement.cs @@ -25,19 +25,19 @@ namespace SecondBotEvents.Commands { if (Vector3.TryParse("<" + x + "," + y + "," + z + ">", out Vector3 pos) == false) { - return Failure("Convert to vector has failed", "AutoPilot", new [] { x, y, z }); + return Failure("Convert to vector has failed", new [] { x, y, z }); } if (SecondbotHelpers.inrange(pos.X, 0, 255) == false) { - return Failure("x value out of range 0-255", "AutoPilot", new [] { x, y, z }); + return Failure("x value out of range 0-255", new [] { x, y, z }); } if (SecondbotHelpers.inrange(pos.Y, 0, 255) == false) { - return Failure("y value out of range 0-255", "AutoPilot", new [] { x, y, z }); + return Failure("y value out of range 0-255", new [] { x, y, z }); } if (SecondbotHelpers.inrange(pos.Z, 0, 5000) == false) { - return Failure("z value out of range 0-5000", "AutoPilot", new [] { x, y, z }); + return Failure("z value out of range 0-5000", new [] { x, y, z }); } getClient().Self.AutoPilotCancel(); getClient().Self.Movement.TurnToward(pos, true); @@ -45,7 +45,7 @@ namespace SecondBotEvents.Commands uint Globalx, Globaly; Utils.LongToUInts(getClient().Network.CurrentSim.Handle, out Globalx, out Globaly); getClient().Self.AutoPilot((ulong)(Globalx + pos.X), (ulong)(Globaly + pos.Y), pos.Z); - return BasicReply("ok", "AutoPilot", new [] { x, y, z }); + return BasicReply("ok", new [] { x, y, z }); } [About("Attempt to teleport to a new region")] @@ -53,7 +53,7 @@ namespace SecondBotEvents.Commands public object AutoPilotStop() { getClient().Self.AutoPilotCancel(); - return BasicReply("ok", "AutoPilotStop"); + return BasicReply("ok"); } [About("Make the bot request the target avatar teleport to the bot")] @@ -65,10 +65,10 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID", "SendTeleportLure", new [] { avatar }); + return Failure("Invaild avatar UUID", new [] { avatar }); } getClient().Self.SendTeleportLure(avataruuid); - return BasicReply("ok", "SendTeleportLure", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } [About("Sends a teleport request (Move the bot to the avatar)")] @@ -80,11 +80,11 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID", "RequestTeleport", new [] { avatar }); + return Failure("Invaild avatar UUID", new [] { avatar }); } // @todo action from event log with accept getClient().Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you"); - return BasicReply("ok", "RequestTeleport", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } [About("Makes the bot fly (or not)")] @@ -95,11 +95,11 @@ namespace SecondBotEvents.Commands { if (bool.TryParse(mode, out bool flymode) == false) { - return Failure("Invaild mode", "Fly", new [] { mode }); + return Failure("Invaild mode", new [] { mode }); } getClient().Self.Movement.Fly = flymode; getClient().Self.Movement.SendUpdate(); - return BasicReply("ok", "Fly", new [] { mode }); + return BasicReply("ok", new [] { mode }); } [About("Rotates the bot to face a vector from its current location")] @@ -111,21 +111,21 @@ namespace SecondBotEvents.Commands { if (Vector3.TryParse(vector, out Vector3 pos) == false) { - return Failure("Invaild vector", "RotateToFaceVector", new [] { vector }); + return Failure("Invaild vector", new [] { vector }); } if (SecondbotHelpers.inrange(pos.X, 0, 255) == false) { - return Failure("Vector x value is out of range 0-255", "RotateToFaceVector", new [] { vector }); + return Failure("Vector x value is out of range 0-255", new [] { vector }); } if (SecondbotHelpers.inrange(pos.Y, 0, 255) == false) { - return Failure("Vector y value is out of range 0-255", "RotateToFaceVector", new [] { vector }); + return Failure("Vector y value is out of range 0-255", new [] { vector }); } if (SecondbotHelpers.inrange(pos.Z, 0, 5000) == false) { - return Failure("Vector z value is out of range 0-5000", "RotateToFaceVector", new [] { vector }); + return Failure("Vector z value is out of range 0-5000", new [] { vector }); } - return BasicReply(getClient().Self.Movement.TurnToward(pos, true).ToString(), "RotateToFaceVector", new [] { vector }); + return BasicReply(getClient().Self.Movement.TurnToward(pos, true).ToString(), new [] { vector }); } [About("Rotates the bot to face a avatar")] @@ -138,13 +138,13 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID", "RotateToFace", new [] { avatar }); + return Failure("Invaild avatar UUID", new [] { avatar }); } if (getClient().Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false) { - return Failure("Unable to see avatar", "RotateToFace", new [] { avatar }); + return Failure("Unable to see avatar", new [] { avatar }); } - return BasicReply(getClient().Self.Movement.TurnToward(getClient().Network.CurrentSim.AvatarPositions[avataruuid], true).ToString(), "RotateToFace", new [] { avatar }); + return BasicReply(getClient().Self.Movement.TurnToward(getClient().Network.CurrentSim.AvatarPositions[avataruuid], true).ToString(), new [] { avatar }); } [About("Rotates the avatar to face a rotation from north in Degrees")] @@ -155,7 +155,7 @@ namespace SecondBotEvents.Commands { if (float.TryParse(deg, out float target_yaw) == true) { - return Failure("Unable to process rotation", "RotateTo", new [] { deg }); + return Failure("Unable to process rotation", new [] { deg }); } float yaw = target_yaw; getClient().Self.Movement.BodyRotation.GetEulerAngles(out float roll, out float pitch, out _); @@ -178,7 +178,7 @@ namespace SecondBotEvents.Commands result.Z = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2; getClient().Self.Movement.BodyRotation = result; getClient().Self.Movement.SendUpdate(); - return BasicReply("ok", "RotateTo", new [] { deg }); + return BasicReply("ok", new [] { deg }); } @@ -195,9 +195,9 @@ namespace SecondBotEvents.Commands bool status = TeleportRequest(new [] { region, x, y, z }); if (status == false) { - return Failure("Error Unable to Teleport to location", "Teleport", new [] { region, x, y, z }); + return Failure("Error Unable to Teleport to location", new [] { region, x, y, z }); } - return BasicReply("Accepted", "Teleport", new [] { region, x, y, z }); + return BasicReply("Accepted", new [] { region, x, y, z }); } @@ -209,9 +209,9 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(slurl) == false) { - return Failure("slurl is empty", "TeleportSLURL", new [] { slurl }); + return Failure("slurl is empty", new [] { slurl }); } - return BasicReply(TeleportRequest(new [] { slurl }).ToString(), "TeleportSLURL", new [] { slurl }); + return BasicReply(TeleportRequest(new [] { slurl }).ToString(), new [] { slurl }); } protected bool TeleportRequest(string[] args) diff --git a/SecondBotEvents/Commands/Notecard.cs b/SecondBotEvents/Commands/Notecard.cs index 9983537..a824396 100644 --- a/SecondBotEvents/Commands/Notecard.cs +++ b/SecondBotEvents/Commands/Notecard.cs @@ -20,11 +20,11 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(collection) == false) { - return Failure("Collection value is empty", "NotecardAdd", new [] { collection, content }); + return Failure("Collection value is empty", new [] { collection, content }); } if (SecondbotHelpers.notempty(content) == false) { - return Failure("Content value is empty", "NotecardAdd", new [] { collection, content }); + return Failure("Content value is empty", new [] { collection, content }); } return Failure("@todo notecard temp stroage"); //return BasicReply("ok", "NotecardAdd", new [] { collection, content }); @@ -38,7 +38,7 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(collection) == false) { - return Failure("Collection value is empty", "NotecardClear", new [] { collection }); + return Failure("Collection value is empty", new [] { collection }); } return Failure("@todo notecard storage"); } @@ -56,16 +56,16 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(collection) == false) { - return Failure("Collection value is empty", "NotecardSend", new [] { avatar, collection, notecardname }); + return Failure("Collection value is empty", new [] { avatar, collection, notecardname }); } if (SecondbotHelpers.notempty(notecardname) == false) { - return Failure("Notecardname value is empty", "NotecardSend", new [] { avatar, collection, notecardname }); + return Failure("Notecardname value is empty", new [] { avatar, collection, notecardname }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid", "NotecardSend", new [] { avatar, collection, notecardname }); + return Failure("Invaild avatar uuid", new [] { avatar, collection, notecardname }); } return Failure("@todo notecard storage"); } @@ -82,16 +82,16 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(notecardname) == false) { - return Failure("notecardname value is empty", "NotecardDirectSend", new[] { avatar, content, notecardname }); + return Failure("notecardname value is empty", new[] { avatar, content, notecardname }); } if (SecondbotHelpers.notempty(content) == false) { - return Failure("content value is empty", "NotecardDirectSend", new[] { avatar, content, notecardname }); + return Failure("content value is empty", new[] { avatar, content, notecardname }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid", "NotecardDirectSend", new[] { avatar, content, notecardname }); + return Failure("Invaild avatar uuid", new[] { avatar, content, notecardname }); } return Failure("@todo notecard sending"); } diff --git a/SecondBotEvents/Commands/ParcelCommands.cs b/SecondBotEvents/Commands/ParcelCommands.cs index 99109e4..328db9d 100644 --- a/SecondBotEvents/Commands/ParcelCommands.cs +++ b/SecondBotEvents/Commands/ParcelCommands.cs @@ -26,11 +26,11 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if(tests.Key == false) { - return Failure(tests.Value, "SetParcelSale", new [] { amount, avatar }); + return Failure(tests.Value, new [] { amount, avatar }); } if (int.TryParse(amount,out int amountvalue) == false) { - return Failure("Invaild amount", "SetParcelSale", new [] { amount, avatar }); + return Failure("Invaild amount", new [] { amount, avatar }); } int minAmount = 1; @@ -45,14 +45,14 @@ namespace SecondBotEvents.Commands } if ((amountvalue < minAmount) || (amountvalue > 9999999)) { - return Failure("Invaild amount", "SetParcelSale", new [] { amount, avatar }); + return Failure("Invaild amount", new [] { amount, avatar }); } targetparcel.SalePrice = amountvalue; targetparcel.AuthBuyerID = avataruuid; parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true); parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false); targetparcel.Update(getClient().Network.CurrentSim, false); - return Failure("ok", "SetParcelSale", new [] { amount, avatar }); + return Failure("ok", new [] { amount, avatar }); } [About("Gets the parcel Dwell (Traffic) value and returns it via the reply target")] @@ -64,9 +64,9 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "GetParcelTraffic"); + return Failure(tests.Value); } - return BasicReply(targetparcel.Dwell.ToString(), "GetParcelTraffic"); + return BasicReply(targetparcel.Dwell.ToString()); } [About("Changes the parcel landing mode to point and sets the landing point")] @@ -82,24 +82,24 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "SetParcelLandingZone", new [] { x, y, z }); + return Failure(tests.Value, new [] { x, y, z }); } if(int.TryParse(x,out int X) == false) { - return Failure("Unable to process landing point x value", "SetParcelLandingZone", new [] { x, y, z }); + return Failure("Unable to process landing point x value", new [] { x, y, z }); } if (int.TryParse(y, out int Y) == false) { - return Failure("Unable to process landing point y value", "SetParcelLandingZone", new [] { x, y, z }); + return Failure("Unable to process landing point y value", new [] { x, y, z }); } if (int.TryParse(z, out int Z) == false) { - return Failure("Unable to process landing point z value", "SetParcelLandingZone", new [] { x, y, z }); + return Failure("Unable to process landing point z value", new [] { x, y, z }); } targetparcel.Landing = LandingType.LandingPoint; targetparcel.UserLocation = new Vector3(X, Y, Z); targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "SetParcelLandingZone", new [] { x, y, z }); + return BasicReply("ok", new [] { x, y, z }); } @@ -114,15 +114,15 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "SetParcelName", new [] { name }); + return Failure(tests.Value, new [] { name }); } if (SecondbotHelpers.notempty(name) == false) { - return Failure("Parcel name is empty", "SetParcelName", new [] { name }); + return Failure("Parcel name is empty", new [] { name }); } targetparcel.Name = name; targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "SetParcelName", new [] { name }); + return BasicReply("ok", new [] { name }); } [About("Updates the current parcels description")] @@ -135,11 +135,11 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "SetParcelDesc", new [] { desc }); + return Failure(tests.Value, new [] { desc }); } targetparcel.Desc = desc; targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "SetParcelDesc", new [] { desc }); + return BasicReply("ok", new [] { desc }); } [About("Fetchs the current parcels desc")] @@ -151,9 +151,9 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "GetParcelDesc"); + return Failure(tests.Value); } - return BasicReply(targetparcel.Desc, "GetParcelDesc"); + return BasicReply(targetparcel.Desc); } [About("gets the flags for the parcel")] @@ -165,7 +165,7 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "GetParcelFlags"); + return Failure(tests.Value); } Dictionary flags = parcel_static.get_flags_list(); Dictionary collection = new Dictionary(); @@ -173,8 +173,7 @@ namespace SecondBotEvents.Commands { collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString()); } - SuccessNoReturn("GetParcelFlags"); - return collection; + return BasicReply(JsonConvert.SerializeObject(collection)); } [About("Ejects an avatar")] @@ -186,10 +185,10 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar", "ParcelEject", new [] { avatar }); + return Failure("Invaild avatar", new [] { avatar }); } getClient().Parcels.EjectUser(avataruuid, false); - return BasicReply("ok", "ParcelEject", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } [About("Abandons the parcel the bot is currently on, returning it to Linden's or Estate owner")] @@ -199,10 +198,10 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "AbandonLand"); + return Failure(tests.Value); } getClient().Parcels.ReleaseParcel(getClient().Network.CurrentSim, targetparcel.LocalID); - return BasicReply("ok", "AbandonLand"); + return BasicReply("ok"); } @@ -218,12 +217,12 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelBan", new [] { avatar }); + return Failure(tests.Value, new [] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar", "ParcelBan", new [] { avatar }); + return Failure("Invaild avatar", new [] { avatar }); } bool alreadyBanned = false; foreach (ParcelAccessEntry E in targetparcel.AccessBlackList) @@ -236,7 +235,7 @@ namespace SecondBotEvents.Commands } if (alreadyBanned == true) { - return BasicReply("Avatar is in the blacklist", "ParcelBan", new [] { avatar }); + return BasicReply("Avatar is in the blacklist", new [] { avatar }); } ParcelAccessEntry entry = new ParcelAccessEntry(); entry.AgentID = avataruuid; @@ -244,7 +243,7 @@ namespace SecondBotEvents.Commands entry.Time = new System.DateTime(3030, 03, 03); targetparcel.AccessBlackList.Add(entry); targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "ParcelBan", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } [About("Unbans an avatar from a parcel")] @@ -259,12 +258,12 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelUnBan", new [] { avatar }); + return Failure(tests.Value, new [] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar", "ParcelUnBan", new [] { avatar }); + return Failure("Invaild avatar", new [] { avatar }); } bool alreadyBanned = false; ParcelAccessEntry removeentry = new ParcelAccessEntry(); @@ -279,11 +278,11 @@ namespace SecondBotEvents.Commands } if (alreadyBanned == false) { - return BasicReply("Avatar is already unbanned", "ParcelUnBan", new [] { avatar }); + return BasicReply("Avatar is already unbanned", new [] { avatar }); } targetparcel.AccessBlackList.Remove(removeentry); targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "ParcelUnBan", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } @@ -297,10 +296,10 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "SetParcelMusic", new [] { musicurl }); + return Failure(tests.Value, new [] { musicurl }); } bool status = parcel_static.set_parcel_music(getClient(), targetparcel, musicurl); - return BasicReply(status.ToString(), "SetParcelMusic", new [] { musicurl }); + return BasicReply(status.ToString(), new [] { musicurl }); } [About("Updates the current parcels name")] @@ -318,7 +317,7 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "SetParcelFlag", new [] { escapedflagdata }); + return Failure(tests.Value, new [] { escapedflagdata }); } List acceptablewords = new List(); Dictionary flags = parcel_static.get_flags_list(); @@ -347,11 +346,11 @@ namespace SecondBotEvents.Commands } if (setflags.Count == 0) { - return Failure("No accepted flags", "SetParcelFlag", new [] { escapedflagdata }); + return Failure("No accepted flags", new [] { escapedflagdata }); } if (parcel_static.has_parcel_perm(targetparcel, getClient()) == false) { - return Failure("Incorrect perms to control parcel", "SetParcelFlag", new [] { escapedflagdata }); + return Failure("Incorrect perms to control parcel", new [] { escapedflagdata }); } foreach (KeyValuePair cfg in setflags) { @@ -361,7 +360,7 @@ namespace SecondBotEvents.Commands } } targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("Applying perms", "SetParcelFlag", new [] { escapedflagdata }); + return BasicReply("Applying perms", new [] { escapedflagdata }); } [About("Returns all objects from the current parcel for the selected avatar")] @@ -375,15 +374,15 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelReturnTargeted", new [] { avatar }); + return Failure(tests.Value, new [] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID", "ParcelReturnTargeted", new [] { avatar }); + return Failure("Invaild avatar UUID", new [] { avatar }); } getClient().Parcels.ReturnObjects(getClient().Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List() { avataruuid }); - return BasicReply("ok", "ParcelReturnTargeted", new [] { avatar }); + return BasicReply("ok", new [] { avatar }); } @@ -399,21 +398,21 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelDeedToGroup", new [] { group }); + return Failure(tests.Value, new [] { group }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group uuid", "ParcelDeedToGroup", new [] { group }); + return Failure("Invaild group uuid", new [] { group }); } if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false) { - return Failure("Not in group", "ParcelDeedToGroup", new [] { group }); + return Failure("Not in group", new [] { group }); } targetparcel.GroupID = groupuuid; targetparcel.Update(getClient().Network.CurrentSim, false); Thread.Sleep(500); getClient().Parcels.DeedToGroup(getClient().Network.CurrentSim, targetparcel.LocalID, groupuuid); - return BasicReply("ok", "ParcelDeedToGroup", new [] { group }); + return BasicReply("ok", new [] { group }); } [About("Attempts to buy the parcel the bot is standing on, the amount must match the sale price for the land!")] @@ -431,11 +430,11 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelBuy", new [] { amount }); + return Failure(tests.Value, new [] { amount }); } if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != getClient().Self.AgentID)) { - return Failure("Parcel sale locked to other avatars", "ParcelBuy", new[] { amount }); + return Failure("Parcel sale locked to other avatars", new[] { amount }); } int minAmount = 1; if (targetparcel.AuthBuyerID == getClient().Self.AgentID) @@ -444,22 +443,22 @@ namespace SecondBotEvents.Commands } if (int.TryParse(amount, out int amountvalue) == false) { - return Failure("Invaild amount", "ParcelBuy", new [] { amount }); + return Failure("Invaild amount", new [] { amount }); } if (amountvalue < minAmount) { - return Failure("Invaild amount", "ParcelBuy", new [] { amount }); + return Failure("Invaild amount", new [] { amount }); }; if (targetparcel.Flags.HasFlag(ParcelFlags.ForSale) == false) { - return Failure("Parcel not for sale", "ParcelBuy", new [] { amount }); + return Failure("Parcel not for sale", new [] { amount }); } if (targetparcel.SalePrice != amountvalue) { - return Failure("Parcel sale price and amount do not match", "ParcelBuy", new [] { amount }); + return Failure("Parcel sale price and amount do not match", new [] { amount }); } getClient().Parcels.Buy(getClient().Network.CurrentSim, targetparcel.LocalID, false, UUID.Zero, false, targetparcel.Area, amountvalue); - return BasicReply("ok", "ParcelBuy", new [] { amount }); + return BasicReply("ok", new [] { amount }); } [About("Freezes an avatar")] @@ -472,15 +471,15 @@ namespace SecondBotEvents.Commands { if (bool.TryParse(state, out bool freezestate) == false) { - return Failure("Invaild state", "ParcelFreeze", new [] { avatar, state }); + return Failure("Invaild state", new [] { avatar, state }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID", "ParcelFreeze", new [] { avatar, state }); + return Failure("Invaild avatar UUID", new [] { avatar, state }); } getClient().Parcels.FreezeUser(avataruuid, freezestate); - return BasicReply("ok", "ParcelFreeze", new [] { avatar, state }); + return BasicReply("ok", new [] { avatar, state }); } @@ -493,7 +492,7 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "GetParcelBanlist"); + return Failure(tests.Value); } GetParcelBanlistObject reply = new GetParcelBanlistObject(); int delays = 0; @@ -524,7 +523,7 @@ namespace SecondBotEvents.Commands reply.delay = delays * 1000; reply.parcelName = targetparcel.Name; reply.regionName = getClient().Network.CurrentSim.Name; - return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist"); + return BasicReply(JsonConvert.SerializeObject(reply)); } [About("Returns a rezzed object")] @@ -536,7 +535,7 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(objectuuid, out UUID targetobject) == false) { - return Failure("Invaild object uuid", "UnRezObject", new [] { objectuuid }); + return Failure("Invaild object uuid", new [] { objectuuid }); } bool found = false; Dictionary objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy(); @@ -551,9 +550,9 @@ namespace SecondBotEvents.Commands } if(found == false) { - return Failure("Unable to find object", "UnRezObject", new [] { objectuuid }); + return Failure("Unable to find object", new [] { objectuuid }); } - return BasicReply("ok", "UnRezObject", new [] { objectuuid }); + return BasicReply("ok", new [] { objectuuid }); } [About("Updates the current parcels media settings \n" + @@ -575,7 +574,7 @@ namespace SecondBotEvents.Commands KeyValuePair tests = SetupCurrentParcel(); if (tests.Key == false) { - return Failure(tests.Value, "ParcelSetMedia", new [] { escapedflagdata }); + return Failure(tests.Value, new [] { escapedflagdata }); } string[] args = escapedflagdata.Split(":::"); foreach (string A in args) @@ -636,7 +635,7 @@ namespace SecondBotEvents.Commands } } targetparcel.Update(getClient().Network.CurrentSim, false); - return BasicReply("ok", "ParcelSetMedia", new [] { escapedflagdata }); + return BasicReply("ok", new [] { escapedflagdata }); } protected bool UpdateParcel_MediaType(Parcel targetparcel, string value) diff --git a/SecondBotEvents/Commands/Self.cs b/SecondBotEvents/Commands/Self.cs index 0e01fe7..d17040f 100644 --- a/SecondBotEvents/Commands/Self.cs +++ b/SecondBotEvents/Commands/Self.cs @@ -26,7 +26,7 @@ namespace SecondBotEvents.Commands { if (getClient().Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false) { - return Failure("Cant find UUID in sim", "PointAt", new [] { targetUUID }); + return Failure("Cant find UUID in sim", new [] { targetUUID }); } ProcessAvatar(targetUUID); getClient().Self.Stand(); @@ -35,7 +35,7 @@ namespace SecondBotEvents.Commands getClient().Self.AnimationStart(Animations.POINT_YOU, true); getClient().Self.PointAtEffect(getClient().Self.AgentID, avataruuid, new Vector3d(0, 0, 0), PointAtType.Select, UUID.Random()); getClient().Self.BeamEffect(getClient().Self.AgentID, avataruuid, new Vector3d(0, 0, 2), new Color4(255, 255, 255, 1), (float)3.0, UUID.Random()); - return BasicReply("ok", "PointAt", new [] { targetUUID }); + return BasicReply("ok", new [] { targetUUID }); } [About("Reads a value from the KeyValue storage (temp unless SQL is enabled)")] @@ -57,11 +57,11 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.isempty(Key) == false) { - return Failure("Key is empty", "SetKeyValue", new[] { Key, Value }); + return Failure("Key is empty", new[] { Key, Value }); } if (SecondbotHelpers.isempty(Value) == false) { - return Failure("Value is empty", "SetKeyValue", new[] { Key, Value }); + return Failure("Value is empty", new[] { Key, Value }); } master.DataStoreService.SetKeyValue(Key, Value); return BasicReply("ok"); @@ -75,7 +75,7 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.isempty(Key) == false) { - return Failure("Key is empty", "SetKeyValue", new[] { Key }); + return Failure("Key is empty", new[] { Key }); } master.DataStoreService.ClearKeyValue(Key); return BasicReply("ok"); @@ -90,14 +90,14 @@ namespace SecondBotEvents.Commands if (target == "ground") { getClient().Self.SitOnGround(); - return BasicReply("ok", "Sit", new [] { target }); + return BasicReply("ok", new [] { target }); } if(UUID.TryParse(target,out UUID objectuuid) == false) { - return Failure("Invaild object UUID", "Sit", new [] { target }); + return Failure("Invaild object UUID", new [] { target }); } getClient().Self.RequestSit(objectuuid, Vector3.Zero); - return BasicReply("ok", "Sit", new [] { target }); + return BasicReply("ok", new [] { target }); } [About("Makes the bot stand up if sitting (also resets animations)")] @@ -117,7 +117,7 @@ namespace SecondBotEvents.Commands { if (UUID.TryParse(target, out UUID objectuuid) == false) { - return Failure("Invaild object UUID", "ClickObject", new [] { target }); + return Failure("Invaild object UUID", new [] { target }); } getClient().Self.PointAtEffect(getClient().Self.AgentID, objectuuid, new Vector3d(0, 0, 0), PointAtType.Select, new UUID("1df9eb92-62fa-15e5-4bfb-5931f1525274")); @@ -134,7 +134,7 @@ namespace SecondBotEvents.Commands break; } } - return BasicReply(found_object.ToString(), "ClickObject", new [] { target }); + return BasicReply(found_object.ToString(), new [] { target }); } [About("Makes the bot kill itself you monster")] @@ -149,7 +149,6 @@ namespace SecondBotEvents.Commands [ReturnHints("list of commands")] public object GetLastCommands(string token) { - SuccessNoReturn("GetLastCommands"); return Failure("@todo command storage"); } @@ -173,30 +172,30 @@ namespace SecondBotEvents.Commands ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup", "SetPermFlag", new [] { avatar, flag, state, sticky }); + return Failure("avatar lookup", new [] { avatar, flag, state, sticky }); } bool stateflag = false; bool stickyflag = false; if(bool.TryParse(state,out stateflag) == false) { - return Failure("Invaild state", "SetPermFlag", new [] { avatar, flag, state, sticky }); + return Failure("Invaild state", new [] { avatar, flag, state, sticky }); } if (bool.TryParse(sticky, out stickyflag) == false) { - return Failure("Invaild sticky", "SetPermFlag", new [] { avatar, flag, state, sticky }); + return Failure("Invaild sticky", new [] { avatar, flag, state, sticky }); } string[] AcceptedFlags = new [] { "friend", "group", "animation", "teleport", "command", "inventory" }; if (AcceptedFlags.Contains(flag) == false) { - return Failure("Invaild flag", "SetPermFlag", new [] { avatar, flag, state, sticky }); + return Failure("Invaild flag", new [] { avatar, flag, state, sticky }); } if (stateflag == true) { // @todo add stick/normal accept dynamic actions - return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new [] { avatar, flag, state, sticky }); + return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString(), new [] { avatar, flag, state, sticky }); } // @todo remove stick/normal accept dynamic actions - return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new [] { avatar, flag, state, sticky }); + return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString(), new [] { avatar, flag, state, sticky }); } diff --git a/SecondBotEvents/Commands/StreamAdmin.cs b/SecondBotEvents/Commands/StreamAdmin.cs index d424bbe..cc25ea8 100644 --- a/SecondBotEvents/Commands/StreamAdmin.cs +++ b/SecondBotEvents/Commands/StreamAdmin.cs @@ -27,11 +27,11 @@ namespace SecondBotEvents.Commands { if (SecondbotHelpers.notempty(endpoint) == false) { - return Failure("Endpoint is empty", "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("Endpoint is empty", new [] { endpoint, endpointcode }); } if (SecondbotHelpers.notempty(endpointcode) == false) { - return Failure("Endpointcode is empty", "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("Endpointcode is empty", new [] { endpoint, endpointcode }); } string attempt_endpoint = endpoint + "sys.php"; @@ -47,24 +47,24 @@ namespace SecondBotEvents.Commands RestResponse endpoint_checks = client.ExecutePostAsync(request).Result; if (endpoint_checks.StatusCode != System.Net.HttpStatusCode.OK) { - return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString(), "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString(), new [] { endpoint, endpointcode }); } try { NotecardEndpoint server_reply = JsonConvert.DeserializeObject(endpoint_checks.Content); if (server_reply.status == false) { - return Failure("Bad reply: " + server_reply.message, "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("Bad reply: " + server_reply.message, new [] { endpoint, endpointcode }); } if (server_reply.NotecardTitle.Length < 3) { - return Failure("Notecard title is to short", "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("Notecard title is to short", new [] { endpoint, endpointcode }); } return Failure("@todo notecard sending"); } catch (Exception e) { - return Failure("Error: " + e.Message + "", "FetchNextNotecard", new [] { endpoint, endpointcode }); + return Failure("Error: " + e.Message + "", new [] { endpoint, endpointcode }); } } diff --git a/SecondBotEvents/Config/CommandsConfig.cs b/SecondBotEvents/Config/CommandsConfig.cs index 7189c0d..20bf78f 100644 --- a/SecondBotEvents/Config/CommandsConfig.cs +++ b/SecondBotEvents/Config/CommandsConfig.cs @@ -14,7 +14,7 @@ namespace SecondBotEvents.Config settings.Add("AllowFundsCommands"); settings.Add("AllowIMcontrol"); settings.Add("SharedSecret"); - settings.Add("OnlyMasterAvs"); + settings.Add("EnableMasterControls"); settings.Add("MastersCSV"); settings.Add("EnforceTimeWindow"); settings.Add("TimeWindowSecs"); @@ -41,9 +41,9 @@ namespace SecondBotEvents.Config return ReadSettingAsInt("TimeWindowSecs", 35); } - public bool GetOnlyMasterAvs() + public bool GetEnableMasterControls() { - return ReadSettingAsBool("OnlyMasterAvs", false); + return ReadSettingAsBool("EnableMasterControls", false); } diff --git a/SecondBotEvents/Services/Commands.cs b/SecondBotEvents/Services/Commands.cs index 14aa4e6..466c5ae 100644 --- a/SecondBotEvents/Services/Commands.cs +++ b/SecondBotEvents/Services/Commands.cs @@ -43,7 +43,7 @@ namespace SecondBotEvents.Services bool isCallable = false; foreach (CustomAttributeData At in M.CustomAttributes) { - if (At.AttributeType.Name == "RouteAttribute") + if (At.AttributeType.Name == "About") { isCallable = true; break; @@ -150,7 +150,7 @@ namespace SecondBotEvents.Services { break; } - if (myConfig.GetOnlyMasterAvs() == false) + if (myConfig.GetEnableMasterControls() == false) { break; } @@ -197,6 +197,16 @@ namespace SecondBotEvents.Services { mode = "IM"; } + else if (target.Split(' ', StringSplitOptions.RemoveEmptyEntries).Length == 2) + { + string UUIDfetch = master.DataStoreService.getAvatarUUID(target); + if (UUIDfetch == "lookup") + { + return; + } + mode = "IM"; + UUID.TryParse(UUIDfetch, out target_avatar); + } else if (int.TryParse(target, out target_channel) == false) { return; @@ -237,9 +247,16 @@ namespace SecondBotEvents.Services public KeyValuePair runCommand(SignedCommand C) { - C.command = commandnameLowerToReal[C.command.ToLowerInvariant()]; + try { + string lowerName = C.command.ToLower(); + if(commandnameLowerToReal.ContainsKey(lowerName) == false) + { + return new KeyValuePair(false, "Unknown command"); + } + C.command = commandnameLowerToReal[lowerName]; + CommandsAPI Endpoint = commandEndpoints[endpointcommandmap[C.command]]; MethodInfo theMethod = Endpoint.GetType().GetMethod(C.command); if (theMethod != null) @@ -256,10 +273,6 @@ namespace SecondBotEvents.Services { return new KeyValuePair(false, "Endpoint is null"); } - if (argsList.Count == 0) - { - return new KeyValuePair(false, "Zero args at final check require at min 1"); - } object[] argsWorker = argsList.ToArray(); object processed = theMethod.Invoke(Endpoint, argsWorker); reply = "Error"; @@ -316,7 +329,7 @@ namespace SecondBotEvents.Services { getClient().Network.SimConnected -= BotLoggedIn; getClient().Self.IM += BotImMessage; - if (myConfig.GetOnlyMasterAvs() == true) + if (myConfig.GetEnableMasterControls() == true) { foreach(string A in myConfig.GetMastersCSV()) { diff --git a/SecondBotEvents/Services/HttpService.cs b/SecondBotEvents/Services/HttpService.cs index 16a1ae7..8f485bd 100644 --- a/SecondBotEvents/Services/HttpService.cs +++ b/SecondBotEvents/Services/HttpService.cs @@ -158,29 +158,20 @@ namespace SecondBotEvents.Services } } - protected void SuccessNoReturn(string command) - { - SuccessNoReturn(command, new string[] { }); - } - protected void SuccessNoReturn(string command, string[] args) - { - // @todo Command history storage system - } - - protected object BasicReply(string input, string command) - { - return BasicReply(input, command, new string[] { }); - } - protected object BasicReply(string input) { - return BasicReply(input, getCallingCommand(), new string[] { }); + return BasicReply(input, new string[] { }, getCallingCommand()); } - protected object BasicReply(string input, string command, string[] args) + protected object BasicReply(string input, string[] args) + { + return BasicReply(input, args, getCallingCommand()); + } + + protected object BasicReply(string input, string[] args, string command) { // @todo Command history storage system - return new { reply = input, status = true }; + return new { reply = input, status = false }; } protected object Failure(string input, string command, string[] args, string whyfailed) @@ -189,12 +180,6 @@ namespace SecondBotEvents.Services return new { reply = input, status = false }; } - protected object Failure(string input, string command, string[] args) - { - return Failure(input, command, args, null); - } - - protected object Failure(string input, string[] args) { return Failure(input, getCallingCommand(), args, null); @@ -210,11 +195,6 @@ namespace SecondBotEvents.Services return (new System.Diagnostics.StackTrace()).GetFrame(2).GetMethod().Name; } - protected object Failure(string input, string command) - { - return Failure(input, command, new string[] { }); - } - } diff --git a/SecondBotEvents/Services/InteractionService.cs b/SecondBotEvents/Services/InteractionService.cs index 2e11135..dc9d159 100644 --- a/SecondBotEvents/Services/InteractionService.cs +++ b/SecondBotEvents/Services/InteractionService.cs @@ -47,7 +47,7 @@ namespace SecondBotEvents.Services jsonOuput(false, sourceName, avatarName, "disabled by config"); return false; } - if (master.CommandsService.myConfig.GetOnlyMasterAvs() == false) + if (master.CommandsService.myConfig.GetEnableMasterControls() == false) { // master avatars list is not enabled. unable to continue jsonOuput(false, sourceName, avatarName, "masters AV list is disabled");