mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
Changed: #1304: Instanciation of guild missions.
--HG-- branch : gsoc2011-guildmissions
This commit is contained in:
parent
c4d39b2f98
commit
ef009ebc90
5 changed files with 69 additions and 11 deletions
|
@ -184,6 +184,7 @@ public:
|
|||
{
|
||||
// To Do
|
||||
}
|
||||
void addMission(CMissionGuild* guildMission) {}
|
||||
//@}
|
||||
|
||||
/// inventory management
|
||||
|
|
|
@ -99,6 +99,12 @@ public:
|
|||
/// user wanna pick a mission
|
||||
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
|
||||
void setLastSentInfoVersion(uint32 slot, uint8 infoVersion)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,14 @@ public:
|
|||
:CGuildMemberModule(proxy,guildMember){}
|
||||
virtual bool canAffectGrade(EGSPD::CGuildGrade::TGuildGrade grade)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) { }
|
||||
|
||||
inline void setGuild( uint16 guildId );
|
||||
/// override
|
||||
void updateUsersJournalEntry();
|
||||
/// override
|
||||
|
@ -58,6 +59,10 @@ private:
|
|||
bool _Chained;
|
||||
};
|
||||
|
||||
void CMissionGuild::setGuild( uint16 guildId )
|
||||
{
|
||||
_GuildId = guildId;
|
||||
}
|
||||
|
||||
#endif // RY_MISSION_GUILD_H
|
||||
|
||||
|
|
|
@ -836,29 +836,68 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl
|
|||
}
|
||||
else if ( templ->Type == MISSION_DESC::Guild )
|
||||
{
|
||||
/// todo guild mission
|
||||
/// Check to see if we can pick the mission
|
||||
CGuildMemberModule * module;
|
||||
if ( !user->getModuleParent().getModule( module ) )
|
||||
{
|
||||
MISDBG("%s user not in a guild", sDebugPrefix.c_str());
|
||||
return;
|
||||
}
|
||||
inst = module->pickMission( templ->Alias );
|
||||
if (!inst)
|
||||
/* /// This is already checked in the prerequisites
|
||||
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;
|
||||
}
|
||||
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++ )
|
||||
/// 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
|
||||
teamMission->initBasics( giver );
|
||||
soloMission->setTeam( user->getTeamId() );
|
||||
/*//teamMission->initBasics( giver );
|
||||
//soloMission->setTeam( user->getTeamId() );
|
||||
CGuild * guild = user->getGuild();
|
||||
if ( guild )
|
||||
{
|
||||
mission->getguild
|
||||
if ( guild->getMissions().size() >= MaxGuildMissionCount)
|
||||
{
|
||||
CCharacter::sendDynamicSystemMessage(user->getId(), "MISSION_MAX_GUILD_REACHED" );
|
||||
|
@ -884,8 +923,7 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl
|
|||
else
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue