Jump to content

[11656][fix] - Too much gold accounted for daily quests at max level


Guest mumion
 Share

Recommended Posts

Problem: After reaching max level (80) the player receives the bonus gold for each time he turns in a daily quests

Fix: rewrite code in that way the experience points or gold is only given the first time the quest is turned in

diff --git a/src/game/Player.cpp b/src/game/Player.cpp

index d16196b..f579213 100644

--- a/src/game/Player.cpp

+++ b/src/game/Player.cpp

@@ -13930,15 +13930,21 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,

QuestStatusData& q_status = mQuestStatus[quest_id];

// Not give XP in case already completed once repeatable quest

- uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue(this)*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST));

+ uint32 xp = 0;

+ if ( !q_status.m_rewarded )

+ {

+ if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))

+ {

+ xp = uint32(pQuest->XPValue(this)*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST));

+ GiveXP( xp, NULL);

+ }

+ else

+ {

+ uint32 money = uint32(pQuest->GetRewMoneyMaxLevel() * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));

+ ModifyMoney( money );

+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, money);

+ }

- if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))

- GiveXP(XP , NULL);

- else

- {

- uint32 money = uint32(pQuest->GetRewMoneyMaxLevel() * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));

- ModifyMoney( money );

- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, money);

}

// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative

@@ -13993,7 +13999,7 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,

q_status.uState = QUEST_CHANGED;

if (announce)

- SendQuestReward(pQuest, XP, questGiver);

+ SendQuestReward(pQuest, xp, questGiver);

bool handled = false;

Sorry for not putting it into a code block but it totally spoils the view

Link to comment
Share on other sites

If this is correct it should be in under review, and you could use [ code = diff ] tags:

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index d16196b..f579213 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -13930,15 +13930,21 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,
    QuestStatusData& q_status = mQuestStatus[quest_id];
    // Not give XP in case already completed once repeatable quest
-    uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue(this)*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST));
+    uint32 xp = 0;
+    if ( !q_status.m_rewarded )
+    {
+       if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
+       {
+           xp = uint32(pQuest->XPValue(this)*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST));
+           GiveXP( xp, NULL);
+       }
+        else
+        {
+               uint32 money = uint32(pQuest->GetRewMoneyMaxLevel() * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
+            ModifyMoney( money );
+            GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, money);
+        }
-    if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
-        GiveXP(XP , NULL);
-    else
-    {
-        uint32 money = uint32(pQuest->GetRewMoneyMaxLevel() * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
-        ModifyMoney( money );
-        GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, money);
    }
    // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
@@ -13993,7 +13999,7 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,
        q_status.uState = QUEST_CHANGED;
    if (announce)
-        SendQuestReward(pQuest, XP, questGiver);
+        SendQuestReward(pQuest, xp, questGiver);
    bool handled = false;

Regards

Skirnir

Link to comment
Share on other sites

 Share

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