private void CalculateLevel() { long totalSpentExp = 0; foreach (var attribute in Attributes) { int attributeExp = 0; for (int i = attribute.Start; i < attribute.Base; i++) { attributeExp += RaiseCost(attribute, i); } totalSpentExp += attributeExp; } foreach (var skill in Skills) { int skillExp = 0; for (int i = skill.Start; i < skill.Base; i++) { skillExp += RaiseCost(skill, i); } totalSpentExp += skillExp; } CurrentExp = totalSpentExp; CurrentLevel = HelperFuncs.GetLevelFromExp(CurrentExp); }