public static Monster ConvertToUsable(this Monster5e monster5e) { return(new Monster() { Name = monster5e.Name, ReferenceCardSize = ECardSize.None, PrimarySource = monster5e.Source, OtherSources = new List <string>(monster5e.OtherSources != null ? monster5e.OtherSources.Select(s => s.Source) : new string[] { }), CreatureTypeRef = monster5e.CreatureType.ToString(), HarvestingTable = new HarvestingTable { Rows = new List <HarvestingTableRow>() }, StatBlock = new StatBlock { Strength = monster5e.Strength, Dexterity = monster5e.Dexterity, Constitution = monster5e.Constitution, Intelligence = monster5e.Intelligence, Wisdom = monster5e.Wisdom, Charisma = monster5e.Charisma }, ChallengeRating = monster5e.ChallengeRating?.ConvertToUsable() }); }
private void TryStore5eMonster(Monster5e monster5e) { // ignore NPCs for now if (monster5e.IsNPC || monster5e.HasCopyDirective) { return; } try { Monster monster = null; CreatureType creatureType = null; monster = monster5e.ConvertToUsable(); creatureType = monster5e.CreatureType.ConvertToUsable(); CreatureTypes.TryAdd(creatureType.ToString().ToLower(), creatureType); if (Monsters.TryGetValue(monster.Name.ToLower(), out Monster storedMonster)) { storedMonster.CopyInMissing(monster); } else { Monsters.TryAdd(monster.Name.ToLower(), monster); } UpdateDictionaries(); } catch (Exception) { throw new Exception($"Damn it!! {monster5e.Name}"); } }