Fixed problem with not setAchievementCriteriaDataSet::criteria_id, Add achievement creteria requirements forACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET*, by GriffonHeart.
--HG-- branch : trunk
This commit is contained in:
@@ -93,6 +93,8 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
|
||||
break;
|
||||
default:
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType);
|
||||
@@ -1033,10 +1035,21 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
|
||||
{
|
||||
if (!miscvalue1 || miscvalue1 != achievementCriteria->be_spell_target.spellID)
|
||||
continue;
|
||||
|
||||
// those requirements couldn't be found in the dbc
|
||||
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
|
||||
if(!data)
|
||||
continue;
|
||||
|
||||
if(!data->Meets(GetPlayer(),unit))
|
||||
continue;
|
||||
|
||||
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
{
|
||||
@@ -1962,6 +1975,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
|
||||
// this will allocate empty data set storage
|
||||
AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id];
|
||||
dataSet.SetCriteriaId(criteria_id);
|
||||
|
||||
if (data.dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED)
|
||||
++disabled_count;
|
||||
|
||||
@@ -181,10 +181,10 @@ struct AchievementCriteriaData
|
||||
struct AchievementCriteriaDataSet
|
||||
{
|
||||
AchievementCriteriaDataSet() : criteria_id(0) {}
|
||||
explicit AchievementCriteriaDataSet(uint32 id) : criteria_id(id) {}
|
||||
typedef std::vector<AchievementCriteriaData> Storage;
|
||||
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
|
||||
bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
|
||||
void SetCriteriaId(uint32 id) {criteria_id = id;}
|
||||
private:
|
||||
uint32 criteria_id;
|
||||
Storage storage;
|
||||
|
||||
Reference in New Issue
Block a user