Changed: #1304: Implementation of basic CGuild functions for guild missions

This commit is contained in:
Fabien_HENON 2011-06-29 14:44:30 +02:00
parent 028af046fb
commit b16d22977b
2 changed files with 60 additions and 11 deletions

View file

@ -34,6 +34,7 @@
#include "outpost_manager/outpost_manager.h" #include "outpost_manager/outpost_manager.h"
#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"
/// todo guild remove entity id translator /// todo guild remove entity id translator
#include "nel/misc/eid_translator.h" #include "nel/misc/eid_translator.h"
@ -686,23 +687,54 @@ void CGuild::unregisterGuild()
// //
//} //}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CGuild::removeMission(CMissionGuild * mission, TMissionResult result) void CGuild::removeMission( uint idx, TMissionResult result)
{ {
/// todo guild mission if ( idx >= _Missions.size() )
return;
/// if the mission was finished, the result is success
if ( _Missions[idx]->getFinished() )
{
if ( _Missions[idx]->getMissionSuccess() )
result = mr_success;
else
result = mr_fail;
}
CMissionTemplate *tpl = CMissionManager::getInstance()->getTemplate(_Missions[idx]->getTemplateId());
if ( tpl && !tpl->Tags.NoList )
{
_Missions[idx]->clearUsersJournalEntry();
}
CMissionManager::getInstance()->deInstanciateMission(_Missions[idx]);
delete _Missions[idx];
_Missions.erase(_Missions.begin() + idx) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CGuild::addSuccessfulMission(CMissionTemplate * templ) void CGuild::addSuccessfulMission(CMissionTemplate * templ)
{ {
/// todo guild mission /*TMissionHistory &mh = _MissionHistories[templ.Alias];
mh.Successfull = true;*/
/// TODO: Add the mission histories
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias) bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
{ {
/// todo guild mission return true;
}
//----------------------------------------------------------------------------
bool CGuild::isMissionSuccessfull(TAIAlias alias)
{
/*std::map<TAIAlias, TMissionHistory>::iterator it(_MissionHistories.find(alias));
if (it != _MissionHistories.end())
return it->second.Successfull;*/
/// TODO: Add the mission histories
return false; return false;
} }

View file

@ -27,6 +27,7 @@
#include "outpost_manager/outpost_guild_db_updater.h" #include "outpost_manager/outpost_guild_db_updater.h"
#include "guild_interface.h" #include "guild_interface.h"
#include "database_guild.h" #include "database_guild.h"
#include "mission_manager/mission_guild.h"
class CMissionGuild; class CMissionGuild;
class CGuildMember; class CGuildMember;
@ -176,17 +177,30 @@ public:
///\name Mission management ///\name Mission management
//@{ //@{
void removeMission(CMissionGuild * mission, TMissionResult result); void removeMission(CMissionGuild * mission, TMissionResult result)
{
for (uint i = 0; i < _Missions.size(); i++)
{
if ( _Missions[i] == mission )
{
removeMission(i, 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 isMissionSuccessfull(TAIAlias alias);
///\return the mission ///\return the mission
inline std::vector<CMissionGuild*> & getMissions() inline std::vector<CMissionGuild*> & getMissions()
{ {
return std::vector<CMissionGuild*>(); return _Missions;
// To Do }
void addMission(CMissionGuild* guildMission)
{
_Missions.push_back(guildMission);
guildMission->updateUsersJournalEntry();
} }
void addMission(CMissionGuild* guildMission) {}
bool isMissionSuccessfull(TAIAlias alias) { return false; }
//@} //@}
/// inventory management /// inventory management
@ -359,6 +373,9 @@ private:
/// list of outposts challenged by guild /// list of outposts challenged by guild
std::vector<TAIAlias> _ChallengedOutposts; std::vector<TAIAlias> _ChallengedOutposts;
///the missions took by the guild
std::vector<CMissionGuild*> _Missions;
NLMISC_COMMAND_FRIEND( guildDB ); NLMISC_COMMAND_FRIEND( guildDB );
}; };
#endif // RY_GUILD_H #endif // RY_GUILD_H