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