feat: add tag exclusions
This commit is contained in:
parent
ca8beb53cc
commit
4077719af2
|
@ -907,6 +907,7 @@ namespace Glamaholic.Ui {
|
||||||
private string Query { get; }
|
private string Query { get; }
|
||||||
private HashSet<ClassJob> WantedJobs { get; } = new();
|
private HashSet<ClassJob> WantedJobs { get; } = new();
|
||||||
private HashSet<string> Tags { get; } = new();
|
private HashSet<string> Tags { get; } = new();
|
||||||
|
private HashSet<string> ExcludeTags { get; } = new();
|
||||||
private HashSet<uint> ItemIds { get; } = new();
|
private HashSet<uint> ItemIds { get; } = new();
|
||||||
private HashSet<string> ItemNames { get; } = new();
|
private HashSet<string> ItemNames { get; } = new();
|
||||||
|
|
||||||
|
@ -934,6 +935,9 @@ namespace Glamaholic.Ui {
|
||||||
case 2:
|
case 2:
|
||||||
this.ItemNames.Add(quoted);
|
this.ItemNames.Add(quoted);
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.ExcludeTags.Add(quoted);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
quoted = null;
|
quoted = null;
|
||||||
|
@ -984,6 +988,21 @@ namespace Glamaholic.Ui {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (word.StartsWith("!t:")) {
|
||||||
|
if (word.StartsWith("!t:\"")) {
|
||||||
|
if (word.EndsWith('"') && word.Length >= 6) {
|
||||||
|
this.ExcludeTags.Add(word[4..^1]);
|
||||||
|
} else {
|
||||||
|
quoteType = 3;
|
||||||
|
quoted = word[4..];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.ExcludeTags.Add(word[3..]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (word.StartsWith("id:")) {
|
if (word.StartsWith("id:")) {
|
||||||
if (uint.TryParse(word[3..], out var id)) {
|
if (uint.TryParse(word[3..], out var id)) {
|
||||||
this.ItemIds.Add(id);
|
this.ItemIds.Add(id);
|
||||||
|
@ -1020,7 +1039,13 @@ namespace Glamaholic.Ui {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there's nothing custom about this filter, this is a match
|
// if there's nothing custom about this filter, this is a match
|
||||||
if (this.MaxLevel == 0 && this.WantedJobs.Count == 0 && this.Tags.Count == 0 && this.ItemIds.Count == 0 && this.ItemNames.Count == 0) {
|
var notCustom = this.MaxLevel == 0
|
||||||
|
&& this.WantedJobs.Count == 0
|
||||||
|
&& this.Tags.Count == 0
|
||||||
|
&& this.ExcludeTags.Count == 0
|
||||||
|
&& this.ItemIds.Count == 0
|
||||||
|
&& this.ItemNames.Count == 0;
|
||||||
|
if (notCustom) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,6 +1055,12 @@ namespace Glamaholic.Ui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var tag in this.ExcludeTags) {
|
||||||
|
if (plate.Tags.Contains(tag)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ItemIds.Count > 0) {
|
if (this.ItemIds.Count > 0) {
|
||||||
var matching = plate.Items.Values
|
var matching = plate.Items.Values
|
||||||
.Select(mirage => mirage.ItemId)
|
.Select(mirage => mirage.ItemId)
|
||||||
|
|
Loading…
Reference in New Issue