Jump to content

[fix] wrong quest xp calculation


Guest fabian

Recommended Posts

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

I have ssen that some quests have wrong xp stats. for example the first dk quest. it gives 825 xp but must give 815. It fix the calculation of the xps

For which repository revision was the patch created?

10218

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

no?

Who has been writing this patch? Please include either forum user names or email addresses.

me

diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp
index e2d86ca..1a98abc 100644
--- a/src/game/QuestDef.cpp
+++ b/src/game/QuestDef.cpp
@@ -238,15 +238,7 @@ uint32 Quest::XPValue(Player *pPlayer) const
        {
            uint32 rawXP = xpMultiplier * pXPData->xpIndex[RewXPId] / 10;

-            // round values
-            if (rawXP > 1000)
-                realXP = ((rawXP + 25) / 50 * 50);
-            else if (rawXP > 500)
-                realXP = ((rawXP + 12) / 25 * 25);
-            else if (rawXP > 100)
-                realXP = ((rawXP + 5) / 10 * 10);
-            else
-                realXP = ((rawXP + 2) / 5 * 5);
+            realXP = ((rawXP + 2) / 5 * 5);
        }

        return realXP;

Link to comment
Share on other sites

realXP = ((rawXP + 2) / 5 * 5);

was already here:

-            // round values
-            if (rawXP > 1000)
-                realXP = ((rawXP + 25) / 50 * 50);
-            else if (rawXP > 500)
-                realXP = ((rawXP + 12) / 25 * 25);
-            else if (rawXP > 100)
-                realXP = ((rawXP + 5) / 10 * 10);
-            else
-                realXP = ((rawXP + 2) / 5 * 5);

I have tested all formuals from this and try a few other but only realXP = ((rawXP + 2) / 5 * 5); is the right formular. tested wit a lot of quests.

it works fine for me

Link to comment
Share on other sites

the formula round the quest values for example 80 % from 815 xp are 652 the formula round it to 650.

is it blizzlike?

are the xps rounded on official servers? if no we can use this:

if (const QuestXPLevel* pXPData = sQuestXPLevelStore.LookupEntry(baseLevel))

realXP = xpMultiplier * pXPData->xpIndex[RewXPId];

and not this:

realXP = ((rawXP + 2) / 5 * 5);

but I think the values are rounded on offi. also

realXP = ((rawXP + 2) / 5 * 5);

Link to comment
Share on other sites

no all xps are rounded with realXP = ((rawXP + 2) / 5 * 5); it works with the code

realXP = ((rawXP + 2) / 5 * 5);

tested with a lot of quests and levels

or are they wrong rounding values?

/Edit

I have no mistakes ingame and all quest xps are rounded

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