Exemplo n.º 1
0
// static
void LLFloaterPay::payViaObject(money_callback callback, const LLUUID& object_id)
{
	LLViewerObject* object = gObjectList.findObject(object_id);
	if (!object) return;
	
	LLFloaterPay *floater = new LLFloaterPay("Give L$", callback, object_id, TRUE);
	if (!floater) return;

	LLSelectNode* node = floater->mObjectSelection->getFirstRootNode();
	if (!node) 
	{
		//FIXME: notify user object no longer exists
		floater->close();
		return;
	}
	
	LLHost target_region = object->getRegion()->getHost();
	
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_RequestPayPrice);
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addUUIDFast(_PREHASH_ObjectID, object_id);
	msg->sendReliable(target_region);
	msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater);
	
	LLUUID owner_id;
	BOOL is_group = FALSE;
	node->mPermissions->getOwnership(owner_id, is_group);
	
	floater->childSetText("object_name_text",node->mName);

	floater->finishPayUI(owner_id, is_group);
}
Exemplo n.º 2
0
// static
void LLFloaterPay::payViaObject(money_callback callback, LLSafeHandle<LLObjectSelection> selection)
{
	// Object that lead to the selection, may be child
	LLViewerObject* object = selection->getPrimaryObject();
	if (!object)
		return;
	
	LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_object", LLSD(object->getID()));
	if (!floater)
		return;
	
	floater->setCallback(callback);
	// Hold onto the selection until we close
	floater->mObjectSelection = selection;

	LLSelectNode* node = selection->getFirstRootNode();
	if (!node) 
	{
		//FIXME: notify user object no longer exists
		floater->closeFloater();
		return;
	}
	
	LLHost target_region = object->getRegion()->getHost();
	
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_RequestPayPrice);
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
	msg->sendReliable(target_region);
	msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater);
	
	LLUUID owner_id;
	BOOL is_group = FALSE;
	node->mPermissions->getOwnership(owner_id, is_group);
	
	floater->childSetText("object_name_text",node->mName);

	floater->finishPayUI(owner_id, is_group);
}