diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 666370029..306a7703d 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -105,6 +105,8 @@ MapDifficultyMap sMapDifficultyMap; DBCStorage sMovieStore(MovieEntryfmt); DBCStorage sQuestSortStore(QuestSortEntryfmt); +DBCStorage sQuestXPLevelStore(QuestXPLevelfmt); + DBCStorage sPvPDifficultyStore(PvPDifficultyfmt); DBCStorage sRandomPropertiesPointsStore(RandomPropertiesPointsfmt); @@ -320,7 +322,7 @@ void LoadDBCStores(const std::string& dataPath) exit(1); } - const uint32 DBCFilesCount = 82; + const uint32 DBCFilesCount = 83; 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,sQuestSortStore, dbcPath,"QuestSort.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPLevelStore, dbcPath,"QuestXP.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc"); for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index b18768105..9ffc86f77 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -123,6 +123,7 @@ extern DBCStorage sMapStore; extern MapDifficultyMap sMapDifficultyMap; extern DBCStorage sMovieStore; extern DBCStorage sQuestSortStore; +extern DBCStorage sQuestXPLevelStore; //extern DBCStorage sPvPDifficultyStore; -- use GetBattlegroundSlotByLevel for access extern DBCStorage sRandomPropertiesPointsStore; extern DBCStorage sScalingStatDistributionStore; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 30d000f94..d2a6af286 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1161,6 +1161,13 @@ struct QuestSortEntry // 17 name flags }; +struct QuestXPLevel +{ + uint32 questLevel; // 0 + uint32 xpIndex[9]; // 1-9 + //unk // 10 +}; + struct RandomPropertiesPointsEntry { //uint32 Id; // 0 hidden key diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 104140447..c30ea40ec 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -76,6 +76,7 @@ const char MapEntryfmt[]="nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx const char MapDifficultyEntryfmt[]="diixxxxxxxxxxxxxxxxxiix"; const char MovieEntryfmt[]="nxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; +const char QuestXPLevelfmt[]="niiiiiiiiix"; const char PvPDifficultyfmt[]="diiiii"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 9404e9c9c..3b86c4b4e 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -512,7 +512,12 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID 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())); } @@ -771,7 +776,12 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, 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 // TODO: fixme. rewarded honor points. Multiply with 10 to satisfy client diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index a03ccd74f..b7f49b637 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -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 pLevel = pPlayer->getLevel(); - uint32 qLevel = QuestLevel > 0 ? (uint32)QuestLevel : 0; - 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; + uint32 realXP = 0; + uint32 xpMultiplier = 0; + int32 baseLevel = 0; + int32 playerLevel = pPlayer->getLevel(); - if( pLevel <= qLevel + 5 ) - return (uint32)fullxp; - else if( pLevel == qLevel + 6 ) - return (uint32)(fullxp * 0.8f); - else if( pLevel == qLevel + 7 ) - return (uint32)(fullxp * 0.6f); - else if( pLevel == qLevel + 8 ) - return (uint32)(fullxp * 0.4f); - else if( pLevel == qLevel + 9 ) - return (uint32)(fullxp * 0.2f); + // formula can possibly be organized better, using less if's and simplify some. + + if (QuestLevel != -1) + baseLevel = QuestLevel; + + if (((baseLevel - playerLevel) + 10)*2 > 10) + { + baseLevel = playerLevel; + + if (QuestLevel != -1) + baseLevel = QuestLevel; + + if (((baseLevel - playerLevel) + 10)*2 <= 10) + { + if (QuestLevel == -1) + baseLevel = playerLevel; + + xpMultiplier = 2 * (baseLevel - playerLevel) + 20; + } 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; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6056460a0..3d957c107 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9317" + #define REVISION_NR "9318" #endif // __REVISION_NR_H__