From ac1a116f98257c64f5a94c36085308ade72d2235 Mon Sep 17 00:00:00 2001 From: SubaruYashiro Date: Mon, 29 Dec 2025 07:45:45 +0800 Subject: [PATCH] [Item Hotkey] Add Try On item with hotkey --- Tweaks/Tooltips/Hotkeys/TryOnItem.cs | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Tweaks/Tooltips/Hotkeys/TryOnItem.cs diff --git a/Tweaks/Tooltips/Hotkeys/TryOnItem.cs b/Tweaks/Tooltips/Hotkeys/TryOnItem.cs new file mode 100644 index 00000000..a04fcb94 --- /dev/null +++ b/Tweaks/Tooltips/Hotkeys/TryOnItem.cs @@ -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; + } +}