Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-10-02 20:12:36 +01:00
commit 662976b602
1 changed files with 24 additions and 0 deletions

View File

@ -805,6 +805,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
} }
Scene s = LocateSceneClientIn(remoteClient.AgentId); Scene s = LocateSceneClientIn(remoteClient.AgentId);
// Implmenting base sale data checking here so the default OpenSimulator implementation isn't useless
// combined with other implementations. We're actually validating that the client is sending the data
// that it should. In theory, the client should already know what to send here because it'll see it when it
// gets the object data. If the data sent by the client doesn't match the object, the viewer probably has an
// old idea of what the object properties are. Viewer developer Hazim informed us that the base module
// didn't check the client sent data against the object do any. Since the base modules are the
// 'crowning glory' examples of good practice..
// Validate that the object exists in the scene the user is in
SceneObjectPart part = s.GetSceneObjectPart(localID); SceneObjectPart part = s.GetSceneObjectPart(localID);
if (part == null) if (part == null)
{ {
@ -812,6 +822,20 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
return; return;
} }
// Validate that the client sent the price that the object is being sold for
if (part.SalePrice != salePrice)
{
remoteClient.SendAgentAlertMessage("Cannot buy at this price. Buy Failed. If you continue to get this relog.", false);
return;
}
// Validate that the client sent the proper sale type the object has set
if (part.ObjectSaleType != saleType)
{
remoteClient.SendAgentAlertMessage("Cannot buy this way. Buy Failed. If you continue to get this relog.", false);
return;
}
IBuySellModule module = s.RequestModuleInterface<IBuySellModule>(); IBuySellModule module = s.RequestModuleInterface<IBuySellModule>();
if (module != null) if (module != null)
module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice); module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice);