mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Allow filtering designs for contained items.
This commit is contained in:
parent
a3583dd5f1
commit
36f6c48f7a
2 changed files with 21 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ using System.Buffers.Text;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using Glamourer.Services;
|
using Glamourer.Services;
|
||||||
|
using OtterGui.Classes;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.GameData.Structs;
|
using Penumbra.GameData.Structs;
|
||||||
using Penumbra.String.Functions;
|
using Penumbra.String.Functions;
|
||||||
|
|
@ -39,6 +40,20 @@ public unsafe struct DesignData
|
||||||
public DesignData()
|
public DesignData()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
public bool ContainsName(LowerString name)
|
||||||
|
=> name.IsContained(_nameHead)
|
||||||
|
|| name.IsContained(_nameBody)
|
||||||
|
|| name.IsContained(_nameHands)
|
||||||
|
|| name.IsContained(_nameLegs)
|
||||||
|
|| name.IsContained(_nameFeet)
|
||||||
|
|| name.IsContained(_nameEars)
|
||||||
|
|| name.IsContained(_nameNeck)
|
||||||
|
|| name.IsContained(_nameWrists)
|
||||||
|
|| name.IsContained(_nameRFinger)
|
||||||
|
|| name.IsContained(_nameLFinger)
|
||||||
|
|| name.IsContained(_nameMainhand)
|
||||||
|
|| name.IsContained(_nameOffhand);
|
||||||
|
|
||||||
public readonly StainId Stain(EquipSlot slot)
|
public readonly StainId Stain(EquipSlot slot)
|
||||||
{
|
{
|
||||||
var index = slot.ToIndex();
|
var index = slot.ToIndex();
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,8 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
||||||
else if (design != null)
|
else if (design != null)
|
||||||
_designManager.CreateClone(design, _newName, true);
|
_designManager.CreateClone(design, _newName, true);
|
||||||
else
|
else
|
||||||
Glamourer.Messager.NotificationMessage("Could not create a design, clipboard did not contain valid design data.", NotificationType.Error, false);
|
Glamourer.Messager.NotificationMessage("Could not create a design, clipboard did not contain valid design data.",
|
||||||
|
NotificationType.Error, false);
|
||||||
_clipboardText = null;
|
_clipboardText = null;
|
||||||
}
|
}
|
||||||
else if (_cloneDesign != null)
|
else if (_cloneDesign != null)
|
||||||
|
|
@ -206,6 +207,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
||||||
FilterTooltip = "Filter designs for those where their full paths or names contain the given substring.\n"
|
FilterTooltip = "Filter designs for those where their full paths or names contain the given substring.\n"
|
||||||
+ "Enter m:[string] to filter for designs with with a mod association containing the string.\n"
|
+ "Enter m:[string] to filter for designs with with a mod association containing the string.\n"
|
||||||
+ "Enter t:[string] to filter for designs set to specific tags.\n"
|
+ "Enter t:[string] to filter for designs set to specific tags.\n"
|
||||||
|
+ "Enter i:[string] to filter for designs containing specific items.\n"
|
||||||
+ "Enter n:[string] to filter only for design names and no paths.";
|
+ "Enter n:[string] to filter only for design names and no paths.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,6 +226,8 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
||||||
'M' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 2),
|
'M' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 2),
|
||||||
't' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 3),
|
't' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 3),
|
||||||
'T' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 3),
|
'T' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 3),
|
||||||
|
'i' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 4),
|
||||||
|
'I' => filterValue.Length == 2 ? (LowerString.Empty, -1) : (new LowerString(filterValue[2..]), 4),
|
||||||
_ => (new LowerString(filterValue), 0),
|
_ => (new LowerString(filterValue), 0),
|
||||||
},
|
},
|
||||||
_ => (new LowerString(filterValue), 0),
|
_ => (new LowerString(filterValue), 0),
|
||||||
|
|
@ -259,6 +263,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
||||||
1 => !design.Name.Contains(_designFilter),
|
1 => !design.Name.Contains(_designFilter),
|
||||||
2 => !design.AssociatedMods.Any(kvp => _designFilter.IsContained(kvp.Key.Name)),
|
2 => !design.AssociatedMods.Any(kvp => _designFilter.IsContained(kvp.Key.Name)),
|
||||||
3 => !design.Tags.Any(_designFilter.IsContained),
|
3 => !design.Tags.Any(_designFilter.IsContained),
|
||||||
|
4 => !design.DesignData.ContainsName(_designFilter),
|
||||||
_ => false, // Should never happen
|
_ => false, // Should never happen
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue