parcel in memory checks
This commit is contained in:
parent
3c572a2682
commit
1e4d916e5a
15 changed files with 340 additions and 235 deletions
|
|
@ -17,15 +17,22 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, localid);
|
||||
return 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("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,14 @@ namespace BSB.Commands.CMD_Parcel
|
|||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], bot.GetClient.Network.CurrentSim.Parcels[localid].Desc, CommandName);
|
||||
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 false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ namespace BSB.Commands.CMD_Parcel
|
|||
}
|
||||
else
|
||||
{
|
||||
Failed("Enhance your calm");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -20,7 +20,14 @@ namespace BSB.Commands.CMD_Parcel
|
|||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
return bot.GetCommandsInterface.SmartCommandReply(args[0], bot.GetClient.Network.CurrentSim.Parcels[localid].Name, CommandName);
|
||||
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 false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,20 +17,27 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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];
|
||||
int expected_price = -1;
|
||||
if(args.Length == 1)
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
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;
|
||||
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() + "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Expected price is not -1 or matchs: " + expected_price.ToString() + "");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -69,52 +69,59 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (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)
|
||||
{
|
||||
if (price >= 1)
|
||||
if (int.TryParse(args[0], out int price) == true)
|
||||
{
|
||||
if (price <= 99999)
|
||||
if (price >= 1)
|
||||
{
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, localid);
|
||||
p.AuthBuyerID = bot.GetClient.Self.AgentID;
|
||||
p.SalePrice = 0;
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, p, true);
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, p, false);
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
Thread.Sleep(200);
|
||||
bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, localid, false, UUID.Zero, false, p.Area, 0);
|
||||
Thread.Sleep(1000);
|
||||
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
if (price <= 99999)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, localid);
|
||||
p.AuthBuyerID = bot.GetClient.Self.AgentID;
|
||||
p.SalePrice = 0;
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, p, true);
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, p, false);
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
Thread.Sleep(200);
|
||||
bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, localid, false, UUID.Zero, false, p.Area, 0);
|
||||
Thread.Sleep(1000);
|
||||
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to send request for parcel object owners");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to send request for parcel object owners");
|
||||
return Failed("Price must be 99999 or less");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Price must be 99999 or less");
|
||||
return Failed("Price must be 1 or more");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Price must be 1 or more");
|
||||
return Failed("Unable to process price");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to process price");
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -38,14 +38,21 @@ namespace BSB.Commands.CMD_Parcel
|
|||
if (bot.GetCommandsInterface.SmartCommandReply(args[0], "Vaildate", CommandName, true) == true)
|
||||
{
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to await reply");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to await reply");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -21,10 +21,17 @@ namespace BSB.Commands.CMD_Parcel
|
|||
{
|
||||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, localid, ObjectReturnType.List, owner_uuids);
|
||||
base.Callback(args, e, true);
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, localid, ObjectReturnType.List, owner_uuids);
|
||||
base.Callback(args, e, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Callback(args, e, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -42,14 +49,21 @@ 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.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to await reply");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to await reply");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -19,15 +19,22 @@ 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);
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, localid, ObjectReturnType.None, new List<UUID>() { avatarUUID });
|
||||
return 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("Parcel perm check failed");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -18,163 +18,170 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (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)
|
||||
{
|
||||
case "MediaType":
|
||||
{
|
||||
if (bits[1] == "IMG-PNG")
|
||||
switch (bits[0])
|
||||
{
|
||||
case "MediaType":
|
||||
{
|
||||
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[1] == "IMG-PNG")
|
||||
{
|
||||
if (bits[0] == "MediaHeight")
|
||||
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))
|
||||
{
|
||||
p.Media.MediaHeight = size;
|
||||
}
|
||||
else if (bits[0] == "MediaWidth")
|
||||
{
|
||||
p.Media.MediaWidth = size;
|
||||
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; // not sure how this happened
|
||||
format_failed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
case "MediaID":
|
||||
{
|
||||
format_failed = true;
|
||||
if (UUID.TryParse(bits[1], out UUID texture) == true)
|
||||
{
|
||||
p.Media.MediaID = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaID":
|
||||
{
|
||||
if (UUID.TryParse(bits[1], out UUID texture) == true)
|
||||
case "MediaURL":
|
||||
{
|
||||
p.Media.MediaID = texture;
|
||||
p.Media.MediaURL = bits[1];
|
||||
break;
|
||||
}
|
||||
else
|
||||
case "MediaDesc":
|
||||
{
|
||||
format_failed = true;
|
||||
p.Media.MediaDesc = bits[1];
|
||||
break;
|
||||
}
|
||||
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)
|
||||
case "MediaAutoScale":
|
||||
{
|
||||
p.Media.MediaAutoScale = output;
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
p.Media.MediaAutoScale = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
case "MediaLoop":
|
||||
{
|
||||
format_failed = true;
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
{
|
||||
p.Media.MediaLoop = output;
|
||||
}
|
||||
else
|
||||
{
|
||||
format_failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MediaLoop":
|
||||
{
|
||||
if (bool.TryParse(bits[1], out bool output) == true)
|
||||
default:
|
||||
{
|
||||
p.Media.MediaLoop = output;
|
||||
why_failed = "Arg:" + loop.ToString() + " is not a supported media option!";
|
||||
all_flags_ok = false;
|
||||
break;
|
||||
}
|
||||
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
|
||||
{
|
||||
format_failed = true;
|
||||
return Failed(why_failed);
|
||||
}
|
||||
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);
|
||||
return Failed("Do not have expected perms for this parcel!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Do not have expected perms for this parcel!");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -15,29 +15,16 @@ namespace BSB.Commands.CMD_Parcel
|
|||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
if (p.MusicURL != "")
|
||||
if (args.Length == 0)
|
||||
{
|
||||
p.MusicURL = "";
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("No change made");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[0].StartsWith("http") == true)
|
||||
{
|
||||
if (p.MusicURL != args[0])
|
||||
if (p.MusicURL != "")
|
||||
{
|
||||
p.MusicURL = args[0];
|
||||
p.MusicURL = "";
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -48,13 +35,33 @@ namespace BSB.Commands.CMD_Parcel
|
|||
}
|
||||
else
|
||||
{
|
||||
return Failed("Invaild url");
|
||||
if (args[0].StartsWith("http") == true)
|
||||
{
|
||||
if (p.MusicURL != args[0])
|
||||
{
|
||||
p.MusicURL = args[0];
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("No change made");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Invaild url");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Required parcel perms missing!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Required parcel perms missing!");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,16 +20,23 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
p.Name = args[0];
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
p.Name = args[0];
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -20,16 +20,23 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
p.Desc = args[0];
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return 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("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -56,22 +56,29 @@ namespace BSB.Commands.CMD_Parcel
|
|||
if (setflags.Count > 0)
|
||||
{
|
||||
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 (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
||||
{
|
||||
foreach (KeyValuePair<string, bool> cfg in setflags)
|
||||
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
||||
if (parcel_static.has_parcel_perm(p, bot) == true)
|
||||
{
|
||||
if (flags.ContainsKey(cfg.Key) == true)
|
||||
foreach (KeyValuePair<string, bool> cfg in setflags)
|
||||
{
|
||||
parcel_static.ParcelSetFlag(flags[cfg.Key], p, cfg.Value);
|
||||
if (flags.ContainsKey(cfg.Key) == true)
|
||||
{
|
||||
parcel_static.ParcelSetFlag(flags[cfg.Key], p, cfg.Value);
|
||||
}
|
||||
}
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
p.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -21,49 +21,56 @@ namespace BSB.Commands.CMD_Parcel
|
|||
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 (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)
|
||||
{
|
||||
low_limit = 0;
|
||||
if (UUID.TryParse(args[1], out target_buyer) == true)
|
||||
{
|
||||
low_limit = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (price >= low_limit)
|
||||
{
|
||||
if (price <= 99999)
|
||||
if (price >= low_limit)
|
||||
{
|
||||
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;
|
||||
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 99999 or less");
|
||||
return Failed("Price must be " + low_limit.ToString() + " or more");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Price must be "+ low_limit.ToString()+" or more");
|
||||
return Failed("Unable to process price");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Unable to process price");
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Incorrect perms to control parcel");
|
||||
return Failed("Unable to find parcel in memory, please wait and try again");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue