[10252] Implement reputation_reward_rate for quests and creatures

* In addition, implement "flat" reputation for quests, where a value in RewRepValueN is given. Human diplomacy will not affect the total. The rate however will be applied, where a faction is defined with a rate for quests. Value in database are expected to be *100 of the actual value given (before rate are applied).
* New database storage can contain rates for quest/creature/spell reputation and will affect the base value given as reward. When for example the quest reward for a faction should receive 30% more reputation points, the rate can be set to 1.3.
* This will fix issues with certain quests that are using the expected RewRepValueId but where the outcome has been lower than expected.
* Note that if the rate is set to 0.0 it will disable reputation gain for the faction and type.
* Reputation rate for spells (spell effect) is not yet implemented

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-07-23 17:49:13 +02:00
parent 50c2e8eca2
commit 61990de6dd
13 changed files with 159 additions and 9 deletions

View file

@ -237,6 +237,14 @@ struct MailLevelReward
typedef std::list<MailLevelReward> MailLevelRewardList;
typedef UNORDERED_MAP<uint8,MailLevelRewardList> MailLevelRewardMap;
// We assume the rate is in general the same for all three types below, but chose to keep three for scalability and customization
struct RepRewardRate
{
float quest_rate; // We allow rate = 0.0 in database. For this case, it means that
float creature_rate; // no reputation are given at all for this faction/rate type.
float spell_rate; // not implemented yet (SPELL_EFFECT_REPUTATION)
};
struct ReputationOnKillEntry
{
uint32 repfaction1;
@ -460,7 +468,9 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
typedef UNORDERED_MAP<uint32, RepRewardRate > RepRewardRateMap;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap;
typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap;
@ -590,6 +600,15 @@ class ObjectMgr
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
RepRewardRate const* GetRepRewardRate(uint32 factionId) const
{
RepRewardRateMap::const_iterator itr = m_RepRewardRateMap.find(factionId);
if (itr != m_RepRewardRateMap.end())
return &itr->second;
return NULL;
}
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
{
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
@ -685,7 +704,9 @@ class ObjectMgr
void LoadCorpses();
void LoadFishingBaseSkillLevel();
void LoadReputationRewardRate();
void LoadReputationOnKill();
void LoadPointsOfInterest();
void LoadQuestPOI();
@ -1006,6 +1027,7 @@ class ObjectMgr
AreaTriggerMap mAreaTriggers;
AreaTriggerScriptMap mAreaTriggerScripts;
RepRewardRateMap m_RepRewardRateMap;
RepOnKillMap mRepOnKill;
GossipMenusMap m_mGossipMenusMap;