Changed: #1304: Adding guild mission support in functions acceptExchange and processMissionEventList of the CCharacter class
This commit is contained in:
parent
f41994dfff
commit
46b592db13
3 changed files with 49 additions and 1 deletions
|
@ -728,6 +728,30 @@ bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
|
||||||
return true;
|
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)
|
bool CGuild::isMissionSuccessfull(TAIAlias alias)
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,6 +190,9 @@ public:
|
||||||
void removeMission( uint idx, TMissionResult result);
|
void removeMission( uint idx, TMissionResult result);
|
||||||
void addSuccessfulMission(CMissionTemplate * templ);
|
void addSuccessfulMission(CMissionTemplate * templ);
|
||||||
bool processMissionEvent( CMissionEvent & event, TAIAlias alias = CAIAliasTranslator::Invalid);
|
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);
|
bool isMissionSuccessfull(TAIAlias alias);
|
||||||
///\return the mission
|
///\return the mission
|
||||||
inline std::vector<CMissionGuild*> & getMissions()
|
inline std::vector<CMissionGuild*> & getMissions()
|
||||||
|
|
|
@ -10708,6 +10708,7 @@ void CCharacter::acceptExchange(uint8 exchangeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
CTeam * team = TeamManager.getRealTeam( _TeamId );
|
CTeam * team = TeamManager.getRealTeam( _TeamId );
|
||||||
|
CGuild* guild = CGuildManager::getInstance()->getGuildFromId( _GuildId );
|
||||||
if (_BotGift == NULL)
|
if (_BotGift == NULL)
|
||||||
{
|
{
|
||||||
nlwarning("Player %s has no bot gift", _Id.toString().c_str());
|
nlwarning("Player %s has no bot gift", _Id.toString().c_str());
|
||||||
|
@ -10731,6 +10732,15 @@ void CCharacter::acceptExchange(uint8 exchangeId)
|
||||||
}
|
}
|
||||||
mission = team->getMissionByAlias( missionAlias );
|
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<CGameItemPtr> vect;
|
vector<CGameItemPtr> vect;
|
||||||
vector<CPetAnimal> exchangePlayerPets;
|
vector<CPetAnimal> exchangePlayerPets;
|
||||||
|
@ -10764,6 +10774,8 @@ void CCharacter::acceptExchange(uint8 exchangeId)
|
||||||
processMissionStepUserEvent( eventList,missionAlias,stepIndex );
|
processMissionStepUserEvent( eventList,missionAlias,stepIndex );
|
||||||
else if ( type == MISSION_DESC::Group )
|
else if ( type == MISSION_DESC::Group )
|
||||||
team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex );
|
team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex );
|
||||||
|
else if ( type == MISSION_DESC::Guild )
|
||||||
|
guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex );
|
||||||
eventList.pop_front();
|
eventList.pop_front();
|
||||||
for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it )
|
for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it )
|
||||||
processMissionEvent(*(*it));
|
processMissionEvent(*(*it));
|
||||||
|
@ -10783,6 +10795,8 @@ void CCharacter::acceptExchange(uint8 exchangeId)
|
||||||
processMissionStepUserEvent( eventList,missionAlias,stepIndex );
|
processMissionStepUserEvent( eventList,missionAlias,stepIndex );
|
||||||
else if ( type == MISSION_DESC::Group )
|
else if ( type == MISSION_DESC::Group )
|
||||||
team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex );
|
team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex );
|
||||||
|
else if ( type == MISSION_DESC::Guild )
|
||||||
|
guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex );
|
||||||
eventList.pop_front();
|
eventList.pop_front();
|
||||||
for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it )
|
for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it )
|
||||||
processMissionEvent(*(*it));
|
processMissionEvent(*(*it));
|
||||||
|
@ -11615,7 +11629,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
bool firstEvent = true;
|
bool firstEvent = true;
|
||||||
CGuild * guild = NULL;
|
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId );
|
||||||
while ( !eventList.empty() )
|
while ( !eventList.empty() )
|
||||||
{
|
{
|
||||||
bool eventProcessed = false;
|
bool eventProcessed = false;
|
||||||
|
@ -11652,6 +11666,13 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
|
||||||
eventProcessed = team->processTeamMissionEvent(eventList, alias);
|
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;
|
processed |= eventProcessed;
|
||||||
|
|
||||||
// the first event of the list was processed, so we remove it.
|
// the first event of the list was processed, so we remove it.
|
||||||
|
|
Loading…
Reference in a new issue