diff --git a/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterService.cs b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterService.cs index 4f33dba..63c2ad5 100644 --- a/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterService.cs +++ b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterService.cs @@ -12,5 +12,6 @@ namespace SessionCompanion.Services.Interfaces { Task> GetBasicCharactersData(List charactersId); Task> GetUserLoginCharacters(int userId); + Task GetCharacterEveryStat(int characterId); } } diff --git a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs index 0262a5f..8893dd7 100644 --- a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs +++ b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs @@ -25,6 +25,73 @@ namespace SessionCompanion.Services.Profiles .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() + .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(); } } } diff --git a/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs b/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs index a07f53c..9177415 100644 --- a/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs +++ b/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs @@ -51,6 +51,22 @@ namespace SessionCompanion.Services.Services var result = Mapper.Map>(characters); return result; } - + /// + /// Funkcja zwraca wszystkie statystyki danej postaci + /// + /// indentyfikator postaci + /// ViewModel z statystykami postaci + public async Task GetCharacterEveryStat(int characterId) + { + var character = await Repository.Get(c => c.Id.Equals(characterId)) + .Include(x => x.Intelligence) + .Include(x => x.Strength) + .Include(x => x.Wisdom) + .Include(x => x.Charisma) + .Include(x => x.Constitution) + .Include(x => x.Dexterity).SingleAsync(); + var result = Mapper.Map(character); + return result; + } } }