Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player: Modified reputation gain calculations #553

Closed
wants to merge 6 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6282,15 +6282,26 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32

uint32 currentLevel = GetLevel();

if (MaNGOS::XP::IsTrivialLevelDifference(currentLevel, creatureOrQuestLevel))
percent *= minRate;
else
// Level zero seems to be treated as always equal to players current level in IsTrivialLevelDifference therefore I have skipped level difference penalty computations for that value
if (creatureOrQuestLevel > 0)
{
// Pre-3.0.8: Declines with 20% for each level if 6 levels or more below the player down to a minimum (default: 20%)
const uint32 treshold = (creatureOrQuestLevel + 5);
// Old code seems to have been correct for computing level difference penalties for quests
if (source == REPUTATION_SOURCE_QUEST)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here you are saying the reputation penalty isnt related for quest case with "grayness" in any way, but only related to the + 5 constant (cos gray level is dynamic based on level of source)

{
// Pre-3.0.8: Declines with 20% for each level if 6 levels or more below the player down to a minimum (default: 20%)
const uint32 treshold = (creatureOrQuestLevel + 5);

if (currentLevel > treshold)
percent *= std::max(minRate, (1.0f - (0.2f * (currentLevel - treshold))));
}
else if (source == REPUTATION_SOURCE_KILL)
{
// For kill reputiation gains the penalties value seems to have been 20% for each level below lowest green level down to a minimum (default: 20%)
const uint32_t lastGreenLevel = MaNGOS::XP::GetGrayLevel(currentLevel) + 1;

if (currentLevel > treshold)
percent *= std::max(minRate, (1.0f - (0.2f * (currentLevel - treshold))));
if (lastGreenLevel > creatureOrQuestLevel)
percent *= std::max(minRate, (1.0f - (0.2f * (lastGreenLevel - creatureOrQuestLevel))));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is based on the forum post, but have you actually tested this on classic PTR or what specifically is this based on (I have read the links pointing it out)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After careful investigation, the function GetGrayLevel is deprecated and IsTrivialLevelDifference is the correct one. (trivial means grey in official naming)

I went ahead and a 48 npc (green) on lvl 60 gives full rep, and the GetGrayLevel function would not do that properly

}
}

if (percent <= 0.0f)
Expand Down