mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Add furniture to redraw bar and help, improve redraw bar slightly.
This commit is contained in:
parent
c88f1a7b1c
commit
2fd8c98147
2 changed files with 45 additions and 13 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.Game.Housing;
|
||||||
using OtterGui.Widgets;
|
using OtterGui.Widgets;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.Interop.Services;
|
using Penumbra.Interop.Services;
|
||||||
|
|
@ -26,10 +28,12 @@ public class ModsTab : ITab
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
private readonly IClientState _clientState;
|
private readonly IClientState _clientState;
|
||||||
private readonly CollectionSelectHeader _collectionHeader;
|
private readonly CollectionSelectHeader _collectionHeader;
|
||||||
|
private readonly ITargetManager _targets;
|
||||||
|
private readonly IObjectTable _objectTable;
|
||||||
|
|
||||||
public ModsTab(ModManager modManager, CollectionManager collectionManager, ModFileSystemSelector selector, ModPanel panel,
|
public ModsTab(ModManager modManager, CollectionManager collectionManager, ModFileSystemSelector selector, ModPanel panel,
|
||||||
TutorialService tutorial, RedrawService redrawService, Configuration config, IClientState clientState,
|
TutorialService tutorial, RedrawService redrawService, Configuration config, IClientState clientState,
|
||||||
CollectionSelectHeader collectionHeader)
|
CollectionSelectHeader collectionHeader, ITargetManager targets, IObjectTable objectTable)
|
||||||
{
|
{
|
||||||
_modManager = modManager;
|
_modManager = modManager;
|
||||||
_activeCollections = collectionManager.Active;
|
_activeCollections = collectionManager.Active;
|
||||||
|
|
@ -40,6 +44,8 @@ public class ModsTab : ITab
|
||||||
_config = config;
|
_config = config;
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
_collectionHeader = collectionHeader;
|
_collectionHeader = collectionHeader;
|
||||||
|
_targets = targets;
|
||||||
|
_objectTable = objectTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVisible
|
public bool IsVisible
|
||||||
|
|
@ -133,7 +139,9 @@ public class ModsTab : ITab
|
||||||
if (hovered)
|
if (hovered)
|
||||||
ImGui.SetTooltip($"The supported modifiers for '/penumbra redraw' are:\n{TutorialService.SupportedRedrawModifiers}");
|
ImGui.SetTooltip($"The supported modifiers for '/penumbra redraw' are:\n{TutorialService.SupportedRedrawModifiers}");
|
||||||
|
|
||||||
void DrawButton(Vector2 size, string label, string lower)
|
void DrawButton(Vector2 size, string label, string lower, string additionalTooltip)
|
||||||
|
{
|
||||||
|
using (var disabled = ImRaii.Disabled(additionalTooltip.Length > 0))
|
||||||
{
|
{
|
||||||
if (ImGui.Button(label, size))
|
if (ImGui.Button(label, size))
|
||||||
{
|
{
|
||||||
|
|
@ -142,20 +150,43 @@ public class ModsTab : ITab
|
||||||
else
|
else
|
||||||
_redrawService.RedrawAll(RedrawType.Redraw);
|
_redrawService.RedrawAll(RedrawType.Redraw);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip(lower.Length > 0 ? $"Execute '/penumbra redraw {lower}'." : $"Execute '/penumbra redraw'.");
|
ImGuiUtil.HoverTooltip(lower.Length > 0
|
||||||
|
? $"Execute '/penumbra redraw {lower}'.{additionalTooltip}"
|
||||||
|
: $"Execute '/penumbra redraw'.{additionalTooltip}", ImGuiHoveredFlags.AllowWhenDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
using var id = ImRaii.PushId("Redraw");
|
using var id = ImRaii.PushId("Redraw");
|
||||||
using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null);
|
using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
var buttonWidth = frameHeight with { X = ImGui.GetContentRegionAvail().X / 4 };
|
var buttonWidth = frameHeight with { X = ImGui.GetContentRegionAvail().X / 5 };
|
||||||
DrawButton(buttonWidth, "All", string.Empty);
|
var tt = _objectTable.GetObjectAddress(0) == nint.Zero
|
||||||
|
? "\nCan only be used when you are logged in and your character is available."
|
||||||
|
: string.Empty;
|
||||||
|
DrawButton(buttonWidth, "All", string.Empty, tt);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
DrawButton(buttonWidth, "Self", "self");
|
DrawButton(buttonWidth, "Self", "self", tt);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
DrawButton(buttonWidth, "Target", "target");
|
|
||||||
|
tt = _targets.Target == null && _targets.GPoseTarget == null
|
||||||
|
? "\nCan only be used when you have a target."
|
||||||
|
: string.Empty;
|
||||||
|
DrawButton(buttonWidth, "Target", "target", tt);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
DrawButton(frameHeight with { X = ImGui.GetContentRegionAvail().X - 1 }, "Focus", "focus");
|
|
||||||
|
tt = _targets.FocusTarget == null
|
||||||
|
? "\nCan only be used when you have a focus target."
|
||||||
|
: string.Empty;
|
||||||
|
DrawButton(buttonWidth, "Focus", "focus", tt);
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
tt = !IsIndoors()
|
||||||
|
? "\nCan currently only be used for indoor furniture."
|
||||||
|
: string.Empty;
|
||||||
|
DrawButton(frameHeight with { X = ImGui.GetContentRegionAvail().X - 1 }, "Furniture", "furniture", tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static unsafe bool IsIndoors()
|
||||||
|
=> HousingManager.Instance()->IsInside();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ public class TutorialService
|
||||||
+ " - 'target' or '<t>': your target\n"
|
+ " - 'target' or '<t>': your target\n"
|
||||||
+ " - 'focus' or '<f>: your focus target\n"
|
+ " - 'focus' or '<f>: your focus target\n"
|
||||||
+ " - 'mouseover' or '<mo>': the actor you are currently hovering over\n"
|
+ " - 'mouseover' or '<mo>': the actor you are currently hovering over\n"
|
||||||
|
+ " - 'furniture': most indoor furniture, does not currently work outdoors\n"
|
||||||
+ " - any specific actor name to redraw all actors of that exactly matching name.";
|
+ " - any specific actor name to redraw all actors of that exactly matching name.";
|
||||||
|
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue