mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 01:18:46 +00:00
Changed: #1304: Implementation of the "guild" parameter for the "recv_money" action
This commit is contained in:
parent
8ec732ece9
commit
0604109b52
1 changed files with 54 additions and 10 deletions
|
@ -1695,6 +1695,11 @@ class CMissionActionRecvMoney : public IMissionAction
|
||||||
|
|
||||||
std::vector<TDataSetRow> entities;
|
std::vector<TDataSetRow> entities;
|
||||||
instance->getEntities(entities);
|
instance->getEntities(entities);
|
||||||
|
|
||||||
|
// If the guild parameter is not set we just divide the money and give it to each entity
|
||||||
|
if (!_Guild)
|
||||||
|
{
|
||||||
|
|
||||||
uint amount = _Amount / (uint)entities.size();
|
uint amount = _Amount / (uint)entities.size();
|
||||||
if ( amount == 0 || _Amount % entities.size() )
|
if ( amount == 0 || _Amount % entities.size() )
|
||||||
amount++;
|
amount++;
|
||||||
|
@ -1709,6 +1714,45 @@ class CMissionActionRecvMoney : public IMissionAction
|
||||||
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_MONEY",params);
|
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_MONEY",params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// Else we give the money to the guild
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (entities.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CCharacter * user = PlayerManager.getChar( entities[0] );
|
||||||
|
if (!user)
|
||||||
|
{
|
||||||
|
LOGMISSIONACTION("recv_money : Invalid user");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId());
|
||||||
|
if (guild)
|
||||||
|
{
|
||||||
|
guild->addMoney(_Amount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGMISSIONACTION("recv_money : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tell everyone some money has been given to the guild
|
||||||
|
for ( uint i = 0; i < entities.size(); i++ )
|
||||||
|
{
|
||||||
|
CCharacter * user = PlayerManager.getChar( entities[i] );
|
||||||
|
if ( user )
|
||||||
|
{
|
||||||
|
SM_STATIC_PARAMS_1(params, STRING_MANAGER::integer);
|
||||||
|
params[0].Int = _Amount;
|
||||||
|
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_MONEY",params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
uint _Amount;
|
uint _Amount;
|
||||||
bool _Guild;
|
bool _Guild;
|
||||||
|
|
Loading…
Reference in a new issue