public void LoadSpellLists() { SpellLists.Clear(); foreach (var spellList in dataStore.Load()) { SpellLists.Add(new SpellListViewModel(spellList)); } }
public virtual void AddField(TextSpan field) { if (Condition.TryParse(field, out var condition)) { Conditions.Add(condition); return; } var(k, v) = field.SplitTuple(':'); switch (k.Value) { case "PROHIBITSPELL": ProhibitedSpells.Add(ProhibitedSpell.Parse(v)); return; case "BONUS": Bonuses.Add(Bonus.Parse(v)); return; case "DEFINE": { var parts = v.Split('|').ToArray(); if (parts.Length != 2) { throw new ParseFailedException(field, "Unable to parse variable definition."); } Definitions.Add(new VariableDefinition(parts[0].Value, Helpers.ParseInt(parts[1]))); return; } case "ABILITY": Abilities.Add(AbilityReference.Parse(v)); return; case "DOMAIN": Domains.Add(DomainReference.Parse(v)); return; case "CSKILL": ClassSkills.AddRange(v.Value.Split('|')); return; case "SOURCEPAGE": SourcePage = v.Value; return; case "SPELLLEVEL": SpellLists.AddRange(SpellList.Parse(v)); return; case "WEAPONBONUS": WeaponBonusProficiencySelections.Add(v.Value.Split('|').ToList()); return; case "KIT": // we are ignoring this one return; case "ADD": { var(type, parameter) = v.SplitTuple('|'); switch (type.Value) { case "SPELLCASTER": AddedSpellCasterLevels.Add(AddedSpellCasterLevel.Parse(parameter)); return; } break; } } throw new ParseFailedException(field, $"Unknown field '{field.Value}'"); }