fix(Core/Quests): implement QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER (#9661)

Fixes #9552
This commit is contained in:
UltraNix
2021-12-17 18:06:15 +01:00
committed by GitHub
parent ef8faa0904
commit 0dd59e66d3
5 changed files with 66 additions and 56 deletions
@@ -0,0 +1,4 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1639258188478104400');
UPDATE `quest_template_addon` SET `SpecialFlags`=`SpecialFlags`|0x040 WHERE `ID` IN (7791,7792,7793,7794,7795,7798,7799,7800,7802,7803,7804,7805,7807,7808,7809,
7811,7813,7814,7817,7818,7820,7821,7822,7823,7824,7826,7827,7831,7833,7834,7835,7836,10352,10354,10356,10357,10359,10360,10361,10362);
+1 -1
View File
@@ -5848,7 +5848,7 @@ void Player::RewardReputation(Quest const* quest)
}
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
GetReputationMgr().ModifyReputation(factionEntry, rep);
GetReputationMgr().ModifyReputation(factionEntry, rep, false, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
}
}
+3 -1
View File
@@ -163,9 +163,11 @@ enum QuestSpecialFlags
QUEST_SPECIAL_FLAGS_DF_QUEST = 0x008, // Set by 8 in SpecialFlags in DB if the quest is used by Dungeon Finder.
QUEST_SPECIAL_FLAGS_MONTHLY = 0x010, // Set by 16 in SpecialFlags in DB if the quest is reset at the begining of the month
QUEST_SPECIAL_FLAGS_CAST = 0x020, // Set by 32 in SpecialFlags in DB if the quest requires RequiredOrNpcGo killcredit but NOT kill (a spell cast)
QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER = 0x040, // Set by 64 in SpecialFlags in DB if the quest does not share rewarded reputation with other allied factions
// room for more custom flags
QUEST_SPECIAL_FLAGS_DB_ALLOWED = QUEST_SPECIAL_FLAGS_REPEATABLE | QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT | QUEST_SPECIAL_FLAGS_AUTO_ACCEPT | QUEST_SPECIAL_FLAGS_DF_QUEST | QUEST_SPECIAL_FLAGS_MONTHLY | QUEST_SPECIAL_FLAGS_CAST,
QUEST_SPECIAL_FLAGS_DB_ALLOWED = QUEST_SPECIAL_FLAGS_REPEATABLE | QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT | QUEST_SPECIAL_FLAGS_AUTO_ACCEPT |
QUEST_SPECIAL_FLAGS_DF_QUEST | QUEST_SPECIAL_FLAGS_MONTHLY | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER,
QUEST_SPECIAL_FLAGS_DELIVER = 0x080, // Internal flag computed only
QUEST_SPECIAL_FLAGS_SPEAKTO = 0x100, // Internal flag computed only
+5 -1
View File
@@ -282,9 +282,12 @@ void ReputationMgr::Initialize()
}
}
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly)
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillOver)
{
bool res = false;
if (!noSpillOver)
{
// if spillover definition exists in DB, override DBC
if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID))
{
@@ -340,6 +343,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
}
}
}
}
// spillover done, update faction itself
FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID);
+4 -4
View File
@@ -110,11 +110,11 @@ public: // accessors
public: // modifiers
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
{
return SetReputation(factionEntry, standing, false, false);
return SetReputation(factionEntry, standing, false, false, false);
}
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool spillOverOnly = false)
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool spillOverOnly = false, bool noSpillOver = false)
{
return SetReputation(factionEntry, standing, true, spillOverOnly);
return SetReputation(factionEntry, standing, true, spillOverOnly, noSpillOver);
}
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
@@ -136,7 +136,7 @@ public: // senders
private: // internal helper functions
void Initialize();
uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const;
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly);
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillOver = false);
void SetVisible(FactionState* faction);
void SetAtWar(FactionState* faction, bool atWar) const;
void SetInactive(FactionState* faction, bool inactive) const;