mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-16 06:18:43 +00:00
Changed: #1304: Adding mission histories for CGuild
This commit is contained in:
parent
cb07a91882
commit
78bc50b0bc
2 changed files with 49 additions and 8 deletions
|
@ -704,6 +704,8 @@ void CGuild::removeMission( uint idx, TMissionResult result)
|
||||||
|
|
||||||
CMissionTemplate *tpl = CMissionManager::getInstance()->getTemplate(_Missions[idx]->getTemplateId());
|
CMissionTemplate *tpl = CMissionManager::getInstance()->getTemplate(_Missions[idx]->getTemplateId());
|
||||||
|
|
||||||
|
updateMissionHistories( _Missions[idx]->getTemplateId(), result);
|
||||||
|
|
||||||
if ( tpl && !tpl->Tags.NoList )
|
if ( tpl && !tpl->Tags.NoList )
|
||||||
{
|
{
|
||||||
_Missions[idx]->clearUsersJournalEntry();
|
_Missions[idx]->clearUsersJournalEntry();
|
||||||
|
@ -717,21 +719,53 @@ void CGuild::removeMission( uint idx, TMissionResult result)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void CGuild::addSuccessfulMission(CMissionTemplate * templ)
|
void CGuild::addSuccessfulMission(CMissionTemplate * templ)
|
||||||
{
|
{
|
||||||
/*TMissionHistory &mh = _MissionHistories[templ.Alias];
|
TMissionHistory &mh = _MissionHistories[templ->Alias];
|
||||||
mh.Successfull = true;*/
|
mh.Successfull = true;
|
||||||
/// TODO: Add the mission histories
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void CGuild::clearSuccessfulMissions()
|
||||||
|
{
|
||||||
|
_MissionHistories.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void CGuild::updateMissionHistories(TAIAlias missionAlias, uint32 result)
|
||||||
|
{
|
||||||
|
TMissionHistory &mh = _MissionHistories[missionAlias];
|
||||||
|
|
||||||
|
switch(result)
|
||||||
|
{
|
||||||
|
case mr_success:
|
||||||
|
case mr_forced:
|
||||||
|
mh.Successfull = true;
|
||||||
|
// validate last try date
|
||||||
|
_MissionHistories[missionAlias].LastSuccessDate = CTickEventHandler::getGameCycle();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
|
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
|
||||||
{
|
{
|
||||||
return true;
|
std::list<CMissionEvent*> listEvents;
|
||||||
|
listEvents.push_back(&event);
|
||||||
|
return processGuildMissionEvent(listEvents, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CGuild::processGuildMissionEvent(std::list< CMissionEvent *> & eventList, TAIAlias missionAlias)
|
bool CGuild::processGuildMissionEvent(std::list< CMissionEvent *> & eventList, TAIAlias missionAlias)
|
||||||
{
|
{
|
||||||
return true;
|
for (uint i = 0; i < _Missions.size(); i++ )
|
||||||
|
{
|
||||||
|
nlassert( _Missions[i] );
|
||||||
|
if ( missionAlias == CAIAliasTranslator::Invalid || _Missions[i]->getTemplateId() == missionAlias )
|
||||||
|
{
|
||||||
|
if ( processGuildMissionStepEvent( eventList, _Missions[i]->getTemplateId() ,0xFFFFFFFF) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -755,10 +789,9 @@ CMissionGuild* CGuild::getMissionByAlias( TAIAlias missionAlias )
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CGuild::isMissionSuccessfull(TAIAlias alias)
|
bool CGuild::isMissionSuccessfull(TAIAlias alias)
|
||||||
{
|
{
|
||||||
/*std::map<TAIAlias, TMissionHistory>::iterator it(_MissionHistories.find(alias));
|
std::map<TAIAlias, TMissionHistory>::iterator it(_MissionHistories.find(alias));
|
||||||
if (it != _MissionHistories.end())
|
if (it != _MissionHistories.end())
|
||||||
return it->second.Successfull;*/
|
return it->second.Successfull;
|
||||||
/// TODO: Add the mission histories
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
class CMissionGuild;
|
class CMissionGuild;
|
||||||
class CGuildMember;
|
class CGuildMember;
|
||||||
|
|
||||||
|
/* Storage class for mission history data.
|
||||||
|
*/
|
||||||
|
struct TMissionHistory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A guild in ryzom
|
* A guild in ryzom
|
||||||
|
@ -189,6 +193,8 @@ public:
|
||||||
}
|
}
|
||||||
void removeMission( uint idx, TMissionResult result);
|
void removeMission( uint idx, TMissionResult result);
|
||||||
void addSuccessfulMission(CMissionTemplate * templ);
|
void addSuccessfulMission(CMissionTemplate * templ);
|
||||||
|
void clearSuccessfulMissions();
|
||||||
|
void updateMissionHistories(TAIAlias missionAlias, uint32 result);
|
||||||
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 processGuildMissionEvent(std::list< CMissionEvent * > & eventList, TAIAlias missionAlias );
|
||||||
bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex);
|
bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex);
|
||||||
|
@ -378,6 +384,8 @@ private:
|
||||||
|
|
||||||
///the missions took by the guild
|
///the missions took by the guild
|
||||||
std::vector<CMissionGuild*> _Missions;
|
std::vector<CMissionGuild*> _Missions;
|
||||||
|
/// Successful missions
|
||||||
|
std::map<TAIAlias, TMissionHistory> _MissionHistories;
|
||||||
|
|
||||||
NLMISC_COMMAND_FRIEND( guildDB );
|
NLMISC_COMMAND_FRIEND( guildDB );
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue