shared codeblock updates
This commit is contained in:
parent
1ff8fd7228
commit
a4deb6857a
9 changed files with 190 additions and 334 deletions
|
|
@ -8,7 +8,7 @@ using OpenMetaverse;
|
|||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class AbandonLand : CoreCommand
|
||||
public class AbandonLand : ParcelCommand_RequirePerms
|
||||
{
|
||||
public override string Helpfile { get { return "Abandons the parcel the bot is currently on, returning it to Linden's or Estate owner"; } }
|
||||
|
||||
|
|
@ -16,24 +16,8 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, targetparcel.LocalID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,26 +8,15 @@ using OpenMetaverse;
|
|||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class GetParcelDesc : CoreCommand
|
||||
public class GetParcelDesc : ParcelCommand_CheckParcel_1arg_smart
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Smart"}; } }
|
||||
public override string[] ArgHints { get { return new[] { "Smart reply [Channel|Avatar|http url]" }; } }
|
||||
public override int MinArgs { get { return 1; } }
|
||||
public override string Helpfile { get { return "Fetchs the current parcels desc and sends it to the smart reply target on [ARG 1]"; } }
|
||||
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], bot.GetClient.Network.CurrentSim.Parcels[localid].Desc, CommandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], targetparcel.Desc, CommandName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,26 +8,15 @@ using OpenMetaverse;
|
|||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class GetParcelName : CoreCommand
|
||||
public class GetParcelName : ParcelCommand_CheckParcel_1arg_smart
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Smart"}; } }
|
||||
public override string[] ArgHints { get { return new[] { "Smart reply [Channel|Avatar|http url]" }; } }
|
||||
public override int MinArgs { get { return 1; } }
|
||||
public override string Helpfile { get { return "Fetchs the current parcels name and sends it to the smart reply target on [ARG 1]"; } }
|
||||
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], bot.GetClient.Network.CurrentSim.Parcels[localid].Name, CommandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], targetparcel.Name, CommandName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Text;
|
|||
|
||||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
class ParcelBuy : CoreCommand
|
||||
class ParcelBuy : ParcelCommand_CheckParcel
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Number" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "expected price to pay" }; } }
|
||||
|
|
@ -16,28 +16,19 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
int expected_price = -1;
|
||||
if (args.Length == 1)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
int expected_price = -1;
|
||||
if (args.Length == 1)
|
||||
{
|
||||
int.TryParse(args[0], out expected_price);
|
||||
}
|
||||
if ((p.SalePrice == expected_price) || (expected_price == -1))
|
||||
{
|
||||
bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, localid, false, UUID.Zero, false, p.Area, p.SalePrice);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Expected price is not -1 or matchs: " + expected_price.ToString() + "");
|
||||
}
|
||||
int.TryParse(args[0], out expected_price);
|
||||
}
|
||||
if ((targetparcel.SalePrice == expected_price) || (expected_price == -1))
|
||||
{
|
||||
bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, false, UUID.Zero, false, targetparcel.Area, targetparcel.SalePrice);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
return Failed("Expected price is not -1 or matchs: " + expected_price.ToString() + "");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,54 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using BetterSecondBotShared.logs;
|
||||
using BetterSecondBotShared.Static;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class ParcelDeedToGroup : CoreCommand
|
||||
public class ParcelDeedToGroup : ParcelCommand_RequirePerms_1arg_Group
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "UUID" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "Group UUID" }; } }
|
||||
public override int MinArgs { get { return 1; } }
|
||||
|
||||
public override string Helpfile { get { return "transfers the current parcel ownership to a group"; } }
|
||||
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
if (UUID.TryParse(args[0], out UUID groupuuid) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
p.GroupID = groupuuid;
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
Thread.Sleep(1000);
|
||||
bot.GetClient.Parcels.DeedToGroup(bot.GetClient.Network.CurrentSim, localid, groupuuid);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to process group uuid");
|
||||
}
|
||||
targetparcel.GroupID = groupuuid;
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
Thread.Sleep(1000);
|
||||
bot.GetClient.Parcels.DeedToGroup(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, groupuuid);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
|
||||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
class ParcelReturnTargeted : CoreCommand
|
||||
class ParcelReturnTargeted : ParcelCommand_RequirePerms
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Avatar" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "Avatar [UUID or Firstname Lastname]" }; } }
|
||||
|
|
@ -18,24 +18,8 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (UUID.TryParse(args[0], out UUID avatarUUID) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, localid, ObjectReturnType.None, new List<UUID>() { avatarUUID });
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Parcel perm check failed");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List<UUID>() { avatarUUID });
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Text;
|
|||
|
||||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
class ParcelSetMedia : CoreCommand
|
||||
class ParcelSetMedia : ParcelCommand_RequirePerms
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Flag [Repeatable]" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "See flags table" }; } }
|
||||
|
|
@ -17,171 +17,155 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
bool all_flags_ok = true;
|
||||
string why_failed = "";
|
||||
int loop = 1;
|
||||
foreach (string A in args)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
bool format_failed = false;
|
||||
string[] bits = A.Split('=');
|
||||
if (bits.Length == 2)
|
||||
{
|
||||
bool all_flags_ok = true;
|
||||
string why_failed = "";
|
||||
int loop = 1;
|
||||
foreach (string A in args)
|
||||
switch (bits[0])
|
||||
{
|
||||
bool format_failed = false;
|
||||
string[] bits = A.Split('=');
|
||||
if (bits.Length == 2)
|
||||
{
|
||||
switch (bits[0])
|
||||
case "MediaType":
|
||||
{
|
||||
case "MediaType":
|
||||
{
|
||||
if (bits[1] == "IMG-PNG")
|
||||
{
|
||||
p.Media.MediaType = "image/png";
|
||||
}
|
||||
else if (bits[1] == "IMG-JPG")
|
||||
{
|
||||
p.Media.MediaType = "image/jpeg";
|
||||
}
|
||||
else if (bits[1] == "VID-MP4")
|
||||
{
|
||||
p.Media.MediaType = "video/mp4";
|
||||
}
|
||||
else if (bits[1] == "VID-AVI")
|
||||
{
|
||||
p.Media.MediaType = "video/x-msvideo";
|
||||
}
|
||||
else if (bits[1].StartsWith("Custom-") == true)
|
||||
{
|
||||
string mime = bits[1];
|
||||
mime = mime.Replace("Custom-", "");
|
||||
p.Media.MediaType = mime;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaWidth":
|
||||
case "MediaHeight":
|
||||
{
|
||||
if (int.TryParse(bits[1], out int size) == true)
|
||||
{
|
||||
if ((size >= 256) || (size <= 1024))
|
||||
{
|
||||
if (bits[0] == "MediaHeight")
|
||||
{
|
||||
p.Media.MediaHeight = size;
|
||||
}
|
||||
else if (bits[0] == "MediaWidth")
|
||||
{
|
||||
p.Media.MediaWidth = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true; // not sure how this happened
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaID":
|
||||
{
|
||||
if (UUID.TryParse(bits[1], out UUID texture) == true)
|
||||
{
|
||||
p.Media.MediaID = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaURL":
|
||||
{
|
||||
p.Media.MediaURL = bits[1];
|
||||
break;
|
||||
}
|
||||
case "MediaDesc":
|
||||
{
|
||||
p.Media.MediaDesc = bits[1];
|
||||
break;
|
||||
}
|
||||
case "MediaAutoScale":
|
||||
{
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
p.Media.MediaAutoScale = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaLoop":
|
||||
{
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
p.Media.MediaLoop = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
why_failed = "Arg:" + loop.ToString() + " is not a supported media option!";
|
||||
all_flags_ok = false;
|
||||
break;
|
||||
}
|
||||
if (bits[1] == "IMG-PNG")
|
||||
{
|
||||
targetparcel.Media.MediaType = "image/png";
|
||||
}
|
||||
else if (bits[1] == "IMG-JPG")
|
||||
{
|
||||
targetparcel.Media.MediaType = "image/jpeg";
|
||||
}
|
||||
else if (bits[1] == "VID-MP4")
|
||||
{
|
||||
targetparcel.Media.MediaType = "video/mp4";
|
||||
}
|
||||
else if (bits[1] == "VID-AVI")
|
||||
{
|
||||
targetparcel.Media.MediaType = "video/x-msvideo";
|
||||
}
|
||||
else if (bits[1].StartsWith("Custom-") == true)
|
||||
{
|
||||
string mime = bits[1];
|
||||
mime = mime.Replace("Custom-", "");
|
||||
targetparcel.Media.MediaType = mime;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaWidth":
|
||||
case "MediaHeight":
|
||||
{
|
||||
if (int.TryParse(bits[1], out int size) == true)
|
||||
{
|
||||
if ((size >= 256) || (size <= 1024))
|
||||
{
|
||||
if (bits[0] == "MediaHeight")
|
||||
{
|
||||
targetparcel.Media.MediaHeight = size;
|
||||
}
|
||||
else if (bits[0] == "MediaWidth")
|
||||
{
|
||||
targetparcel.Media.MediaWidth = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true; // not sure how this happened
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaID":
|
||||
{
|
||||
if (UUID.TryParse(bits[1], out UUID texture) == true)
|
||||
{
|
||||
targetparcel.Media.MediaID = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaURL":
|
||||
{
|
||||
targetparcel.Media.MediaURL = bits[1];
|
||||
break;
|
||||
}
|
||||
case "MediaDesc":
|
||||
{
|
||||
targetparcel.Media.MediaDesc = bits[1];
|
||||
break;
|
||||
}
|
||||
case "MediaAutoScale":
|
||||
{
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
targetparcel.Media.MediaAutoScale = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaLoop":
|
||||
{
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
targetparcel.Media.MediaLoop = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
why_failed = "Arg:" + loop.ToString() + " is not a supported media option!";
|
||||
all_flags_ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
if (format_failed == true)
|
||||
{
|
||||
why_failed = "Arg:" + loop.ToString() + " Not formated correctly";
|
||||
all_flags_ok = false;
|
||||
}
|
||||
if (all_flags_ok == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
loop++;
|
||||
}
|
||||
if (all_flags_ok == true)
|
||||
{
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed(why_failed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Do not have expected perms for this parcel!");
|
||||
format_failed = true;
|
||||
}
|
||||
if (format_failed == true)
|
||||
{
|
||||
why_failed = "Arg:" + loop.ToString() + " Not formated correctly";
|
||||
all_flags_ok = false;
|
||||
}
|
||||
if (all_flags_ok == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
loop++;
|
||||
}
|
||||
if (all_flags_ok == true)
|
||||
{
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
return Failed(why_failed);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using OpenMetaverse;
|
|||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class SetParcelDesc : CoreCommand
|
||||
public class SetParcelDesc : ParcelCommand_RequirePerms
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "String" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "The new desc" }; } }
|
||||
|
|
@ -19,25 +19,9 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
p.Desc = args[0];
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
targetparcel.Desc = args[0];
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using OpenMetaverse;
|
|||
namespace BSB.Commands.CMD_Parcel
|
||||
{
|
||||
|
||||
public class SetParcelSale : CoreCommand
|
||||
public class SetParcelSale : ParcelCommand_RequirePerms
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Number","Avatar" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "L$ amount to mark the parcel for sale as (Range: 1 to 99999 unless [ARG 2] is set)", "Avatar who can buy the land (If set allows you to set the sell price to zero)" }; } }
|
||||
|
|
@ -20,57 +20,41 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
if (int.TryParse(args[0], out int price) == true)
|
||||
{
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
UUID target_buyer = UUID.Zero;
|
||||
int low_limit = 1;
|
||||
if (args.Length == 2)
|
||||
{
|
||||
if (int.TryParse(args[0], out int price) == true)
|
||||
if (UUID.TryParse(args[1], out target_buyer) == true)
|
||||
{
|
||||
UUID target_buyer = UUID.Zero;
|
||||
int low_limit = 1;
|
||||
if (args.Length == 2)
|
||||
{
|
||||
if (UUID.TryParse(args[1], out target_buyer) == true)
|
||||
{
|
||||
low_limit = 0;
|
||||
}
|
||||
}
|
||||
if (price >= low_limit)
|
||||
{
|
||||
if (price <= 99999)
|
||||
{
|
||||
p.SalePrice = price;
|
||||
p.AuthBuyerID = target_buyer;
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, p, true);
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, p, false);
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Price must be 99999 or less");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Price must be " + low_limit.ToString() + " or more");
|
||||
}
|
||||
low_limit = 0;
|
||||
}
|
||||
}
|
||||
if (price >= low_limit)
|
||||
{
|
||||
if (price <= 99999)
|
||||
{
|
||||
targetparcel.SalePrice = price;
|
||||
targetparcel.AuthBuyerID = target_buyer;
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true);
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false);
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to process price");
|
||||
return Failed("Price must be 99999 or less");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
return Failed("Price must be " + low_limit.ToString() + " or more");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
return Failed("Unable to process price");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue