Created custom mappings
This commit is contained in:
parent
1bce1e94e8
commit
b53ece536b
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user