mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Utilisation du nom du PHB au lieu de l'ancien d'AideDD
This commit is contained in:
parent
c28fd4657f
commit
03f54c2c75
10 changed files with 39 additions and 15 deletions
16
AideDeJeu/AideDeJeu/Tools/Comparers.cs
Normal file
16
AideDeJeu/AideDeJeu/Tools/Comparers.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
using AideDeJeuLib;
|
||||||
|
using AideDeJeuLib.Spells;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AideDeJeu.Tools
|
||||||
|
{
|
||||||
|
public class ItemComparer : Comparer<Item>
|
||||||
|
{
|
||||||
|
public override int Compare(Item x, Item y)
|
||||||
|
{
|
||||||
|
return x.NamePHB.CompareTo(y.NamePHB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -267,7 +267,7 @@ namespace AideDeJeu.ViewModels
|
||||||
|
|
||||||
public MonsterDetailViewModel(Monster item = null)
|
public MonsterDetailViewModel(Monster item = null)
|
||||||
{
|
{
|
||||||
Title = item?.Name;
|
Title = item?.NamePHB;
|
||||||
Item = item;
|
Item = item;
|
||||||
LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand());
|
LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
using AideDeJeuLib;
|
using AideDeJeu.Tools;
|
||||||
|
using AideDeJeuLib;
|
||||||
using AideDeJeuLib.Monsters;
|
using AideDeJeuLib.Monsters;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AideDeJeu.ViewModels
|
namespace AideDeJeu.ViewModels
|
||||||
|
|
@ -197,10 +199,12 @@ namespace AideDeJeu.ViewModels
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AllItems.Clear();
|
AllItems.Clear();
|
||||||
var monsters = 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);
|
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 monster in monsters)
|
var aitems = items.ToArray();
|
||||||
|
Array.Sort(aitems, new ItemComparer());
|
||||||
|
foreach (var item in aitems)
|
||||||
{
|
{
|
||||||
AllItems.Add(monster);
|
AllItems.Add(item);
|
||||||
}
|
}
|
||||||
FilterItems();
|
FilterItems();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ namespace AideDeJeu.ViewModels
|
||||||
|
|
||||||
public SpellDetailViewModel(Spell item = null)
|
public SpellDetailViewModel(Spell item = null)
|
||||||
{
|
{
|
||||||
Title = item?.Name;
|
Title = item?.NamePHB;
|
||||||
Item = item;
|
Item = item;
|
||||||
LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand());
|
LoadItemCommand = new Command(async () => await ExecuteLoadItemCommand());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
using AideDeJeuLib;
|
using AideDeJeu.Tools;
|
||||||
|
using AideDeJeuLib;
|
||||||
using AideDeJeuLib.Spells;
|
using AideDeJeuLib.Spells;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AideDeJeu.ViewModels
|
namespace AideDeJeu.ViewModels
|
||||||
|
|
@ -168,7 +170,9 @@ namespace AideDeJeu.ViewModels
|
||||||
{
|
{
|
||||||
AllItems.Clear();
|
AllItems.Clear();
|
||||||
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);
|
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)
|
var aitems = items.ToArray();
|
||||||
|
Array.Sort(aitems, new ItemComparer());
|
||||||
|
foreach (var item in aitems)
|
||||||
{
|
{
|
||||||
AllItems.Add(item);
|
AllItems.Add(item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<StackLayout Padding="10">
|
<StackLayout Padding="10">
|
||||||
<Label Text="{Binding Name}"
|
<Label Text="{Binding NamePHB}"
|
||||||
LineBreakMode="NoWrap"
|
LineBreakMode="NoWrap"
|
||||||
Style="{DynamicResource subsubsection}"
|
Style="{DynamicResource subsubsection}"
|
||||||
FontSize="16" />
|
FontSize="16" />
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
<skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" />
|
<skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" />
|
||||||
|
|
||||||
<Label Text="{Binding Item.Name}" Style="{StaticResource Key=subsection}" />
|
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=subsection}" />
|
||||||
<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />
|
<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />
|
||||||
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=content}" />
|
<Label Text="{Binding Item.Name}" Style="{StaticResource Key=content}" />
|
||||||
|
|
||||||
<!--<Label Text=" " />-->
|
<!--<Label Text=" " />-->
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
Title="{Binding Title}">
|
Title="{Binding Title}">
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout Orientation="Vertical" Padding="15">
|
<StackLayout Orientation="Vertical" Padding="15">
|
||||||
<Label Text="{Binding Item.Name}" Style="{StaticResource Key=subsection}" />
|
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=subsection}" />
|
||||||
<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />
|
<Label Text="{Binding Item.NameVO}" Style="{StaticResource Key=content}" />
|
||||||
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=content}" />
|
<Label Text="{Binding Item.Name}" Style="{StaticResource Key=content}" />
|
||||||
|
|
||||||
<Label Text=" " />
|
<Label Text=" " />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace AideDeJeuLib.Monsters
|
||||||
var altNames = divMonster.SelectSingleNode("div[@class='trad']").InnerText;
|
var altNames = divMonster.SelectSingleNode("div[@class='trad']").InnerText;
|
||||||
var matchNames = new Regex(@"\[ (?<vo>.*?) \](?: \[ (?<alt>.*?) \])?").Match(altNames);
|
var matchNames = new Regex(@"\[ (?<vo>.*?) \](?: \[ (?<alt>.*?) \])?").Match(altNames);
|
||||||
monster.NameVO = matchNames.Groups["vo"].Value;
|
monster.NameVO = matchNames.Groups["vo"].Value;
|
||||||
monster.NamePHB = matchNames.Groups["alt"].Value;
|
monster.NamePHB = string.IsNullOrEmpty(matchNames.Groups["alt"].Value) ? monster.Name : matchNames.Groups["alt"].Value;
|
||||||
|
|
||||||
var divSansSerif = divMonster?.SelectSingleNode("div[contains(@class,'sansSerif')]");
|
var divSansSerif = divMonster?.SelectSingleNode("div[contains(@class,'sansSerif')]");
|
||||||
var typeSizeAlignment = divSansSerif?.SelectSingleNode("h2/em")?.InnerText;
|
var typeSizeAlignment = divSansSerif?.SelectSingleNode("h2/em")?.InnerText;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace AideDeJeuLib.Spells
|
||||||
var altNames = nodeSpell.SelectSingleNode("div[@class='trad']").InnerText;
|
var altNames = nodeSpell.SelectSingleNode("div[@class='trad']").InnerText;
|
||||||
var matchNames = new Regex(@"\[ (?<vo>.*?) \](?: \[ (?<alt>.*?) \])?").Match(altNames);
|
var matchNames = new Regex(@"\[ (?<vo>.*?) \](?: \[ (?<alt>.*?) \])?").Match(altNames);
|
||||||
spell.NameVO = matchNames.Groups["vo"].Value;
|
spell.NameVO = matchNames.Groups["vo"].Value;
|
||||||
spell.NamePHB = matchNames.Groups["alt"].Value;
|
spell.NamePHB = string.IsNullOrEmpty(matchNames.Groups["alt"].Value) ? spell.Name : matchNames.Groups["alt"].Value;
|
||||||
spell.LevelType = nodeSpell.SelectSingleNode("h2/em").InnerText;
|
spell.LevelType = nodeSpell.SelectSingleNode("h2/em").InnerText;
|
||||||
spell.Level = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[0].Split(' ')[1];
|
spell.Level = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[0].Split(' ')[1];
|
||||||
spell.Type = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[1];
|
spell.Type = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[1];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue