Core/Creatures: Compute the level from ContentTuning

Port From (https://github.com/TrinityCore/TrinityCore/commit/562f65f3f8f271fc52cc428c71a562af22829dc0)
This commit is contained in:
hondacrx
2023-04-21 18:49:58 -04:00
parent b7a8a88a76
commit 8828e94482
5 changed files with 87 additions and 114 deletions
+4 -9
View File
@@ -1425,16 +1425,11 @@ namespace Game.Entities
public void SelectLevel()
{
CreatureTemplate cInfo = GetCreatureTemplate();
// level
var minMaxLevels = cInfo.GetMinMaxLevel();
int minlevel = Math.Min(minMaxLevels[0], minMaxLevels[1]);
int maxlevel = Math.Max(minMaxLevels[0], minMaxLevels[1]);
int level = (minlevel == maxlevel ? minlevel : RandomHelper.IRand(minlevel, maxlevel));
SetLevel((uint)level);
// Level
ApplyLevelScaling();
int levelWithDelta = m_unitData.ScalingLevelMax + m_unitData.ScalingLevelDelta;
byte level = (byte)MathFunctions.RoundToInterval(ref levelWithDelta, 1, SharedConst.StrongMaxLevel);
SetLevel(level);
UpdateLevelDependantStats();
}