if the AuthBuyerID is set to the bot the min price can now be zero

This commit is contained in:
Madpeter 2022-02-10 07:20:05 +00:00
parent 3dc3499a8c
commit cfaa72b2a9

View file

@ -457,11 +457,20 @@ namespace BetterSecondBot.HttpService
{ {
return Failure(tests.Value, "ParcelBuy", new [] { amount }); return Failure(tests.Value, "ParcelBuy", new [] { amount });
} }
if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID))
{
return Failure("Parcel sale locked to other avatars", "ParcelBuy", new[] { amount });
}
int minAmount = 1;
if (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID)
{
minAmount = 0;
}
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", "ParcelBuy", new [] { amount });
} }
if (amountvalue < 1) if (amountvalue < minAmount)
{ {
return Failure("Invaild amount", "ParcelBuy", new [] { amount }); return Failure("Invaild amount", "ParcelBuy", new [] { amount });
}; };
@ -469,10 +478,6 @@ namespace BetterSecondBot.HttpService
{ {
return Failure("Parcel not for sale", "ParcelBuy", new [] { amount }); return Failure("Parcel not for sale", "ParcelBuy", new [] { amount });
} }
if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID))
{
return Failure("Parcel sale locked to other avatars", "ParcelBuy", 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", "ParcelBuy", new [] { amount });