@ -836,29 +836,68 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl
}
}
else if ( templ - > Type = = MISSION_DESC : : Guild )
else if ( templ - > Type = = MISSION_DESC : : Guild )
{
{
/// todo guild mission
/// Check to see if we can pick the mission
CGuildMemberModule * module ;
CGuildMemberModule * module ;
if ( ! user - > getModuleParent ( ) . getModule ( module ) )
if ( ! user - > getModuleParent ( ) . getModule ( module ) )
{
{
MISDBG ( " %s user not in a guild " , sDebugPrefix . c_str ( ) ) ;
MISDBG ( " %s user not in a guild " , sDebugPrefix . c_str ( ) ) ;
return ;
return ;
}
}
inst = module - > pickMission ( templ - > Alias ) ;
/* /// This is already checked in the prerequisites
if ( ! inst )
if ( ! module - > pickMission ( templ - > Alias ) )
{
/// Todo : error message for the member
return ;
} */
CGuild * guild = CGuildManager : : getInstance ( ) - > getGuildFromId ( user - > getGuildId ( ) ) ;
if ( ! guild )
{
nlwarning ( " <MISSIONS>cant find guild ID : %d " , _GuildId ) ;
return ;
}
if ( ! templ - > Tags . NoList & & guild - > getMissions ( ) . size ( ) > = MaxGuildMissionCount )
{
CCharacter : : sendDynamicSystemMessage ( user - > getId ( ) , " MISSION_MAX_GUILD_REACHED " ) ;
return ;
}
CMissionGuild * guildMission = EGS_PD_CAST < CMissionGuild * > ( EGSPD : : CMissionGuildPD : : create ( templ - > Alias ) ) ;
if ( ! guildMission )
{
MISDBG ( " %s could not create guild mission " , sDebugPrefix . c_str ( ) ) ;
return ;
return ;
}
guildMission - > onCreation ( giver ) ;
guildMission - > setGuild ( user - > getGuildId ( ) ) ;
// Find a suitable client index (for non-invisible missions)
if ( templ - > Tags . NoList = = false )
{
uint8 idx = 0 ;
for ( uint i = MaxGroupMissionCount ; i < MaxGroupMissionCount + MaxGuildMissionCount ; i + + )
{
if ( ! CBankAccessor_PLR : : getGROUP ( ) . getMISSIONS ( ) . getArray ( i ) . getTITLE ( user - > _PropertyDatabase ) )
{
idx = i ;
break ;
}
}
guildMission - > setClientIndex ( idx ) ;
}
// Add mission
guild - > addMission ( guildMission ) ;
inst = guildMission ;
/// /!\ Do the same thing that the team missions but with the loop: for ( uint i = MaxGroupMissionCount; i < MaxGroupMissionCount + MaxGuildMissionCount; i++ )
/// /!\ 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
/// Instead of for ( uint i = 0; i < MaxGroupMissionCount; i++ ), so that we use available space for guild missions
/// todo guild mission : see solo
/*//teamMission->initBasics( giver );
/*
//soloMission->setTeam( user->getTeamId() );
todo guild mission : implement that in module
teamMission - > initBasics ( giver ) ;
soloMission - > setTeam ( user - > getTeamId ( ) ) ;
CGuild * guild = user - > getGuild ( ) ;
CGuild * guild = user - > getGuild ( ) ;
if ( guild )
if ( guild )
{
{
mission - > getguild
if ( guild - > getMissions ( ) . size ( ) > = MaxGuildMissionCount )
if ( guild - > getMissions ( ) . size ( ) > = MaxGuildMissionCount )
{
{
CCharacter : : sendDynamicSystemMessage ( user - > getId ( ) , " MISSION_MAX_GUILD_REACHED " ) ;
CCharacter : : sendDynamicSystemMessage ( user - > getId ( ) , " MISSION_MAX_GUILD_REACHED " ) ;
@ -884,8 +923,7 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl
else
else
{
{
}
} */
*/
}
}
else
else
{
{