|
|
|
@ -617,7 +617,7 @@ class CMissionActionRecvItem : public IMissionAction
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( !_Group )
|
|
|
|
|
else if ( !_Group && !_Guild)
|
|
|
|
|
{
|
|
|
|
|
CCharacter * user = PlayerManager.getChar( entities[0] );
|
|
|
|
|
CTeam * team = TeamManager.getRealTeam(user->getTeamId());
|
|
|
|
@ -628,7 +628,111 @@ class CMissionActionRecvItem : public IMissionAction
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the case we want to give the item to the guild
|
|
|
|
|
if (_Guild)
|
|
|
|
|
{
|
|
|
|
|
if (entities.size() == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CCharacter * user = PlayerManager.getChar( entities[0] );
|
|
|
|
|
if (!user)
|
|
|
|
|
{
|
|
|
|
|
LOGMISSIONACTION("recv_fame : Invalid user");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId());
|
|
|
|
|
if (!guild)
|
|
|
|
|
{
|
|
|
|
|
LOGMISSIONACTION("recv_fame : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SM_STATIC_PARAMS_3(params, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer);
|
|
|
|
|
if ( _SheetId != CSheetId::Unknown )
|
|
|
|
|
{
|
|
|
|
|
const CStaticItem * form = CSheets::getForm( _SheetId );
|
|
|
|
|
if ( !form )
|
|
|
|
|
{
|
|
|
|
|
LOGMISSIONACTION("sheetId '" + _SheetId.toString() + "' is unknown");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (form->Family != ITEMFAMILY::MISSION_ITEM)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
uint quantity = _Quantity;
|
|
|
|
|
while (quantity > 0)
|
|
|
|
|
{
|
|
|
|
|
CGameItemPtr item = user->createItem(_Quality, quantity, _SheetId);
|
|
|
|
|
if (item == NULL)
|
|
|
|
|
break;
|
|
|
|
|
const uint32 stackSize = item->getStackSize();
|
|
|
|
|
|
|
|
|
|
if (!guild->putItem(item))
|
|
|
|
|
{
|
|
|
|
|
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() );
|
|
|
|
|
if ( templ )
|
|
|
|
|
{
|
|
|
|
|
if ( templ->Tags.FailIfInventoryIsFull )
|
|
|
|
|
{
|
|
|
|
|
instance->setProcessingState(CMission::ActionFailed);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// from here item maybe NULL (because of autostack)
|
|
|
|
|
|
|
|
|
|
quantity -= stackSize;
|
|
|
|
|
}
|
|
|
|
|
params[2].Int = _Quality;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const CStaticItem * form = CSheets::getForm( _Item.getSheetId() );
|
|
|
|
|
if ( !form )
|
|
|
|
|
{
|
|
|
|
|
LOGMISSIONACTION("sheetId '" + _Item.getSheetId().toString() + "' is unknown");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
uint quantity = _Quantity;
|
|
|
|
|
while (quantity > 0)
|
|
|
|
|
{
|
|
|
|
|
CGameItemPtr item = _Item.createItem(quantity);
|
|
|
|
|
if (item == NULL)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const uint32 stackSize = item->getStackSize();
|
|
|
|
|
if (!guild->putItem(item))
|
|
|
|
|
{
|
|
|
|
|
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() );
|
|
|
|
|
if ( templ )
|
|
|
|
|
{
|
|
|
|
|
if ( templ->Tags.FailIfInventoryIsFull )
|
|
|
|
|
{
|
|
|
|
|
instance->setProcessingState(CMission::ActionFailed);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// from here item maybe NULL (because of autostack)
|
|
|
|
|
|
|
|
|
|
quantity -= stackSize;
|
|
|
|
|
}
|
|
|
|
|
params[2].Int = _Item.getQuality();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
params[0].SheetId = _SheetId;
|
|
|
|
|
params[1].Int = _Quantity;
|
|
|
|
|
|
|
|
|
|
for ( uint i = 0; i < entities.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
CCharacter * user = PlayerManager.getChar( entities[i] );
|
|
|
|
|
if ( user )
|
|
|
|
|
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_ITEM", params);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// check free room space in inventory
|
|
|
|
|
// NB : in case of group, fail happens only if none in the group have enough free space
|
|
|
|
|
sint16 neededSlotCount = 0;
|
|
|
|
@ -647,7 +751,6 @@ class CMissionActionRecvItem : public IMissionAction
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool fail = true;
|
|
|
|
|
for ( uint i = 0; i < entities.size(); i++ )
|
|
|
|
|
{
|
|
|
|
@ -765,6 +868,7 @@ class CMissionActionRecvItem : public IMissionAction
|
|
|
|
|
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_ITEM", params);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
CMissionItem _Item;
|
|
|
|
|
uint16 _Quality;
|
|
|
|
|