Jump to content

[7772] ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED implementation


Recommended Posts

Posted

What bug does the patch fix? What features does the patch add?

This patch implements ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED.

For which repository revision was the patch created?

7763

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Couldn't find any.

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 8d91103..549060d 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1126,6 +1126,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
            case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
                SetCriteriaProgress(achievementCriteria, GetPlayer()->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS));
                break;
+            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
+                if (miscvalue1)
+                    SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_HIGHEST);
+                else
+                    SetCriteriaProgress(achievementCriteria, GetPlayer()->GetMoney(), PROGRESS_HIGHEST);
+                break;
            // std case: not exist in DBC, not triggered in code as result
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
@@ -1160,7 +1166,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
            case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:
            case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
            case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
-            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
            case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
            case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
@@ -1312,6 +1317,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
        case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
        case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
        case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD:
+        case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
        case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
        case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
        case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 5076764..c6a1897 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -13380,6 +13380,8 @@ void Player::MoneyChanged( uint32 count )
            }
        }
    }
+
+    GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED, count);
}

void Player::ReputationChanged(FactionEntry const* factionEntry )

Posted

1) MoneyChanged is quest related update function, so better not add to it unrelated code. I move call to Player::SetMoney where it only called.

2) i think not exist any reason have different code for in game and loading cases. In all cases we can use GetPlayer()->GetMoney().

With this changes in [7772]. Thank you :)

×
×
  • 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