[7981] Implement ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM required for 310

This commit is contained in:
VladimirMangos 2009-06-09 09:35:16 +04:00
parent 6a1b4e5729
commit 28680fccd6
3 changed files with 21 additions and 3 deletions

View file

@ -203,6 +203,14 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
return false;
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if(team.team != ALLIANCE && team.team != HORDE)
{
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) have unknown team in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,dataType,gender.gender);
return false;
}
return true;
default:
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType);
return false;
@ -263,6 +271,10 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return source->GetMap()->GetSpawnMode()==difficalty.difficalty;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
return ((Player*)target)->GetTeam() == team.team;
}
return false;
}

View file

@ -53,12 +53,13 @@ enum AchievementCriteriaDataType
ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8, // minvalue value provided with achievement update must be not less that limit
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9, // minlevel minlevel of target
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10,// gender 0=male; 1=female
ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement createria complete if not all requirement implemented and listed in table
ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement creteria complete if not all requirement implemented and listed in table
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12,// difficulty normal/heroic difficulty for current event map
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13,// count "with less than %u people in the zone"
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14,// team HORDE(67), ALLIANCE(469)
};
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 14 // maximum value in AchievementCriteriaDataType enum
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 15 // maximum value in AchievementCriteriaDataType enum
class Player;
class Unit;
@ -128,6 +129,11 @@ struct AchievementCriteriaData
{
uint32 maxcount;
} map_players;
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14
struct
{
uint32 team;
} team;
// ...
struct
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7980"
#define REVISION_NR "7981"
#endif // __REVISION_NR_H__