Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion HearthDb/Cards.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ static Cards()
public static Card GetFromName(string name, Locale lang, bool collectible = true)
=> (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang)?.Equals(name, StringComparison.InvariantCultureIgnoreCase) ?? false);

public static Card GetFromDbfId(int dbfId, bool collectibe = true)
public static List<Card> GetFromFuzzyName(string name, Locale lang, bool collectible = true)
{
var values = (collectible ? Collectible : All).Values;
var result = values.Where(x =>
x.GetLocName(lang)?.IndexOf(name, StringComparison.InvariantCultureIgnoreCase) >= 0);
return result.ToList();
}

public static Card GetFromDbfId(int dbfId, bool collectibe = true)
=> (collectibe ? Collectible : All).Values.FirstOrDefault(x => x.DbfId == dbfId);
}
}