mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[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:
parent
87a35b0489
commit
a9a16061d5
7 changed files with 102 additions and 36 deletions
|
|
@ -105,6 +105,8 @@ MapDifficultyMap sMapDifficultyMap;
|
|||
DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt);
|
||||
|
||||
DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt);
|
||||
DBCStorage <QuestXPLevel> sQuestXPLevelStore(QuestXPLevelfmt);
|
||||
|
||||
DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt);
|
||||
|
||||
DBCStorage <RandomPropertiesPointsEntry> 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))
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ extern DBCStorage <MapEntry> sMapStore;
|
|||
extern MapDifficultyMap sMapDifficultyMap;
|
||||
extern DBCStorage <MovieEntry> sMovieStore;
|
||||
extern DBCStorage <QuestSortEntry> sQuestSortStore;
|
||||
extern DBCStorage <QuestXPLevel> sQuestXPLevelStore;
|
||||
//extern DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore; -- use GetBattlegroundSlotByLevel for access
|
||||
extern DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore;
|
||||
extern DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9317"
|
||||
#define REVISION_NR "9318"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue