diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp index ccf55d54b..1a5c9fff3 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp @@ -728,6 +728,30 @@ bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias) return true; } +//---------------------------------------------------------------------------- +bool CGuild::processGuildMissionEvent(std::list< CMissionEvent *> & eventList, TAIAlias missionAlias) +{ + return true; +} + +//---------------------------------------------------------------------------- +bool CGuild::processGuildMissionStepEvent(std::list< CMissionEvent*> & eventList, TAIAlias missionAlias, uint32 stepIndex) +{ + return true; +} + +//---------------------------------------------------------------------------- +CMissionGuild* CGuild::getMissionByAlias( TAIAlias missionAlias ) +{ + const uint size = (uint)_Missions.size(); + for ( uint i = 0; i < size; i++ ) + { + if ( _Missions[i] && _Missions[i]->getTemplateId() == missionAlias ) + return _Missions[i]; + } + return NULL; +} + //---------------------------------------------------------------------------- bool CGuild::isMissionSuccessfull(TAIAlias alias) { diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild.h index 342174ebb..b3b8e4e01 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild.h @@ -190,6 +190,9 @@ public: void removeMission( uint idx, TMissionResult result); void addSuccessfulMission(CMissionTemplate * templ); bool processMissionEvent( CMissionEvent & event, TAIAlias alias = CAIAliasTranslator::Invalid); + bool processGuildMissionEvent(std::list< CMissionEvent * > & eventList, TAIAlias missionAlias ); + bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex); + CMissionGuild* getMissionByAlias( TAIAlias missionAlias ); bool isMissionSuccessfull(TAIAlias alias); ///\return the mission inline std::vector & getMissions() diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index a70762816..b70eb3b88 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -10708,6 +10708,7 @@ void CCharacter::acceptExchange(uint8 exchangeId) } CTeam * team = TeamManager.getRealTeam( _TeamId ); + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); if (_BotGift == NULL) { nlwarning("Player %s has no bot gift", _Id.toString().c_str()); @@ -10731,6 +10732,15 @@ void CCharacter::acceptExchange(uint8 exchangeId) } mission = team->getMissionByAlias( missionAlias ); } + else if (type == MISSION_DESC::Guild) + { + if (guild == NULL) + { + nlwarning("CCharacter::acceptExchange : character %s -> no guild",_Id.toString().c_str() ); + return; + } + mission = guild->getMissionByAlias( missionAlias ); + } vector vect; vector exchangePlayerPets; @@ -10764,6 +10774,8 @@ void CCharacter::acceptExchange(uint8 exchangeId) processMissionStepUserEvent( eventList,missionAlias,stepIndex ); else if ( type == MISSION_DESC::Group ) team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex ); + else if ( type == MISSION_DESC::Guild ) + guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex ); eventList.pop_front(); for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it ) processMissionEvent(*(*it)); @@ -10783,6 +10795,8 @@ void CCharacter::acceptExchange(uint8 exchangeId) processMissionStepUserEvent( eventList,missionAlias,stepIndex ); else if ( type == MISSION_DESC::Group ) team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex ); + else if ( type == MISSION_DESC::Guild ) + guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex ); eventList.pop_front(); for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it ) processMissionEvent(*(*it)); @@ -11615,7 +11629,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis bool processed = false; bool firstEvent = true; - CGuild * guild = NULL; + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); while ( !eventList.empty() ) { bool eventProcessed = false; @@ -11652,6 +11666,13 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis eventProcessed = team->processTeamMissionEvent(eventList, alias); } + // THIRD - Check with guild missions (if event not already processed and char belongs to a guild) + if (!eventProcessed && (event.Restriction != CMissionEvent::NoGroup)) + { + if (guild != NULL) + eventProcessed = guild->processGuildMissionEvent(eventList, alias); + } + processed |= eventProcessed; // the first event of the list was processed, so we remove it.