SES-148 Endpointy dla Armor i Weapon #71

Merged
s426134 merged 11 commits from SES-148 into dev 2021-01-14 16:45:05 +01:00
38 changed files with 2068 additions and 15 deletions
Showing only changes of commit 3facffb771 - Show all commits

View File

@ -127,3 +127,4 @@ namespace SessionCompanion.Database
}
}
}

View File

@ -0,0 +1,985 @@
[
{
"id": 1,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 4,
"Initiative": 2,
"HealthPoints": 8,
"CurrentHealthPoints": 8,
"ArmorClass": 5,
"Proficiency": 2
},
"biography": {
"Name": "Ulora",
"ClassId": 2,
"RaceId": 3,
"AlignmentId": "LawfulGood",
"BackgroundId": 2,
"Sex": "Female",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 11,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 12,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 44
},
{
"SpellId": 57
}
],
"charisma": {
"Value": 5,
"Modification": -2,
"SavingThrows": 0,
"CanSavingThrows": false,
"Deception": 0,
"CanDeception": false,
"Intimidation": 0,
"CanIntimidation": false,
"Performance": 0,
"CanPerformance": false,
"Persuasion": 0,
"CanPersuasion": false
},
"constitution": {
"Value": 12,
"Modification": 2,
"SavingThrows": 2,
"CanSaveThrows": true
},
"dexterity": {
"Value": 15,
"Modification": 2,
"SavingThrows": 3,
"CanSaveThrows": true,
"Acrobatics": 3,
"CanAcrobatics": true,
"SleightOfHand": 2,
"CanSleightOfHand": true,
"Stealth": 3,
"canStealth": true
},
"intelligence": {
"Value": 14,
"Modification": 4,
"SavingThrows": 2,
"CanSaveThrows": true,
"arcana": 2,
"canArcana": true,
"History": 4,
"CanHistory": true,
"Investigation": 3,
"CanInvestigation": true,
"Nature": 1,
"CanNature": true,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 8,
"Modification": -1,
"SavingThrows": 0,
"CanSaveThrows": false,
"Athletics": 0,
"canAthletics": false
},
"wisdom": {
"Value": 10,
"Modification": 0,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 1,
"CanAnimalHandling": true,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 2,
"CanPerception": true,
"Survival": 0,
"CanSurvival": false
}
},
{
"id": 2,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 3,
"Initiative": 5,
"HealthPoints": 12,
"CurrentHealthPoints": 11,
"ArmorClass": 4,
"Proficiency": 1
},
"biography": {
"Name": "Nucate",
"ClassId": 1,
"RaceId": 1,
"AlignmentId": "LawfulGood",
"BackgroundId": 1,
"Sex": "Male",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 30,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 25,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 2
},
{
"SpellId": 42
}
],
"charisma": {
"Value": 10,
"Modification": 3,
"SavingThrows": 0,
"CanSavingThrows": false,
"Deception": 0,
"CanDeception": false,
"Intimidation": 1,
"CanIntimidation": true,
"Performance": 2,
"CanPerformance": true,
"Persuasion": 0,
"CanPersuasion": false
},
"constitution": {
"Value": 11,
"Modification": 4,
"SavingThrows": 2,
"CanSaveThrows": true
},
"dexterity": {
"Value": 10,
"Modification": 1,
"SavingThrows": 4,
"CanSaveThrows": true,
"Acrobatics": 3,
"CanAcrobatics": true,
"SleightOfHand": 1,
"CanSleightOfHand": true,
"Stealth": 2,
"canStealth": true
},
"intelligence": {
"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
},
"strength": {
"Value": 10,
"Modification": 1,
"SavingThrows": 0,
"CanSaveThrows": false,
"Athletics": 2,
"canAthletics": true
},
"wisdom": {
"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
}
},
{
"id": 3,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 4,
"Initiative": 2,
"HealthPoints": 17,
"CurrentHealthPoints": 16,
"ArmorClass": 6,
"Proficiency": 3
},
"biography": {
"Name": "Muraraj",
"ClassId": 2,
"RaceId": 2,
"AlignmentId": "LawfulGood",
"BackgroundId": 1,
"Sex": "Male",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 1,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 2,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
},
{
"WeaponId": 10,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 42
}
],
"charisma": {
"Value": 15,
"Modification": 2,
"SavingThrows": 2,
"CanSaveThrows": true,
"Deception": 1,
"CanDeception": true,
"Intimidation": 4,
"CanIntimidation": true,
"Performance": 2,
"CanPerformance": true,
"Persuasion": 2,
"CanPersuasion": true
},
"constitution": {
"Value": 15,
"Modification": 4,
"SavingThrows": 2,
"CanSaveThrows": true
},
"dexterity": {
"Value": 8,
"Modification": -1,
"SavingThrows": 0,
"CanSaveThrows": false,
"Acrobatics": 0,
"CanAcrobatics": false,
"SleightOfHand": 0,
"CanSleightOfHand": false,
"Stealth": 0,
"canStealth": false
},
"intelligence": {
"Value": 8,
"Modification": -1,
"SavingThrows": 0,
"CanSaveThrows": false,
"arcana": 0,
"canArcana": false,
"History": 0,
"CanHistory": false,
"Investigation": 0,
"CanInvestigation": false,
"Nature": 0,
"CanNature": false,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 18,
"Modification": 4,
"SavingThrows": 3,
"CanSaveThrows": true,
"Athletics": 5,
"canAthletics": true
},
"wisdom": {
"Value": 6,
"Modification": -3,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 0,
"CanAnimalHandling": false,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 0,
"CanPerception": false,
"Survival": 0,
"CanSurvival": false
}
},
{
"id": 5,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 8,
"Initiative": 7,
"HealthPoints": 7,
"CurrentHealthPoints": 7,
"ArmorClass": 2,
"Proficiency": 3
},
"biography": {
"Name": "Amarena",
"ClassId": 2,
"RaceId": 1,
"AlignmentId": "LawfulGood",
"BackgroundId": 2,
"Sex": "Female",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 2,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 14,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
},
{
"WeaponId": 4,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 2
}
],
"charisma": {
"Value": 7,
"Modification": -2,
"SavingThrows": 0,
"CanSavingThrows": false,
"Deception": 0,
"CanDeception": false,
"Intimidation": 0,
"CanIntimidation": false,
"Performance": 0,
"CanPerformance": false,
"Persuasion": 0,
"CanPersuasion": false
},
"constitution": {
"Value": 11,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true
},
"dexterity": {
"Value": 17,
"Modification": 4,
"SavingThrows": 3,
"CanSaveThrows": true,
"Acrobatics": 4,
"CanAcrobatics": true,
"SleightOfHand": 2,
"CanSleightOfHand": true,
"Stealth": 5,
"canStealth": true
},
"intelligence": {
"Value": 10,
"Modification": 0,
"SavingThrows": 0,
"CanSaveThrows": false,
"arcana": 0,
"canArcana": false,
"History": 0,
"CanHistory": false,
"Investigation": 0,
"CanInvestigation": false,
"Nature": 0,
"CanNature": false,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 14,
"Modification": 2,
"SavingThrows": 1,
"CanSaveThrows": true,
"Athletics": 3,
"canAthletics": true
},
"wisdom": {
"Value": 7,
"Modification": 0,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 0,
"canAnimalHandling": false,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 0,
"CanPerception": false,
"Survival": 0,
"CanSurvival": false
}
},
{
"id": 6,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 2,
"Initiative": 3,
"HealthPoints": 17,
"CurrentHealthPoints": 17,
"ArmorClass": 5,
"Proficiency": 1
},
"biography": {
"Name": "Yaz' uw Emul",
"ClassId": 1,
"RaceId": 3,
"AlignmentId": "LawfulGood",
"BackgroundId": 3,
"Sex": "Male",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 16,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 14,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 2
},
{
"SpellId": 65
},
{
"SpellId": 44
}
],
"charisma": {
"Value": 10,
"Modification": 0,
"SavingThrows": 0,
"CanSavingThrows": false,
"Deception": 1,
"CanDeception": true,
"Intimidation": 2,
"CanIntimidation": true,
"Performance": 0,
"CanPerformance": false,
"Persuasion": 0,
"CanPersuasion": false
},
"constitution": {
"Value": 14,
"Modification": 4,
"SavingThrows": 1,
"CanSaveThrows": true
},
"dexterity": {
"Value": 6,
"Modification": -3,
"SavingThrows": 0,
"CanSaveThrows": false,
"Acrobatics": 0,
"CanAcrobatics": false,
"SleightOfHand": 0,
"CanSleightOfHand": false,
"Stealth": 0,
"canStealth": false
},
"intelligence": {
"Value": 11,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true,
"arcana": 0,
"canArcana": false,
"History": 2,
"CanHistory": true,
"Investigation": 1,
"CanInvestigation": true,
"Nature": 0,
"CanNature": false,
"Religion": 4,
"canReligion": true
},
"strength": {
"Value": 18,
"Modification": 4,
"SavingThrows": 2,
"CanSaveThrows": true,
"Athletics": 4,
"canAthletics": true
},
"wisdom": {
"Value": 9,
"Modification": -1,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 0,
"canAnimalHandling": false,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 0,
"CanPerception": false,
"Survival": 0,
"CanSurvival": false
}
},
{
"id": 7,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 5,
"Initiative": 4,
"HealthPoints": 13,
"CurrentHealthPoints": 13,
"ArmorClass": 2,
"Proficiency": 1
},
"biography": {
"Name": "Kamul",
"ClassId": 2,
"RaceId": 1,
"AlignmentId": "LawfulGood",
"BackgroundId": 1,
"Sex": "Female",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 18,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 1,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 3
},
{
"SpellId": 85
},
{
"SpellId": 94
}
],
"charisma": {
"Value": 10,
"Modification": 0,
"SavingThrows": 0,
"CanSavingThrows": false,
"Deception": 2,
"CanDeception": true,
"Intimidation": 0,
"CanIntimidation": false,
"Performance": 1,
"CanPerformance": true,
"Persuasion": 2,
"CanPersuasion": true
},
"constitution": {
"Value": 8,
"Modification": -2,
"SavingThrows": 0,
"CanSaveThrows": false
},
"dexterity": {
"Value": 12,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true,
"Acrobatics": 2,
"CanAcrobatics": true,
"SleightOfHand": 1,
"CanSleightOfHand": true,
"Stealth": 0,
"canStealth": false
},
"intelligence": {
"Value": 15,
"Modification": 4,
"SavingThrows": 2,
"CanSaveThrows": true,
"arcana": 4,
"canArcana": true,
"History": 1,
"CanHistory": true,
"Investigation": 1,
"CanInvestigation": true,
"Nature": 6,
"CanNature": true,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 13,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true,
"Athletics": 2,
"canAthletics": true
},
"wisdom": {
"Value": 13,
"Modification": 2,
"SavingThrows": 2,
"CanSaveThrows": true,
"AnimalHandling": 1,
"canAnimalHandling": true,
"Insight": 4,
"canInsight": true,
"medicine": 2,
"CanMedicine": true,
"Perception": 5,
"CanPerception": true,
"Survival": 2,
"CanSurvival": true
}
},
{
"id": 8,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 9,
"Initiative": 6,
"HealthPoints": 7,
"CurrentHealthPoints": 7,
"ArmorClass": 4,
"Proficiency": 1
},
"biography": {
"Name": "Mu",
"ClassId": 1,
"RaceId": 3,
"AlignmentId": "LawfulGood",
"BackgroundId": 2,
"Sex": "Male",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 1,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 17,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
},
{
"WeaponId": 27,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 3
}
],
"charisma": {
"Value": 11,
"Modification": 1,
"SavingThrows": 1,
"CanSavingThrows": true,
"Deception": 1,
"CanDeception": true,
"Intimidation": 0,
"CanIntimidation": false,
"Performance": 0,
"CanPerformance": false,
"Persuasion": 0,
"CanPersuasion": false
},
"constitution": {
"Value": 13,
"Modification": 2,
"SavingThrows": 1,
"CanSaveThrows": true
},
"dexterity": {
"Value": 17,
"Modification": 4,
"SavingThrows": 3,
"CanSaveThrows": true,
"Acrobatics": 3,
"CanAcrobatics": true,
"SleightOfHand": 4,
"CanSleightOfHand": true,
"Stealth": 1,
"canStealth": true
},
"intelligence": {
"Value": 8,
"Modification": -2,
"SavingThrows": 0,
"CanSaveThrows": false,
"arcana": 0,
"canArcana": false,
"History": 0,
"CanHistory": false,
"Investigation": 0,
"CanInvestigation": false,
"Nature": 0,
"CanNature": false,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 18,
"Modification": 4,
"SavingThrows": 3,
"CanSaveThrows": true,
"Athletics": 5,
"canAthletics": true
},
"wisdom": {
"Value": 8,
"Modification": -2,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 0,
"canAnimalHandling": false,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 0,
"CanPerception": false,
"Survival": 0,
"CanSurvival": false
}
},
{
"id": 9,
"userId": -1,
"statistics": {
"ExperiencePoints": 0,
"Level": 1,
"Speed": 4,
"Initiative": 3,
"HealthPoints": 12,
"CurrentHealthPoints": 12,
"ArmorClass": 3,
"Proficiency": 1
},
"biography": {
"Name": "Aarak",
"ClassId": 2,
"RaceId": 3,
"AlignmentId": "LawfulGood",
"BackgroundId": 2,
"Sex": "Female",
"Languages": "Common",
"background": {
"Origin": "No origin",
"History": "Nothing much"
}
},
"characterWeapons": [
{
"WeaponId": 4,
"InUse": true,
"HoldInRightHand": true,
"HoldInLeftHand": false
},
{
"WeaponId": 7,
"InUse": false,
"HoldInRightHand": false,
"HoldInLeftHand": false
}
],
"characterSpells": [
{
"SpellId": 1
},
{
"SpellId": 55
}
],
"charisma": {
"Value": 12,
"Modification": 2,
"SavingThrows": 1,
"CanSavingThrows": true,
"Deception": 0,
"CanDeception": false,
"Intimidation": 0,
"CanIntimidation": false,
"Performance": 0,
"CanPerformance": false,
"Persuasion": 3,
"CanPersuasion": true
},
"constitution": {
"Value": 11,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true
},
"dexterity": {
"Value": 15,
"Modification": 3,
"SavingThrows": 2,
"CanSaveThrows": true,
"Acrobatics": 2,
"CanAcrobatics": true,
"SleightOfHand": 1,
"CanSleightOfHand": true,
"Stealth": 4,
"canStealth": true
},
"intelligence": {
"Value": 12,
"Modification": 1,
"SavingThrows": 1,
"CanSaveThrows": true,
"arcana": 0,
"canArcana": false,
"History": 0,
"CanHistory": false,
"Investigation": 0,
"CanInvestigation": false,
"Nature": 2,
"CanNature": true,
"Religion": 0,
"canReligion": false
},
"strength": {
"Value": 15,
"Modification": 4,
"SavingThrows": 3,
"CanSaveThrows": true,
"Athletics": 2,
"canAthletics": true
},
"wisdom": {
"Value": 6,
"Modification": -4,
"SavingThrows": 0,
"CanSaveThrows": false,
"AnimalHandling": 0,
"canAnimalHandling": false,
"Insight": 0,
"canInsight": false,
"medicine": 0,
"CanMedicine": false,
"Perception": 0,
"CanPerception": false,
"Survival": 0,
"CanSurvival": false
}
}
]

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class GameActionRepository : Repository<GameAction>, IRepository<GameAction>
{
public GameActionRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class LegendaryActionRepository : Repository<LegendaryAction>, IRepository<LegendaryAction>
{
public LegendaryActionRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class MonsterActionsRepository : Repository<MonsterAction>, IRepository<MonsterAction>
{
public MonsterActionsRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class MonsterLegendaryActionsRepository : Repository<MonsterLegendaryAction>, IRepository<MonsterLegendaryAction>
{
public MonsterLegendaryActionsRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class MonsterRepository : Repository<Monster>, IRepository<Monster>
{
public MonsterRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class MonsterSpecialAbilitiesRepository : Repository<MonsterSpecialAbility>, IRepository<MonsterSpecialAbility>
{
public MonsterSpecialAbilitiesRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -0,0 +1,14 @@
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Database.Repositories
{
public class SpecialAbilityRepository : Repository<SpecialAbility>, IRepository<SpecialAbility>
{
public SpecialAbilityRepository(ApplicationDbContext _dbContext) : base(_dbContext)
{ }
}
}

View File

@ -21,8 +21,4 @@
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="JsonData\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class GameAction : BaseEntity
{
// <summary>
/// Nazwa akcji
/// </summary>
public string Name { get; set; }
/// <summary>
/// Opis akcji
/// </summary>
public string Description { get; set; }
public int AttackBonus { get; set; }
public int? DamageDice { get; set; }
public int? DamageDiceAmount { get; set; }
public int? DamageBonus { get; set; }
public virtual ICollection<MonsterAction> MonsterActions { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class LegendaryAction : BaseEntity
{
// <summary>
/// Nazwa legendarnej akcji
/// </summary>
public string Name { get; set; }
/// <summary>
/// Opis akcji
/// </summary>
public string Description { get; set; }
public virtual ICollection<MonsterLegendaryAction> MonsterLegendaryActions { get; set; }
}
}

View File

@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class Monster : BaseEntity
{
/// <summary>
/// Nazwa potwora
/// </summary>
public string Name { get; set; }
/// <summary>
/// Rozmiar potwora
/// </summary>
public string Size { get; set; }
/// <summary>
/// Rodzaj potwora
/// </summary>
public string Type { get; set; }
/// <summary>
/// Podtyp potwora
/// </summary>
public string Subtype { get; set; }
/// <summary>
/// Charakter potwora
/// </summary>
public string Alignment { get; set; }
/// <summary>
/// Poziom pancerza potwora
/// </summary>
public int ArmorClass { get; set; }
/// <summary>
/// Iloś punktów zycia potwora
/// </summary>
public int HitPoints { get; set; }
/// <summary>
/// Ilość kości określajacych punkty życia potwora
/// </summary>
public int HitDiceAmount { get; set; }
/// <summary>
/// Kość którą rzucamy aby określić punkty życia potwora
/// </summary>
public int HitDiceType { get; set; }
/// <summary>
/// Szybkość chodzenia potwora
/// </summary>
public string WalkSpeed { get; set; }
/// <summary>
/// Szybkość pływania potwora
/// </summary>
public string SwimSpeed { get; set; }
/// <summary>
/// Szybkość latania potwora
/// </summary>
public string FlySpeed { get; set; }
/// <summary>
/// Punkty zręczności potwora
/// </summary>
public int Dexterity { get; set; }
public int? DexteritySave { get; set; }
/// <summary>
/// Punkty siły potwora
/// </summary>
public int Strength { get; set; }
public int? StrengthSave { get; set; }
/// <summary>
/// Punkty kondycji potwora
/// </summary>
public int Constitution { get; set; }
public int? ConstitutionSave { get; set; }
/// <summary>
/// Punkty inteligencji potwora
/// </summary>
public int Intelligence { get; set; }
public int? IntelligenceSave { get; set; }
/// <summary>
/// Punkty mądrości potwora
/// </summary>
public int Wisdom { get; set; }
public int? WisdomSave { get; set; }
/// <summary>
/// Punkty charyzmy potwora
/// </summary>
public int Charisma { get; set; }
public int? CharismaSave { get; set; }
/// <summary>
/// Poziom trudności potwora
/// </summary>
public int ChallengeRating { get; set; }
/// <summary>
/// Punkty doświadczenia za zabicie potwora
/// </summary>
public int ExperiencePoints { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterActions
/// </summary>
public virtual ICollection<MonsterAction> MonsterAction { get; set; }
/// <summary>
/// Na jakie stany odporny jest potwor
/// </summary>
public string MonsterConditionImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia odporny jest potwor
/// </summary>
public string MonsterDamageImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia potwor ma zmniejszoną słabosc
/// </summary>
public string MonsterDamageResistances { get; set; }
/// <summary>
/// Na co potwor jest wrazliwy
/// </summary>
public string MonsterDamageVulnerabilities { get; set; }
/// <summary>
/// Jezyki jakimi wlada potwor
/// </summary>
public string MonsterLanguages { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterLegendaryActions
/// </summary>
public virtual ICollection<MonsterLegendaryAction> MonsterLegendaryAction { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterSenses
/// </summary>
public string MonsterSenses { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterSpecialAbilities
/// </summary>
public virtual ICollection<MonsterSpecialAbility> MonsterSpecialAbility { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class MonsterAction : BaseEntity
{
/// <summary>
/// Id potwora
/// </summary>
public int MonsterId { get; set; }
/// <summary>
/// Połączenie z tabelą Monsters
/// </summary>
public virtual Monster Monster { get; set; }
public int GameActionId { get; set; }
public virtual GameAction GameAction { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class MonsterLegendaryAction : BaseEntity
{
/// <summary>
/// Id potwora
/// </summary>
public int MonsterId { get; set; }
public int LegendaryActionId { get; set; }
/// <summary>
/// Połączenie z tabelą Monster
/// </summary>
public virtual Monster Monster { get; set; }
public virtual LegendaryAction LegendaryActions { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class MonsterSpecialAbility : BaseEntity
{
public int SpecialAbilityId { get; set; }
public int? DamageDice { get; set; }
public int? DamageDiceAmount { get; set; }
/// <summary>
/// Id potwora
/// </summary>
public int? MonsterId { get; set; }
public virtual SpecialAbility SpecialAbility { get; set; }
/// <summary>
/// Połączenie z tabelą Monster
/// </summary>
public virtual Monster Monster { get; set; }
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database.Tables
{
public class SpecialAbility : BaseEntity
{
// <summary>
/// Nazwa umiejętności
/// </summary>
public string Name { get; set; }
/// <summary>
/// Opis umiejętności
/// </summary>
public string Description { get; set; }
public int? DamageDice { get; set; }
public int? DamageDiceAmount { get; set; }
public virtual ICollection<MonsterSpecialAbility> MonsterSpecialAbilities { get; set; }
}
}

View File

@ -15,5 +15,6 @@ namespace SessionCompanion.Services.Interfaces
public interface ICharacterArmorService : IServiceBase<CharacterArmorViewModel, CharacterArmor>
{
Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId);
Task<List<CharacterArmorViewModelDetails>> GetCharacterArmorsTaskList(int characterId);
}
}

View File

@ -12,5 +12,6 @@ namespace SessionCompanion.Services.Interfaces
public interface ICharacterOtherEquipmentService : IServiceBase<CharacterOtherEquipmentViewModel, CharacterOtherEquipment>
{
Task<List<CharacterOtherEquipmentWithDetailsViewModel>> GetCharacterOtherEquipmentList(int characterId);
}
}

View File

@ -1,6 +1,8 @@
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.ViewModels.CharacterViewModels;
using SessionCompanion.ViewModels.ClassViewModels;
using SessionCompanion.ViewModels.RaceViewModels;
using SessionCompanion.ViewModels.UniversalModels;
using System;
using System.Collections.Generic;
@ -15,5 +17,6 @@ namespace SessionCompanion.Services.Interfaces
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
Task<List<UniversalStatisticViewModel>> GetCharacterStatistics(int characterId);
Task<CharacterBasicInfoViewModel> GetBasicCharacterbasicInfo(int characterId);
Task<IEnumerable<CharacterFromTemplatesSimpleViewModel>> GetCharactersFromTemplate(List<RaceViewModel> raceViewModels, List<ClassViewModel> classViewModels);
}
}

View File

@ -4,7 +4,11 @@ using SessionCompanion.ViewModels.CharacterWeaponViewModels;
namespace SessionCompanion.Services.Interfaces
{
using System.Collections.Generic;
using System.Threading.Tasks;
public interface ICharacterWeaponService : IServiceBase<CharacterWeaponViewModel, CharacterWeapon>
{
Task<List<CharacterWeaponWithWeaponDetailsViewModel>> GetCharacterWeaponsList(int characterId);
}
}

View File

@ -18,11 +18,13 @@ namespace SessionCompanion.Services.Services
using SessionCompanion.ViewModels.ApiResponses;
using SessionCompanion.ViewModels.CharacterArmorViewModels;
using SessionCompanion.Extensions.EitherType;
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
public class CharacterArmorService : ServiceBase<CharacterArmorViewModel, CharacterArmor>, ICharacterArmorService
{
public CharacterArmorService(IMapper mapper, IRepository<CharacterArmor> repository) : base(mapper, repository)
{ }
public async Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
{
CharacterArmor armorInUse = new CharacterArmor();
@ -40,7 +42,7 @@ namespace SessionCompanion.Services.Services
if (armorToUse is null)
return new ErrorResponse() { StatusCode = 204, Message = "No weapon to change to" };
s426135 marked this conversation as resolved Outdated

weapon ? xd

weapon ? xd
if (armorInUse is null)
{
armorToUse.InUse = true;
@ -70,5 +72,17 @@ namespace SessionCompanion.Services.Services
return new ErrorResponse() { StatusCode = 500, Message = e.Message };
}
}
/// <summary>
/// Metoda pobiera listę pancerzy konkretnej postaci
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista pancerzy posiadanych przez postać </returns>
public async Task<List<CharacterArmorViewModelDetails>> GetCharacterArmorsTaskList(int characterId)
{
var characterWeapons = await Repository.Get().Where(a => a.CharacterId.Equals(characterId)).Include(a => a.Armor).ToListAsync();
var result = Mapper.Map<List<CharacterArmorViewModelDetails>>(characterWeapons);
return result;
}
}
}

View File

@ -1,7 +1,11 @@
namespace SessionCompanion.Services.Services
{
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
@ -13,5 +17,17 @@
public CharacterOtherEquipmentService(IMapper mapper, IRepository<CharacterOtherEquipment> repository) : base(mapper, repository)
{ }
/// <summary>
/// Metoda pobiera listę pozostałego ekwipunku konkretnej postaci
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista pozostałego ekwpinuku posiadanego przez postać </returns>
public async Task<List<CharacterOtherEquipmentWithDetailsViewModel>> GetCharacterOtherEquipmentList(int characterId)
{
var characterWeapons = await Repository.Get().Where(a => a.CharacterId.Equals(characterId)).Include(a => a.OtherEquipment).ToListAsync();
var result = Mapper.Map<List<CharacterOtherEquipmentWithDetailsViewModel>>(characterWeapons);
return result;
}
}
}

View File

@ -16,12 +16,14 @@ using System.IO;
using Newtonsoft.Json.Linq;
using SessionCompanion.ViewModels.UniversalModels;
using SessionCompanion.Services.Helpers;
using SessionCompanion.ViewModels.RaceViewModels;
using SessionCompanion.ViewModels.ClassViewModels;
namespace SessionCompanion.Services.Services
{
public class CharacterService : ServiceBase<CharacterViewModel, Character>, ICharacterService
{
public CharacterService(IMapper mapper, IRepository<Character> repository) : base(mapper, repository)
public CharacterService(IMapper mapper, IRepository<Character> repository, IRepository<Class> classRepository) : base(mapper, repository)
{ }
/// <summary>
@ -111,5 +113,31 @@ namespace SessionCompanion.Services.Services
var result = Mapper.Map<CharacterBasicInfoViewModel>(character);
return result;
}
/// <summary>
/// Function returns basic stats from Characters in templates
/// </summary>
/// <returns></returns>
public async Task<IEnumerable<CharacterFromTemplatesSimpleViewModel>> GetCharactersFromTemplate(List<RaceViewModel> raceViewModels, List<ClassViewModel> classViewModels)
{
const string file = "../SessionCompanion.Database/JsonData/characters_templates.json";
List<CharacterFromTemplatesSimpleViewModel> basicStats = new List<CharacterFromTemplatesSimpleViewModel>();
using (StreamReader reader = new StreamReader(file))
{
var json = await reader.ReadToEndAsync();
foreach (var item in JArray.Parse(json))
{
CharacterFromTemplatesSimpleViewModel characterFromTemplatesSimpleViewModel = new CharacterFromTemplatesSimpleViewModel()
{
Id = (int)item["id"],
Class = classViewModels.Where(c => c.Id.Equals((int)item["biography"]["ClassId"])).Select(c => c.Name).Single(),
Race = raceViewModels.Where(r => r.Id.Equals((int)item["biography"]["RaceId"])).Select(r => r.Name).Single(),
Name = (string)item["biography"]["Name"]
};
basicStats.Add(characterFromTemplatesSimpleViewModel);
}
}
return basicStats;
}
}
}

View File

@ -7,9 +7,28 @@ using SessionCompanion.ViewModels.CharacterWeaponViewModels;
namespace SessionCompanion.Services.Services
{
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
public class CharacterWeaponService : ServiceBase<CharacterWeaponViewModel, CharacterWeapon>, ICharacterWeaponService
{
public CharacterWeaponService(IMapper mapper, IRepository<CharacterWeapon> repository) : base(mapper, repository)
{ }
/// <summary>
/// Metoda pobiera listę broni konkretnej postaci
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista broni posiadanych przez postać </returns>
public async Task<List<CharacterWeaponWithWeaponDetailsViewModel>> GetCharacterWeaponsList(int characterId)
{
var characterWeapons = await Repository.Get().Where(w => w.CharacterId.Equals(characterId)).Include(w => w.Weapon).ToListAsync();
var result = Mapper.Map<List<CharacterWeaponWithWeaponDetailsViewModel>>(characterWeapons);
return result;
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.ViewModels.CharacterViewModels
{
public class CharacterFromTemplatesSimpleViewModel
{
/// <summary>
/// Id postaci
/// </summary>
public int Id { get; set; }
/// <summary>
/// Imie postaci
/// </summary>
public string Name { get; set; }
/// <summary>
/// Nazwa rasy postaci
/// </summary>
public string Race { get; set; }
/// <summary>
/// Nazwa Klasy postaci
/// </summary>
public string Class { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.GameActionViewModels
{
public class GameActionViewModel
{
public int Id { get; set; }
public string Name { get; set; }
/// <summary>
/// Opis akcji
/// </summary>
public string Description { get; set; }
public int AttackBonus { get; set; }
public int? DamageDice { get; set; }
public int? DamageDiceAmount { get; set; }
public int? DamageBonus { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.LegendaryActionViewModels
{
public class LegendaryActionViewModel
{
public int Id { get; set; }
// <summary>
/// Nazwa legendarnej akcji
/// </summary>
public string Name { get; set; }
/// <summary>
/// Opis akcji
/// </summary>
public string Description { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.MonsterActionsViewModels
{
public class MonsterActionsViewModel
{
public int Id { get; set; }
/// <summary>
/// Id potwora
/// </summary>
public int MonsterId { get; set; }
public int GameActionId { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.MonsterLegendaryActionsViewModels
{
public class MonsterLegendaryActionsViewModel
{
public int Id { get; set; }
public int MonsterId { get; set; }
public int LegendaryActionId { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.MonsterSpecialAbilitiesViewModels
{
public class MonsterSpecialAbilitiesViewModel
{
public int Id { get; set; }
public int MonsterId { get; set; }
public int LegendaryActionId { get; set; }
}
}

View File

@ -0,0 +1,156 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.MonsterViewModels
{
using SessionCompanion.ViewModels.GameActionViewModels;
using SessionCompanion.ViewModels.LegendaryActionViewModels;
using SessionCompanion.ViewModels.SpecialAbilityViewModels;
public class MonsterAllInformationViewModel
{
public int Id { get; set; }
/// <summary>
/// Nazwa potwora
/// </summary>
public string Name { get; set; }
/// <summary>
/// Rozmiar potwora
/// </summary>
public string Size { get; set; }
/// <summary>
/// Rodzaj potwora
/// </summary>
public string Type { get; set; }
/// <summary>
/// Podtyp potwora
/// </summary>
public string Subtype { get; set; }
/// <summary>
/// Charakter potwora
/// </summary>
public string Alignment { get; set; }
/// <summary>
/// Poziom pancerza potwora
/// </summary>
public int ArmorClass { get; set; }
/// <summary>
/// Iloś punktów zycia potwora
/// </summary>
public int HitPoints { get; set; }
/// <summary>
/// Ilość kości określajacych punkty życia potwora
/// </summary>
public int HitDiceAmount { get; set; }
/// <summary>
/// Kość którą rzucamy aby określić punkty życia potwora
/// </summary>
public int HitDiceType { get; set; }
/// <summary>
/// Szybkość chodzenia potwora
/// </summary>
public string WalkSpeed { get; set; }
/// <summary>
/// Szybkość pływania potwora
/// </summary>
public string SwimSpeed { get; set; }
/// <summary>
/// Szybkość latania potwora
/// </summary>
public string FlySpeed { get; set; }
/// <summary>
/// Punkty zręczności potwora
/// </summary>
public int Dexterity { get; set; }
public int? DexteritySave { get; set; }
/// <summary>
/// Punkty siły potwora
/// </summary>
public int Strength { get; set; }
public int? StrengthSave { get; set; }
/// <summary>
/// Punkty kondycji potwora
/// </summary>
public int Constitution { get; set; }
public int? ConstitutionSave { get; set; }
/// <summary>
/// Punkty inteligencji potwora
/// </summary>
public int Intelligence { get; set; }
public int? IntelligenceSave { get; set; }
/// <summary>
/// Punkty mądrości potwora
/// </summary>
public int Wisdom { get; set; }
public int? WisdomSave { get; set; }
/// <summary>
/// Punkty charyzmy potwora
/// </summary>
public int Charisma { get; set; }
public int? CharismaSave { get; set; }
/// <summary>
/// Poziom trudności potwora
/// </summary>
public int ChallengeRating { get; set; }
/// <summary>
/// Punkty doświadczenia za zabicie potwora
/// </summary>
public int ExperiencePoints { get; set; }
/// <summary>
/// Na jakie stany odporny jest potwor
/// </summary>
public string MonsterConditionImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia odporny jest potwor
/// </summary>
public string MonsterDamageImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia potwor ma zmniejszoną słabosc
/// </summary>
public string MonsterDamageResistances { get; set; }
/// <summary>
/// Na co potwor jest wrazliwy
/// </summary>
public string MonsterDamageVulnerabilities { get; set; }
/// <summary>
/// Jezyki jakimi wlada potwor
/// </summary>
public string MonsterLanguages { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterSenses
/// </summary>
public string MonsterSenses { get; set; }
public ICollection<GameActionViewModel> MonsterGameActions { get; set; }
public ICollection<LegendaryActionViewModel> MonsteLegendaryActions { get; set; }
public ICollection<SpecialAbilityViewModel> MonsterSpecialAbilities { get; set; }
}
}

View File

@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.MonsterViewModels
{
public class MonsterViewModel
{
public int Id { get; set; }
/// <summary>
/// Nazwa potwora
/// </summary>
public string Name { get; set; }
/// <summary>
/// Rozmiar potwora
/// </summary>
public string Size { get; set; }
/// <summary>
/// Rodzaj potwora
/// </summary>
public string Type { get; set; }
/// <summary>
/// Podtyp potwora
/// </summary>
public string Subtype { get; set; }
/// <summary>
/// Charakter potwora
/// </summary>
public string Alignment { get; set; }
/// <summary>
/// Poziom pancerza potwora
/// </summary>
public int ArmorClass { get; set; }
/// <summary>
/// Iloś punktów zycia potwora
/// </summary>
public int HitPoints { get; set; }
/// <summary>
/// Ilość kości określajacych punkty życia potwora
/// </summary>
public int HitDiceAmount { get; set; }
/// <summary>
/// Kość którą rzucamy aby określić punkty życia potwora
/// </summary>
public int HitDiceType { get; set; }
/// <summary>
/// Szybkość chodzenia potwora
/// </summary>
public string WalkSpeed { get; set; }
/// <summary>
/// Szybkość pływania potwora
/// </summary>
public string SwimSpeed { get; set; }
/// <summary>
/// Szybkość latania potwora
/// </summary>
public string FlySpeed { get; set; }
/// <summary>
/// Punkty zręczności potwora
/// </summary>
public int Dexterity { get; set; }
public int? DexteritySave { get; set; }
/// <summary>
/// Punkty siły potwora
/// </summary>
public int Strength { get; set; }
public int? StrengthSave { get; set; }
/// <summary>
/// Punkty kondycji potwora
/// </summary>
public int Constitution { get; set; }
public int? ConstitutionSave { get; set; }
/// <summary>
/// Punkty inteligencji potwora
/// </summary>
public int Intelligence { get; set; }
public int? IntelligenceSave { get; set; }
/// <summary>
/// Punkty mądrości potwora
/// </summary>
public int Wisdom { get; set; }
public int? WisdomSave { get; set; }
/// <summary>
/// Punkty charyzmy potwora
/// </summary>
public int Charisma { get; set; }
public int? CharismaSave { get; set; }
/// <summary>
/// Poziom trudności potwora
/// </summary>
public int ChallengeRating { get; set; }
/// <summary>
/// Punkty doświadczenia za zabicie potwora
/// </summary>
public int ExperiencePoints { get; set; }
/// <summary>
/// Na jakie stany odporny jest potwor
/// </summary>
public string MonsterConditionImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia odporny jest potwor
/// </summary>
public string MonsterDamageImmunities { get; set; }
/// <summary>
/// Na jakie obrazenia potwor ma zmniejszoną słabosc
/// </summary>
public string MonsterDamageResistances { get; set; }
/// <summary>
/// Na co potwor jest wrazliwy
/// </summary>
public string MonsterDamageVulnerabilities { get; set; }
/// <summary>
/// Jezyki jakimi wlada potwor
/// </summary>
public string MonsterLanguages { get; set; }
/// <summary>
/// Połączenie z tabelą MonsterSenses
/// </summary>
public string MonsterSenses { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.SpecialAbilityViewModels
{
public class SpecialAbilityViewModel
{
public int Id { get; set; }
// <summary>
/// Nazwa umiejętności
/// </summary>
public string Name { get; set; }
/// <summary>
/// Opis umiejętności
/// </summary>
public string Description { get; set; }
public int? DamageDice { get; set; }
public int? DamageDiceAmount { get; set; }
}
}

View File

@ -36,6 +36,13 @@ namespace SessionCompanion.Configurations
services.AddScoped<IRepository<CharacterOtherEquipment>, CharacterOtherEquipmentRepository>();
services.AddScoped<IRepository<Weapon>, WeaponRepository>();
services.AddScoped<IRepository<CharacterWeapon>, CharacterWeaponRepository>();
services.AddScoped<IRepository<GameAction>, GameActionRepository>();
services.AddScoped<IRepository<LegendaryAction>, LegendaryActionRepository>();
services.AddScoped<IRepository<MonsterAction>, MonsterActionsRepository>();
services.AddScoped<IRepository<MonsterLegendaryAction>, MonsterLegendaryActionsRepository>();
services.AddScoped<IRepository<Monster>, MonsterRepository>();
services.AddScoped<IRepository<MonsterSpecialAbility>, MonsterSpecialAbilitiesRepository>();
services.AddScoped<IRepository<SpecialAbility>, SpecialAbilityRepository>();
return services;
}
}

View File

@ -9,6 +9,7 @@ namespace SessionCompanion.Controllers
{
using SessionCompanion.Hubs;
using SessionCompanion.ViewModels.UniversalModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@ -19,11 +20,15 @@ namespace SessionCompanion.Controllers
{
private readonly ICharacterService _service;
private readonly SessionHubData _sessionHubData;
private readonly IRaceService _raceService;
private readonly IClassService _classService;
public CharacterController(ICharacterService service)
public CharacterController(ICharacterService service, IRaceService raceService, IClassService classService)
{
this._service = service;
this._sessionHubData = new SessionHubData();
this._raceService = raceService;
this._classService = classService;
}
/// <summary>
@ -105,5 +110,29 @@ namespace SessionCompanion.Controllers
};
return info;
}
/// <summary>
/// Metoda zwraca podstawowe informacje dla postaci z Templatek
/// </summary>
/// <returns>liste podstawowych informacji o postaciach z templatki</returns>
[HttpGet("getTemplateCharacters")]
public async Task<Either<ErrorResponse, List<CharacterFromTemplatesSimpleViewModel>>> GetTemplateCharacters()
{
var races = _raceService.Get().ToList();
var classes = _classService.Get().ToList();
try
{
var templateCharacters = await _service.GetCharactersFromTemplate(races, classes);
return templateCharacters.ToList();
}
catch (Exception e)
{
return new ErrorResponse()
{
StatusCode = 500,
Message = e.Message
};
}
}
}
}

View File

@ -0,0 +1,69 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SessionCompanion.Controllers
{
using SessionCompanion.Extensions.EitherType;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.ApiResponses;
using SessionCompanion.ViewModels.CharacterArmorViewModels;
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
using SessionCompanion.ViewModels.CharacterWeaponViewModels;
[Route("api/character/equipment")]
[ApiController]
public class EquipmentController : Controller
{
private readonly ICharacterArmorService _characterArmorServic;
private readonly ICharacterOtherEquipmentService _characterOtherEquipmentService;
private readonly ICharacterWeaponService _characterWeaponService;
public EquipmentController(ICharacterArmorService characterArmorService,
ICharacterOtherEquipmentService characterOtherEquipmentService,
ICharacterWeaponService characterWeaponService)
{
this._characterArmorServic = characterArmorService;
this._characterOtherEquipmentService = characterOtherEquipmentService;
this._characterWeaponService = characterWeaponService;
}
/// <summary>
/// Zwraca listę pozostałego ekwipunku dla danej postaci
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista pozostałego ekwipunku lub błąd </returns>
[HttpGet("getOtherEquipment")]
public async Task<Either<List<CharacterOtherEquipmentWithDetailsViewModel>, ErrorResponse>> GetCharacterOtherEquipment(int characterId)
{
return await this._characterOtherEquipmentService.GetCharacterOtherEquipmentList(characterId);
}
/// <summary>
/// Zwraca listę pancerzy posiadanych przez daną postać
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista pozostałego ekwipunku lub błąd </returns>
[HttpGet("getArmors")]
public async Task<Either<List<CharacterArmorViewModelDetails>, ErrorResponse>> GetCharacterArmors(int characterId)
{
return await this._characterArmorServic.GetCharacterArmorsTaskList(characterId);
}
/// <summary>
/// Zwraca listę broni posiadanej przez daną postać
/// </summary>
/// <param name="characterId"> Id postaci </param>
/// <returns> Lista broni lub błąd </returns>
[HttpGet("getWeapons")]
public async Task<Either<List<CharacterWeaponWithWeaponDetailsViewModel>, ErrorResponse>> GetCharacterWeapons(int characterId)
{
return await this._characterWeaponService.GetCharacterWeaponsList(characterId);
}
}
}

View File

@ -6,13 +6,16 @@ using System.Threading.Tasks;
namespace SessionCompanion.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using Microsoft.AspNetCore.SignalR;
using SessionCompanion.Database.Tables;
using SessionCompanion.Extensions.EitherType;
using SessionCompanion.Hubs;
using SessionCompanion.ViewModels.ApiResponses;
using SessionCompanion.ViewModels.CharacterViewModels;
using SessionCompanion.ViewModels.UserViewModels;
[Route("api/user")]
@ -20,13 +23,15 @@ namespace SessionCompanion.Controllers
public class UserController : Controller
{
private readonly IUserService _service;
private readonly ICharacterService _characterService;
private SessionHubData _sessionHubData;
public UserController(IUserService service)
public UserController(IUserService service, ICharacterService characterService)
{
this._service = service;
this._sessionHubData = new SessionHubData();
this._characterService = characterService;
}
/// <summary>
@ -41,13 +46,31 @@ namespace SessionCompanion.Controllers
UserViewModel user = await _service.SearchUserByUsername(userName);
if (user != null && user.Password.Equals(password))
return user.Id;
{
List<int> userCharactersIds = _characterService.Get(c => c.UserId.Equals(user.Id)).Result.Select(c => c.Id).ToList();
return new ErrorResponse()
{
StatusCode = 403,
Message = "User name not found or incorrect password"
};
foreach(int characterId in userCharactersIds)
{
if (SessionHubData.ConnectedCharacters.ContainsKey(characterId))
{
return new ErrorResponse()
{
StatusCode = 403,
Message = "User is already logged in"
};
}
}
return user.Id;
}
else
{
return new ErrorResponse()
{
StatusCode = 403,
Message = "User name not found or incorrect password"
};
}
}