[10270] Implement basic system for reputation spillover

* Database table needs data for each faction that should give spillover to other faction(s). One faction may give spillover to max 4 other spillover factions.
* The spillover rate is multiplied with the points after bonuses and reward rate is set, Rate is given as: 0.5 for 50% gain, -1.0 for 100% loss, etc
* It is possible to restrict spillover faction by rank. If player has a higher rank with the spillover faction given in database, no spillover will be given towards this faction

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-07-25 17:04:54 +02:00
parent 647acd8caa
commit fb1e8c01ef
13 changed files with 269 additions and 13 deletions

View file

@ -258,6 +258,13 @@ struct ReputationOnKillEntry
bool team_dependent;
};
struct RepSpilloverTemplate
{
uint32 faction[MAX_SPILLOVER_FACTIONS];
float faction_rate[MAX_SPILLOVER_FACTIONS];
uint32 faction_rank[MAX_SPILLOVER_FACTIONS];
};
struct PointOfInterest
{
uint32 entry;
@ -472,6 +479,7 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, RepRewardRate > RepRewardRateMap;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
typedef UNORDERED_MAP<uint32, RepSpilloverTemplate> RepSpilloverTemplateMap;
typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap;
@ -619,6 +627,15 @@ class ObjectMgr
return NULL;
}
RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const
{
RepSpilloverTemplateMap::const_iterator itr = m_RepSpilloverTemplateMap.find(factionId);
if (itr != m_RepSpilloverTemplateMap.end())
return &itr->second;
return NULL;
}
PointOfInterest const* GetPointOfInterest(uint32 id) const
{
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
@ -708,6 +725,7 @@ class ObjectMgr
void LoadReputationRewardRate();
void LoadReputationOnKill();
void LoadReputationSpilloverTemplate();
void LoadPointsOfInterest();
void LoadQuestPOI();
@ -1031,6 +1049,7 @@ class ObjectMgr
RepRewardRateMap m_RepRewardRateMap;
RepOnKillMap mRepOnKill;
RepSpilloverTemplateMap m_RepSpilloverTemplateMap;
GossipMenusMap m_mGossipMenusMap;
GossipMenuItemsMap m_mGossipMenuItemsMap;