fix(Core/Reputations): Faction rep gained by killing mobs is now prop… (#9737)
* fix(Core/Reputations): Faction rep gained by killing mobs is now properly rounded up. Do not increase reputation rank if exceeds max rank cap. Fixes #8718
This commit is contained in:
@@ -684,7 +684,7 @@ void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, T
|
|||||||
{
|
{
|
||||||
uint32 realFactionId = GetRealRepFactionForPlayer(factionId, itr->second);
|
uint32 realFactionId = GetRealRepFactionForPlayer(factionId, itr->second);
|
||||||
|
|
||||||
uint32 repGain = reputation;
|
float repGain = static_cast<float>(reputation);
|
||||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
|
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
|
||||||
|
|||||||
@@ -5736,7 +5736,7 @@ ReputationRank Player::GetReputationRank(uint32 faction) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total reputation percent player gain with quest/creature level
|
// Calculate total reputation percent player gain with quest/creature level
|
||||||
int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus)
|
float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus)
|
||||||
{
|
{
|
||||||
float percent = 100.0f;
|
float percent = 100.0f;
|
||||||
|
|
||||||
@@ -5746,7 +5746,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
|
|||||||
if (source == REPUTATION_SOURCE_KILL)
|
if (source == REPUTATION_SOURCE_KILL)
|
||||||
repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
|
repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
|
||||||
|
|
||||||
percent += rep > 0 ? repMod : -repMod;
|
percent += rep > 0.f ? repMod : -repMod;
|
||||||
|
|
||||||
float rate;
|
float rate;
|
||||||
switch (source)
|
switch (source)
|
||||||
@@ -5844,24 +5844,26 @@ void Player::RewardReputation(Unit* victim, float rate)
|
|||||||
|
|
||||||
if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
|
if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
|
||||||
{
|
{
|
||||||
int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||||
donerep1 = int32(donerep1 * rate);
|
donerep1 *= rate;
|
||||||
|
|
||||||
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||||
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
|
|
||||||
if (factionEntry1)
|
if (factionEntry1)
|
||||||
GetReputationMgr().ModifyReputation(factionEntry1, donerep1, bool(current_reputation_rank1 > Rep->ReputationMaxCap1));
|
{
|
||||||
|
GetReputationMgr().ModifyReputation(factionEntry1, donerep1, false, static_cast<ReputationRank>(Rep->ReputationMaxCap1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
|
if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
|
||||||
{
|
{
|
||||||
int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||||
donerep2 = int32(donerep2 * rate);
|
donerep2 *= rate;
|
||||||
|
|
||||||
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||||
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
|
|
||||||
if (factionEntry2)
|
if (factionEntry2)
|
||||||
GetReputationMgr().ModifyReputation(factionEntry2, donerep2, bool(current_reputation_rank2 > Rep->ReputationMaxCap2));
|
{
|
||||||
|
GetReputationMgr().ModifyReputation(factionEntry2, donerep2, false, static_cast<ReputationRank>(Rep->ReputationMaxCap2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5873,11 +5875,11 @@ void Player::RewardReputation(Quest const* quest)
|
|||||||
if (!quest->RewardFactionId[i])
|
if (!quest->RewardFactionId[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32 rep = 0;
|
float rep = 0.f;
|
||||||
|
|
||||||
if (quest->RewardFactionValueIdOverride[i])
|
if (quest->RewardFactionValueIdOverride[i])
|
||||||
{
|
{
|
||||||
rep = quest->RewardFactionValueIdOverride[i] / 100;
|
rep = quest->RewardFactionValueIdOverride[i] / 100.f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5885,11 +5887,11 @@ void Player::RewardReputation(Quest const* quest)
|
|||||||
if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
|
if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
|
||||||
{
|
{
|
||||||
uint32 field = std::abs(quest->RewardFactionValueId[i]);
|
uint32 field = std::abs(quest->RewardFactionValueId[i]);
|
||||||
rep = questFactionRewEntry->QuestRewFactionValue[field];
|
rep = static_cast<float>(questFactionRewEntry->QuestRewFactionValue[field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rep)
|
if (rep == 0.f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (quest->IsDaily())
|
if (quest->IsDaily())
|
||||||
@@ -5914,7 +5916,9 @@ void Player::RewardReputation(Quest const* quest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
|
||||||
GetReputationMgr().ModifyReputation(factionEntry, rep, false, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
|
{
|
||||||
|
GetReputationMgr().ModifyReputation(factionEntry, rep, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14795,7 +14799,7 @@ uint8 Player::GetMostPointsTalentTree() const
|
|||||||
return maxIndex;
|
return maxIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetReputation(uint32 factionentry, uint32 value)
|
void Player::SetReputation(uint32 factionentry, float value)
|
||||||
{
|
{
|
||||||
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
|
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1645,7 +1645,7 @@ public:
|
|||||||
void learnQuestRewardedSpells();
|
void learnQuestRewardedSpells();
|
||||||
void learnQuestRewardedSpells(Quest const* quest);
|
void learnQuestRewardedSpells(Quest const* quest);
|
||||||
void learnSpellHighRank(uint32 spellid);
|
void learnSpellHighRank(uint32 spellid);
|
||||||
void SetReputation(uint32 factionentry, uint32 value);
|
void SetReputation(uint32 factionentry, float value);
|
||||||
[[nodiscard]] uint32 GetReputation(uint32 factionentry) const;
|
[[nodiscard]] uint32 GetReputation(uint32 factionentry) const;
|
||||||
std::string const& GetGuildName();
|
std::string const& GetGuildName();
|
||||||
[[nodiscard]] uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
|
[[nodiscard]] uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
|
||||||
@@ -2056,7 +2056,7 @@ public:
|
|||||||
void RewardReputation(Unit* victim, float rate);
|
void RewardReputation(Unit* victim, float rate);
|
||||||
void RewardReputation(Quest const* quest);
|
void RewardReputation(Quest const* quest);
|
||||||
|
|
||||||
int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
|
float CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus = false);
|
||||||
|
|
||||||
void UpdateSkillsForLevel();
|
void UpdateSkillsForLevel();
|
||||||
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
|
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
|
||||||
|
|||||||
@@ -1016,7 +1016,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
|||||||
{
|
{
|
||||||
for (auto const& itr : factionsList)
|
for (auto const& itr : factionsList)
|
||||||
{
|
{
|
||||||
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(itr), 42999, false);
|
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(itr), 42999.f, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,17 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing)
|
|||||||
return MIN_REPUTATION_RANK;
|
return MIN_REPUTATION_RANK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 ReputationMgr::ReputationRankToStanding(ReputationRank rank)
|
||||||
|
{
|
||||||
|
int32 standing = Reputation_Bottom;
|
||||||
|
for (uint8 i = MIN_REPUTATION_RANK; i <= rank; ++i)
|
||||||
|
{
|
||||||
|
standing += PointsInRank[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::max(standing - 1, Reputation_Bottom);
|
||||||
|
}
|
||||||
|
|
||||||
bool ReputationMgr::IsAtWar(uint32 faction_id) const
|
bool ReputationMgr::IsAtWar(uint32 faction_id) const
|
||||||
{
|
{
|
||||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||||
@@ -271,6 +282,7 @@ void ReputationMgr::Initialize()
|
|||||||
newFaction.Flags = GetDefaultStateFlags(factionEntry);
|
newFaction.Flags = GetDefaultStateFlags(factionEntry);
|
||||||
newFaction.needSend = true;
|
newFaction.needSend = true;
|
||||||
newFaction.needSave = true;
|
newFaction.needSave = true;
|
||||||
|
newFaction.roundedUp = false;
|
||||||
|
|
||||||
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
||||||
++_visibleFactionCount;
|
++_visibleFactionCount;
|
||||||
@@ -282,7 +294,7 @@ void ReputationMgr::Initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillOver)
|
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, float standing, bool incremental, bool noSpillOver, Optional<ReputationRank> repMaxCap)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
@@ -298,7 +310,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||||||
if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
|
if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
|
||||||
{
|
{
|
||||||
// bonuses are already given, so just modify standing by rate
|
// bonuses are already given, so just modify standing by rate
|
||||||
int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
|
float spilloverRep = standing * repTemplate->faction_rate[i];
|
||||||
SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
|
SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +331,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||||||
// some team factions have own reputation standing, in this case do not spill to other sub-factions
|
// some team factions have own reputation standing, in this case do not spill to other sub-factions
|
||||||
if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL))
|
if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL))
|
||||||
{
|
{
|
||||||
SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
|
SetOneFactionReputation(parent, spillOverRepOut, incremental);
|
||||||
}
|
}
|
||||||
else // spill to "sister" factions
|
else // spill to "sister" factions
|
||||||
{
|
{
|
||||||
@@ -336,7 +348,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||||||
{
|
{
|
||||||
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
||||||
continue;
|
continue;
|
||||||
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
float spilloverRep = spillOverRepOut * factionEntryCalc->spilloverRateIn;
|
||||||
if (spilloverRep != 0 || !incremental)
|
if (spilloverRep != 0 || !incremental)
|
||||||
res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
|
res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
|
||||||
}
|
}
|
||||||
@@ -345,20 +357,25 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool spillOverOnly = repMaxCap ? GetRank(factionEntry) > *repMaxCap : false;
|
||||||
|
|
||||||
// spillover done, update faction itself
|
// spillover done, update faction itself
|
||||||
FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID);
|
FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID);
|
||||||
if (faction != _factions.end())
|
if (faction != _factions.end())
|
||||||
{
|
{
|
||||||
// Xinef: if we update spillover only, do not update main reputation (rank exceeds creature reward rate)
|
// Xinef: if we update spillover only, do not update main reputation (rank exceeds creature reward rate)
|
||||||
if (!spillOverOnly)
|
if (!spillOverOnly)
|
||||||
res = SetOneFactionReputation(factionEntry, standing, incremental);
|
{
|
||||||
|
res = SetOneFactionReputation(factionEntry, standing, incremental, repMaxCap);
|
||||||
|
}
|
||||||
|
|
||||||
// only this faction gets reported to client, even if it has no own visible standing
|
// only this faction gets reported to client, even if it has no own visible standing
|
||||||
SendState(&faction->second);
|
SendState(&faction->second);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, float stand, bool incremental, Optional<ReputationRank> repMaxCap)
|
||||||
{
|
{
|
||||||
FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
|
FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
|
||||||
if (itr != _factions.end())
|
if (itr != _factions.end())
|
||||||
@@ -367,8 +384,27 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
|||||||
|
|
||||||
if (incremental)
|
if (incremental)
|
||||||
{
|
{
|
||||||
// int32 *= float cause one point loss?
|
stand *= sWorld->getRate(RATE_REPUTATION_GAIN);
|
||||||
standing = int32(floor((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f));
|
}
|
||||||
|
|
||||||
|
int32 standing = 0;
|
||||||
|
float stand2;
|
||||||
|
if (fabs(modff(stand, &stand2)) < 1.f)
|
||||||
|
{
|
||||||
|
if (itr->second.roundedUp)
|
||||||
|
{
|
||||||
|
standing = static_cast<int32>(ceil(stand));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
standing = static_cast<int32>(stand);
|
||||||
|
}
|
||||||
|
|
||||||
|
itr->second.roundedUp = !itr->second.roundedUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (incremental)
|
||||||
|
{
|
||||||
standing += itr->second.Standing + BaseRep;
|
standing += itr->second.Standing + BaseRep;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,6 +415,11 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
|||||||
|
|
||||||
ReputationRank old_rank = ReputationToRank(itr->second.Standing + BaseRep);
|
ReputationRank old_rank = ReputationToRank(itr->second.Standing + BaseRep);
|
||||||
ReputationRank new_rank = ReputationToRank(standing);
|
ReputationRank new_rank = ReputationToRank(standing);
|
||||||
|
if (repMaxCap && new_rank > *repMaxCap)
|
||||||
|
{
|
||||||
|
standing = ReputationRankToStanding(*repMaxCap);
|
||||||
|
new_rank = *repMaxCap;
|
||||||
|
}
|
||||||
|
|
||||||
if (sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental))
|
if (sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental))
|
||||||
{
|
{
|
||||||
@@ -574,6 +615,8 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
|||||||
faction->needSend = false;
|
faction->needSend = false;
|
||||||
faction->needSave = false;
|
faction->needSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faction->roundedUp = false;
|
||||||
}
|
}
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ struct FactionState
|
|||||||
uint8 Flags;
|
uint8 Flags;
|
||||||
bool needSend;
|
bool needSend;
|
||||||
bool needSave;
|
bool needSave;
|
||||||
|
bool roundedUp;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<RepListID, FactionState> FactionStateList;
|
typedef std::map<RepListID, FactionState> FactionStateList;
|
||||||
@@ -68,6 +69,8 @@ public: // statics
|
|||||||
static const int32 Reputation_Bottom;
|
static const int32 Reputation_Bottom;
|
||||||
|
|
||||||
static ReputationRank ReputationToRank(int32 standing);
|
static ReputationRank ReputationToRank(int32 standing);
|
||||||
|
static int32 ReputationRankToStanding(ReputationRank rank);
|
||||||
|
|
||||||
public: // accessors
|
public: // accessors
|
||||||
uint8 GetVisibleFactionCount() const { return _visibleFactionCount; }
|
uint8 GetVisibleFactionCount() const { return _visibleFactionCount; }
|
||||||
uint8 GetHonoredFactionCount() const { return _honoredFactionCount; }
|
uint8 GetHonoredFactionCount() const { return _honoredFactionCount; }
|
||||||
@@ -108,13 +111,13 @@ public: // accessors
|
|||||||
}
|
}
|
||||||
|
|
||||||
public: // modifiers
|
public: // modifiers
|
||||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
|
bool SetReputation(FactionEntry const* factionEntry, float standing)
|
||||||
{
|
{
|
||||||
return SetReputation(factionEntry, standing, false, false, false);
|
return SetReputation(factionEntry, standing, false);
|
||||||
}
|
}
|
||||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool spillOverOnly = false, bool noSpillOver = false)
|
bool ModifyReputation(FactionEntry const* factionEntry, float standing, bool noSpillOver = false, Optional<ReputationRank> repMaxCap = {})
|
||||||
{
|
{
|
||||||
return SetReputation(factionEntry, standing, true, spillOverOnly, noSpillOver);
|
return SetReputation(factionEntry, standing, true, noSpillOver, repMaxCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
||||||
@@ -125,7 +128,7 @@ public: // modifiers
|
|||||||
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply);
|
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply);
|
||||||
|
|
||||||
//! Public for chat command needs
|
//! Public for chat command needs
|
||||||
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
bool SetOneFactionReputation(FactionEntry const* factionEntry, float standing, bool incremental, Optional<ReputationRank> repMaxCap = { });
|
||||||
|
|
||||||
public: // senders
|
public: // senders
|
||||||
void SendInitialReputations();
|
void SendInitialReputations();
|
||||||
@@ -136,7 +139,7 @@ public: // senders
|
|||||||
private: // internal helper functions
|
private: // internal helper functions
|
||||||
void Initialize();
|
void Initialize();
|
||||||
uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const;
|
uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const;
|
||||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillOver = false);
|
bool SetReputation(FactionEntry const* factionEntry, float standing, bool incremental, bool noSpillOver = false, Optional<ReputationRank> repMaxCap = { });
|
||||||
void SetVisible(FactionState* faction);
|
void SetVisible(FactionState* faction);
|
||||||
void SetAtWar(FactionState* faction, bool atWar) const;
|
void SetAtWar(FactionState* faction, bool atWar) const;
|
||||||
void SetInactive(FactionState* faction, bool inactive) const;
|
void SetInactive(FactionState* faction, bool inactive) const;
|
||||||
|
|||||||
@@ -4879,7 +4879,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 repChange = damage;
|
float repChange = static_cast<float>(damage);
|
||||||
|
|
||||||
uint32 factionId = m_spellInfo->Effects[effIndex].MiscValue;
|
uint32 factionId = m_spellInfo->Effects[effIndex].MiscValue;
|
||||||
|
|
||||||
@@ -4888,7 +4888,6 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
|
repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
|
||||||
|
|
||||||
player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
|
player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -851,7 +851,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false);
|
target->GetReputationMgr().SetOneFactionReputation(factionEntry, float(amount), false);
|
||||||
target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry));
|
target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry));
|
||||||
|
|
||||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId,
|
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId,
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
||||||
{
|
{
|
||||||
player->GetReputationMgr().SetReputation(factionEntry, repValue);
|
player->GetReputationMgr().SetReputation(factionEntry, static_cast<float>(repValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
||||||
{
|
{
|
||||||
player->GetReputationMgr().SetReputation(factionEntry, repValue2);
|
player->GetReputationMgr().SetReputation(factionEntry, static_cast<float>(repValue2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||||||
// add 19 honor
|
// add 19 honor
|
||||||
player->RewardHonor(nullptr, 1, 19);
|
player->RewardHonor(nullptr, 1, 19);
|
||||||
// add 20 cenarion circle repu
|
// add 20 cenarion circle repu
|
||||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
|
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
|
||||||
// complete quest
|
// complete quest
|
||||||
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A);
|
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A);
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
|
|||||||
// add 19 honor
|
// add 19 honor
|
||||||
player->RewardHonor(nullptr, 1, 19);
|
player->RewardHonor(nullptr, 1, 19);
|
||||||
// add 20 cenarion circle repu
|
// add 20 cenarion circle repu
|
||||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
|
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
|
||||||
// complete quest
|
// complete quest
|
||||||
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H);
|
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2463,7 +2463,7 @@ class spell_gen_oracle_wolvar_reputation : public SpellScript
|
|||||||
// Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated)
|
// Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated)
|
||||||
// Not when player already has equal or higher rep with this faction
|
// Not when player already has equal or higher rep with this faction
|
||||||
if (player->GetReputationMgr().GetReputation(factionEntry) <= repChange)
|
if (player->GetReputationMgr().GetReputation(factionEntry) <= repChange)
|
||||||
player->GetReputationMgr().SetReputation(factionEntry, repChange);
|
player->GetReputationMgr().SetReputation(factionEntry, static_cast<float>(repChange));
|
||||||
|
|
||||||
// EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation
|
// EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user