using System; using System.Collections.Generic; using System.Linq; using System.Text; using AutoMapper; using SessionCompanion.Database.Tables; using SessionCompanion.ViewModels.CharacterViewModels; namespace SessionCompanion.Services.Profiles { public class CharacterProfile : Profile { public CharacterProfile() { CreateMap(); CreateMap(); CreateMap() .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)); CreateMap(); CreateMap() // Charisma .ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception)) .ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation)) .ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance)) .ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion)) .ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows)) .ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception)) .ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation)) .ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification)) .ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance)) .ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion)) .ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows)) .ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value)) // Dexterity .ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value)) .ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification)) .ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows)) .ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows)) .ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics)) .ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics)) .ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand)) .ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand)) .ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth)) .ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth)) // Strength .ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics)) .ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics)) .ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows)) .ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification)) .ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows)) .ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value)) // Wisdom .ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling)) .ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling)) .ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight)) .ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine)) .ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception)) .ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows)) .ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival)) .ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight)) .ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine)) .ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification)) .ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception)) .ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows)) .ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival)) .ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value)) // Intelligence .ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana)) .ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana)) .ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory)) .ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation)) .ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature)) .ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion)) .ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows)) .ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History)) .ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation)) .ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification)) .ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature)) .ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion)) .ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows)) .ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value)) // Constitution .ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows)) .ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification)) .ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows)) .ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value)); CreateMap(); CreateMap() .ForMember(vm => vm.Id, conf => conf.MapFrom(charact => charact.Id)) .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)); CreateMap(); CreateMap(); CreateMap() .ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charac => charac.Statistics.Level)) .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charac => charac.Statistics.CurrentHealthPoints)) .ForMember(vm => vm.ClassName, conf => conf.MapFrom(charac => charac.Biography.Class.Name)) .ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name)) .ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception)) .ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation)) .ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance)) .ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion)) .ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows)) .ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception)) .ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation)) .ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification)) .ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance)) .ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion)) .ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows)) .ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value)) // Dexterity .ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value)) .ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification)) .ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows)) .ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows)) .ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics)) .ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics)) .ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand)) .ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand)) .ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth)) .ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth)) // Strength .ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics)) .ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics)) .ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows)) .ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification)) .ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows)) .ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value)) // Wisdom .ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling)) .ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling)) .ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight)) .ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine)) .ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception)) .ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows)) .ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival)) .ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight)) .ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine)) .ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification)) .ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception)) .ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows)) .ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival)) .ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value)) // Intelligence .ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana)) .ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana)) .ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory)) .ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation)) .ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature)) .ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion)) .ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows)) .ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History)) .ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation)) .ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification)) .ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature)) .ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion)) .ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows)) .ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value)) // Constitution .ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows)) .ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification)) .ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows)) .ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value)); CreateMap(); CreateMap() .ForMember(vm => vm.CharacterId, conf => conf.MapFrom(charact => charact.Id)) .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex)) .ForMember(vm => vm.CharacterLanguages, conf => conf.MapFrom(charact => charact.Biography.Languages.Split(new char[] { ';' }).ToList())) .ForMember(vm => vm.ClassId, conf => conf.MapFrom(charact => charact.Biography.Class.Id)) .ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)) .ForMember(vm => vm.Proficiencies, conf => conf.MapFrom(charact => charact.Biography.Class.Proficiencies.Split(new char[] { ';' }).ToList())) .ForMember(vm => vm.Subclasses, conf => conf.MapFrom(charact => charact.Biography.Class.Subclasses)) .ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex)) .ForMember(vm => vm.RaceName, conf => conf.MapFrom(charact => charact.Biography.Race.Name)) .ForMember(vm => vm.RaceLanguages, conf => conf.MapFrom(charact => charact.Biography.Race.Language.Split(new char[] { ';' }).ToList())) .ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex)) .ForMember(vm => vm.LanguageDescription, conf => conf.MapFrom(charact => charact.Biography.Race.LanguageDescription)) .ForMember(vm => vm.SizeDescription, conf => conf.MapFrom(charact => charact.Biography.Race.SizeDescription)) .ForMember(vm => vm.StartingProficiencies, conf => conf.MapFrom(charact => charact.Biography.Race.StartingProficiencies.Split(new char[] { ';' }).ToList())) .ForMember(vm => vm.Traits, conf => conf.MapFrom(charact => charact.Biography.Race.Traits.Split(new char[] { ';' }).ToList())) .ForMember(vm => vm.ExperiencePoints, conf => conf.MapFrom(charact => charact.Statistics.ExperiencePoints)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .ForMember(vm => vm.Speed, conf => conf.MapFrom(charact => charact.Statistics.Speed)) .ForMember(vm => vm.Initiative, conf => conf.MapFrom(charact => charact.Statistics.Initiative)); //.ForMember(vm => vm.Features, conf => conf.MapFrom(charact => charact.Biography.Class.ClassFeatures.Where(x => x.ClassId.Equals(charact.Biography.ClassId)).Select(f => f.Feature))); } } }