Core/Misc: Add functionality to allow low level quests/kills/discoveries to grant experience

Port From (https://github.com/TrinityCore/TrinityCore/commit/502f77fe8cb082843f7eb385159dd5038a059443)
This commit is contained in:
hondacrx
2021-02-02 10:28:22 -05:00
parent 3234d5c42c
commit 91459cde06
6 changed files with 86 additions and 9 deletions
+19 -8
View File
@@ -294,14 +294,13 @@ namespace Game
if (player.GetLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(PlayerConst.CurrentExpansion - 1) && player.GetSession().GetExpansion() == PlayerConst.CurrentExpansion && Expansion < (int)PlayerConst.CurrentExpansion)
xp = (uint)(xp / 9.0f);
if (xp <= 100)
xp = 5 * ((xp + 2) / 5);
else if (xp <= 500)
xp = 10 * ((xp + 5) / 10);
else if (xp <= 1000)
xp = 25 * ((xp + 12) / 25);
else
xp = 50 * ((xp + 25) / 50);
xp = RoundXPValue(xp);
if (WorldConfig.GetUIntValue(WorldCfg.MinQuestScaledXpRatio) != 0)
{
uint minScaledXP = RoundXPValue((uint)(questXp.Difficulty[RewardXPDifficulty] * RewardXPMultiplier)) * WorldConfig.GetUIntValue(WorldCfg.MinQuestScaledXpRatio) / 100;
xp = Math.Max(minScaledXP, xp);
}
return xp;
}
@@ -558,6 +557,18 @@ namespace Game
QueryData.Info.TimeAllowed = LimitTime;
}
public static uint RoundXPValue(uint xp)
{
if (xp <= 100)
return 5 * ((xp + 2) / 5);
else if (xp <= 500)
return 10 * ((xp + 5) / 10);
else if (xp <= 1000)
return 25 * ((xp + 12) / 25);
else
return 50 * ((xp + 25) / 50);
}
public bool HasFlag(QuestFlags flag) { return (Flags & flag) != 0; }
public bool HasFlagEx(QuestFlagsEx flag) { return (FlagsEx & flag) != 0; }
public bool HasFlagEx(QuestFlagsEx2 flag) { return (FlagsEx2 & flag) != 0; }