mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 14:35:45 +00:00
MagicItems filtrés, nbsp
This commit is contained in:
parent
6e452d91e8
commit
bb113b8016
10 changed files with 2178 additions and 2066 deletions
13
AideDeJeu/AideDeJeu/Models/MagicItem.cs
Normal file
13
AideDeJeu/AideDeJeu/Models/MagicItem.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using AideDeJeuLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AideDeJeuLib
|
||||
{
|
||||
public class MagicItem : Item
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Rarity { get; set; }
|
||||
}
|
||||
}
|
||||
16
AideDeJeu/AideDeJeu/Models/MagicItems.cs
Normal file
16
AideDeJeu/AideDeJeu/Models/MagicItems.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using AideDeJeu.ViewModels;
|
||||
using AideDeJeuLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AideDeJeuLib
|
||||
{
|
||||
public class MagicItems : Item
|
||||
{
|
||||
public override FilterViewModel GetNewFilterViewModel()
|
||||
{
|
||||
return new VFMagicItemFilterViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -835,4 +835,91 @@ namespace AideDeJeu.ViewModels
|
|||
}
|
||||
|
||||
#endregion Equipments
|
||||
|
||||
#region Magic Items
|
||||
public abstract class MagicItemFilterViewModel : FilterViewModel
|
||||
{
|
||||
private IEnumerable<Filter> _Filters = null;
|
||||
public override IEnumerable<Filter> Filters
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Filters == null)
|
||||
{
|
||||
_Filters = new List<Filter>()
|
||||
{
|
||||
new Filter() { Key = FilterKeys.Type, Name = "Type", KeyValues = Types, _Index = 0 },
|
||||
//new Filter() { Key = FilterKeys.MinPrice, Name = "Prix Minimum", KeyValues = Prices, _Index = 0 },
|
||||
//new Filter() { Key = FilterKeys.MaxPrice, Name = "Prix Maximum", KeyValues = Prices, _Index = 9 },
|
||||
};
|
||||
RegisterFilters();
|
||||
}
|
||||
return _Filters;
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken token = default)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var priceComparer = new PriceComparer();
|
||||
var type = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Type).SelectedKey ?? "";
|
||||
//var minPrice = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinPrice).SelectedKey ?? "0 pc";
|
||||
//var maxPrice = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxPrice).SelectedKey ?? "1 000 000 po";
|
||||
//token.ThrowIfCancellationRequested();
|
||||
return items.Where(item =>
|
||||
{
|
||||
var magicitem = item as MagicItem;
|
||||
return magicitem != null &&
|
||||
magicitem.Type.ToLower().Contains(type.ToLower()) &&
|
||||
//priceComparer.Compare(equipment.Price, minPrice) >= 0 &&
|
||||
//priceComparer.Compare(equipment.Price, maxPrice) <= 0 &&
|
||||
(
|
||||
(Helpers.RemoveDiacritics(magicitem.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
|
||||
(Helpers.RemoveDiacritics(magicitem.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
);
|
||||
}).OrderBy(eq => eq.Name)
|
||||
.AsEnumerable();
|
||||
}, token);
|
||||
|
||||
}
|
||||
|
||||
public abstract List<KeyValuePair<string, string>> Types { get; }
|
||||
|
||||
//public abstract List<KeyValuePair<string, string>> Prices { get; }
|
||||
}
|
||||
|
||||
public class VFMagicItemFilterViewModel : MagicItemFilterViewModel
|
||||
{
|
||||
|
||||
public override List<KeyValuePair<string, string>> Types { get; } = new List<KeyValuePair<string, string>>()
|
||||
{
|
||||
new KeyValuePair<string, string>("", "Tous" ),
|
||||
new KeyValuePair<string, string>("Anneau", "Anneau" ),
|
||||
new KeyValuePair<string, string>("Arme", "Arme" ),
|
||||
new KeyValuePair<string, string>("Armure", "Armure" ),
|
||||
new KeyValuePair<string, string>("Baguette", "Baguette" ),
|
||||
new KeyValuePair<string, string>("Bâton", "Bâton" ),
|
||||
new KeyValuePair<string, string>("Objet merveilleux", "Objet merveilleux" ),
|
||||
new KeyValuePair<string, string>("Parchemin", "Parchemin" ),
|
||||
new KeyValuePair<string, string>("Potion", "Potion" ),
|
||||
new KeyValuePair<string, string>("Sceptre", "Sceptre" ),
|
||||
};
|
||||
|
||||
//public override List<KeyValuePair<string, string>> Prices { get; } = new List<KeyValuePair<string, string>>()
|
||||
//{
|
||||
// new KeyValuePair<string, string>("0 pc", "0 pc" ),
|
||||
// new KeyValuePair<string, string>("1 pc", "1 pc" ),
|
||||
// new KeyValuePair<string, string>("1 pa", "1 pa" ),
|
||||
// new KeyValuePair<string, string>("1 po", "1 po" ),
|
||||
// new KeyValuePair<string, string>("10 po", "10 po" ),
|
||||
// new KeyValuePair<string, string>("100 po", "100 po" ),
|
||||
// new KeyValuePair<string, string>("1 000 po", "1 000 po" ),
|
||||
// new KeyValuePair<string, string>("10 000 po", "10 000 po" ),
|
||||
// new KeyValuePair<string, string>("100 000 po", "100 000 po" ),
|
||||
// new KeyValuePair<string, string>("1 000 000 po", "1 000 000 po" ),
|
||||
//};
|
||||
}
|
||||
|
||||
#endregion Equipments
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace AideDeJeu.ViewModels
|
|||
if(!string.IsNullOrEmpty(subItem.AltNameText))
|
||||
{
|
||||
var altname = subItem.AltNameText;
|
||||
var altlevel = Math.Max(1, Math.Min(6, subItem.NameLevel + 2));
|
||||
var altlevel = Math.Max(1, Math.Min(6, subItem.NameLevel + 3));
|
||||
currentItem.Markdown += $"\n\n{new String('#', altlevel)} _[{altname}]({link})_";
|
||||
}
|
||||
currentItem.Markdown += "\n\n";
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -11,7 +11,7 @@
|
|||
# <!--Name-->Agrandir/rétrécir<!--/Name-->
|
||||
- SRD: <!--AltName-->[Enlarge/Reduce](spells_vo.md#enlargereduce)<!--/AltName-->
|
||||
- Book: <!--Book-->(MDR p36)(SRD p3)<!--/Book-->
|
||||
- : <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
- <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
- **Temps d'incantation :** <!--CastingTime-->1 action<!--/CastingTime-->
|
||||
- **Portée :** <!--Range-->9 mètres<!--/Range-->
|
||||
- **Composantes :** <!--Components-->V, S, M (une pincée de limaille de fer)<!--/Components-->
|
||||
|
|
@ -36,7 +36,7 @@ Si la cible est une créature, tout ce qu'elle porte et tout ce qu'elle transpor
|
|||
# <!--Name-->Agrandir/rétrécir<!--/Name-->
|
||||
|
||||
- SRD: <!--AltName-->[Enlarge/Reduce](spells_vo.md#enlargereduce)<!--/AltName-->
|
||||
- : <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
- <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
|
||||
- **Temps d'incantation :** <!--CastingTime-->1 action<!--/CastingTime-->
|
||||
- **Portée :** <!--Range-->9 mètres<!--/Range-->
|
||||
|
|
@ -63,7 +63,7 @@ Si la cible est une créature, tout ce qu'elle porte et tout ce qu'elle transpor
|
|||
|
||||
- SRD: <!--AltName-->[Enlarge/Reduce](spells_vo.md#enlargereduce)<!--/AltName-->
|
||||
|
||||
- : <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
- <!--Type-->Transmutation<!--/Type--> de niveau <!--Level-->2<!--/Level-->
|
||||
- **Temps d'incantation :** <!--CastingTime-->1 action<!--/CastingTime-->
|
||||
- **Portée :** <!--Range-->9 mètres<!--/Range-->
|
||||
- **Composantes :** <!--Components-->V, S, M (une pincée de limaille de fer)<!--/Components-->
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue