mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
Changed: #1304: Updating CMissionGuild for guild missions.
Implementation of the functions: - updateUsersJournalEntry - clearUsersJournalEntry
This commit is contained in:
parent
9128f754fc
commit
7264e6c1bf
4 changed files with 88 additions and 4 deletions
|
@ -179,6 +179,11 @@ public:
|
|||
void removeMission(CMissionGuild * mission, TMissionResult result);
|
||||
void addSuccessfulMission(CMissionTemplate * templ);
|
||||
bool processMissionEvent( CMissionEvent & event, TAIAlias alias = CAIAliasTranslator::Invalid);
|
||||
///\return the mission
|
||||
inline std::vector<CMissionGuild*> & getMissions()
|
||||
{
|
||||
// To Do
|
||||
}
|
||||
//@}
|
||||
|
||||
/// inventory management
|
||||
|
|
|
@ -25,18 +25,83 @@
|
|||
#include "player_manager/player.h"
|
||||
#include "player_manager/character.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
NL_INSTANCE_COUNTER_IMPL(CMissionGuild);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void CMissionGuild::updateUsersJournalEntry()
|
||||
{
|
||||
/// todo guild mission
|
||||
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId );
|
||||
if (!guild)
|
||||
{
|
||||
nlwarning( "<MISSIONS>cant find guild ID : %d", _GuildId );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::iterator it = guild->getMembersBegin();
|
||||
it != guild->getMembersEnd();++it )
|
||||
{
|
||||
CCharacter * user = PlayerManager.getChar( it->first );
|
||||
if ( !user )
|
||||
{
|
||||
nlwarning( "<MISSIONS>cant find user %s", it->first.toString().c_str() );
|
||||
continue;
|
||||
}
|
||||
updateUserJournalEntry(*user,"GROUP:");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void CMissionGuild::clearUsersJournalEntry()
|
||||
{
|
||||
/// todo guild mission
|
||||
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId );
|
||||
if (!guild)
|
||||
{
|
||||
nlwarning( "<MISSIONS>cant find guild ID : %d", _GuildId );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::iterator it = guild->getMembersBegin();
|
||||
it != guild->getMembersEnd();++it )
|
||||
{
|
||||
CCharacter * user = PlayerManager.getChar( it->first );
|
||||
if ( !user )
|
||||
{
|
||||
nlwarning( "<MISSIONS>cant find user %s", it->first.toString().c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
CBankAccessor_PLR::TGROUP::TMISSIONS::TArray &missionItem = CBankAccessor_PLR::getGROUP().getMISSIONS().getArray(_ClientIndex);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TYPE",_ClientIndex), 0);
|
||||
missionItem.setTYPE(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:ICON",_ClientIndex), 0);
|
||||
missionItem.setICON(user->_PropertyDatabase, CSheetId::Unknown);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TITLE",_ClientIndex), 0);
|
||||
missionItem.setTITLE(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:DETAIL_TEXT",_ClientIndex), 0);
|
||||
missionItem.setDETAIL_TEXT(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:END_DATE",_ClientIndex), 0 );
|
||||
missionItem.setEND_DATE(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:BEGIN_DATE",_ClientIndex), 0 );
|
||||
missionItem.setBEGIN_DATE(user->_PropertyDatabase, 0);
|
||||
for (uint i = 0; i < NB_JOURNAL_COORDS; i++)
|
||||
{
|
||||
CBankAccessor_PLR::TGROUP::TMISSIONS::TArray::TTARGET &targetItem = missionItem.getTARGET(i);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:TITLE",_ClientIndex,i), 0);
|
||||
targetItem.setTITLE(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:X",_ClientIndex,i), 0);
|
||||
targetItem.setX(user->_PropertyDatabase, 0);
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:Y",_ClientIndex,i), 0);
|
||||
targetItem.setY(user->_PropertyDatabase, 0);
|
||||
}
|
||||
for (uint i = 0; i < NB_STEP_PER_MISSION; i++)
|
||||
{
|
||||
// user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:GOALS:%u:TEXT",_ClientIndex,i), 0);
|
||||
missionItem.getGOALS().getArray(i).setTEXT(user->_PropertyDatabase, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -846,6 +846,10 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl
|
|||
inst = module->pickMission( templ->Alias );
|
||||
if (!inst)
|
||||
return;
|
||||
|
||||
/// /!\ Do the same thing that the team missions but with the loop: for ( uint i = MaxGroupMissionCount; i < MaxGroupMissionCount + MaxGuildMissionCount; i++ )
|
||||
/// Instead of for ( uint i = 0; i < MaxGroupMissionCount; i++ ), so that we use available space for guild missions
|
||||
|
||||
/// todo guild mission : see solo
|
||||
/*
|
||||
todo guild mission : implement that in module
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include "team_manager/team_manager.h"
|
||||
#include "mission_manager/mission_team.h"
|
||||
#include "mission_manager/mission_step_ai.h"
|
||||
#include "mission_manager/mission_guild.h"
|
||||
#include "guild_manager/guild_manager.h"
|
||||
#include "guild_manager/guild.h"
|
||||
|
||||
#include "admin.h"
|
||||
#include "creature_manager/creature_manager.h"
|
||||
|
@ -81,10 +83,18 @@ NLMISC_COMMAND(forceJournalUpdate,"force mission journal update","<player id(id:
|
|||
team->getMissions()[i]->updateUsersJournalEntry();
|
||||
}
|
||||
}
|
||||
for (uint i = 0; i < MaxGuildMissionCount; i++)
|
||||
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() );
|
||||
if (guild)
|
||||
{
|
||||
for ( uint i = 0; i < guild->getMissions().size(); i++ )
|
||||
{
|
||||
guild->getMissions()[i]->updateUsersJournalEntry();
|
||||
}
|
||||
}
|
||||
/*for (uint i = 0; i < MaxGuildMissionCount; i++)
|
||||
{
|
||||
/// todo guild mission
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
} // missionProgress //
|
||||
|
||||
|
|
Loading…
Reference in a new issue