SES-118 Endpoint dla staystyk #50

Merged
s426134 merged 11 commits from SES-118 into dev 2021-01-04 09:40:04 +01:00
15 changed files with 10578 additions and 0 deletions

View File

@ -115,6 +115,12 @@ namespace SessionCompanion.Database
builder.Entity<CharacterWeapon>().HasData(SeedData.SeedCharacterWeapon()); builder.Entity<CharacterWeapon>().HasData(SeedData.SeedCharacterWeapon());
builder.Entity<CharacterArmor>().HasData(SeedData.SeedCharacterArmor()); builder.Entity<CharacterArmor>().HasData(SeedData.SeedCharacterArmor());
builder.Entity<CharacterOtherEquipment>().HasData(SeedData.SeedCharacterOtherEquipment()); builder.Entity<CharacterOtherEquipment>().HasData(SeedData.SeedCharacterOtherEquipment());
builder.Entity<Charisma>().HasData(SeedData.SeedCharisma());
builder.Entity<Constitution>().HasData(SeedData.SeedConstitution());
builder.Entity<Dexterity>().HasData(SeedData.SeedDexterity());
builder.Entity<Intelligence>().HasData(SeedData.SeedIntelligence());
builder.Entity<Strength>().HasData(SeedData.SeedStrength());
builder.Entity<Wisdom>().HasData(SeedData.SeedWisdom());
builder.Entity<Spell>().HasData(SeedSpell()); builder.Entity<Spell>().HasData(SeedSpell());
builder.Entity<CharacterSpell>().HasData(SeedData.SeedCharacterSpell()); builder.Entity<CharacterSpell>().HasData(SeedData.SeedCharacterSpell());
builder.Entity<CharacterSpellSlots>().HasData(SeedData.SeedCharacterSpellSlot()); builder.Entity<CharacterSpellSlots>().HasData(SeedData.SeedCharacterSpellSlot());

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace SessionCompanion.Database.Migrations
{
public partial class SeedStatistics : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Charismas",
columns: new[] { "Id", "CanDeception", "CanIntimidation", "CanPerformance", "CanPersuasion", "CanSaveThrows", "CharacterId", "Deception", "Intimidation", "Modification", "Performance", "Persuasion", "SavingThrows", "Value" },
values: new object[,]
{
{ 1, false, true, true, false, false, 1, 0, 1, 3, 2, 0, 0, 10 },
{ 2, true, true, true, false, true, 2, 1, 1, 5, 2, 0, 3, 11 },
{ 3, false, false, true, true, false, 3, 0, 4, -2, 2, 1, 0, 5 }
});
migrationBuilder.InsertData(
table: "Constitutions",
columns: new[] { "Id", "CanSaveThrows", "CharacterId", "Modification", "SavingThrows", "Value" },
values: new object[,]
{
{ 1, true, 1, 4, 2, 11 },
{ 2, true, 2, 4, 1, 9 },
{ 3, true, 3, 1, 2, 12 }
});
migrationBuilder.InsertData(
table: "Dexterities",
columns: new[] { "Id", "Acrobatics", "CanAcrobatics", "CanSaveThrows", "CanSleightOfHand", "CanStealth", "CharacterId", "Modification", "SavingThrows", "SleightOfHand", "Stealth", "Value" },
values: new object[,]
{
{ 2, 1, true, true, true, true, 2, 2, 2, 2, 2, 11 },
{ 3, 0, false, true, true, true, 3, 0, 2, 1, 2, 5 },
{ 1, 3, true, true, true, true, 1, 1, 4, 1, 2, 10 }
});
migrationBuilder.InsertData(
table: "Intelligences",
columns: new[] { "Id", "Arcana", "CanArcana", "CanHistory", "CanInvestigation", "CanNature", "CanReligion", "CanSaveThrows", "CharacterId", "History", "Investigation", "Modification", "Nature", "Religion", "SavingThrows", "Value" },
values: new object[,]
{
{ 1, 1, true, true, false, true, true, true, 1, 4, 0, -2, 1, 3, 1, 6 },
{ 2, 1, true, true, false, false, true, true, 2, 1, 0, 0, 0, 3, 1, 10 },
{ 3, 2, true, false, false, true, true, true, 3, 0, 0, 2, 2, 2, 1, 10 }
});
migrationBuilder.InsertData(
table: "Strengths",
columns: new[] { "Id", "Athletics", "CanAthletics", "CanSaveThrows", "CharacterId", "Modification", "SavingThrows", "Value" },
values: new object[,]
{
{ 1, 2, true, false, 1, 1, 0, 10 },
{ 2, 2, true, true, 2, 3, 2, 11 },
{ 3, 1, true, true, 3, 0, 2, 5 }
});
migrationBuilder.InsertData(
table: "Wisdoms",
columns: new[] { "Id", "AnimalHandling", "CanAnimalHandling", "CanInsight", "CanMedicine", "CanPerception", "CanSaveThrows", "CanSurvival", "CharacterId", "Insight", "Medicine", "Modification", "Perception", "SavingThrows", "Survival", "Value" },
values: new object[,]
{
{ 2, 2, true, true, false, true, true, true, 2, 2, 0, 2, 2, 1, 6, 9 },
{ 1, 2, true, true, false, true, true, true, 1, 1, 0, 3, 5, 1, 2, 11 },
{ 3, 0, false, true, true, true, true, true, 3, 1, 2, -3, 5, 1, 2, 6 }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Charismas",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Charismas",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Charismas",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Constitutions",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Constitutions",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Constitutions",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Dexterities",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Dexterities",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Dexterities",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Intelligences",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Intelligences",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Intelligences",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Strengths",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Strengths",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Strengths",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Wisdoms",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Wisdoms",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Wisdoms",
keyColumn: "Id",
keyValue: 3);
}
}
}

View File

@ -888,6 +888,59 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Charismas"); b.ToTable("Charismas");
b.HasData(
new
{
Id = 1,
CanDeception = false,
CanIntimidation = true,
CanPerformance = true,
CanPersuasion = false,
CanSaveThrows = false,
CharacterId = 1,
Deception = 0,
Intimidation = 1,
Modification = 3,
Performance = 2,
Persuasion = 0,
SavingThrows = 0,
Value = 10
},
new
{
Id = 2,
CanDeception = true,
CanIntimidation = true,
CanPerformance = true,
CanPersuasion = false,
CanSaveThrows = true,
CharacterId = 2,
Deception = 1,
Intimidation = 1,
Modification = 5,
Performance = 2,
Persuasion = 0,
SavingThrows = 3,
Value = 11
},
new
{
Id = 3,
CanDeception = false,
CanIntimidation = false,
CanPerformance = true,
CanPersuasion = true,
CanSaveThrows = false,
CharacterId = 3,
Deception = 0,
Intimidation = 4,
Modification = -2,
Performance = 2,
Persuasion = 1,
SavingThrows = 0,
Value = 5
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
@ -950,6 +1003,35 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Constitutions"); b.ToTable("Constitutions");
b.HasData(
new
{
Id = 1,
CanSaveThrows = true,
CharacterId = 1,
Modification = 4,
SavingThrows = 2,
Value = 11
},
new
{
Id = 2,
CanSaveThrows = true,
CharacterId = 2,
Modification = 4,
SavingThrows = 1,
Value = 9
},
new
{
Id = 3,
CanSaveThrows = true,
CharacterId = 3,
Modification = 1,
SavingThrows = 2,
Value = 12
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
@ -998,6 +1080,53 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Dexterities"); b.ToTable("Dexterities");
b.HasData(
new
{
Id = 1,
Acrobatics = 3,
CanAcrobatics = true,
CanSaveThrows = true,
CanSleightOfHand = true,
CanStealth = true,
CharacterId = 1,
Modification = 1,
SavingThrows = 4,
SleightOfHand = 1,
Stealth = 2,
Value = 10
},
new
{
Id = 2,
Acrobatics = 1,
CanAcrobatics = true,
CanSaveThrows = true,
CanSleightOfHand = true,
CanStealth = true,
CharacterId = 2,
Modification = 2,
SavingThrows = 2,
SleightOfHand = 2,
Stealth = 2,
Value = 11
},
new
{
Id = 3,
Acrobatics = 0,
CanAcrobatics = false,
CanSaveThrows = true,
CanSleightOfHand = true,
CanStealth = true,
CharacterId = 3,
Modification = 0,
SavingThrows = 2,
SleightOfHand = 1,
Stealth = 2,
Value = 5
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
@ -1058,6 +1187,65 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Intelligences"); b.ToTable("Intelligences");
b.HasData(
new
{
Id = 1,
Arcana = 1,
CanArcana = true,
CanHistory = true,
CanInvestigation = false,
CanNature = true,
CanReligion = true,
CanSaveThrows = true,
CharacterId = 1,
History = 4,
Investigation = 0,
Modification = -2,
Nature = 1,
Religion = 3,
SavingThrows = 1,
Value = 6
},
new
{
Id = 2,
Arcana = 1,
CanArcana = true,
CanHistory = true,
CanInvestigation = false,
CanNature = false,
CanReligion = true,
CanSaveThrows = true,
CharacterId = 2,
History = 1,
Investigation = 0,
Modification = 0,
Nature = 0,
Religion = 3,
SavingThrows = 1,
Value = 10
},
new
{
Id = 3,
Arcana = 2,
CanArcana = true,
CanHistory = false,
CanInvestigation = false,
CanNature = true,
CanReligion = true,
CanSaveThrows = true,
CharacterId = 3,
History = 0,
Investigation = 0,
Modification = 2,
Nature = 2,
Religion = 2,
SavingThrows = 1,
Value = 10
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.OtherEquipment", b => modelBuilder.Entity("SessionCompanion.Database.Tables.OtherEquipment", b =>
@ -7611,6 +7799,41 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Strengths"); b.ToTable("Strengths");
b.HasData(
new
{
Id = 1,
Athletics = 2,
CanAthletics = true,
CanSaveThrows = false,
CharacterId = 1,
Modification = 1,
SavingThrows = 0,
Value = 10
},
new
{
Id = 2,
Athletics = 2,
CanAthletics = true,
CanSaveThrows = true,
CharacterId = 2,
Modification = 3,
SavingThrows = 2,
Value = 11
},
new
{
Id = 3,
Athletics = 1,
CanAthletics = true,
CanSaveThrows = true,
CharacterId = 3,
Modification = 0,
SavingThrows = 2,
Value = 5
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
@ -8240,6 +8463,65 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Wisdoms"); b.ToTable("Wisdoms");
b.HasData(
new
{
Id = 1,
AnimalHandling = 2,
CanAnimalHandling = true,
CanInsight = true,
CanMedicine = false,
CanPerception = true,
CanSaveThrows = true,
CanSurvival = true,
CharacterId = 1,
Insight = 1,
Medicine = 0,
Modification = 3,
Perception = 5,
SavingThrows = 1,
Survival = 2,
Value = 11
},
new
{
Id = 2,
AnimalHandling = 2,
CanAnimalHandling = true,
CanInsight = true,
CanMedicine = false,
CanPerception = true,
CanSaveThrows = true,
CanSurvival = true,
CharacterId = 2,
Insight = 2,
Medicine = 0,
Modification = 2,
Perception = 2,
SavingThrows = 1,
Survival = 6,
Value = 9
},
new
{
Id = 3,
AnimalHandling = 0,
CanAnimalHandling = false,
CanInsight = true,
CanMedicine = true,
CanPerception = true,
CanSaveThrows = true,
CanSurvival = true,
CharacterId = 3,
Insight = 1,
Medicine = 2,
Modification = -3,
Perception = 5,
SavingThrows = 1,
Survival = 2,
Value = 6
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>

View File

@ -388,6 +388,318 @@ namespace SessionCompanion.Database
}; };
return characterOtherEquipment; return characterOtherEquipment;
} }
static public List<Strength> SeedStrength()
{
List<Strength> strengths = new List<Strength>
{
new Strength
{
Id = 1,
CharacterId = 1,
Value = 10,
Modification = 1,
SavingThrows = 0,
CanSaveThrows = false,
Athletics = 2,
CanAthletics = true
},
new Strength
{
Id = 2,
CharacterId = 2,
Value = 11,
Modification = 3,
SavingThrows = 2,
CanSaveThrows = true,
Athletics = 2,
CanAthletics = true
},
new Strength
{
Id = 3,
CharacterId = 3,
Value = 5,
Modification = 0,
SavingThrows = 2,
CanSaveThrows = true,
Athletics = 1,
CanAthletics = true
}
};
return strengths;
}
static public List<Charisma> SeedCharisma()
{
List<Charisma> charismas = new List<Charisma>
{
new Charisma
{
Id = 1,
CharacterId = 1,
Value = 10,
Modification = 3,
SavingThrows = 0,
CanSaveThrows = false,
Deception = 0,
CanDeception = false,
Intimidation = 1,
CanIntimidation = true,
Performance = 2,
CanPerformance = true,
Persuasion = 0,
CanPersuasion = false
},
new Charisma
{
Id = 2,
CharacterId = 2,
Value = 11,
Modification = 5,
SavingThrows = 3,
CanSaveThrows = true,
Deception = 1,
CanDeception = true,
Intimidation = 1,
CanIntimidation = true,
Performance = 2,
CanPerformance = true,
Persuasion = 0,
CanPersuasion = false
},
new Charisma
{
Id = 3,
CharacterId = 3,
Value = 5,
Modification = -2,
SavingThrows = 0,
CanSaveThrows = false,
Deception = 0,
CanDeception = false,
Intimidation = 4,
CanIntimidation = false,
Performance = 2,
CanPerformance = true,
Persuasion = 1,
CanPersuasion = true
}
};
return charismas;
}
static public List<Constitution> SeedConstitution()
{
List<Constitution> constitutions = new List<Constitution>
{
new Constitution
{
Id = 1,
CharacterId = 1,
Value = 11,
Modification = 4,
SavingThrows = 2,
CanSaveThrows = true
},
new Constitution
{
Id = 2,
CharacterId = 2,
Value = 9,
Modification = 4,
SavingThrows = 1,
CanSaveThrows = true
},
new Constitution
{
Id = 3,
CharacterId = 3,
Value = 12,
Modification = 1,
SavingThrows = 2,
CanSaveThrows = true
}
};
return constitutions;
}
static public List<Dexterity> SeedDexterity()
{
List<Dexterity> dexterities = new List<Dexterity>
{
new Dexterity
{
Id = 1,
CharacterId = 1,
Value = 10,
Modification = 1,
SavingThrows = 4,
CanSaveThrows = true,
Acrobatics = 3,
CanAcrobatics = true,
SleightOfHand = 1,
CanSleightOfHand = true,
Stealth = 2,
CanStealth = true
},
new Dexterity
{
Id = 2,
CharacterId = 2,
Value = 11,
Modification = 2,
SavingThrows = 2,
CanSaveThrows = true,
Acrobatics = 1,
CanAcrobatics = true,
SleightOfHand = 2,
CanSleightOfHand = true,
Stealth = 2,
CanStealth = true
},
new Dexterity
{
Id = 3,
CharacterId = 3,
Value = 5,
Modification = 0,
SavingThrows = 2,
CanSaveThrows = true,
Acrobatics = 0,
CanAcrobatics = false,
SleightOfHand = 1,
CanSleightOfHand = true,
Stealth = 2,
CanStealth = true
}
};
return dexterities;
}
static public List<Intelligence> SeedIntelligence()
{
List<Intelligence> intelligences = new List<Intelligence>
{
new Intelligence
{
Id = 1,
CharacterId = 1,
Value = 6,
Modification = -2,
SavingThrows = 1,
CanSaveThrows = true,
Arcana = 1,
CanArcana = true,
History = 4,
CanHistory = true,
Investigation = 0,
CanInvestigation = false,
Nature = 1,
CanNature = true,
Religion = 3,
CanReligion = true
},
new Intelligence
{
Id = 2,
CharacterId = 2,
Value = 10,
Modification = 0,
SavingThrows = 1,
CanSaveThrows = true,
Arcana = 1,
CanArcana = true,
History = 1,
CanHistory = true,
Investigation = 0,
CanInvestigation = false,
Nature = 0,
CanNature = false,
Religion = 3,
CanReligion = true
},
new Intelligence
{
Id = 3,
CharacterId = 3,
Value = 10,
Modification = 2,
SavingThrows = 1,
CanSaveThrows = true,
Arcana = 2,
CanArcana = true,
History = 0,
CanHistory = false,
Investigation = 0,
CanInvestigation = false,
Nature = 2,
CanNature = true,
Religion = 2,
CanReligion = true
}
};
return intelligences;
}
static public List<Wisdom> SeedWisdom()
{
List<Wisdom> wisdoms = new List<Wisdom>
{
new Wisdom
{
Id = 1,
CharacterId = 1,
Value = 11,
Modification = 3,
SavingThrows = 1,
CanSaveThrows = true,
AnimalHandling = 2,
CanAnimalHandling = true,
Insight = 1,
CanInsight = true,
Medicine = 0,
CanMedicine = false,
Perception = 5,
CanPerception = true,
Survival = 2,
CanSurvival = true
},
new Wisdom
{
Id = 2,
CharacterId = 2,
Value = 9,
Modification = 2,
SavingThrows = 1,
CanSaveThrows = true,
AnimalHandling = 2,
CanAnimalHandling = true,
Insight = 2,
CanInsight = true,
Medicine = 0,
CanMedicine = false,
Perception = 2,
CanPerception = true,
Survival = 6,
CanSurvival = true
},
new Wisdom
{
Id = 3,
CharacterId = 3,
Value = 6,
Modification = -3,
SavingThrows = 1,
CanSaveThrows = true,
AnimalHandling = 0,
CanAnimalHandling = false,
Insight = 1,
CanInsight = true,
Medicine = 2,
CanMedicine = true,
Perception = 5,
CanPerception = true,
Survival = 2,
CanSurvival = true
}
};
return wisdoms;
}
static public List<CharacterSpell> SeedCharacterSpell() static public List<CharacterSpell> SeedCharacterSpell()
{ {
List<CharacterSpell> characterSpells = new List<CharacterSpell> List<CharacterSpell> characterSpells = new List<CharacterSpell>

View File

@ -0,0 +1,216 @@
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.UniversalModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Services.Helpers
{
public static class CustomMappings
{
public static UniversalStatisticViewModel MapCharisma(Charisma charisma)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = charisma.Id,
Name = "Charisma",
Value = charisma.Value,
Modification = charisma.Modification,
SavingThrows = charisma.SavingThrows,
CanSaveThrows = charisma.CanSaveThrows,
Skills = new List<UniversalSkillViewModel>
{
new UniversalSkillViewModel
{
Name = "Deception",
Value = charisma.Deception,
Can = charisma.CanDeception
},
new UniversalSkillViewModel
{
Name = "Intimidation",
Value = charisma.Intimidation,
Can = charisma.CanIntimidation
},
new UniversalSkillViewModel
{
Name = "Performance",
Value = charisma.Performance,
Can = charisma.CanPerformance
},
new UniversalSkillViewModel
{
Name = "Persuasion",
Value = charisma.Persuasion,
Can = charisma.CanPersuasion
}
}
};
return universalStatisticViewModel;
}
public static UniversalStatisticViewModel MapConstitution(Constitution constitution)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = constitution.Id,
Name = "Constitution",
Value = constitution.Value,
Modification = constitution.Modification,
SavingThrows = constitution.SavingThrows,
CanSaveThrows = constitution.CanSaveThrows,
Skills = null
};
return universalStatisticViewModel;
}
public static UniversalStatisticViewModel MapDexterity(Dexterity dexterity)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = dexterity.Id,
Name = "Dexterity",
Value = dexterity.Value,
Modification = dexterity.Modification,
SavingThrows = dexterity.SavingThrows,
CanSaveThrows = dexterity.CanSaveThrows,
Skills = new List<UniversalSkillViewModel>
{
new UniversalSkillViewModel
{
Name = "Acrobatics",
Value = dexterity.Acrobatics,
Can = dexterity.CanAcrobatics
},
new UniversalSkillViewModel
{
Name = "SleightOfHand",
Value = dexterity.SleightOfHand,
Can = dexterity.CanSleightOfHand
},
new UniversalSkillViewModel
{
Name = "Stealth",
Value = dexterity.Stealth,
Can = dexterity.CanStealth
}
}
};
return universalStatisticViewModel;
}
public static UniversalStatisticViewModel MapIntelligence(Intelligence intelligence)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = intelligence.Id,
Name = "Intelligence",
Value = intelligence.Value,
Modification = intelligence.Modification,
SavingThrows = intelligence.SavingThrows,
CanSaveThrows = intelligence.CanSaveThrows,
Skills = new List<UniversalSkillViewModel>
{
new UniversalSkillViewModel
{
Name = "Arcana",
Value = intelligence.Arcana,
Can = intelligence.CanArcana
},
new UniversalSkillViewModel
{
Name = "History",
Value = intelligence.History,
Can = intelligence.CanHistory
},
new UniversalSkillViewModel
{
Name = "Investigation",
Value = intelligence.Investigation,
Can = intelligence.CanInvestigation
},
new UniversalSkillViewModel
{
Name = "Nature",
Value = intelligence.Nature,
Can = intelligence.CanNature
},
new UniversalSkillViewModel
{
Name = "Religion",
Value = intelligence.Religion,
Can = intelligence.CanReligion
}
}
};
return universalStatisticViewModel;
}
public static UniversalStatisticViewModel MapStrength(Strength strength)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = strength.Id,
Name = "Strength",
Value = strength.Value,
Modification = strength.Modification,
SavingThrows = strength.SavingThrows,
CanSaveThrows = strength.CanSaveThrows,
Skills = new List<UniversalSkillViewModel>
{
new UniversalSkillViewModel
{
Name = "Athletics",
Value = strength.Athletics,
Can = strength.CanAthletics
}
}
};
return universalStatisticViewModel;
}
public static UniversalStatisticViewModel MapWisdom(Wisdom wisdom)
{
UniversalStatisticViewModel universalStatisticViewModel = new UniversalStatisticViewModel
{
Id = wisdom.Id,
Name = "Wisdom",
Value = wisdom.Value,
Modification = wisdom.Modification,
SavingThrows = wisdom.SavingThrows,
CanSaveThrows = wisdom.CanSaveThrows,
Skills = new List<UniversalSkillViewModel>
{
new UniversalSkillViewModel
{
Name = "AnimalHandling",
Value = wisdom.AnimalHandling,
Can = wisdom.CanAnimalHandling
},
new UniversalSkillViewModel
{
Name = "Insight",
Value = wisdom.Insight,
Can = wisdom.CanInsight
},
new UniversalSkillViewModel
{
Name = "Medicine",
Value = wisdom.Medicine,
Can = wisdom.CanMedicine
},
new UniversalSkillViewModel
{
Name = "Perception",
Value = wisdom.Perception,
Can = wisdom.CanPerception
},
new UniversalSkillViewModel
{
Name = "Survival",
Value = wisdom.Survival,
Can = wisdom.CanSurvival
},
}
};
return universalStatisticViewModel;
}
}
}

View File

@ -1,6 +1,7 @@
using SessionCompanion.Database.Tables; using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base; using SessionCompanion.Services.Base;
using SessionCompanion.ViewModels.CharacterViewModels; using SessionCompanion.ViewModels.CharacterViewModels;
using SessionCompanion.ViewModels.UniversalModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -12,5 +13,6 @@ namespace SessionCompanion.Services.Interfaces
{ {
Task<IEnumerable<CharacterBasicStatsViewModel>> GetBasicCharactersData(List<int> charactersId); Task<IEnumerable<CharacterBasicStatsViewModel>> GetBasicCharactersData(List<int> charactersId);
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId); Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
Task<List<UniversalStatisticViewModel>> GetCharacterStatistics(int characterId);
} }
} }

View File

@ -25,6 +25,73 @@ namespace SessionCompanion.Services.Profiles
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .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.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints))
.ForMember(vm => vm.Class, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap(); .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();
} }
} }
} }

View File

@ -14,6 +14,8 @@ using Microsoft.EntityFrameworkCore;
using AutoMapper.QueryableExtensions; using AutoMapper.QueryableExtensions;
using System.IO; using System.IO;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using SessionCompanion.ViewModels.UniversalModels;
using SessionCompanion.Services.Helpers;
namespace SessionCompanion.Services.Services namespace SessionCompanion.Services.Services
{ {
@ -51,6 +53,48 @@ namespace SessionCompanion.Services.Services
var result = Mapper.Map<IEnumerable<CharacterBasicStatsViewModel>>(characters); var result = Mapper.Map<IEnumerable<CharacterBasicStatsViewModel>>(characters);
return result; return result;
} }
/// <summary>
/// Funkcja zwraca wszystkie statystyki danej postaci
/// </summary>
/// <param name="characterId">indentyfikator postaci</param>
/// <returns>ViewModel z statystykami postaci</returns>
public async Task<CharacterEveryStatViewModel> 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<CharacterEveryStatViewModel>(character);
return result;
}
/// <summary>
/// Funkcja zwraca listę, zawierającą statystyki danej postaci
/// </summary>
/// <param name="characterId"></param>
/// <returns>lista zawierającą statystyki danej postaci</returns>
public async Task<List<UniversalStatisticViewModel>> GetCharacterStatistics(int characterId)
{
List<UniversalStatisticViewModel> statistics = new List<UniversalStatisticViewModel>();
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();
statistics.Add(CustomMappings.MapCharisma(character.Charisma));
statistics.Add(CustomMappings.MapDexterity(character.Dexterity));
statistics.Add(CustomMappings.MapConstitution(character.Constitution));
statistics.Add(CustomMappings.MapIntelligence(character.Intelligence));
statistics.Add(CustomMappings.MapStrength(character.Strength));
statistics.Add(CustomMappings.MapWisdom(character.Wisdom));
return statistics;
}
} }
} }

View File

@ -0,0 +1,313 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.ViewModels.CharacterViewModels
{
public class CharacterEveryStatViewModel
{
/// <summary>
/// Id postaci
/// </summary>
public int Id { get; set; }
public int CharismaValue { get; set; }
/// <summary>
/// Modyfikator rzutów na charyzme
/// </summary>
public int CharismaModification { get; set; }
/// <summary>
/// Modyfikator rzutów obronnych na charyzme
/// </summary>
public int CharismaSavingThrows { get; set; }
/// <summary>
/// Czy postać posiada biegłość w charyźmie
/// </summary>
public bool CharismaCanSaveThrows { get; set; }
/// <summary>
/// Wartość oszustwa
/// </summary>
public int Deception { get; set; }
/// <summary>
/// Czy postać posiada biegłość w oszustwie
/// </summary>
public bool CanDeception { get; set; }
/// <summary>
/// Wartość umiejętności zastraszania
/// </summary>
public int Intimidation { get; set; }
/// <summary>
/// Czy postać posiada biegłość w zastraszaniu
/// </summary>
public bool CanIntimidation { get; set; }
/// <summary>
/// Wartość umiejętności występowania
/// </summary>
public int Performance { get; set; }
/// <summary>
/// Czy postać posiada biegłość w występowaniu
/// </summary>
public bool CanPerformance { get; set; }
/// <summary>
/// Wartość umiejętności perswazji
/// </summary>
public int Persuasion { get; set; }
/// <summary>
/// Czy postać posiada biegłość w perswazji
/// </summary>
public bool CanPersuasion { get; set; }
// Constitution
/// <summary>
/// Wartośc Constitution
/// </summary>
public int ConstitutionValue { get; set; }
/// <summary>
/// Modyfikator Constitution
/// </summary>
public int ConstitutionModification { get; set; }
/// <summary>
/// Wartość rzutów obronnych na constitiution
/// </summary>
public int ConstitutionSavingThrows { get; set; }
/// <summary>
/// Czy postać posiada biegłość w Constitution
/// </summary>
public bool ConstitutionCanSaveThrows { get; set; }
// Dexterity
/// <summary>
/// Wartość Dexterity
/// </summary>
public int DexterityValue { get; set; }
/// <summary>
/// Modyfiukator Dexterity
/// </summary>
public int DexterityModification { get; set; }
/// <summary>
/// Biegłośc w Dexterity
/// </summary>
public int DexteritySavingThrows { get; set; }
/// <summary>
/// Czy postać posiada biegłość w Dexterity
/// </summary>
public bool DexterityCanSaveThrows { get; set; }
/// <summary>
/// Wartość umiejętności akrobatyki
/// </summary>
public int Acrobatics { get; set; }
/// <summary>
/// Czy postać posiada biegłość w akrobatyce
/// </summary>
public bool CanAcrobatics { get; set; }
/// <summary>
/// Wartość umiejętności zwinnych dłoni
/// </summary>
public int SleightOfHand { get; set; }
/// <summary>
/// Czy postać posiada biegłość w zwinnych dłoniach
/// </summary>
public bool CanSleightOfHand { get; set; }
/// <summary>
/// Wartość umiejętności skradania się
/// </summary>
public int Stealth { get; set; }
/// <summary>
/// Czy postać posiada biegłość w skradaniu się
/// </summary>
public bool CanStealth { get; set; }
// Intelligence
/// <summary>
/// Wartośc Intelligence
/// </summary>
public int IntelligenceValue { get; set; }
/// <summary>
/// Modyfikator Intelligence
/// </summary>
public int IntelligenceModification { get; set; }
/// <summary>
/// Biegłość w Intelligence
/// </summary>
public int IntelligenceSavingThrows { get; set; }
/// <summary>
/// Czy posiada biegłośc w Intellgence
/// </summary>
public bool IntelligenceCanSaveThrows { get; set; }
/// <summary>
/// Wartość umiejętności wiedzy tejemnej
/// </summary>
public int Arcana { get; set; }
/// <summary>
/// Czy postać posiada biegłość w wiedzy tejemnej
/// </summary>
public bool CanArcana { get; set; }
/// <summary>
/// Wartość umiejętności historii
/// </summary>
public int History { get; set; }
/// <summary>
/// Czy postać posiada biegłość w historii
/// </summary>
public bool CanHistory { get; set; }
/// <summary>
/// Wartość umiejętności śledztwa
/// </summary>
public int Investigation { get; set; }
/// <summary>
/// Czy postać posiada biegłość w śledztwie
/// </summary>
public bool CanInvestigation { get; set; }
/// <summary>
/// Wartość umiejętności przyrody
/// </summary>
public int Nature { get; set; }
/// <summary>
/// Czy postać posiada biegłość w przyrodzie
/// </summary>
public bool CanNature { get; set; }
/// <summary>
/// Wartość umiejętności religii
/// </summary>
public int Religion { get; set; }
/// <summary>
/// Czy postać posiada biegłość w religii
/// </summary>
public bool CanReligion { get; set; }
// Strength
/// <summary>
/// Wartośc siły
/// </summary>
public int StrengthValue { get; set; }
/// <summary>
/// Modyfikator siły
/// </summary>
public int StrengthModification { get; set; }
/// <summary>
/// Biegłość w Sile
/// </summary>
public int StrengthSavingThrows { get; set; }
/// <summary>
/// Czy posiada biegłość w sile
/// </summary>
public bool StrengthCanSaveThrows { get; set; }
/// <summary>
/// Wartość umiejętności atletyki
/// </summary>
public int Athletics { get; set; }
/// <summary>
/// Czy postać posiada biegłość w atletyce
/// </summary>
public bool CanAthletics { get; set; }
// Wisdom
/// <summary>
/// Wartośc wisdom
/// </summary>
public int WisdomValue { get; set; }
/// <summary>
/// Modyfikator wisdom
/// </summary>
public int WisdomModification { get; set; }
/// <summary>
/// Biegłość w Wisdom
/// </summary>
public int WisdomSavingThrows { get; set; }
/// <summary>
/// Czy postać posiada biegłość w wisdom
/// </summary>
public bool WisdomCanSaveThrows { get; set; }
/// <summary>
/// Wartość umiejętności opieki nad zwierzętami
/// </summary>
public int AnimalHandling { get; set; }
/// <summary>
/// Czy postać posiada biegłość w opiece nad zwierzętami
/// </summary>
public bool CanAnimalHandling { get; set; }
/// <summary>
/// Wartość umiejętności intuicji
/// </summary>
public int Insight { get; set; }
/// <summary>
/// Czy postać posiada biegłość w intuicji
/// </summary>
public bool CanInsight { get; set; }
/// <summary>
/// Wartość umiejętności medycyny
/// </summary>
public int Medicine { get; set; }
/// <summary>
/// Czy postać posiada biegłość w medycynie
/// </summary>
public bool CanMedicine { get; set; }
/// <summary>
/// Wartość umiejętności percepcji
/// </summary>
public int Perception { get; set; }
/// <summary>
/// Czy postać posiada biegłość w percepcji
/// </summary>
public bool CanPerception { get; set; }
/// <summary>
/// Wartość umiejętności sztuki przetrwania
/// </summary>
public int Survival { get; set; }
/// <summary>
/// Czy postać posiada biegłość w sztuce przetrwania
/// </summary>
public bool CanSurvival { get; set; }
}
}

View File

@ -105,6 +105,306 @@
Klasa postaci Klasa postaci
</summary> </summary>
</member> </member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Id">
<summary>
Id postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CharismaModification">
<summary>
Modyfikator rzutów na charyzme
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CharismaSavingThrows">
<summary>
Modyfikator rzutów obronnych na charyzme
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CharismaCanSaveThrows">
<summary>
Czy postać posiada biegłość w charyźmie
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Deception">
<summary>
Wartość oszustwa
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanDeception">
<summary>
Czy postać posiada biegłość w oszustwie
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Intimidation">
<summary>
Wartość umiejętności zastraszania
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanIntimidation">
<summary>
Czy postać posiada biegłość w zastraszaniu
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Performance">
<summary>
Wartość umiejętności występowania
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanPerformance">
<summary>
Czy postać posiada biegłość w występowaniu
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Persuasion">
<summary>
Wartość umiejętności perswazji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanPersuasion">
<summary>
Czy postać posiada biegłość w perswazji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.ConstitutionValue">
<summary>
Wartośc Constitution
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.ConstitutionModification">
<summary>
Modyfikator Constitution
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.ConstitutionSavingThrows">
<summary>
Wartość rzutów obronnych na constitiution
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.ConstitutionCanSaveThrows">
<summary>
Czy postać posiada biegłość w Constitution
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.DexterityValue">
<summary>
Wartość Dexterity
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.DexterityModification">
<summary>
Modyfiukator Dexterity
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.DexteritySavingThrows">
<summary>
Biegłośc w Dexterity
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.DexterityCanSaveThrows">
<summary>
Czy postać posiada biegłość w Dexterity
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Acrobatics">
<summary>
Wartość umiejętności akrobatyki
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanAcrobatics">
<summary>
Czy postać posiada biegłość w akrobatyce
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.SleightOfHand">
<summary>
Wartość umiejętności zwinnych dłoni
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanSleightOfHand">
<summary>
Czy postać posiada biegłość w zwinnych dłoniach
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Stealth">
<summary>
Wartość umiejętności skradania się
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanStealth">
<summary>
Czy postać posiada biegłość w skradaniu się
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.IntelligenceValue">
<summary>
Wartośc Intelligence
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.IntelligenceModification">
<summary>
Modyfikator Intelligence
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.IntelligenceSavingThrows">
<summary>
Biegłość w Intelligence
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.IntelligenceCanSaveThrows">
<summary>
Czy posiada biegłośc w Intellgence
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Arcana">
<summary>
Wartość umiejętności wiedzy tejemnej
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanArcana">
<summary>
Czy postać posiada biegłość w wiedzy tejemnej
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.History">
<summary>
Wartość umiejętności historii
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanHistory">
<summary>
Czy postać posiada biegłość w historii
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Investigation">
<summary>
Wartość umiejętności śledztwa
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanInvestigation">
<summary>
Czy postać posiada biegłość w śledztwie
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Nature">
<summary>
Wartość umiejętności przyrody
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanNature">
<summary>
Czy postać posiada biegłość w przyrodzie
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Religion">
<summary>
Wartość umiejętności religii
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanReligion">
<summary>
Czy postać posiada biegłość w religii
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.StrengthValue">
<summary>
Wartośc siły
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.StrengthModification">
<summary>
Modyfikator siły
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.StrengthSavingThrows">
<summary>
Biegłość w Sile
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.StrengthCanSaveThrows">
<summary>
Czy posiada biegłość w sile
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Athletics">
<summary>
Wartość umiejętności atletyki
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanAthletics">
<summary>
Czy postać posiada biegłość w atletyce
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.WisdomValue">
<summary>
Wartośc wisdom
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.WisdomModification">
<summary>
Modyfikator wisdom
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.WisdomSavingThrows">
<summary>
Biegłość w Wisdom
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.WisdomCanSaveThrows">
<summary>
Czy postać posiada biegłość w wisdom
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.AnimalHandling">
<summary>
Wartość umiejętności opieki nad zwierzętami
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanAnimalHandling">
<summary>
Czy postać posiada biegłość w opiece nad zwierzętami
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Insight">
<summary>
Wartość umiejętności intuicji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanInsight">
<summary>
Czy postać posiada biegłość w intuicji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Medicine">
<summary>
Wartość umiejętności medycyny
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanMedicine">
<summary>
Czy postać posiada biegłość w medycynie
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Perception">
<summary>
Wartość umiejętności percepcji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanPerception">
<summary>
Czy postać posiada biegłość w percepcji
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.Survival">
<summary>
Wartość umiejętności sztuki przetrwania
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterEveryStatViewModel.CanSurvival">
<summary>
Czy postać posiada biegłość w sztuce przetrwania
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Id"> <member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Id">
<summary> <summary>
Identyfikator postaci Identyfikator postaci

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.ViewModels.UniversalModels
{
public class UniversalSkillViewModel
{
public string Name { get; set; }
public int Value { get; set; }
public bool Can { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.ViewModels.UniversalModels
{
public class UniversalStatisticViewModel
{
public int Id { get; set; }
public string Name { get; set; }
public int Value { get; set; }
public int Modification { get; set; }
public int SavingThrows { get; set; }
public bool CanSaveThrows { get; set; }
public List<UniversalSkillViewModel>? Skills { get; set; }
}
}

View File

@ -8,6 +8,7 @@ using SessionCompanion.ViewModels.CharacterViewModels;
namespace SessionCompanion.Controllers namespace SessionCompanion.Controllers
{ {
using SessionCompanion.Hubs; using SessionCompanion.Hubs;
using SessionCompanion.ViewModels.UniversalModels;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
@ -76,5 +77,16 @@ namespace SessionCompanion.Controllers
return characters.ToList(); return characters.ToList();
} }
/// <summary>
/// Metoda zwraca wszystkie statystyki dla danej postaci
/// </summary>
s426135 marked this conversation as resolved Outdated

brak opisu

brak opisu
/// <param name="characterId"> Id postaci </param>

brak opisu

brak opisu
/// <returns> Listę wszystkich statystyk </returns>
[HttpGet("characterStats")]
s426135 marked this conversation as resolved Outdated

brak required

brak required
public async Task<Either<List<UniversalStatisticViewModel>, ErrorResponse>> GetCharacterEveryStat([Required] int characterId)
{

Statystyki są niezmienne w budowe, wystarczy pobrać każdą z nich z osobna lub jednym zapytaniem wsyzstkie i póxniej zbudować z silnego typowania dla każdego ability odpowiednio widok i to połączyć w listę statystyk.
Można też użyć do tego mappera, ale to trochę więcej zabawy. Kod bedzie na "wyższym poziomie" ale nie trzeba tego robić

Statystyki są niezmienne w budowe, wystarczy pobrać każdą z nich z osobna lub jednym zapytaniem wsyzstkie i póxniej zbudować z silnego typowania dla każdego ability odpowiednio widok i to połączyć w listę statystyk. Można też użyć do tego mappera, ale to trochę więcej zabawy. Kod bedzie na "wyższym poziomie" ale nie trzeba tego robić
var statistics = await _service.GetCharacterStatistics(characterId);
return statistics;
}
} }
} }

View File

@ -24,6 +24,20 @@
</summary> </summary>
<returns> Lista zalogowanych postaci lub wiadomość błędu </returns> <returns> Lista zalogowanych postaci lub wiadomość błędu </returns>
</member> </member>
<member name="M:SessionCompanion.Controllers.CharacterController.GetCharacterEveryStat(System.Int32)">
<summary>
Metoda zwraca wszystkie statystyki dla danej postaci
Zwracane statystyki dla:
Charisma
Constitution
Dexterity
Intelligence
Strength
Wisdom
</summary>
<param name="characterId"></param>
<returns></returns>
</member>
<member name="M:SessionCompanion.Controllers.UserController.Login(System.String,System.String)"> <member name="M:SessionCompanion.Controllers.UserController.Login(System.String,System.String)">
<summary> <summary>
Metoda przyjmuje login oraz hasło i sprawdza czy istnieje użytkownik o podanych parametrach Metoda przyjmuje login oraz hasło i sprawdza czy istnieje użytkownik o podanych parametrach