parcel in memory checks

This commit is contained in:
Madpeter 2020-04-28 05:50:28 +01:00
parent 3c572a2682
commit 1e4d916e5a
15 changed files with 340 additions and 235 deletions

View file

@ -17,6 +17,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)
{
@ -28,6 +30,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Incorrect perms to control parcel");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -20,8 +20,15 @@ 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)
{
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;
}
}

View file

@ -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

View file

@ -20,8 +20,15 @@ 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)
{
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;
}
}

View file

@ -17,13 +17,15 @@ 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];
int expected_price = -1;
if(args.Length == 1)
if (args.Length == 1)
{
int.TryParse(args[0], out expected_price);
}
if((p.SalePrice == expected_price) || (expected_price == -1))
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;
@ -33,6 +35,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Expected price is not -1 or matchs: " + expected_price.ToString() + "");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -69,6 +69,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)
{
@ -117,6 +119,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Incorrect perms to control parcel");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -38,6 +38,8 @@ 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.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
{
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
{
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
@ -49,6 +51,11 @@ namespace BSB.Commands.CMD_Parcel
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
else
{
return Failed("Arg 1 is not a vaild smart target");
}

View file

@ -21,7 +21,9 @@ 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)
{
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);
@ -36,12 +38,19 @@ namespace BSB.Commands.CMD_Parcel
base.Callback(args, e, false);
}
}
else
{
base.Callback(args, e, false);
}
}
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)
{
if (bot.CreateAwaitEventReply("parcelobjectowners", this, args) == true)
{
bot.GetClient.Parcels.RequestObjectOwners(bot.GetClient.Network.CurrentSim, localid);
@ -52,6 +61,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Unable to await reply");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -19,6 +19,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)
{
@ -31,6 +33,11 @@ namespace BSB.Commands.CMD_Parcel
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
else
{
return Failed("Invaild avatar UUID");
}

View file

@ -18,8 +18,10 @@ 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)
if (parcel_static.has_parcel_perm(p, bot) == true)
{
bool all_flags_ok = true;
string why_failed = "";
@ -50,7 +52,7 @@ namespace BSB.Commands.CMD_Parcel
{
p.Media.MediaType = "video/x-msvideo";
}
else if(bits[1].StartsWith("Custom-") == true)
else if (bits[1].StartsWith("Custom-") == true)
{
string mime = bits[1];
mime = mime.Replace("Custom-", "");
@ -117,7 +119,7 @@ namespace BSB.Commands.CMD_Parcel
}
case "MediaAutoScale":
{
if(bool.TryParse(bits[1],out bool output) == true)
if (bool.TryParse(bits[1], out bool output) == true)
{
p.Media.MediaAutoScale = output;
}
@ -151,7 +153,7 @@ namespace BSB.Commands.CMD_Parcel
{
format_failed = true;
}
if(format_failed == true)
if (format_failed == true)
{
why_failed = "Arg:" + loop.ToString() + " Not formated correctly";
all_flags_ok = false;
@ -162,7 +164,7 @@ namespace BSB.Commands.CMD_Parcel
}
loop++;
}
if(all_flags_ok == true)
if (all_flags_ok == true)
{
p.Update(bot.GetClient.Network.CurrentSim, false);
return true;
@ -177,6 +179,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Do not have expected perms for this parcel!");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -15,6 +15,8 @@ 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);
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)
{
@ -57,5 +59,10 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Required parcel perms missing!");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
}
}

View file

@ -20,6 +20,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)
{
@ -32,6 +34,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Incorrect perms to control parcel");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -20,6 +20,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)
{
@ -32,6 +34,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Incorrect perms to control parcel");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}

View file

@ -56,6 +56,8 @@ namespace BSB.Commands.CMD_Parcel
if (setflags.Count > 0)
{
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)
{
@ -75,6 +77,11 @@ namespace BSB.Commands.CMD_Parcel
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
else
{
return Failed("No accepted flags");
}

View file

@ -21,6 +21,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)
{
@ -28,9 +30,9 @@ namespace BSB.Commands.CMD_Parcel
{
UUID target_buyer = UUID.Zero;
int low_limit = 1;
if(args.Length == 2)
if (args.Length == 2)
{
if(UUID.TryParse(args[1],out target_buyer) == true)
if (UUID.TryParse(args[1], out target_buyer) == true)
{
low_limit = 0;
}
@ -53,7 +55,7 @@ namespace BSB.Commands.CMD_Parcel
}
else
{
return Failed("Price must be "+ low_limit.ToString()+" or more");
return Failed("Price must be " + low_limit.ToString() + " or more");
}
}
else
@ -66,6 +68,11 @@ namespace BSB.Commands.CMD_Parcel
return Failed("Incorrect perms to control parcel");
}
}
else
{
return Failed("Unable to find parcel in memory, please wait and try again");
}
}
return false;
}
}