mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Spells nouvelle formule
This commit is contained in:
		
							parent
							
								
									6bb3737b1f
								
							
						
					
					
						commit
						d464657423
					
				
					 6 changed files with 4369 additions and 3631 deletions
				
			
		|  | @ -15,7 +15,7 @@ namespace AideDeJeuLib | |||
|         public string Level { get; set; } | ||||
|         public string Type { get; set; } | ||||
|         public string Concentration { get; set; } | ||||
|         public string Rituel { get; set; } | ||||
|         public string Ritual { get; set; } | ||||
|         public string CastingTime { get; set; } | ||||
|         public string Range { get; set; } | ||||
|         public string Components { get; set; } | ||||
|  |  | |||
|  | @ -17,13 +17,13 @@ namespace AideDeJeuLib | |||
|             { | ||||
|                 if (int.Parse(Level) > 0) | ||||
|                 { | ||||
|                     if (string.IsNullOrEmpty(Rituel)) | ||||
|                     if (string.IsNullOrEmpty(Ritual)) | ||||
|                     { | ||||
|                         return $"{Type} de niveau {Level}"; | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         return $"{Type} de niveau {Level} {Rituel}"; | ||||
|                         return $"{Type} de niveau {Level} {Ritual}"; | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|  | @ -37,7 +37,7 @@ namespace AideDeJeuLib | |||
|                 var match = re.Match(value); | ||||
|                 this.Type = match.Groups["type"].Value; | ||||
|                 this.Level = match.Groups["level"].Value; | ||||
|                 this.Rituel = match.Groups["rituel"].Value; | ||||
|                 this.Ritual = match.Groups["rituel"].Value; | ||||
|                 if (string.IsNullOrEmpty(this.Type)) | ||||
|                 { | ||||
|                     re = new Regex("(?<type>.*), (?<level>tour de magie)"); | ||||
|  | @ -46,7 +46,7 @@ namespace AideDeJeuLib | |||
|                     { | ||||
|                         this.Type = match.Groups["type"].Value; | ||||
|                         this.Level = "0"; // match.Groups["level"].Value; | ||||
|                         this.Rituel = match.Groups["rituel"].Value; | ||||
|                         this.Ritual = match.Groups["rituel"].Value; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  |  | |||
|  | @ -13,13 +13,13 @@ namespace AideDeJeuLib | |||
|         { | ||||
|             get | ||||
|             { | ||||
|                 if (string.IsNullOrEmpty(Rituel)) | ||||
|                 if (string.IsNullOrEmpty(Ritual)) | ||||
|                 { | ||||
|                     return $"Level {Level} - {Type}"; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return $"Level {Level} - {Type} {Rituel}"; | ||||
|                     return $"Level {Level} - {Type} {Ritual}"; | ||||
|                 } | ||||
|             } | ||||
|             set | ||||
|  | @ -28,7 +28,7 @@ namespace AideDeJeuLib | |||
|                 var match = re.Match(value); | ||||
|                 this.Type = match.Groups["type"].Value; | ||||
|                 this.Level = match.Groups["level"].Value; | ||||
|                 this.Rituel = match.Groups["rituel"].Value; | ||||
|                 this.Ritual = match.Groups["rituel"].Value; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -28,6 +28,22 @@ namespace AideDeJeu.Tools | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public class LevelComparer : Comparer<string> | ||||
|     { | ||||
|         public override int Compare(string x, string y) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(x) && string.IsNullOrEmpty(y)) return 0; | ||||
|             if (string.IsNullOrEmpty(x)) return 1; | ||||
|             if (string.IsNullOrEmpty(y)) return -1; | ||||
| 
 | ||||
|             int ix = 0; | ||||
|             int.TryParse(x, out ix); | ||||
|             int iy = 0; | ||||
|             int.TryParse(y, out iy); | ||||
|             return ix - iy; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public class PriceComparer : Comparer<string> | ||||
|     { | ||||
|         int ToCopperPieces(string price) | ||||
|  |  | |||
|  | @ -179,6 +179,7 @@ namespace AideDeJeu.ViewModels | |||
|         { | ||||
|             return await Task.Run(() => | ||||
|             { | ||||
|                 var levelComparer = new LevelComparer(); | ||||
|                 var classe = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Class).SelectedKey ?? ""; | ||||
|                 var niveauMin = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinLevel).SelectedKey ?? "0"; | ||||
|                 var niveauMax = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxLevel).SelectedKey ?? "9"; | ||||
|  | @ -189,12 +190,13 @@ namespace AideDeJeu.ViewModels | |||
|                 return items.Where(item => | ||||
|                 { | ||||
|                     var spell = item as Spell; | ||||
|                     return (int.Parse(spell.Level) >= int.Parse(niveauMin)) && | ||||
|                         (int.Parse(spell.Level) <= int.Parse(niveauMax)) && | ||||
|                     return | ||||
|                         levelComparer.Compare(spell.Level, niveauMin) >= 0 && | ||||
|                         levelComparer.Compare(spell.Level, niveauMax) <= 0 && | ||||
|                         spell.Type.ToLower().Contains(ecole.ToLower()) && | ||||
|                         spell.Source.Contains(source) && | ||||
|                         spell.Classes.Contains(classe) && | ||||
|                         (spell.Rituel == null || spell.Rituel.Contains(rituel)) && | ||||
|                         (spell.Source != null && spell.Source.Contains(source)) && | ||||
|                         (spell.Classes != null && spell.Classes.Contains(classe)) && | ||||
|                         (spell.Ritual != null && spell.Ritual.Contains(rituel)) && | ||||
|                         ( | ||||
|                             (Helpers.RemoveDiacritics(spell.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) || | ||||
|                             (Helpers.RemoveDiacritics(spell.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) | ||||
|  | @ -262,7 +264,7 @@ namespace AideDeJeu.ViewModels | |||
|         public override List<KeyValuePair<string, string>> Rituels { get; } = new List<KeyValuePair<string, string>>() | ||||
|         { | ||||
|             new KeyValuePair<string, string>("", "Tous"), | ||||
|             new KeyValuePair<string, string>("(rituel)", "Rituel"), | ||||
|             new KeyValuePair<string, string>("rituel", "Rituel"), | ||||
|         }; | ||||
| 
 | ||||
|         public override List<KeyValuePair<string, string>> Sources { get; } = new List<KeyValuePair<string, string>>() | ||||
|  | @ -374,7 +376,7 @@ namespace AideDeJeu.ViewModels | |||
|         public override List<KeyValuePair<string, string>> Rituels { get; } = new List<KeyValuePair<string, string>>() | ||||
|         { | ||||
|             new KeyValuePair<string, string>("", "Tous"), | ||||
|             new KeyValuePair<string, string>("(rituel)", "Rituel"), | ||||
|             new KeyValuePair<string, string>("rituel", "Rituel"), | ||||
|         }; | ||||
| 
 | ||||
|         public override List<KeyValuePair<string, string>> Sources { get; } = new List<KeyValuePair<string, string>>() | ||||
|  |  | |||
							
								
								
									
										7952
									
								
								Data/spells_hd.md
									
										
									
									
									
								
							
							
						
						
									
										7952
									
								
								Data/spells_hd.md
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez