diff --git a/AideDeJeu/AideDeJeu/ViewModels/MonstersViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/MonstersViewModel.cs index 18ba66cf..12e371d4 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/MonstersViewModel.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/MonstersViewModel.cs @@ -14,130 +14,159 @@ namespace AideDeJeu.ViewModels { public ObservableCollection Items { get; set; } - public List> Classes { get; set; } = new List>() + public List> Categories { get; set; } = new List>() { new KeyValuePair("", "Toutes" ), - new KeyValuePair("b", "Barde" ), - new KeyValuePair("c", "Clerc" ), - new KeyValuePair("d", "Druide" ), - new KeyValuePair("s", "Ensorceleur" ), - new KeyValuePair("w", "Magicien" ), - new KeyValuePair("p", "Paladin" ), - new KeyValuePair("r", "Rôdeur" ), - new KeyValuePair("k", "Sorcier" ), + new KeyValuePair("M", "Monstres" ), + new KeyValuePair("A", "Animaux" ), + new KeyValuePair("P", "PNJ" ), }; - public List> Niveaux { get; set; } = new List>() + public List> Types { 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("", "Tous" ), + new KeyValuePair("Humanoïde", "Humanoïde"), + new KeyValuePair("Aberration", "Aberration"), + new KeyValuePair("Bête", "Bête"), + new KeyValuePair("Céleste", "Céleste"), + new KeyValuePair("Créature artificielle", "Créature artificielle"), + new KeyValuePair("Créature monstrueuse", "Créature monstrueuse"), + new KeyValuePair("Dragon", "Dragon"), + new KeyValuePair("Élémentaire", "Élémentaire"), + new KeyValuePair("Fée", "Fée"), + new KeyValuePair("Fiélon", "Fiélon"), + new KeyValuePair("Géant", "Géant"), + new KeyValuePair("Mort-vivant", "Mort-vivant"), + new KeyValuePair("Plante", "Plante"), + new KeyValuePair("Vase", "Vase"), }; - public List> Ecoles { get; set; } = new List>() + public List> Powers { get; set; } = new List>() + { + new KeyValuePair("0", "0" ), + new KeyValuePair(".25", "1/4" ), + new KeyValuePair(".5", "1/2" ), + new KeyValuePair("1", "1" ), + new KeyValuePair("2", "2" ), + new KeyValuePair("4", "4" ), + new KeyValuePair("6", "6" ), + new KeyValuePair("8", "8" ), + new KeyValuePair("10", "10" ), + new KeyValuePair("15", "15" ), + new KeyValuePair("20", "20" ), + new KeyValuePair("30", "30" ), + }; + + public List> Sizes { get; set; } = new List>() { new KeyValuePair("", "Toutes"), - new KeyValuePair("abjuration", "Abjuration"), - new KeyValuePair("divination", "Divination"), - new KeyValuePair("enchantement", "Enchantement"), - new KeyValuePair("evocation", "Évocation"), - new KeyValuePair("illusion", "Illusion"), - new KeyValuePair("invocation", "Invocation"), - new KeyValuePair("necromancie", "Nécromancie"), - new KeyValuePair("transmutation", "Transmutation"), + new KeyValuePair("TP", "Très petite"), + new KeyValuePair("P", "Petite"), + new KeyValuePair("M", "Moyenne"), + new KeyValuePair("G", "Grande"), + new KeyValuePair("TG", "Très grande"), + new KeyValuePair("Gig", "Gigantesque"), }; - public List> Rituels { get; set; } = new List>() + public List> Legendaries { get; set; } = new List>() { - new KeyValuePair("", "Tous"), - new KeyValuePair("1", "Rituel"), + new KeyValuePair("", "Toutes"), + new KeyValuePair("si", "Si"), + new KeyValuePair("no", "Non"), }; public List> Sources { get; set; } = new List>() { new KeyValuePair("", "Toutes"), new KeyValuePair("srd", "SRD"), - new KeyValuePair("ph", "PHB"), - new KeyValuePair("sup", "SCAG, XGtE"), + new KeyValuePair("mm", "MM"), + new KeyValuePair("sup", "VGtM, MToF"), + new KeyValuePair("supno", "AL, AideDD"), }; - private int _Classe = 0; - public int Classe + private int _Category = 0; + public int Category { get { - return _Classe; + return _Category; } set { - SetProperty(ref _Classe, value); + SetProperty(ref _Category, value); LoadItemsCommand.Execute(null); } } - private int _NiveauMin = 0; - public int NiveauMin + private int _Type = 0; + public int Type { get { - return _NiveauMin; + return _Type; } set { - SetProperty(ref _NiveauMin, value); - if (_NiveauMax < _NiveauMin) + SetProperty(ref _Type, value); + LoadItemsCommand.Execute(null); + } + } + private int _MinPower = 0; + public int MinPower + { + get + { + return _MinPower; + } + set + { + SetProperty(ref _MinPower, value); + if (_MaxPower < _MinPower) { - SetProperty(ref _NiveauMax, value, nameof(NiveauMax)); + SetProperty(ref _MaxPower, value, nameof(MaxPower)); } LoadItemsCommand.Execute(null); } } - private int _NiveauMax = 9; - public int NiveauMax + private int _MaxPower = 9; + public int MaxPower { get { - return _NiveauMax; + return _MaxPower; } set { - SetProperty(ref _NiveauMax, value); - if (_NiveauMax < _NiveauMin) + SetProperty(ref _MaxPower, value); + if (_MaxPower < _MinPower) { - SetProperty(ref _NiveauMin, value, nameof(NiveauMin)); + SetProperty(ref _MinPower, value, nameof(MinPower)); } LoadItemsCommand.Execute(null); } } - private int _Ecole = 0; - public int Ecole + private int _Size = 0; + public int Size { get { - return _Ecole; + return _Size; } set { - SetProperty(ref _Ecole, value); + SetProperty(ref _Size, value); LoadItemsCommand.Execute(null); } } - private int _Rituel = 0; - public int Rituel + private int _Legendary = 0; + public int Legendary { get { - return _Rituel; + return _Legendary; } set { - SetProperty(ref _Rituel, value); + SetProperty(ref _Legendary, value); LoadItemsCommand.Execute(null); } } @@ -160,16 +189,8 @@ namespace AideDeJeu.ViewModels public MonstersViewModel() { - //Title = "Browse"; Items = new ObservableCollection(); LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand()); - - //MessagingCenter.Subscribe(this, "AddItem", async (obj, item) => - //{ - // var _item = item as Item; - // Items.Add(_item); - // await DataStore.AddItemAsync(_item); - //}); } async Task ExecuteLoadItemsCommand() @@ -181,17 +202,8 @@ namespace AideDeJeu.ViewModels try { - // - // - // - // - // - // - // - // - Items.Clear(); - var items = await new MonstersScrappers().GetMonsters(); + var items = await new MonstersScrappers().GetMonsters(category: Categories[Category].Key, type: Types[Type].Key, minPower: Powers[MinPower].Key, maxPower: Powers[MaxPower].Key, size: Sizes[Size].Key, legendary:Legendaries[Legendary].Key, source: Sources[Source].Key); foreach (var item in items) { Items.Add(item); diff --git a/AideDeJeu/AideDeJeu/ViewModels/SpellDetailViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/SpellDetailViewModel.cs index 04aeef72..8710f445 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/SpellDetailViewModel.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/SpellDetailViewModel.cs @@ -121,13 +121,8 @@ namespace AideDeJeu.ViewModels try { - //Items.Clear(); - var item = await new SpellsScrappers().GetSpell(Item.Id); + var item = await SpellsScrappers.GetSpell(Item.Id); Item = item; - //foreach (var item in items) - //{ - // Items.Add(item); - //} } catch (Exception ex) { diff --git a/AideDeJeu/AideDeJeu/Views/MonstersPage.xaml b/AideDeJeu/AideDeJeu/Views/MonstersPage.xaml index 58297f91..f670c53f 100644 --- a/AideDeJeu/AideDeJeu/Views/MonstersPage.xaml +++ b/AideDeJeu/AideDeJeu/Views/MonstersPage.xaml @@ -27,20 +27,29 @@ --> -