|
|
|
@ -55,6 +55,26 @@ inline bool skillRequiredAreBelowSkillValueLimit( uint skillValueLimit, const ve
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find in skillsRequiredList that all skills are lower (by value) than the provided limit value
|
|
|
|
|
*/
|
|
|
|
|
inline bool skillsAreBelowSkillValueLimit( uint skillValueLimit, const vector<CPlayerSkill>& skillsRequiredList )
|
|
|
|
|
{
|
|
|
|
|
H_AUTO(skillsAreBelowSkillValueLimit);
|
|
|
|
|
vector<CPlayerSkill>::const_iterator irs;
|
|
|
|
|
for ( irs=skillsRequiredList.begin(); irs!=skillsRequiredList.end(); ++irs )
|
|
|
|
|
{
|
|
|
|
|
const CPlayerSkill& requiredSkill = *irs;
|
|
|
|
|
if ( ! requiredSkill.isSkillValueLowerThan( skillValueLimit ) )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find in the player skill list has at least one skill that is higher than the provided skill.
|
|
|
|
|
*
|
|
|
|
@ -87,6 +107,26 @@ inline bool skillRequiredMatchPlayerSkills( const vector<SSkill>& playerSkills,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find in skillsRequiredList that all skills match in player skills
|
|
|
|
|
*
|
|
|
|
|
* Precondition:
|
|
|
|
|
* - skillsRequiredList contains valid skills (not unknown)
|
|
|
|
|
*/
|
|
|
|
|
inline bool skillsMatchPlayerSkills( const vector<SSkill>& playerSkills, const vector<CPlayerSkill>& skillsRequiredList )
|
|
|
|
|
{
|
|
|
|
|
H_AUTO(skillsMatchPlayerSkills);
|
|
|
|
|
vector<CPlayerSkill>::const_iterator irs;
|
|
|
|
|
for ( irs=skillsRequiredList.begin(); irs!=skillsRequiredList.end(); ++irs )
|
|
|
|
|
{
|
|
|
|
|
const CPlayerSkill& requiredSkill = *irs;
|
|
|
|
|
if ( ! skillMatchesOneOfList( requiredSkill, playerSkills ) )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check character fame against brick fame
|
|
|
|
|
*
|
|
|
|
@ -176,6 +216,16 @@ bool isPlayerAllowedToGetAllBricksFromPhrase( const CEntityId& eid,
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ! staticBrick->LearnRequiresSkills.empty() )
|
|
|
|
|
{
|
|
|
|
|
// Check if the brick is below or equal the skill value limit
|
|
|
|
|
if ( ! skillsAreBelowSkillValueLimit( skillValueLimit, staticBrick->LearnRequiresSkills ) )
|
|
|
|
|
return false;
|
|
|
|
|
// Check if all of the skills match one of the player's
|
|
|
|
|
if ( ! skillsMatchPlayerSkills( playerSkills, staticBrick->LearnRequiresSkills ) )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if one of the fame required doesn't match with brick min fame value
|
|
|
|
|
if ( ! fameRequiredMatchPlayerFaction( eid, staticBrick->Faction, staticBrick->MinFameValue ) )
|
|
|
|
|
return false;
|
|
|
|
|