Skip to content

Commit

Permalink
Merge pull request #109 from MKhayle/main
Browse files Browse the repository at this point in the history
VFX = 0 Filter for StatusEffects
  • Loading branch information
Minmoose authored Jan 5, 2025
2 parents ca4a5a5 + 17b484d commit 836df61
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
18 changes: 16 additions & 2 deletions Brio/UI/Controls/Selectors/StatusEffectSelector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Brio.Resources;
using Brio.UI.Widgets.Actor;
using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET;
using Lumina.Excel.Sheets;
Expand All @@ -10,11 +11,13 @@ namespace Brio.UI.Controls.Selectors;
public class StatusEffectSelectorHolder
{
public Status Status { get; set; }
public bool _VFXLockEnabled { get; set; }
}

internal class StatusEffectSelector(string id) : Selector<StatusEffectSelectorHolder>(id)
{
protected override Vector2 MinimumListSize { get; } = new(300, 300);
public bool _VFXLockEnabled = true;

protected override float EntrySize => ImGui.GetTextLineHeight() * 3f;

Expand All @@ -28,6 +31,17 @@ protected override void PopulateList()
}
}

protected override void DrawOptions()
{
base.DrawOptions();

if(ImGui.Checkbox("###status_vfx_filter", ref this._VFXLockEnabled))
UpdateList();
ImGui.SameLine();
ImGui.Text("Remove Status Effects that do not have a VFX.");

}

protected override void DrawItem(StatusEffectSelectorHolder sesh, bool isHovered)
{
var item = sesh.Status;
Expand All @@ -43,7 +57,7 @@ protected override void DrawItem(StatusEffectSelectorHolder sesh, bool isHovered

ImGui.Image(tex.ImGuiHandle, iconSize);
ImGui.SameLine();
ImGui.Text($"{item.Name}\n{item.RowId}\nVFX: {item.VFX.RowId} / Hit: {item.HitEffect.RowId}");
ImGui.Text($"{item.Name.ExtractText()}\n{item.RowId}\nVFX: {item.VFX.RowId} / Hit: {item.HitEffect.RowId}");
}

protected override int Compare(StatusEffectSelectorHolder sesh1, StatusEffectSelectorHolder sesh2)
Expand All @@ -63,10 +77,10 @@ protected override int Compare(StatusEffectSelectorHolder sesh1, StatusEffectSel
protected override bool Filter(StatusEffectSelectorHolder sesh, string search)
{
var item = sesh.Status;
if(_VFXLockEnabled && item.VFX.RowId == 0) return false;

if(item.StatusCategory == 0)
return false;

var searchTerm = $"{item.Name} {item.RowId} {item.VFX.RowId} {item.HitEffect.RowId}";

if(searchTerm.Contains(search, StringComparison.InvariantCultureIgnoreCase))
Expand Down
12 changes: 11 additions & 1 deletion Brio/UI/Widgets/Actor/StatusEffectsWidget.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Brio.Capabilities.Actor;
using Brio.Capabilities.Core;
using Brio.Resources;
using Brio.UI.Controls.Selectors;
using Brio.UI.Controls.Stateless;
Expand All @@ -19,6 +20,7 @@ internal class StatusEffectsWidget(StatusEffectCapability capability) : Widget<S
public override WidgetFlags Flags => WidgetFlags.DrawBody;

private int _selectedStatus;
private bool _VFXLockEnabled = false;

private static readonly StatusEffectSelector _globalStatusEffectSelector = new("global_status_selector");

Expand All @@ -33,6 +35,8 @@ public override void DrawBody()
{
foreach(var status in statuses)
{
if(_VFXLockEnabled && status.VFX.RowId == 0) continue;

bool selected = status.RowId == _selectedStatus;

IDalamudTextureWrap? tex = null;
Expand All @@ -50,7 +54,7 @@ public override void DrawBody()
ImGui.SetCursorPos(position);
ImGui.Image(tex.ImGuiHandle, iconSize);
ImGui.SameLine();
ImGui.Text($"{status.Name}\n{status.RowId}");
ImGui.Text($"{status.Name.ExtractText()}\n{status.RowId}");

if(wasSelected)
_selectedStatus = (int)status.RowId;
Expand Down Expand Up @@ -78,6 +82,12 @@ public override void DrawBody()
if(ImBrio.FontIconButton("status_effects_remove", FontAwesomeIcon.Minus, "Remove Effect", isSelectedPlaying))
Capability.RemoveStatus((ushort)_selectedStatus);

ImGui.SameLine();

ImGui.Checkbox("###status_vfx_filter", ref _VFXLockEnabled);
if(ImGui.IsItemHovered())
ImGui.SetTooltip("Hide Status Effects that have no VFX.");

ImGui.SameLine();


Expand Down

0 comments on commit 836df61

Please sign in to comment.