Skip to content

Commit

Permalink
[10719] Implement proper calculation quest honor reward.
Browse files Browse the repository at this point in the history
Now server side rewar same as reported at client side.

Also thanks to KiriX for patch prepering to commit and testing.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
tomrus88 committed Nov 15, 2010
1 parent eab2e4b commit 4d77d12
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/game/DBCStores.cpp
Expand Up @@ -206,6 +206,7 @@ DBCStorage <TaxiPathEntry> sTaxiPathStore(TaxiPathEntryfmt);
TaxiPathNodesByPath sTaxiPathNodesByPath;
static DBCStorage <TaxiPathNodeEntry> sTaxiPathNodeStore(TaxiPathNodeEntryfmt);

DBCStorage <TeamContributionPoints> sTeamContributionPoints(TeamContributionPointsfmt);
DBCStorage <TotemCategoryEntry> sTotemCategoryStore(TotemCategoryEntryfmt);
DBCStorage <VehicleEntry> sVehicleStore(VehicleEntryfmt);
DBCStorage <VehicleSeatEntry> sVehicleSeatStore(VehicleSeatEntryfmt);
Expand Down Expand Up @@ -390,7 +391,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1);
}

const uint32 DBCFilesCount = 87;
const uint32 DBCFilesCount = 88;

barGoLink bar( (int)DBCFilesCount );

Expand Down Expand Up @@ -693,6 +694,7 @@ void LoadDBCStores(const std::string& dataPath)
}
}

LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTeamContributionPoints, dbcPath,"TeamContributionPoints.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTotemCategoryStore, dbcPath,"TotemCategory.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc");
Expand Down
1 change: 1 addition & 0 deletions src/game/DBCStores.h
Expand Up @@ -189,6 +189,7 @@ extern TaxiMask sTaxiNodesMask;
extern TaxiMask sOldContinentsNodesMask;
extern TaxiPathSetBySource sTaxiPathSetBySource;
extern TaxiPathNodesByPath sTaxiPathNodesByPath;
extern DBCStorage <TeamContributionPoints> sTeamContributionPoints;
extern DBCStorage <TotemCategoryEntry> sTotemCategoryStore;
extern DBCStorage <VehicleEntry> sVehicleStore;
extern DBCStorage <VehicleSeatEntry> sVehicleSeatStore;
Expand Down
6 changes: 6 additions & 0 deletions src/game/DBCStructure.h
Expand Up @@ -1934,6 +1934,12 @@ struct TaxiPathNodeEntry
uint32 departureEventID; // 10 m_departureEventID
};

struct TeamContributionPoints
{
//uint32 Entry; // 0
float Value; // 1 (???)
};

struct TotemCategoryEntry
{
uint32 ID; // 0
Expand Down
1 change: 1 addition & 0 deletions src/game/DBCfmt.h
Expand Up @@ -124,6 +124,7 @@ const char TalentTabEntryfmt[]="nxxiiixxxxx";
const char TaxiNodesEntryfmt[]="nifffsii";
const char TaxiPathEntryfmt[]="niii";
const char TaxiPathNodeEntryfmt[]="diiifffiiii";
const char TeamContributionPointsfmt[]="df";
const char TotemCategoryEntryfmt[]="nxii";
const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxxxxxxxxxx";
Expand Down
4 changes: 2 additions & 2 deletions src/game/Player.cpp
Expand Up @@ -13727,8 +13727,8 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,
}

// honor reward
if (pQuest->GetRewHonorAddition())
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorAddition()));
if (uint32 honor = pQuest->CalculateRewardHonor(getLevel()))
RewardHonor(NULL, 0, honor);

// title reward
if (pQuest->GetCharTitleId())
Expand Down
21 changes: 21 additions & 0 deletions src/game/QuestDef.cpp
Expand Up @@ -19,6 +19,7 @@
#include "QuestDef.h"
#include "Player.h"
#include "World.h"
#include "DBCStores.h"

Quest::Quest(Field * questRecord)
{
Expand Down Expand Up @@ -271,3 +272,23 @@ bool Quest::IsAllowedInRaid() const

return sWorld.getConfig(CONFIG_BOOL_QUEST_IGNORE_RAID);
}

uint32 Quest::CalculateRewardHonor(uint32 level) const
{
if (level > GT_MAX_LEVEL)
level = GT_MAX_LEVEL;

uint32 honor = 0;

if(GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
{
// values stored from 0.. for 1...
TeamContributionPoints const* tc = sTeamContributionPoints.LookupEntry(level-1);
if(!tc)
return 0;
uint32 i_honor = uint32(tc->Value * GetRewHonorMultiplier() * 0.1000000014901161);
honor = i_honor + GetRewHonorAddition();
}

return honor;
}
2 changes: 2 additions & 0 deletions src/game/QuestDef.h
Expand Up @@ -273,6 +273,8 @@ class Quest
void SetQuestActiveState(bool state) { m_isActive = state; }
bool IsActive() const { return m_isActive; }

uint32 CalculateRewardHonor(uint32 level) const;

// multiple values
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
uint32 ReqItemId[QUEST_ITEM_OBJECTIVES_COUNT];
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10718"
#define REVISION_NR "10719"
#endif // __REVISION_NR_H__

0 comments on commit 4d77d12

Please sign in to comment.