remove unneeded method names as args

This commit is contained in:
Madpeter 2022-06-01 18:22:40 +01:00
parent f93dcb6bf5
commit b089591fcb
19 changed files with 315 additions and 328 deletions

View file

@ -19,10 +19,10 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return BasicReply("avatar lookup", "AddToAllowAnimations", new [] { avatar }); return BasicReply("avatar lookup", new [] { avatar });
} }
// @todo accept storage // @todo accept storage
return Failure("@todo", "AddToAllowAnimations"); return Failure("@todo");
} }
[About("Attempts to play a gesture")] [About("Attempts to play a gesture")]
@ -33,11 +33,11 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(gesture, out UUID gestureUUID) == false) 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)); InventoryItem itm = getClient().Inventory.FetchItem(gestureUUID, getClient().Self.AgentID, (3 * 1000));
getClient().Self.PlayGesture(itm.AssetUUID); getClient().Self.PlayGesture(itm.AssetUUID);
return BasicReply("Accepted", "PlayGesture", new [] { gesture }); return BasicReply("Accepted", new [] { gesture });
} }
[About("Resets the animation stack for the bot")] [About("Resets the animation stack for the bot")]
@ -45,7 +45,7 @@ namespace SecondBotEvents.Commands
public object ResetAnimations() public object ResetAnimations()
{ {
// @todo Reset animations function from old version // @todo Reset animations function from old version
return Failure("@todo", "ResetAnimations"); return Failure("@todo");
} }
} }

View file

@ -27,15 +27,15 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.isempty(message) == true) 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) 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) 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); getClient().Self.Chat(message, channelnum, ChatType.Normal);
return BasicReply("ok"); return BasicReply("ok");
@ -53,14 +53,14 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) if(avataruuid == UUID.Zero)
{ {
return Failure("avatar lookup", "IM", new [] { avatar, message }); return Failure("avatar lookup", new [] { avatar, message });
} }
if (SecondbotHelpers.isempty(message) == true) 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); 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")] [About("gets a full list of all avatar chat windows")]

View file

@ -11,7 +11,7 @@ namespace SecondBotEvents.Commands
[ReturnHints("world")] [ReturnHints("world")]
public object Hello() public object Hello()
{ {
return BasicReply("world", "Hello"); return BasicReply("world");
} }
} }

View file

@ -30,7 +30,7 @@ namespace SecondBotEvents.Commands
{ {
if (int.TryParse(dialogid, out int dialogidnum) == false) 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"); return Failure("@todo dialog relay");
} }
@ -43,7 +43,7 @@ namespace SecondBotEvents.Commands
{ {
if (bool.TryParse(status, out bool statuscode) == false) 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"); return Failure("@todo dialog relay");
} }

View file

@ -19,7 +19,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Discord client not ready"); 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")] [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) 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")] [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"); return Failure("Discord client not ready");
} }
SuccessNoReturn("Discord_BulkClear_Messages", new [] { serverid, memberid }); return BasicReply(master.DiscordService.ClearMessages(serverid, memberid).Result.ToString(), new[] { serverid, memberid });
return master.DiscordService.ClearMessages(serverid, memberid).Result;
} }
[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")] [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 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" + [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"); return Failure("Discord client not ready");
} }
SuccessNoReturn("Discord_MembersList", new [] { serverid }); return BasicReply(master.DiscordService.ListMembers(serverid).Result.ToString(), new[] { serverid });
return master.DiscordService.ListMembers(serverid).Result;
} }
[About("Sends a message to the selected channel - Optional TTS usage")] [About("Sends a message to the selected channel - Optional TTS usage")]
@ -104,9 +102,9 @@ namespace SecondBotEvents.Commands
} }
if (SecondbotHelpers.notempty(message) == false) 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")] [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 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")] [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"); return Failure("Discord client not ready");
} }
SuccessNoReturn("Discord_Role_GetSettings", new [] { serverid, roleid }); return BasicReply(master.DiscordService.RoleSettings(serverid, roleid).ToString(), new [] { serverid, roleid });
return master.DiscordService.RoleSettings(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" + [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 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" + [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"); return Failure("Discord client not ready");
} }
SuccessNoReturn("Discord_RoleCreate", new [] { serverid, role }); return BasicReply(master.DiscordService.CreateRole(serverid, role).Result.ToString(), new[] { serverid, role });
return master.DiscordService.CreateRole(serverid,role).Result;
} }
[About("Returns a list of roles and their ids in collection \n This command requires Discord full client mode enabled and connected")] [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 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")] [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 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")] [About("Returns a list of text channels in a server")]
@ -208,7 +204,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Discord client not ready"); return Failure("Discord client not ready");
} }
return master.DiscordService.ListTextChannels(serverid); return BasicReply(master.DiscordService.ListTextChannels(serverid).ToString());
} }
} }
} }

View file

@ -21,13 +21,13 @@ namespace SecondBotEvents.Commands
{ {
if (getClient().Network.CurrentSim.IsEstateManager == false) 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); bool.TryParse(mode, out bool modeflag);
if (modeflag == false) if (modeflag == false)
{ {
getClient().Estate.CancelRestart(); getClient().Estate.CancelRestart();
return BasicReply("canceled", "SimRestart", new [] { delay, mode }); return BasicReply("canceled", new [] { delay, mode });
} }
int delay_restart = 60; int delay_restart = 60;
int.TryParse(delay, out delay_restart); int.TryParse(delay, out delay_restart);
@ -36,7 +36,7 @@ namespace SecondBotEvents.Commands
delay_restart = 240; delay_restart = 240;
} }
getClient().Estate.RestartRegion(delay_restart); 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")] [About("Sends the message to the current sim")]
@ -48,14 +48,14 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(message) == false) if (SecondbotHelpers.notempty(message) == false)
{ {
return Failure("Message empty", "SimMessage", new [] { message }); return Failure("Message empty", new [] { message });
} }
if (getClient().Network.CurrentSim.IsEstateManager == false) 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); getClient().Estate.SimulatorMessage(message);
return BasicReply("ok", "SimMessage", new [] { message }); return BasicReply("ok", new [] { message });
} }
[About("Fetchs the regions map tile")] [About("Fetchs the regions map tile")]
@ -66,9 +66,9 @@ namespace SecondBotEvents.Commands
{ {
if (getClient().Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false) 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")] [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) 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<string, string> reply = new Dictionary<string, string>(); Dictionary<string, string> reply = new Dictionary<string, string>();
reply.Add("region", regionname); reply.Add("region", regionname);
@ -123,25 +123,25 @@ namespace SecondBotEvents.Commands
{ {
if (getClient().Network.CurrentSim.IsEstateManager == false) 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; UUID avataruuid = UUID.Zero;
if (UUID.TryParse(avatar, out avataruuid) == false) 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; bool globalban = false;
if (bool.TryParse(global, out 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") if (mode != "add")
{ {
getClient().Estate.UnbanUser(avataruuid, globalban); 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); getClient().Estate.BanUser(avataruuid, globalban);
return BasicReply("Ban request accepted", "UpdateEstateBanlist", new [] { avatar, mode, global }); return BasicReply("Ban request accepted", new [] { avatar, mode, global });
} }
} }
} }

View file

@ -31,24 +31,24 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("avatar lookup", "FriendFullPerms", new [] { avatar, state }); return Failure("avatar lookup", new [] { avatar, state });
} }
bool status = false; bool status = false;
if (bool.TryParse(state, out 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) 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) if (status == true)
{ {
getClient().Friends.GrantRights(avataruuid, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects); 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); 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")] [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); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("avatar lookup", "FriendRequest", new [] { avatar, state }); return Failure("avatar lookup", new [] { avatar, state });
} }
bool status = false; bool status = false;
if (bool.TryParse(state, out 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 (getClient().Friends.FriendList.ContainsKey(avataruuid) == true)
{ {
if (status == false) if (status == false)
{ {
getClient().Friends.TerminateFriendship(avataruuid); getClient().Friends.TerminateFriendship(avataruuid);
return BasicReply("Removed", "FriendRequest", new [] { avatar, state }); return BasicReply("Removed", new [] { avatar, state });
} }
} }
if (status == false) if (status == false)
{ {
return Failure("Not in friendslist", "FriendRequest", new [] { avatar, state }); return Failure("Not in friendslist", new [] { avatar, state });
} }
getClient().Friends.OfferFriendship(avataruuid); getClient().Friends.OfferFriendship(avataruuid);
return BasicReply("Request sent", "FriendRequest", new [] { avatar, state }); return BasicReply("Request sent", new [] { avatar, state });
} }
} }

View file

@ -16,10 +16,10 @@ namespace SecondBotEvents.Commands
{ {
if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) if (master.CommandsService.myConfig.GetAllowFundsCommands() == false)
{ {
return Failure("Funds commands are disabled", "Balance"); return Failure("Funds commands are disabled");
} }
getClient().Self.RequestBalance(); getClient().Self.RequestBalance();
return BasicReply(getClient().Self.Balance.ToString(), "Balance"); return BasicReply(getClient().Self.Balance.ToString());
} }
[About("Makes the bot pay a avatar")] [About("Makes the bot pay a avatar")]
@ -34,23 +34,23 @@ namespace SecondBotEvents.Commands
{ {
if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) 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); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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) 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)) 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); 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")] [About("Makes the bot pay a object")]
@ -67,26 +67,26 @@ namespace SecondBotEvents.Commands
{ {
if (master.CommandsService.myConfig.GetAllowFundsCommands() == false) 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) 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) 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)) 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) 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); getClient().Self.GiveObjectMoney(objectUUID, amountvalue, primname);
return BasicReply("ok", "PayObject", new [] { objectuuid, primname, amount }); return BasicReply("ok", new [] { objectuuid, primname, amount });
} }
} }
} }

View file

@ -23,7 +23,7 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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); ProcessAvatar(avatar);
return BasicReply(master.DataStoreService.IsGroupMember(groupuuid, avataruuid).ToString()); return BasicReply(master.DataStoreService.IsGroupMember(groupuuid, avataruuid).ToString());
@ -40,7 +40,7 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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))); return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupMembers(groupuuid)));
} }
@ -59,16 +59,16 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) 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); ProcessAvatar(avatar);
if(avataruuid == null) if(avataruuid == null)
{ {
return Failure("Unknown avatar", "GroupBan", new[] { group, avatar, state }); return Failure("Unknown avatar", new[] { group, avatar, state });
} }
GroupBanAction Action = GroupBanAction.Ban; GroupBanAction Action = GroupBanAction.Ban;
if (state == "false") if (state == "false")
@ -97,16 +97,16 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupEject", new[] { group, avatar }); return Failure("Unknown group", new[] { group, avatar });
} }
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == null) if (avataruuid == null)
{ {
return Failure("Unknown avatar", "GroupEject", new[] { group, avatar}); return Failure("Unknown avatar", new[] { group, avatar});
} }
getClient().Groups.EjectUser(groupuuid, avataruuid); getClient().Groups.EjectUser(groupuuid, avataruuid);
return BasicReply("Accepted"); return BasicReply("Accepted");
@ -126,15 +126,15 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) 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) 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); ProcessAvatar(avatar);
if(master.DataStoreService.IsGroupMember(groupuuid, avataruuid) == false) if(master.DataStoreService.IsGroupMember(groupuuid, avataruuid) == false)
@ -161,16 +161,16 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) 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); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("avatar lookup", "GroupInvite", new [] { group, avatar, role }); return Failure("avatar lookup", new [] { group, avatar, role });
} }
List<UUID> roles = new List<UUID>(); List<UUID> roles = new List<UUID>();
roles.Add(UUID.Zero); roles.Add(UUID.Zero);
@ -179,12 +179,12 @@ namespace SecondBotEvents.Commands
UUID roleuuid = UUID.Zero; UUID roleuuid = UUID.Zero;
if (UUID.TryParse(role, out roleuuid) == false) 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); roles.Add(roleuuid);
} }
getClient().Groups.Invite(groupuuid, roles, avataruuid); 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!)")] [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) 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) 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) 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) 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(); GroupNotice NewNotice = new GroupNotice();
NewNotice.Subject = title; NewNotice.Subject = title;
NewNotice.Message = message; NewNotice.Message = message;
NewNotice.OwnerID = getClient().Self.AgentID; NewNotice.OwnerID = getClient().Self.AgentID;
getClient().Groups.SendGroupNotice(groupuuid, NewNotice); 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")] [About("Activates the selected title")]
@ -234,18 +234,18 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) 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) 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); 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")] [About("Sets the selected group to the active group")]
@ -257,14 +257,14 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupActiveGroup", new[] { group }); return Failure("Unknown group", new[] { group });
} }
getClient().Groups.ActivateGroup(groupuuid); 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")] [About("Sends a group notice with an attachment")]
@ -283,23 +283,23 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupuuid) == false) 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) 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) 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) 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) 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(); GroupNotice NewNotice = new GroupNotice();
NewNotice.Subject = title; NewNotice.Subject = title;
@ -307,7 +307,7 @@ namespace SecondBotEvents.Commands
NewNotice.OwnerID = getClient().Self.AgentID; NewNotice.OwnerID = getClient().Self.AgentID;
NewNotice.AttachmentID = inventoryuuid; NewNotice.AttachmentID = inventoryuuid;
getClient().Groups.SendGroupNotice(groupuuid, NewNotice); 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) 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) 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))); return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupRoles(groupuuid)));
} }
@ -354,11 +354,11 @@ namespace SecondBotEvents.Commands
UUID groupUUID = UUID.Zero; UUID groupUUID = UUID.Zero;
if(UUID.TryParse(group,out groupUUID) == false) 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) 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()); return BasicReply(master.DataStoreService.GetGroupChatHasUnread(groupUUID).ToString());
} }
@ -387,7 +387,7 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(group, out UUID groupUUID) == false) 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))); return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupChatHistory(groupUUID)));
} }
@ -403,15 +403,15 @@ namespace SecondBotEvents.Commands
UUID groupUUID = UUID.Zero; UUID groupUUID = UUID.Zero;
if (UUID.TryParse(group, out groupUUID) == false) 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) 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) 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); getClient().Self.InstantMessageGroup(groupUUID, message);
return BasicReply("Sending"); return BasicReply("Sending");

View file

@ -49,7 +49,7 @@ namespace SecondBotEvents.Commands
S.Encode(); S.Encode();
getClient().Inventory.RequestCreateItemFromAsset(S.AssetData, inventoryName, "", AssetType.Sound, InventoryType.Sound, AA.UUID, null); 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) 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)); InventoryItem itm = getClient().Inventory.FetchItem(targetitem, getClient().Self.AgentID, (5 * 1000));
if (itm == null) 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); 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) 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) 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); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), target);
if (realitem == null) 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; realitem.Name = newname;
getClient().Inventory.RequestUpdateItem(realitem); 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")] [About("Attempts to Remove the given inventory item")]
@ -109,10 +109,10 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(item, out UUID target) == false) 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<UUID>() { target }, new List<UUID>()); getClient().Inventory.Remove(new List<UUID>() { target }, new List<UUID>());
return BasicReply("Ok", "DeleteInventoryItem", new [] { item }); return BasicReply("Ok", new [] { item });
} }
[About("Attempts to Remove the given inventory folder")] [About("Attempts to Remove the given inventory folder")]
@ -123,10 +123,10 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(folder, out UUID target) == false) 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<UUID>(), new List<UUID>() { target }); getClient().Inventory.Remove(new List<UUID>(), new List<UUID>() { target });
return BasicReply("Ok", "DeleteInventoryFolder", new [] { folder }); return BasicReply("Ok", new [] { folder });
} }
[About("Attempts to attach the given inventory item")] [About("Attempts to attach the given inventory item")]
@ -137,11 +137,11 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(item,out UUID itemuuid) == false) 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); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid);
getClient().Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false); getClient().Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false);
return BasicReply("Ok", "Attach", new [] { item }); return BasicReply("Ok", new [] { item });
} }
[About("Attempts to Remove the given inventory folder")] [About("Attempts to Remove the given inventory folder")]
@ -152,11 +152,11 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(item, out UUID itemuuid) == false) 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); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid);
getClient().Appearance.RemoveFromOutfit(realitem); 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<br/>Please note: This does not use the outfits folder!<br/>Please do not use links in the folder!")] [About("Replaces the current avatar outfit with the Clothing/[NAME] folder<br/>Please note: This does not use the outfits folder!<br/>Please do not use links in the folder!")]
@ -170,7 +170,7 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(name) == false) 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 // uses the Clothing folder
// must be a full outfit (shapes/eyes ect) // must be a full outfit (shapes/eyes ect)
@ -187,7 +187,7 @@ namespace SecondBotEvents.Commands
} }
if (AA == null) 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); T = getClient().Inventory.Store.GetContents(AA);
AA = null; AA = null;
@ -201,13 +201,13 @@ namespace SecondBotEvents.Commands
} }
if (AA == null) if (AA == null)
{ {
return Failure("Cant find target folder", "Outfit", new [] { name }); return Failure("Cant find target folder", new [] { name });
} }
List<InventoryBase> contents = getClient().Inventory.FolderContents(AA.UUID, getClient().Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000); List<InventoryBase> contents = getClient().Inventory.FolderContents(AA.UUID, getClient().Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000);
List<InventoryItem> wareables = new List<InventoryItem>(); List<InventoryItem> wareables = new List<InventoryItem>();
if (contents == null) 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) foreach (InventoryBase item in contents)
{ {
@ -217,7 +217,7 @@ namespace SecondBotEvents.Commands
} }
} }
getClient().Appearance.ReplaceOutfit(wareables, false); 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) if (NotecardFolder != null)
{ {
return Failure("Unable to find notecard folder", "InventoryPurgeNotecards"); return Failure("Unable to find notecard folder");
} }
List<UUID> purge_notecards = new List<UUID>(); List<UUID> purge_notecards = new List<UUID>();
List<InventoryBase> contents = getClient().Inventory.FolderContents(NotecardFolder.UUID, getClient().Self.AgentID, true, true, InventorySortOrder.ByDate, 40 * 1000); List<InventoryBase> 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<UUID>()); getClient().Inventory.Remove(purge_notecards, new List<UUID>());
} }
return BasicReply("Ok", "InventoryPurgeNotecards"); return BasicReply("Ok");
} }
[About("converts a inventory uuid to a realworld uuid<br/>Needed for texture preview")] [About("converts a inventory uuid to a realworld uuid<br/>Needed for texture preview")]
@ -270,10 +270,10 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(item, out UUID itemUUID) == false) 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); 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")] [About("sends a item to an avatar")]
@ -289,19 +289,19 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) 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) 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)); InventoryItem itm = getClient().Inventory.FetchItem(targetitem, getClient().Self.AgentID, (3 * 1000));
if (itm == null) 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); 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")] [About("Sends a folder to an avatar")]
@ -317,19 +317,19 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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) 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); InventoryBase FindFolderHelper = HelperInventory.FindFolder(getClient(), getClient().Inventory.Store.RootFolder, targetfolder);
if (FindFolderHelper == null) 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); 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])")] [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) 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) 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) 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)); InventoryItem itm = getClient().Inventory.FetchItem(itemuuid, getClient().Self.AgentID, (3 * 1000));
if (itm == null) 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<uint, Primitive> objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy(); Dictionary<uint, Primitive> objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy();
KeyValuePair<uint, Primitive> RealObject = new KeyValuePair<uint, Primitive>(0,null); KeyValuePair<uint, Primitive> RealObject = new KeyValuePair<uint, Primitive>(0,null);
@ -375,7 +375,7 @@ namespace SecondBotEvents.Commands
} }
if (RealObject.Value == null) 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; bool scriptState = runscript;
if (itm.AssetType != AssetType.LSLText) if (itm.AssetType != AssetType.LSLText)
@ -385,10 +385,10 @@ namespace SecondBotEvents.Commands
if (itm.AssetType == AssetType.LSLText) if (itm.AssetType == AssetType.LSLText)
{ {
getClient().Inventory.CopyScriptToTask(RealObject.Key, itm, scriptState); 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); 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<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>subfolders: InventoryMapFolder[]</li></ul>")] [About("Requests the inventory folder layout as a json object InventoryMapFolder<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>subfolders: InventoryMapFolder[]</li></ul>")]
@ -397,8 +397,8 @@ namespace SecondBotEvents.Commands
public object InventoryFolders() public object InventoryFolders()
{ {
string reply = HelperInventory.MapFolderJson(getClient()); string reply = HelperInventory.MapFolderJson(getClient());
if (reply != null) return BasicReply(reply, "InventoryFolders"); if (reply != null) return BasicReply(reply);
return Failure("Error", "InventoryFolders"); return Failure("Error");
} }
[About("Requests folders limited to selected folder")] [About("Requests folders limited to selected folder")]
@ -408,8 +408,8 @@ namespace SecondBotEvents.Commands
public object InventoryFoldersLimited(string targetfolder) public object InventoryFoldersLimited(string targetfolder)
{ {
string reply = HelperInventory.MapFolderJson(getClient(), targetfolder,false); string reply = HelperInventory.MapFolderJson(getClient(), targetfolder,false);
if (reply != null) return BasicReply(reply, "InventoryFoldersLimited"); if (reply != null) return BasicReply(reply);
return Failure("Error", "InventoryFoldersLimited"); return Failure("Error");
} }
[About("Requests the contents of a folder as an array of InventoryMapItem<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>typename: String</li></ul>")] [About("Requests the contents of a folder as an array of InventoryMapItem<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>typename: String</li></ul>")]
@ -420,9 +420,9 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(folderUUID, out UUID folder) == false) 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")] [About("creates a folder in a folder")]
@ -435,15 +435,15 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(parentFolder, out UUID parentFolderUUID) == false) 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) 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); UUID folder = getClient().Inventory.CreateFolder(parentFolderUUID, folderName);
string uuid = folder.ToString(); 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) 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) 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); 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")] [About("moves a folder to another folder")]
@ -477,14 +477,14 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(sourceFolder, out UUID sourceFolderUUID) == false) 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) 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); getClient().Inventory.MoveFolder(sourceFolderUUID, destFolderUUID);
return BasicReply("Ok", "MoveInventoryFolder", new string[] { sourceFolder, destFolder }); return BasicReply("Ok", new string[] { sourceFolder, destFolder });
} }
} }
} }

View file

@ -25,19 +25,19 @@ namespace SecondBotEvents.Commands
{ {
if (Vector3.TryParse("<" + x + "," + y + "," + z + ">", out Vector3 pos) == false) 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) 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) 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) 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.AutoPilotCancel();
getClient().Self.Movement.TurnToward(pos, true); getClient().Self.Movement.TurnToward(pos, true);
@ -45,7 +45,7 @@ namespace SecondBotEvents.Commands
uint Globalx, Globaly; uint Globalx, Globaly;
Utils.LongToUInts(getClient().Network.CurrentSim.Handle, out Globalx, out Globaly); Utils.LongToUInts(getClient().Network.CurrentSim.Handle, out Globalx, out Globaly);
getClient().Self.AutoPilot((ulong)(Globalx + pos.X), (ulong)(Globaly + pos.Y), pos.Z); 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")] [About("Attempt to teleport to a new region")]
@ -53,7 +53,7 @@ namespace SecondBotEvents.Commands
public object AutoPilotStop() public object AutoPilotStop()
{ {
getClient().Self.AutoPilotCancel(); getClient().Self.AutoPilotCancel();
return BasicReply("ok", "AutoPilotStop"); return BasicReply("ok");
} }
[About("Make the bot request the target avatar teleport to the bot")] [About("Make the bot request the target avatar teleport to the bot")]
@ -65,10 +65,10 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) if(avataruuid == UUID.Zero)
{ {
return Failure("Invaild avatar UUID", "SendTeleportLure", new [] { avatar }); return Failure("Invaild avatar UUID", new [] { avatar });
} }
getClient().Self.SendTeleportLure(avataruuid); 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)")] [About("Sends a teleport request (Move the bot to the avatar)")]
@ -80,11 +80,11 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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 // @todo action from event log with accept
getClient().Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you"); 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)")] [About("Makes the bot fly (or not)")]
@ -95,11 +95,11 @@ namespace SecondBotEvents.Commands
{ {
if (bool.TryParse(mode, out bool flymode) == false) 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.Fly = flymode;
getClient().Self.Movement.SendUpdate(); 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")] [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) 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) 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) 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) 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")] [About("Rotates the bot to face a avatar")]
@ -138,13 +138,13 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) 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) 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")] [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) 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; float yaw = target_yaw;
getClient().Self.Movement.BodyRotation.GetEulerAngles(out float roll, out float pitch, out _); 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; result.Z = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2;
getClient().Self.Movement.BodyRotation = result; getClient().Self.Movement.BodyRotation = result;
getClient().Self.Movement.SendUpdate(); 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 }); bool status = TeleportRequest(new [] { region, x, y, z });
if (status == false) 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) 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) protected bool TeleportRequest(string[] args)

View file

@ -20,11 +20,11 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(collection) == false) 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) 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 Failure("@todo notecard temp stroage");
//return BasicReply("ok", "NotecardAdd", new [] { collection, content }); //return BasicReply("ok", "NotecardAdd", new [] { collection, content });
@ -38,7 +38,7 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(collection) == false) 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"); return Failure("@todo notecard storage");
} }
@ -56,16 +56,16 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(collection) == false) 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) 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); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) 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"); return Failure("@todo notecard storage");
} }
@ -82,16 +82,16 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(notecardname) == false) 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) 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); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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"); return Failure("@todo notecard sending");
} }

View file

@ -26,11 +26,11 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if(tests.Key == false) 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) 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; int minAmount = 1;
@ -45,14 +45,14 @@ namespace SecondBotEvents.Commands
} }
if ((amountvalue < minAmount) || (amountvalue > 9999999)) if ((amountvalue < minAmount) || (amountvalue > 9999999))
{ {
return Failure("Invaild amount", "SetParcelSale", new [] { amount, avatar }); return Failure("Invaild amount", new [] { amount, avatar });
} }
targetparcel.SalePrice = amountvalue; targetparcel.SalePrice = amountvalue;
targetparcel.AuthBuyerID = avataruuid; targetparcel.AuthBuyerID = avataruuid;
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true); parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true);
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false); parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false);
targetparcel.Update(getClient().Network.CurrentSim, 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")] [About("Gets the parcel Dwell (Traffic) value and returns it via the reply target")]
@ -64,9 +64,9 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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")] [About("Changes the parcel landing mode to point and sets the landing point")]
@ -82,24 +82,24 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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) 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) 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) 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.Landing = LandingType.LandingPoint;
targetparcel.UserLocation = new Vector3(X, Y, Z); targetparcel.UserLocation = new Vector3(X, Y, Z);
targetparcel.Update(getClient().Network.CurrentSim, false); 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<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "SetParcelName", new [] { name }); return Failure(tests.Value, new [] { name });
} }
if (SecondbotHelpers.notempty(name) == false) 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.Name = name;
targetparcel.Update(getClient().Network.CurrentSim, false); targetparcel.Update(getClient().Network.CurrentSim, false);
return BasicReply("ok", "SetParcelName", new [] { name }); return BasicReply("ok", new [] { name });
} }
[About("Updates the current parcels description")] [About("Updates the current parcels description")]
@ -135,11 +135,11 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "SetParcelDesc", new [] { desc }); return Failure(tests.Value, new [] { desc });
} }
targetparcel.Desc = desc; targetparcel.Desc = desc;
targetparcel.Update(getClient().Network.CurrentSim, false); targetparcel.Update(getClient().Network.CurrentSim, false);
return BasicReply("ok", "SetParcelDesc", new [] { desc }); return BasicReply("ok", new [] { desc });
} }
[About("Fetchs the current parcels desc")] [About("Fetchs the current parcels desc")]
@ -151,9 +151,9 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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")] [About("gets the flags for the parcel")]
@ -165,7 +165,7 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "GetParcelFlags"); return Failure(tests.Value);
} }
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list(); Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
Dictionary<string, string> collection = new Dictionary<string, string>(); Dictionary<string, string> collection = new Dictionary<string, string>();
@ -173,8 +173,7 @@ namespace SecondBotEvents.Commands
{ {
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString()); collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
} }
SuccessNoReturn("GetParcelFlags"); return BasicReply(JsonConvert.SerializeObject(collection));
return collection;
} }
[About("Ejects an avatar")] [About("Ejects an avatar")]
@ -186,10 +185,10 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) if(avataruuid == UUID.Zero)
{ {
return Failure("Invaild avatar", "ParcelEject", new [] { avatar }); return Failure("Invaild avatar", new [] { avatar });
} }
getClient().Parcels.EjectUser(avataruuid, false); 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")] [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<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "AbandonLand"); return Failure(tests.Value);
} }
getClient().Parcels.ReleaseParcel(getClient().Network.CurrentSim, targetparcel.LocalID); getClient().Parcels.ReleaseParcel(getClient().Network.CurrentSim, targetparcel.LocalID);
return BasicReply("ok", "AbandonLand"); return BasicReply("ok");
} }
@ -218,12 +217,12 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "ParcelBan", new [] { avatar }); return Failure(tests.Value, new [] { avatar });
} }
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("Invaild avatar", "ParcelBan", new [] { avatar }); return Failure("Invaild avatar", new [] { avatar });
} }
bool alreadyBanned = false; bool alreadyBanned = false;
foreach (ParcelAccessEntry E in targetparcel.AccessBlackList) foreach (ParcelAccessEntry E in targetparcel.AccessBlackList)
@ -236,7 +235,7 @@ namespace SecondBotEvents.Commands
} }
if (alreadyBanned == true) 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(); ParcelAccessEntry entry = new ParcelAccessEntry();
entry.AgentID = avataruuid; entry.AgentID = avataruuid;
@ -244,7 +243,7 @@ namespace SecondBotEvents.Commands
entry.Time = new System.DateTime(3030, 03, 03); entry.Time = new System.DateTime(3030, 03, 03);
targetparcel.AccessBlackList.Add(entry); targetparcel.AccessBlackList.Add(entry);
targetparcel.Update(getClient().Network.CurrentSim, false); targetparcel.Update(getClient().Network.CurrentSim, false);
return BasicReply("ok", "ParcelBan", new [] { avatar }); return BasicReply("ok", new [] { avatar });
} }
[About("Unbans an avatar from a parcel")] [About("Unbans an avatar from a parcel")]
@ -259,12 +258,12 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "ParcelUnBan", new [] { avatar }); return Failure(tests.Value, new [] { avatar });
} }
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("Invaild avatar", "ParcelUnBan", new [] { avatar }); return Failure("Invaild avatar", new [] { avatar });
} }
bool alreadyBanned = false; bool alreadyBanned = false;
ParcelAccessEntry removeentry = new ParcelAccessEntry(); ParcelAccessEntry removeentry = new ParcelAccessEntry();
@ -279,11 +278,11 @@ namespace SecondBotEvents.Commands
} }
if (alreadyBanned == false) 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.AccessBlackList.Remove(removeentry);
targetparcel.Update(getClient().Network.CurrentSim, false); 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<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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); 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")] [About("Updates the current parcels name")]
@ -318,7 +317,7 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "SetParcelFlag", new [] { escapedflagdata }); return Failure(tests.Value, new [] { escapedflagdata });
} }
List<string> acceptablewords = new List<string>(); List<string> acceptablewords = new List<string>();
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list(); Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
@ -347,11 +346,11 @@ namespace SecondBotEvents.Commands
} }
if (setflags.Count == 0) 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) 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<string, bool> cfg in setflags) foreach (KeyValuePair<string, bool> cfg in setflags)
{ {
@ -361,7 +360,7 @@ namespace SecondBotEvents.Commands
} }
} }
targetparcel.Update(getClient().Network.CurrentSim, false); 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")] [About("Returns all objects from the current parcel for the selected avatar")]
@ -375,15 +374,15 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "ParcelReturnTargeted", new [] { avatar }); return Failure(tests.Value, new [] { avatar });
} }
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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<UUID>() { avataruuid }); getClient().Parcels.ReturnObjects(getClient().Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List<UUID>() { avataruuid });
return BasicReply("ok", "ParcelReturnTargeted", new [] { avatar }); return BasicReply("ok", new [] { avatar });
} }
@ -399,21 +398,21 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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) 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) 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.GroupID = groupuuid;
targetparcel.Update(getClient().Network.CurrentSim, false); targetparcel.Update(getClient().Network.CurrentSim, false);
Thread.Sleep(500); Thread.Sleep(500);
getClient().Parcels.DeedToGroup(getClient().Network.CurrentSim, targetparcel.LocalID, groupuuid); 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!")] [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<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) 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)) 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; int minAmount = 1;
if (targetparcel.AuthBuyerID == getClient().Self.AgentID) if (targetparcel.AuthBuyerID == getClient().Self.AgentID)
@ -444,22 +443,22 @@ namespace SecondBotEvents.Commands
} }
if (int.TryParse(amount, out int amountvalue) == false) if (int.TryParse(amount, out int amountvalue) == false)
{ {
return Failure("Invaild amount", "ParcelBuy", new [] { amount }); return Failure("Invaild amount", new [] { amount });
} }
if (amountvalue < minAmount) if (amountvalue < minAmount)
{ {
return Failure("Invaild amount", "ParcelBuy", new [] { amount }); return Failure("Invaild amount", new [] { amount });
}; };
if (targetparcel.Flags.HasFlag(ParcelFlags.ForSale) == false) 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) 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); 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")] [About("Freezes an avatar")]
@ -472,15 +471,15 @@ namespace SecondBotEvents.Commands
{ {
if (bool.TryParse(state, out bool freezestate) == false) 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); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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); 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<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "GetParcelBanlist"); return Failure(tests.Value);
} }
GetParcelBanlistObject reply = new GetParcelBanlistObject(); GetParcelBanlistObject reply = new GetParcelBanlistObject();
int delays = 0; int delays = 0;
@ -524,7 +523,7 @@ namespace SecondBotEvents.Commands
reply.delay = delays * 1000; reply.delay = delays * 1000;
reply.parcelName = targetparcel.Name; reply.parcelName = targetparcel.Name;
reply.regionName = getClient().Network.CurrentSim.Name; reply.regionName = getClient().Network.CurrentSim.Name;
return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist"); return BasicReply(JsonConvert.SerializeObject(reply));
} }
[About("Returns a rezzed object")] [About("Returns a rezzed object")]
@ -536,7 +535,7 @@ namespace SecondBotEvents.Commands
{ {
if (UUID.TryParse(objectuuid, out UUID targetobject) == false) 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; bool found = false;
Dictionary<uint, Primitive> objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy(); Dictionary<uint, Primitive> objects_copy = getClient().Network.CurrentSim.ObjectsPrimitives.Copy();
@ -551,9 +550,9 @@ namespace SecondBotEvents.Commands
} }
if(found == false) 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" + [About("Updates the current parcels media settings \n" +
@ -575,7 +574,7 @@ namespace SecondBotEvents.Commands
KeyValuePair<bool, string> tests = SetupCurrentParcel(); KeyValuePair<bool, string> tests = SetupCurrentParcel();
if (tests.Key == false) if (tests.Key == false)
{ {
return Failure(tests.Value, "ParcelSetMedia", new [] { escapedflagdata }); return Failure(tests.Value, new [] { escapedflagdata });
} }
string[] args = escapedflagdata.Split(":::"); string[] args = escapedflagdata.Split(":::");
foreach (string A in args) foreach (string A in args)
@ -636,7 +635,7 @@ namespace SecondBotEvents.Commands
} }
} }
targetparcel.Update(getClient().Network.CurrentSim, false); 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) protected bool UpdateParcel_MediaType(Parcel targetparcel, string value)

View file

@ -26,7 +26,7 @@ namespace SecondBotEvents.Commands
{ {
if (getClient().Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false) 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); ProcessAvatar(targetUUID);
getClient().Self.Stand(); getClient().Self.Stand();
@ -35,7 +35,7 @@ namespace SecondBotEvents.Commands
getClient().Self.AnimationStart(Animations.POINT_YOU, true); 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.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()); 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)")] [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) 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) 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); master.DataStoreService.SetKeyValue(Key, Value);
return BasicReply("ok"); return BasicReply("ok");
@ -75,7 +75,7 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.isempty(Key) == false) if (SecondbotHelpers.isempty(Key) == false)
{ {
return Failure("Key is empty", "SetKeyValue", new[] { Key }); return Failure("Key is empty", new[] { Key });
} }
master.DataStoreService.ClearKeyValue(Key); master.DataStoreService.ClearKeyValue(Key);
return BasicReply("ok"); return BasicReply("ok");
@ -90,14 +90,14 @@ namespace SecondBotEvents.Commands
if (target == "ground") if (target == "ground")
{ {
getClient().Self.SitOnGround(); getClient().Self.SitOnGround();
return BasicReply("ok", "Sit", new [] { target }); return BasicReply("ok", new [] { target });
} }
if(UUID.TryParse(target,out UUID objectuuid) == false) 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); 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)")] [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) 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")); 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; break;
} }
} }
return BasicReply(found_object.ToString(), "ClickObject", new [] { target }); return BasicReply(found_object.ToString(), new [] { target });
} }
[About("Makes the bot kill itself you monster")] [About("Makes the bot kill itself you monster")]
@ -149,7 +149,6 @@ namespace SecondBotEvents.Commands
[ReturnHints("list of commands")] [ReturnHints("list of commands")]
public object GetLastCommands(string token) public object GetLastCommands(string token)
{ {
SuccessNoReturn("GetLastCommands");
return Failure("@todo command storage"); return Failure("@todo command storage");
} }
@ -173,30 +172,30 @@ namespace SecondBotEvents.Commands
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) 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 stateflag = false;
bool stickyflag = false; bool stickyflag = false;
if(bool.TryParse(state,out stateflag) == 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) 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" }; string[] AcceptedFlags = new [] { "friend", "group", "animation", "teleport", "command", "inventory" };
if (AcceptedFlags.Contains(flag) == false) 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) if (stateflag == true)
{ {
// @todo add stick/normal accept dynamic actions // @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 // @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 });
} }

View file

@ -27,11 +27,11 @@ namespace SecondBotEvents.Commands
{ {
if (SecondbotHelpers.notempty(endpoint) == false) 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) 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"; string attempt_endpoint = endpoint + "sys.php";
@ -47,24 +47,24 @@ namespace SecondBotEvents.Commands
RestResponse endpoint_checks = client.ExecutePostAsync(request).Result; RestResponse endpoint_checks = client.ExecutePostAsync(request).Result;
if (endpoint_checks.StatusCode != System.Net.HttpStatusCode.OK) 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 try
{ {
NotecardEndpoint server_reply = JsonConvert.DeserializeObject<NotecardEndpoint>(endpoint_checks.Content); NotecardEndpoint server_reply = JsonConvert.DeserializeObject<NotecardEndpoint>(endpoint_checks.Content);
if (server_reply.status == false) 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) 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"); return Failure("@todo notecard sending");
} }
catch (Exception e) catch (Exception e)
{ {
return Failure("Error: " + e.Message + "", "FetchNextNotecard", new [] { endpoint, endpointcode }); return Failure("Error: " + e.Message + "", new [] { endpoint, endpointcode });
} }
} }

View file

@ -14,7 +14,7 @@ namespace SecondBotEvents.Config
settings.Add("AllowFundsCommands"); settings.Add("AllowFundsCommands");
settings.Add("AllowIMcontrol"); settings.Add("AllowIMcontrol");
settings.Add("SharedSecret"); settings.Add("SharedSecret");
settings.Add("OnlyMasterAvs"); settings.Add("EnableMasterControls");
settings.Add("MastersCSV"); settings.Add("MastersCSV");
settings.Add("EnforceTimeWindow"); settings.Add("EnforceTimeWindow");
settings.Add("TimeWindowSecs"); settings.Add("TimeWindowSecs");
@ -41,9 +41,9 @@ namespace SecondBotEvents.Config
return ReadSettingAsInt("TimeWindowSecs", 35); return ReadSettingAsInt("TimeWindowSecs", 35);
} }
public bool GetOnlyMasterAvs() public bool GetEnableMasterControls()
{ {
return ReadSettingAsBool("OnlyMasterAvs", false); return ReadSettingAsBool("EnableMasterControls", false);
} }

View file

@ -43,7 +43,7 @@ namespace SecondBotEvents.Services
bool isCallable = false; bool isCallable = false;
foreach (CustomAttributeData At in M.CustomAttributes) foreach (CustomAttributeData At in M.CustomAttributes)
{ {
if (At.AttributeType.Name == "RouteAttribute") if (At.AttributeType.Name == "About")
{ {
isCallable = true; isCallable = true;
break; break;
@ -150,7 +150,7 @@ namespace SecondBotEvents.Services
{ {
break; break;
} }
if (myConfig.GetOnlyMasterAvs() == false) if (myConfig.GetEnableMasterControls() == false)
{ {
break; break;
} }
@ -197,6 +197,16 @@ namespace SecondBotEvents.Services
{ {
mode = "IM"; 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) else if (int.TryParse(target, out target_channel) == false)
{ {
return; return;
@ -237,9 +247,16 @@ namespace SecondBotEvents.Services
public KeyValuePair<bool, string> runCommand(SignedCommand C) public KeyValuePair<bool, string> runCommand(SignedCommand C)
{ {
C.command = commandnameLowerToReal[C.command.ToLowerInvariant()];
try try
{ {
string lowerName = C.command.ToLower();
if(commandnameLowerToReal.ContainsKey(lowerName) == false)
{
return new KeyValuePair<bool, string>(false, "Unknown command");
}
C.command = commandnameLowerToReal[lowerName];
CommandsAPI Endpoint = commandEndpoints[endpointcommandmap[C.command]]; CommandsAPI Endpoint = commandEndpoints[endpointcommandmap[C.command]];
MethodInfo theMethod = Endpoint.GetType().GetMethod(C.command); MethodInfo theMethod = Endpoint.GetType().GetMethod(C.command);
if (theMethod != null) if (theMethod != null)
@ -256,10 +273,6 @@ namespace SecondBotEvents.Services
{ {
return new KeyValuePair<bool, string>(false, "Endpoint is null"); return new KeyValuePair<bool, string>(false, "Endpoint is null");
} }
if (argsList.Count == 0)
{
return new KeyValuePair<bool, string>(false, "Zero args at final check require at min 1");
}
object[] argsWorker = argsList.ToArray<object>(); object[] argsWorker = argsList.ToArray<object>();
object processed = theMethod.Invoke(Endpoint, argsWorker); object processed = theMethod.Invoke(Endpoint, argsWorker);
reply = "Error"; reply = "Error";
@ -316,7 +329,7 @@ namespace SecondBotEvents.Services
{ {
getClient().Network.SimConnected -= BotLoggedIn; getClient().Network.SimConnected -= BotLoggedIn;
getClient().Self.IM += BotImMessage; getClient().Self.IM += BotImMessage;
if (myConfig.GetOnlyMasterAvs() == true) if (myConfig.GetEnableMasterControls() == true)
{ {
foreach(string A in myConfig.GetMastersCSV()) foreach(string A in myConfig.GetMastersCSV())
{ {

View file

@ -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) 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 // @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) protected object Failure(string input, string command, string[] args, string whyfailed)
@ -189,12 +180,6 @@ namespace SecondBotEvents.Services
return new { reply = input, status = false }; 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) protected object Failure(string input, string[] args)
{ {
return Failure(input, getCallingCommand(), args, null); return Failure(input, getCallingCommand(), args, null);
@ -210,11 +195,6 @@ namespace SecondBotEvents.Services
return (new System.Diagnostics.StackTrace()).GetFrame(2).GetMethod().Name; return (new System.Diagnostics.StackTrace()).GetFrame(2).GetMethod().Name;
} }
protected object Failure(string input, string command)
{
return Failure(input, command, new string[] { });
}
} }

View file

@ -47,7 +47,7 @@ namespace SecondBotEvents.Services
jsonOuput(false, sourceName, avatarName, "disabled by config"); jsonOuput(false, sourceName, avatarName, "disabled by config");
return false; return false;
} }
if (master.CommandsService.myConfig.GetOnlyMasterAvs() == false) if (master.CommandsService.myConfig.GetEnableMasterControls() == false)
{ {
// master avatars list is not enabled. unable to continue // master avatars list is not enabled. unable to continue
jsonOuput(false, sourceName, avatarName, "masters AV list is disabled"); jsonOuput(false, sourceName, avatarName, "masters AV list is disabled");