mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-12 02:09:46 +00:00
Changed: #1304: Implementation of the cbClientGroupAbandonMission for the guilds
This commit is contained in:
parent
4a2a66b03d
commit
bdbd53266e
3 changed files with 112 additions and 33 deletions
|
@ -35,6 +35,7 @@
|
||||||
#include "primitives_parser.h"
|
#include "primitives_parser.h"
|
||||||
#include "modules/shard_unifier_client.h"
|
#include "modules/shard_unifier_client.h"
|
||||||
#include "mission_manager/mission_manager.h"
|
#include "mission_manager/mission_manager.h"
|
||||||
|
#include "phrase_manager/phrase_utilities_functions.h"
|
||||||
|
|
||||||
/// todo guild remove entity id translator
|
/// todo guild remove entity id translator
|
||||||
#include "nel/misc/eid_translator.h"
|
#include "nel/misc/eid_translator.h"
|
||||||
|
@ -745,6 +746,22 @@ void CGuild::updateMissionHistories(TAIAlias missionAlias, uint32 result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void CGuild::sendDynamicMessageToMembers(const string &msgName, const TVectorParamCheck ¶ms, const set<CEntityId> &excluded) const
|
||||||
|
{
|
||||||
|
for ( std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::const_iterator it = getMembersBegin();
|
||||||
|
it != getMembersEnd();++it )
|
||||||
|
{
|
||||||
|
CCharacter * user = PlayerManager.getChar( it->first );
|
||||||
|
|
||||||
|
if ( excluded.find(it->first) == excluded.end())
|
||||||
|
{
|
||||||
|
const uint32 stringId = STRING_MANAGER::sendStringToClient(TheDataset.getDataSetRow(it->first), msgName, params );
|
||||||
|
PHRASE_UTILITIES::sendDynamicSystemMessage(TheDataset.getDataSetRow(it->first), stringId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
|
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
|
||||||
{
|
{
|
||||||
|
|
|
@ -200,6 +200,7 @@ public:
|
||||||
bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex);
|
bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex);
|
||||||
CMissionGuild* getMissionByAlias( TAIAlias missionAlias );
|
CMissionGuild* getMissionByAlias( TAIAlias missionAlias );
|
||||||
bool isMissionSuccessfull(TAIAlias alias);
|
bool isMissionSuccessfull(TAIAlias alias);
|
||||||
|
void sendDynamicMessageToMembers(const std::string &msgName, const TVectorParamCheck ¶ms, const std::set<NLMISC::CEntityId> &excluded) const;
|
||||||
///\return the mission
|
///\return the mission
|
||||||
inline std::vector<CMissionGuild*> & getMissions()
|
inline std::vector<CMissionGuild*> & getMissions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#include "team_manager/team_manager.h"
|
#include "team_manager/team_manager.h"
|
||||||
#include "mission_manager/mission_team.h"
|
#include "mission_manager/mission_team.h"
|
||||||
#include "mission_manager/mission_log.h"
|
#include "mission_manager/mission_log.h"
|
||||||
|
#include "guild_manager/guild_manager.h"
|
||||||
|
#include "guild_manager/guild.h"
|
||||||
|
#include "guild_manager/guild_member.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -222,6 +225,12 @@ void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &ser
|
||||||
CCharacter * user = PlayerManager.getChar( userId );
|
CCharacter * user = PlayerManager.getChar( userId );
|
||||||
|
|
||||||
user->setAfkState(false);
|
user->setAfkState(false);
|
||||||
|
|
||||||
|
// We check if it's a guild or team mission
|
||||||
|
if (index < MaxGroupMissionCount)
|
||||||
|
{
|
||||||
|
// Team
|
||||||
|
|
||||||
CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
|
CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
|
||||||
if ( !team )
|
if ( !team )
|
||||||
{
|
{
|
||||||
|
@ -266,6 +275,58 @@ void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &ser
|
||||||
team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded );
|
team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded );
|
||||||
}
|
}
|
||||||
team->removeMission( index, mr_abandon );
|
team->removeMission( index, mr_abandon );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Guild
|
||||||
|
// We set the correct index
|
||||||
|
index = MaxGroupMissionCount - index;
|
||||||
|
|
||||||
|
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() );
|
||||||
|
if ( !guild )
|
||||||
|
{
|
||||||
|
MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( guild->getLeader()->getIngameEId() != userId )
|
||||||
|
{
|
||||||
|
CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( index >= guild->getMissions().size() )
|
||||||
|
{
|
||||||
|
MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )",
|
||||||
|
userId.toString().c_str(), index, guild->getMissions().size());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CMissionGuild* mission = guild->getMissions()[index];
|
||||||
|
nlassert(mission);
|
||||||
|
|
||||||
|
if ( mission->getFinished() == false )
|
||||||
|
{
|
||||||
|
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
|
||||||
|
if ( !templ )
|
||||||
|
{
|
||||||
|
MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u",
|
||||||
|
userId.toString().c_str(), mission->getTemplateId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( templ->Tags.NonAbandonnable )
|
||||||
|
{
|
||||||
|
MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it",
|
||||||
|
userId.toString().c_str(), mission->getTemplateId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
set<CEntityId> excluded;
|
||||||
|
excluded.insert( userId );
|
||||||
|
|
||||||
|
guild->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded );
|
||||||
|
}
|
||||||
|
guild->removeMission( index, mr_abandon );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue