From 94d2629b38532b1323c8b9aba843377528fea755 Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Sun, 6 May 2018 00:24:18 +0200 Subject: [PATCH] Correctif changement liste sorts AideDD --- .../AideDeJeu/ViewModels/SpellsViewModel.cs | 24 +++++++++---------- .../AideDeJeuLib/Spells/SpellsScrappers.cs | 5 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/AideDeJeu/AideDeJeu/ViewModels/SpellsViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/SpellsViewModel.cs index 4d4e8f55..5fa2a8fe 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/SpellsViewModel.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/SpellsViewModel.cs @@ -23,18 +23,18 @@ namespace AideDeJeu.ViewModels new KeyValuePair("k", "Sorcier" ), }; - public List> Niveaux { get; set; } = new List>() + public List> Niveaux { get; set; } = new List>() { - new KeyValuePair(0, "Sorts mineurs"), - new KeyValuePair(1, "Niveau 1"), - new KeyValuePair(2, "Niveau 2"), - new KeyValuePair(3, "Niveau 3"), - new KeyValuePair(4, "Niveau 4"), - new KeyValuePair(5, "Niveau 5"), - new KeyValuePair(6, "Niveau 6"), - new KeyValuePair(7, "Niveau 7"), - new KeyValuePair(8, "Niveau 8"), - new KeyValuePair(9, "Niveau 9"), + new KeyValuePair("Z", "Sorts mineurs"), + new KeyValuePair("1", "Niveau 1"), + new KeyValuePair("2", "Niveau 2"), + new KeyValuePair("3", "Niveau 3"), + new KeyValuePair("4", "Niveau 4"), + new KeyValuePair("5", "Niveau 5"), + new KeyValuePair("6", "Niveau 6"), + new KeyValuePair("7", "Niveau 7"), + new KeyValuePair("8", "Niveau 8"), + new KeyValuePair("9", "Niveau 9"), }; public List> Ecoles { get; set; } = new List>() @@ -167,7 +167,7 @@ namespace AideDeJeu.ViewModels try { AllItems.Clear(); - var items = await SpellsScrappers.GetSpells(classe: Classes[Classe].Key, niveauMin: NiveauMin, niveauMax: NiveauMax, ecole: Ecoles[Ecole].Key, rituel: Rituels[Rituel].Key, source: Sources[Source].Key); + var items = await SpellsScrappers.GetSpells(classe: Classes[Classe].Key, niveauMin: Niveaux[NiveauMin].Key, niveauMax: Niveaux[NiveauMax].Key, ecole: Ecoles[Ecole].Key, rituel: Rituels[Rituel].Key, source: Sources[Source].Key); foreach (var item in items) { AllItems.Add(item); diff --git a/AideDeJeu/AideDeJeuLib/Spells/SpellsScrappers.cs b/AideDeJeu/AideDeJeuLib/Spells/SpellsScrappers.cs index e382da89..c6169c0d 100644 --- a/AideDeJeu/AideDeJeuLib/Spells/SpellsScrappers.cs +++ b/AideDeJeu/AideDeJeuLib/Spells/SpellsScrappers.cs @@ -21,14 +21,15 @@ namespace AideDeJeuLib.Spells return client; } - public async Task> GetSpells(string classe = "", int niveauMin = 0, int niveauMax = 9, string ecole = "", string rituel = "", string source = "srd") + public async Task> GetSpells(string classe = "", string niveauMin = "", string niveauMax = "", string ecole = "", string rituel = "", string source = "srd") { string html = null; using (var client = GetHttpClient()) { // https://www.aidedd.org/regles/sorts/ - html = await client.GetStringAsync(string.Format("https://www.aidedd.org/regles/sorts/?c={0}&min=1{1}&max=1{2}&e={3}&r={4}&s={5}", classe, niveauMin, niveauMax, ecole, rituel, source)); + var url = string.Format("https://www.aidedd.org/regles/sorts/?c={0}&min={1}&max={2}&e={3}&r={4}&s={5}", classe, niveauMin, niveauMax, ecole, rituel, source); + html = await client.GetStringAsync(url); } var pack = new HtmlDocument(); pack.LoadHtml(html);