diff --git a/Core/Commands/Parcel/SetParcelSale.cs b/Core/Commands/Parcel/SetParcelSale.cs new file mode 100644 index 0000000..2e06f32 --- /dev/null +++ b/Core/Commands/Parcel/SetParcelSale.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; +using BetterSecondBotShared.logs; +using BetterSecondBotShared.Static; +using OpenMetaverse; + +namespace BSB.Commands.CMD_Parcel +{ + + public class SetParcelSale : CoreCommand + { + public override string[] ArgTypes { get { return new[] { "Number" }; } } + public override string[] ArgHints { get { return new[] { "L$ amount to mark the parcel for sale as" }; } } + public override int MinArgs { get { return 1; } } + + public override string Helpfile { get { return "Sets the current parcel for sale for L$[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); + Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid]; + if (parcel_static.has_parcel_perm(p, bot) == true) + { + if (int.TryParse(args[0], out int price) == true) + { + if (price >= 1) + { + if (price <= 99999) + { + p.SalePrice = price; + p.Update(bot.GetClient.Network.CurrentSim, false); + return true; + } + else + { + return Failed("Price must be 99999 or less"); + } + } + else + { + return Failed("Price must be 1 or more"); + } + } + else + { + return Failed("Unable to process price"); + } + } + else + { + return Failed("Incorrect perms to control parcel"); + } + } + return false; + } + } +}