1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Même modif sur liste des monstres pour récupérer les noms du PHB

This commit is contained in:
Yan Maniez 2018-05-06 00:58:37 +02:00
parent c94fa7be55
commit 43b181a1b5
2 changed files with 17 additions and 3 deletions

View file

@ -39,7 +39,8 @@ namespace AideDeJeu.ViewModels
public List<KeyValuePair<string, string>> Powers { get; set; } = new List<KeyValuePair<string, string>>()
{
new KeyValuePair<string, string>("0", "0" ),
new KeyValuePair<string, string>("Z", "0" ),
new KeyValuePair<string, string>(".12", "1/8" ),
new KeyValuePair<string, string>(".25", "1/4" ),
new KeyValuePair<string, string>(".5", "1/2" ),
new KeyValuePair<string, string>("1", "1" ),

View file

@ -41,8 +41,21 @@ namespace AideDeJeuLib.Monsters
if (tds.Length > 0)
{
var monster = new Monster();
monster.Name = tds[0].InnerText;
var href = tds[0].Element("a").GetAttributeValue("href", "");
var aname = tds[0].Element("a");
var spanname = aname.Element("span");
if (spanname != null)
{
monster.NamePHB = spanname.GetAttributeValue("title", "");
monster.Name = spanname.Element("strong").InnerText;
}
else
{
monster.NamePHB = aname.Element("strong").InnerText;
monster.Name = aname.Element("strong").InnerText;
}
//monster.Name = tds[0].InnerText;
var href = aname.GetAttributeValue("href", "");
var regex = new Regex("vf=(?<id>.*)");
monster.Id = regex.Match(href).Groups["id"].Value;
monster.Power = tds[1].InnerText;