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
36 changes: 36 additions & 0 deletions Tweaks/Tooltips/Hotkeys/TryOnItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Dalamud.Game.ClientState.Keys;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using Lumina.Excel.Sheets;

namespace SimpleTweaksPlugin.Tweaks.Tooltips.Hotkeys;

public class TryOnItem : ItemHotkey
{
protected override string Name => "Try On Item";
protected override VirtualKey[] DefaultKeyCombo => [VirtualKey.CONTROL, VirtualKey.F];

public override void OnTriggered(Item item)
{
if (CheckCanTryOn(item))
{
AgentTryon.TryOn(0, item.RowId);
}
}

unsafe private static bool CheckCanTryOn(Item item) {
// not equippable, Waist or SoulCrystal => false
if (item.EquipSlotCategory.RowId is 0 or 6 or 17)
return false;

// any OffHand that's not a Shield => false
if (item.EquipSlotCategory.RowId is 2 && item.FilterGroup != 3) // 3 = Shield
return false;

var race = (int)PlayerState.Instance()->Race;
if (race == 0)
return false;

return true;
}
}