Fixed a crash in playerinfo level data when its missing from the DB.
Fixes #53
This commit is contained in:
@@ -298,7 +298,10 @@ namespace Game.Entities
|
||||
public PlayerInfo()
|
||||
{
|
||||
for (var i = 0; i < castSpells.Length; ++i)
|
||||
castSpells[i] = new List<uint>();
|
||||
castSpells[i] = new();
|
||||
|
||||
for (var i = 0; i < levelInfo.Length; ++i)
|
||||
levelInfo[i] = new();
|
||||
}
|
||||
|
||||
public struct CreatePosition
|
||||
|
||||
@@ -6492,13 +6492,8 @@ namespace Game
|
||||
if (playerInfo == null)
|
||||
continue;
|
||||
|
||||
if (playerInfo.levelInfo[currentlevel - 1] == null)
|
||||
playerInfo.levelInfo[currentlevel - 1] = new PlayerLevelInfo();
|
||||
|
||||
var levelinfo = playerInfo.levelInfo[currentlevel - 1];
|
||||
|
||||
for (var i = 0; i < (int)Stats.Max; i++)
|
||||
levelinfo.stats[i] = (ushort)(result.Read<ushort>(i + 2) + raceStatModifiers[race][i]);
|
||||
playerInfo.levelInfo[currentlevel - 1].stats[i] = (ushort)(result.Read<ushort>(i + 2) + raceStatModifiers[race][i]);
|
||||
}
|
||||
|
||||
++count;
|
||||
@@ -6539,10 +6534,10 @@ namespace Game
|
||||
continue;
|
||||
|
||||
// fatal error if no level 1 data
|
||||
if (playerInfo.levelInfo == null || playerInfo.levelInfo[0].stats[0] == 0)
|
||||
if (playerInfo.levelInfo[0].stats[0] == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Race {0} Class {1} Level 1 does not have stats data!", race, _class);
|
||||
Global.WorldMgr.StopNow();
|
||||
Environment.Exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user