Core/Reputation: Removed duplicate function to get base reputation with a faction
This commit is contained in:
@@ -127,7 +127,12 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
|
||||
|
||||
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
||||
{
|
||||
int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
|
||||
return GetBaseReputation(factionEntry, _player->GetRace(), _player->GetClass());
|
||||
}
|
||||
|
||||
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint8 playerClass)
|
||||
{
|
||||
int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry, race, playerClass);
|
||||
if (dataIndex < 0)
|
||||
return 0;
|
||||
|
||||
@@ -174,8 +179,7 @@ int32 ReputationMgr::GetMaxReputation(FactionEntry const* factionEntry) const
|
||||
if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID))
|
||||
return (*friendshipReactions->rbegin())->ReactionThreshold;
|
||||
|
||||
int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
|
||||
if (dataIndex >= 0)
|
||||
if (int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); dataIndex >= 0)
|
||||
return factionEntry->ReputationMax[dataIndex];
|
||||
|
||||
return *ReputationRankThresholds.rbegin();
|
||||
@@ -284,8 +288,7 @@ int32 ReputationMgr::GetRenownLevelThreshold(FactionEntry const* renownFactionEn
|
||||
if (!renownFactionEntry || !IsRenownReputation(renownFactionEntry))
|
||||
return 0;
|
||||
|
||||
int32 dataIndex = GetFactionDataIndexForRaceAndClass(renownFactionEntry);
|
||||
if (dataIndex >= 0)
|
||||
if (int32 dataIndex = GetFactionDataIndexForRaceAndClass(renownFactionEntry); dataIndex >= 0)
|
||||
return renownFactionEntry->ReputationMax[dataIndex];
|
||||
|
||||
return 0;
|
||||
@@ -318,14 +321,10 @@ void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, b
|
||||
|
||||
ReputationFlags ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
||||
{
|
||||
ReputationFlags flags = [&]()
|
||||
{
|
||||
int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
|
||||
if (dataIndex < 0)
|
||||
return ReputationFlags::None;
|
||||
ReputationFlags flags = ReputationFlags::None;
|
||||
|
||||
return static_cast<ReputationFlags>(factionEntry->ReputationFlags[dataIndex]);
|
||||
}();
|
||||
if (int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); dataIndex >= 0)
|
||||
flags |= static_cast<ReputationFlags>(factionEntry->ReputationFlags[dataIndex]);
|
||||
|
||||
if (sDB2Manager.GetParagonReputation(factionEntry->ID))
|
||||
flags |= ReputationFlags::ShowPropagated;
|
||||
@@ -831,13 +830,17 @@ void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank n
|
||||
}
|
||||
|
||||
int32 ReputationMgr::GetFactionDataIndexForRaceAndClass(FactionEntry const* factionEntry) const
|
||||
{
|
||||
return GetFactionDataIndexForRaceAndClass(factionEntry, _player->GetRace(), _player->GetClass());
|
||||
}
|
||||
|
||||
int32 ReputationMgr::GetFactionDataIndexForRaceAndClass(FactionEntry const* factionEntry, uint8 race, uint8 playerClass)
|
||||
{
|
||||
if (!factionEntry)
|
||||
return -1;
|
||||
|
||||
uint8 race = _player->GetRace();
|
||||
uint32 classMask = _player->GetClassMask();
|
||||
for (int32 i = 0; i < 4; i++)
|
||||
uint32 classMask = 1 << (playerClass - 1);
|
||||
for (int32 i = 0; i < 4; ++i)
|
||||
{
|
||||
if ((factionEntry->ReputationRaceMask[i].IsEmpty() || factionEntry->ReputationRaceMask[i].HasRace(race))
|
||||
&& (factionEntry->ReputationClassMask[i] == 0 || factionEntry->ReputationClassMask[i] & classMask))
|
||||
|
||||
Reference in New Issue
Block a user