Jump to content

[9118-9119][patch]achievements


Guest GriffonHeart

Recommended Posts

+ Allow use achievements criteria types ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET and ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2 in table achievement_criteria_requirement

This is need for allow check achievements criteria in SD2 scripts

For exmaple: http://ru.wowhead.com/?achievement=3798 and http://ru.wowhead.com/?achievement=3917

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 5a0d3ed..aeeb36e 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -93,6 +93,8 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri
        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_requirement` 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
+                AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(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:
            {

Link to comment
Share on other sites

When I try to implement achievements in trial_of_crusader, I found bug - CheckAchievementCriteriaMeet does'nt work

Can be fixed by patch (may be hack code)

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 5a0d3ed..124195a 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1912,6 +1912,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()

        // this will allocate empty data set storage
        AchievementCriteriaRequirementSet& dataSet = m_criteriaRequirementMap[criteria_id];
+        dataSet.SetCriteriaId(criteria_id);

        // counting disable criteria requirements
        if (data.requirementType == ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED)
diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h
index be071a2..beda615 100644
--- a/src/game/AchievementMgr.h
+++ b/src/game/AchievementMgr.h
@@ -186,6 +186,7 @@ struct AchievementCriteriaRequirementSet
        typedef std::vector<AchievementCriteriaRequirement> Storage;
        void Add(AchievementCriteriaRequirement 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;

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use