[9318] Update quest XP formula

Use dbc store as base for real xp rewarded and also display xp reward accordingly in related packets.
Note there are still some smaller things that may need smaller adjustments and tweaks, these are on the todo-list.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-07 02:39:44 +01:00
parent 87a35b0489
commit a9a16061d5
7 changed files with 102 additions and 36 deletions

View file

@ -105,6 +105,8 @@ MapDifficultyMap sMapDifficultyMap;
DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt); DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt);
DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt); DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt);
DBCStorage <QuestXPLevel> sQuestXPLevelStore(QuestXPLevelfmt);
DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt); DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt);
DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore(RandomPropertiesPointsfmt); DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore(RandomPropertiesPointsfmt);
@ -320,7 +322,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1); exit(1);
} }
const uint32 DBCFilesCount = 82; const uint32 DBCFilesCount = 83;
barGoLink bar( DBCFilesCount ); barGoLink bar( DBCFilesCount );
@ -420,6 +422,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore, dbcPath,"Movie.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore, dbcPath,"Movie.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPLevelStore, dbcPath,"QuestXP.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc");
for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))

View file

@ -123,6 +123,7 @@ extern DBCStorage <MapEntry> sMapStore;
extern MapDifficultyMap sMapDifficultyMap; extern MapDifficultyMap sMapDifficultyMap;
extern DBCStorage <MovieEntry> sMovieStore; extern DBCStorage <MovieEntry> sMovieStore;
extern DBCStorage <QuestSortEntry> sQuestSortStore; extern DBCStorage <QuestSortEntry> sQuestSortStore;
extern DBCStorage <QuestXPLevel> sQuestXPLevelStore;
//extern DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore; -- use GetBattlegroundSlotByLevel for access //extern DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore; -- use GetBattlegroundSlotByLevel for access
extern DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore; extern DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore;
extern DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore; extern DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore;

View file

@ -1161,6 +1161,13 @@ struct QuestSortEntry
// 17 name flags // 17 name flags
}; };
struct QuestXPLevel
{
uint32 questLevel; // 0
uint32 xpIndex[9]; // 1-9
//unk // 10
};
struct RandomPropertiesPointsEntry struct RandomPropertiesPointsEntry
{ {
//uint32 Id; // 0 hidden key //uint32 Id; // 0 hidden key

View file

@ -76,6 +76,7 @@ const char MapEntryfmt[]="nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
const char MapDifficultyEntryfmt[]="diixxxxxxxxxxxxxxxxxiix"; const char MapDifficultyEntryfmt[]="diixxxxxxxxxxxxxxxxxiix";
const char MovieEntryfmt[]="nxx"; const char MovieEntryfmt[]="nxx";
const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx";
const char QuestXPLevelfmt[]="niiiiiiiiix";
const char PvPDifficultyfmt[]="diiiii"; const char PvPDifficultyfmt[]="diiiii";
const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii";
const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii";

View file

@ -512,7 +512,12 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(0); data << uint32(0);
} }
data << uint32(pQuest->GetRewOrReqMoney()); // send rewMoneyMaxLevel explicit for max player level, else send RewOrReqMoney
if (pSession->GetPlayer()->getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
data << uint32(pQuest->GetRewMoneyMaxLevel());
else
data << uint32(pQuest->GetRewOrReqMoney());
data << uint32(pQuest->XPValue(pSession->GetPlayer())); data << uint32(pQuest->XPValue(pSession->GetPlayer()));
} }
@ -771,7 +776,12 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
data << uint32(0); data << uint32(0);
} }
data << uint32(pQuest->GetRewOrReqMoney()); // money // send rewMoneyMaxLevel explicit for max player level, else send RewOrReqMoney
if (pSession->GetPlayer()->getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
data << uint32(pQuest->GetRewMoneyMaxLevel());
else
data << uint32(pQuest->GetRewOrReqMoney());
data << uint32(pQuest->XPValue(pSession->GetPlayer())); // xp data << uint32(pQuest->XPValue(pSession->GetPlayer())); // xp
// TODO: fixme. rewarded honor points. Multiply with 10 to satisfy client // TODO: fixme. rewarded honor points. Multiply with 10 to satisfy client

View file

@ -165,44 +165,88 @@ Quest::Quest(Field * questRecord)
} }
} }
uint32 Quest::XPValue( Player *pPlayer ) const uint32 Quest::XPValue(Player *pPlayer) const
{ {
if( pPlayer ) if (pPlayer)
{ {
if( RewMoneyMaxLevel > 0 ) uint32 realXP = 0;
{ uint32 xpMultiplier = 0;
uint32 pLevel = pPlayer->getLevel(); int32 baseLevel = 0;
uint32 qLevel = QuestLevel > 0 ? (uint32)QuestLevel : 0; int32 playerLevel = pPlayer->getLevel();
float fullxp = 0;
if (qLevel >= 15)
fullxp = RewMoneyMaxLevel / 6.0f;
else if (qLevel == 14)
fullxp = RewMoneyMaxLevel / 4.8f;
else if (qLevel == 13)
fullxp = RewMoneyMaxLevel / 3.666f;
else if (qLevel == 12)
fullxp = RewMoneyMaxLevel / 2.4f;
else if (qLevel == 11)
fullxp = RewMoneyMaxLevel / 1.2f;
else if (qLevel >= 1 && qLevel <= 10)
fullxp = RewMoneyMaxLevel / 0.6f;
else if (qLevel == 0)
fullxp = RewMoneyMaxLevel;
if( pLevel <= qLevel + 5 ) // formula can possibly be organized better, using less if's and simplify some.
return (uint32)fullxp;
else if( pLevel == qLevel + 6 ) if (QuestLevel != -1)
return (uint32)(fullxp * 0.8f); baseLevel = QuestLevel;
else if( pLevel == qLevel + 7 )
return (uint32)(fullxp * 0.6f); if (((baseLevel - playerLevel) + 10)*2 > 10)
else if( pLevel == qLevel + 8 ) {
return (uint32)(fullxp * 0.4f); baseLevel = playerLevel;
else if( pLevel == qLevel + 9 )
return (uint32)(fullxp * 0.2f); if (QuestLevel != -1)
baseLevel = QuestLevel;
if (((baseLevel - playerLevel) + 10)*2 <= 10)
{
if (QuestLevel == -1)
baseLevel = playerLevel;
xpMultiplier = 2 * (baseLevel - playerLevel) + 20;
}
else else
return (uint32)(fullxp * 0.1f); {
xpMultiplier = 10;
}
} }
else
{
baseLevel = playerLevel;
if (QuestLevel != -1)
baseLevel = QuestLevel;
if (((baseLevel - playerLevel) + 10)*2 >= 1)
{
baseLevel = playerLevel;
if (QuestLevel != -1)
baseLevel = QuestLevel;
if (((baseLevel - playerLevel) + 10)*2 <= 10)
{
if (QuestLevel == -1)
baseLevel = playerLevel;
xpMultiplier = 2 * (baseLevel - playerLevel) + 20;
}
else
{
xpMultiplier = 10;
}
}
else
{
xpMultiplier = 1;
}
}
const QuestXPLevel* pXPData = sQuestXPLevelStore.LookupEntry(baseLevel);
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);
return realXP;
} }
return 0; return 0;
} }

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 "9317" #define REVISION_NR "9318"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__