protected virtual void LoadConditions(IniFile ini) {
var conditions = LinqExtension.RangeFrom()
.Select(x => $"CONDITION_{x}")
.TakeWhile(ini.ContainsKey)
.Select(x => new {
Type = ini[x].GetEnumNullable<PlaceConditionsType>("TYPE"),
Value = ini[x].GetIntNullable("OBJECTIVE")
})
.ToList();
if (conditions.Count != 3 || conditions[0].Type == null ||
conditions.Any(x => x.Value == null || x.Type != null && x.Type != conditions[0].Type)) {
AddError(AcErrorType.Data_KunosCareerConditions, ini["CONDITION_0"].GetNonEmpty("TYPE") ?? @"?");
} else {
RemoveError(AcErrorType.Data_KunosCareerConditions);
ConditionType = conditions[0].Type.Value;
FirstPlaceTarget = conditions[2].Value.Value;
SecondPlaceTarget = conditions[1].Value.Value;
ThirdPlaceTarget = conditions[0].Value.Value;
}
}