mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-16 06:18:43 +00:00
Changed: #1304: Instanciation of guild missions.
This commit is contained in:
parent
e576e5e50d
commit
255caa2b0c
5 changed files with 69 additions and 11 deletions
|
@ -184,6 +184,7 @@ public:
|
||||||
{
|
{
|
||||||
// To Do
|
// To Do
|
||||||
}
|
}
|
||||||
|
void addMission(CMissionGuild* guildMission) {}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// inventory management
|
/// inventory management
|
||||||
|
|
|
@ -99,6 +99,12 @@ public:
|
||||||
/// user wanna pick a mission
|
/// user wanna pick a mission
|
||||||
CMissionGuild * pickMission( TAIAlias alias );
|
CMissionGuild * pickMission( TAIAlias alias );
|
||||||
|
|
||||||
|
// Function to check if the member can pick a mission. By default only Officer and above can pick a guild mission
|
||||||
|
virtual bool canPickMission(TAIAlias alias)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// set the version of last sent info of items in guild inventory
|
/// set the version of last sent info of items in guild inventory
|
||||||
void setLastSentInfoVersion(uint32 slot, uint8 infoVersion)
|
void setLastSentInfoVersion(uint32 slot, uint8 infoVersion)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,14 @@ public:
|
||||||
:CGuildMemberModule(proxy,guildMember){}
|
:CGuildMemberModule(proxy,guildMember){}
|
||||||
virtual bool canAffectGrade(EGSPD::CGuildGrade::TGuildGrade grade)const;
|
virtual bool canAffectGrade(EGSPD::CGuildGrade::TGuildGrade grade)const;
|
||||||
virtual bool canInvite()const;
|
virtual bool canInvite()const;
|
||||||
|
|
||||||
|
// Function to check if the member can pick a mission.
|
||||||
|
// By default only Officers and above can pick a guild mission.
|
||||||
|
// So we don't need to implement this function for the other grades
|
||||||
|
virtual bool canPickMission(TAIAlias alias)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
|
|
||||||
CMissionGuild() : _Chained(false) { }
|
CMissionGuild() : _Chained(false) { }
|
||||||
|
|
||||||
|
inline void setGuild( uint16 guildId );
|
||||||
/// override
|
/// override
|
||||||
void updateUsersJournalEntry();
|
void updateUsersJournalEntry();
|
||||||
/// override
|
/// override
|
||||||
|
@ -58,6 +59,10 @@ private:
|
||||||
bool _Chained;
|
bool _Chained;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void CMissionGuild::setGuild( uint16 guildId )
|
||||||
|
{
|
||||||
|
_GuildId = guildId;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // RY_MISSION_GUILD_H
|
#endif // RY_MISSION_GUILD_H
|
||||||
|
|
||||||
|
|
|
@ -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;
|
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;
|
||||||
|
}
|
||||||
|
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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue