mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
Changed: #1304: Implementation of the "guild" parameter for the "recv_named_item" action
This commit is contained in:
parent
42adc7f469
commit
2558e79ea1
1 changed files with 114 additions and 57 deletions
|
@ -975,7 +975,7 @@ class CMissionActionRecvNamedItem : public IMissionAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !_Group )
|
else if ( !_Group && !_Guild)
|
||||||
{
|
{
|
||||||
CCharacter * user = PlayerManager.getChar( entities[0] );
|
CCharacter * user = PlayerManager.getChar( entities[0] );
|
||||||
CTeam * team = TeamManager.getRealTeam(user->getTeamId());
|
CTeam * team = TeamManager.getRealTeam(user->getTeamId());
|
||||||
|
@ -986,6 +986,62 @@ class CMissionActionRecvNamedItem : 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the item to inventory
|
||||||
|
CGameItemPtr item = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity);
|
||||||
|
if (item == NULL)
|
||||||
|
{
|
||||||
|
LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!guild->putItem(item))
|
||||||
|
{
|
||||||
|
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() );
|
||||||
|
if ( templ )
|
||||||
|
{
|
||||||
|
if ( templ->Tags.FailIfInventoryIsFull )
|
||||||
|
{
|
||||||
|
instance->setProcessingState(CMission::ActionFailed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( uint i = 0; i < entities.size(); i++ )
|
||||||
|
{
|
||||||
|
CCharacter * user = PlayerManager.getChar( entities[i] );
|
||||||
|
if ( user )
|
||||||
|
{
|
||||||
|
SM_STATIC_PARAMS_2(params, STRING_MANAGER::dyn_string_id, STRING_MANAGER::integer);
|
||||||
|
params[0].StringId = item->sendNameId(user);
|
||||||
|
params[1].Int = _Quantity;
|
||||||
|
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_NAMED_ITEM", params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// check free room space in inventory
|
// check free room space in inventory
|
||||||
// NB : in case of group, fail happens only if noone in the group have enough free space
|
// NB : in case of group, fail happens only if noone in the group have enough free space
|
||||||
CGameItemPtr itemTmp = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity);
|
CGameItemPtr itemTmp = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity);
|
||||||
|
@ -1068,6 +1124,7 @@ class CMissionActionRecvNamedItem : public IMissionAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
std::string _NamedItem;
|
std::string _NamedItem;
|
||||||
uint16 _Quantity;
|
uint16 _Quantity;
|
||||||
|
|
Loading…
Reference in a new issue