Core/Creatures: Compute the level from ContentTuning
Port From (https://github.com/TrinityCore/TrinityCore/commit/562f65f3f8f271fc52cc428c71a562af22829dc0)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ namespace Game.Entities
|
||||
public string TitleAlt;
|
||||
public string IconName;
|
||||
public uint GossipMenuId;
|
||||
public short Minlevel;
|
||||
public Dictionary<Difficulty, CreatureLevelScaling> scalingStorage = new();
|
||||
public short Maxlevel;
|
||||
public int HealthScalingExpansion;
|
||||
public uint RequiredExpansion;
|
||||
public uint VignetteID; // @todo Read Vignette.db2
|
||||
@@ -145,15 +143,6 @@ namespace Game.Entities
|
||||
return CreatureModel.DefaultVisibleModel;
|
||||
}
|
||||
|
||||
public int[] GetMinMaxLevel()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
HealthScalingExpansion != (int)Expansion.LevelCurrent ? Minlevel : Minlevel + SharedConst.MaxLevel,
|
||||
HealthScalingExpansion != (int)Expansion.LevelCurrent ? Maxlevel : Maxlevel + SharedConst.MaxLevel
|
||||
};
|
||||
}
|
||||
|
||||
public int GetHealthScalingExpansion()
|
||||
{
|
||||
return HealthScalingExpansion == (int)Expansion.LevelCurrent ? (int)Expansion.WarlordsOfDraenor : HealthScalingExpansion;
|
||||
|
||||
Reference in New Issue
Block a user