session-companion/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs

106 lines
9.1 KiB
C#

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<Character, CharacterViewModel>();
CreateMap<CharacterViewModel, Character>();
CreateMap<Character, CharacterForLoginViewModel>()
.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)).ReverseMap();
CreateMap<Character, CharacterBasicStatsViewModel>()
.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))
.ForMember(vm => vm.Class, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
CreateMap<Character, CharacterBasicInfoViewModel>()
.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))
.ForMember(vm => vm.MaxHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.HealthPoints))
.ForMember(vm => vm.Race, conf => conf.MapFrom(charact => charact.Biography.Race.Name))
.ForMember(vm => vm.Class, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
CreateMap<Character, CharacterEveryStatViewModel>()
.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)).ReverseMap();
}
}
}