//------------------------------------------------------------------------
IMPLEMENT_RMI(CItem, SvRequestAttachAccessory)
{
	if (IInventory *pInventory=GetActorInventory(GetOwnerActor()))
	{
		char accessoryName[129] = {0};
		bool result = g_pGame->GetIGameFramework()->GetNetworkSafeClassName(accessoryName, 128, params.accessoryClassId);

#if !defined(_RELEASE)
	if(!result)
	{
		char errorMsg[256];
		sprintf(errorMsg, "CItem::SvRequestAttachAccessory failed to find network safe class name for id %d", params.accessoryClassId);
		CRY_ASSERT_MESSAGE(result, errorMsg);
	}
#endif

		if (accessoryName[0] != '\0' && pInventory->GetCountOfClass(accessoryName)>0)
		{
			DoSwitchAccessory(accessoryName);
			GetGameObject()->InvokeRMI(ClAttachAccessory(), params, eRMI_ToAllClients|eRMI_NoLocalCalls);

			return true;
		}
	}
	
	return true; // set this to false later
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CItem, SvRequestAttachAccessory)
{
	if (IInventory *pInventory = GetActorInventory(GetOwnerActor()))
	{
		if (pInventory->GetCountOfClass(params.accessory.c_str()) > 0)
		{
			DoSwitchAccessory(params.accessory.c_str());
			GetGameObject()->InvokeRMI(ClAttachAccessory(), params, eRMI_ToAllClients | eRMI_NoLocalCalls);
			return true;
		}
	}

	return true; // set this to false later
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CItem, ClAttachInitialAccessory)
{
	char accessoryName[129] = {0};
	bool result = g_pGame->GetIGameFramework()->GetNetworkSafeClassName(accessoryName, 128, params.accessoryClassId);

#if !defined(_RELEASE)
	if(!result)
	{
		char errorMsg[256];
		sprintf(errorMsg, "CItem::ClAttachAccessory failed to find network safe class name for id %d", params.accessoryClassId);
		CRY_ASSERT_MESSAGE(result, errorMsg);
	}
#endif

	DoSwitchAccessory(accessoryName, true);

	return true;
}
Esempio n. 4
0
//------------------------------------------------------------------------
IMPLEMENT_RMI(CItem, ClAttachAccessory)
{
	DoSwitchAccessory(params.accessory.c_str());

	return true;
}