Changed: #1304: Implementation of the "guild" parameter for the "recv_fame" action

--HG--
branch : gsoc2011-guildmissions
hg/feature/gsoc2012-fabien
Fabien_HENON 14 years ago
parent af4d2d6236
commit cb6b4ac917

@ -1813,15 +1813,57 @@ class CMissionActionRecvFame : public IMissionAction
LOGMISSIONACTION("recv_fame"); LOGMISSIONACTION("recv_fame");
std::vector<TDataSetRow> entities; std::vector<TDataSetRow> entities;
instance->getEntities(entities); instance->getEntities(entities);
for ( uint i = 0; i < entities.size(); i++ )
// If there is no "guild" parameter we give the fame to every user
if (!_Guild)
{ {
CEntityId eid = TheDataset.getEntityId(entities[i]);
CFameInterface::getInstance().addFameIndexed(eid, _Faction, _Value, true);
// Make the client refresh the icons on mission giver NPCs, at once for ( uint i = 0; i < entities.size(); i++ )
CCharacter *character = PlayerManager.getChar(entities[i]); {
if (character) CEntityId eid = TheDataset.getEntityId(entities[i]);
character->sendEventForMissionAvailabilityCheck(); CFameInterface::getInstance().addFameIndexed(eid, _Faction, _Value, true);
// Make the client refresh the icons on mission giver NPCs, at once
CCharacter *character = PlayerManager.getChar(entities[i]);
if (character)
character->sendEventForMissionAvailabilityCheck();
}
}
// Else we just give it to the guild
else
{
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)
{
CFameInterface::getInstance().addFameIndexed(guild->getEId(), _Faction, _Value, true);
}
else
{
LOGMISSIONACTION("recv_fame : 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++ )
{
// Make the client refresh the icons on mission giver NPCs, at once
CCharacter *character = PlayerManager.getChar(entities[i]);
if (character)
character->sendEventForMissionAvailabilityCheck();
}
} }
}; };

Loading…
Cancel
Save