[9334] Check if baseLevel for XP is valid before attempt use data from store

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-09 00:06:53 +01:00
parent 134f3fc86c
commit 0fbac741b3
2 changed files with 15 additions and 13 deletions

View file

@ -233,19 +233,21 @@ uint32 Quest::XPValue(Player *pPlayer) const
} }
} }
const QuestXPLevel* pXPData = sQuestXPLevelStore.LookupEntry(baseLevel); // not possible to reward XP when baseLevel does not exist in dbc
if (const QuestXPLevel* pXPData = sQuestXPLevelStore.LookupEntry(baseLevel))
{
uint32 rawXP = xpMultiplier * pXPData->xpIndex[RewXPId] / 10;
uint32 rawXP = xpMultiplier * pXPData->xpIndex[RewXPId] / 10; // round values
if (rawXP > 1000)
// round values realXP = ((rawXP + 25) / 50 * 50);
if (rawXP > 1000) else if (rawXP > 500)
realXP = ((rawXP + 25) / 50 * 50); realXP = ((rawXP + 12) / 25 * 25);
else if (rawXP > 500) else if (rawXP > 100)
realXP = ((rawXP + 12) / 25 * 25); realXP = ((rawXP + 5) / 10 * 10);
else if (rawXP > 100) else
realXP = ((rawXP + 5) / 10 * 10); realXP = ((rawXP + 2) / 5 * 5);
else }
realXP = ((rawXP + 2) / 5 * 5);
return realXP; return realXP;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9333" #define REVISION_NR "9334"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__