mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[9331] Implement DB storage of new quest fields RewRepValueIdN
Value can be -9 to 9. Value point to actual rewarded value in dbc store. This id can then fully replace current use of RewRepValueN, as this field will most likely be reserved for custom reputation rewards (override RewRepValueId). Old system/DB data will still work like normal, but be aware this may change in not too far away future. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
696cba9c37
commit
8465d95d9f
10 changed files with 109 additions and 62 deletions
|
|
@ -6047,13 +6047,44 @@ void Player::RewardReputation(Quest const *pQuest)
|
|||
// quest reputation reward/loss
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
|
||||
{
|
||||
if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] )
|
||||
if (!pQuest->RewRepFaction[i])
|
||||
continue;
|
||||
|
||||
// For future, this row should be used as "override". Example quests are 10298 and 10870.
|
||||
// Typically, no diplomacy mod must apply to the final value (flat). Note the formula must be (finalValue = DBvalue/100)
|
||||
if (pQuest->RewRepValue[i])
|
||||
{
|
||||
int32 rep = CalculateReputationGain(GetQuestLevelForPlayer(pQuest), pQuest->RewRepValue[i], pQuest->RewRepFaction[i], true);
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]);
|
||||
if(factionEntry)
|
||||
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]))
|
||||
GetReputationMgr().ModifyReputation(factionEntry, rep);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 row = 1;
|
||||
int32 field = 0;
|
||||
|
||||
if (pQuest->RewRepValueId[i] < 0)
|
||||
{
|
||||
++row;
|
||||
field = abs(pQuest->RewRepValueId[i]);
|
||||
}
|
||||
else
|
||||
field = pQuest->RewRepValueId[i];
|
||||
|
||||
if (const QuestFactionRewardEntry *pRow = sQuestFactionRewardStore.LookupEntry(row))
|
||||
{
|
||||
int32 repPoints = pRow->rewardValue[field];
|
||||
|
||||
if (!repPoints)
|
||||
continue;
|
||||
|
||||
repPoints = CalculateReputationGain(GetQuestLevelForPlayer(pQuest), repPoints, pQuest->RewRepFaction[i], true);
|
||||
|
||||
if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]))
|
||||
GetReputationMgr().ModifyReputation(factionEntry, repPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: implement reputation spillover
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue