-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
252 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
public interface IDebugTab : IDrawableTab; | ||
|
||
public interface IDrawableTab | ||
{ | ||
string Title { get; } | ||
string InternalName { get; } | ||
bool DrawInChild { get; } | ||
bool IsEnabled { get; } | ||
bool IsPinnable { get; } | ||
bool CanPopOut { get; } | ||
void Draw(); | ||
} | ||
|
||
public abstract partial class DebugTab : IDebugTab | ||
{ | ||
private string? _title = null; | ||
public virtual string Title => _title ??= NameRegex().Replace(TabRegex().Replace(GetType().Name, ""), "$1 $2"); | ||
public virtual bool IsEnabled => true; | ||
public virtual bool IsPinnable => true; | ||
public virtual bool CanPopOut => true; | ||
public virtual bool DrawInChild => true; | ||
public virtual string InternalName => GetType().Name; | ||
|
||
[GeneratedRegex("Tab$")] | ||
private static partial Regex TabRegex(); | ||
|
||
[GeneratedRegex("([a-z])([A-Z])")] | ||
private static partial Regex NameRegex(); | ||
|
||
public virtual void Draw() { } | ||
|
||
public bool Equals(IDebugTab? other) | ||
{ | ||
return other?.Title == _title; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Dalamud.Interface.Utility.Raii; | ||
using ImGuiNET; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
internal unsafe class ExecuteCommandTab : DebugTab | ||
{ | ||
private readonly Memory.ExecuteCommands ec = new(); | ||
private ExecuteCommandFlag flag; | ||
private ExecuteCommandComplexFlag flag2; | ||
private readonly int[] ecParams = new int[4]; | ||
private readonly int[] eccParams = new int[4]; | ||
|
||
public override void Draw() | ||
{ | ||
ImGuiX.Enum("ExecuteCommand", ref flag); | ||
ImGui.InputInt("p1", ref ecParams[0]); | ||
ImGui.InputInt("p2", ref ecParams[1]); | ||
ImGui.InputInt("p3", ref ecParams[2]); | ||
ImGui.InputInt("p4", ref ecParams[3]); | ||
if (ImGui.Button("execute")) | ||
ec.ExecuteCommand(flag, ecParams[0], ecParams[1], ecParams[2], ecParams[3]); | ||
|
||
using var id = ImRaii.PushId("complex"); | ||
ImGuiX.Enum("ExecuteCommandComplex", ref flag2); | ||
ImGui.InputInt("p1", ref eccParams[0]); | ||
ImGui.InputInt("p2", ref eccParams[1]); | ||
ImGui.InputInt("p3", ref eccParams[2]); | ||
ImGui.InputInt("p4", ref eccParams[3]); | ||
if (ImGui.Button("execute")) | ||
ec.ExecuteCommandComplexLocation(flag2, Player.Position, eccParams[0], eccParams[1], eccParams[2], eccParams[3]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using FFXIVClientStructs.FFXIV.Client.Game; | ||
using FFXIVClientStructs.Interop; | ||
using ImGuiNET; | ||
using Lumina.Excel.Sheets; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
internal unsafe class InventoryTab : DebugTab | ||
{ | ||
private unsafe List<Pointer<InventoryItem>> InventoryItems | ||
{ | ||
get | ||
{ | ||
List<Pointer<InventoryItem>> items = []; | ||
foreach (var inv in Inventory.Equippable) | ||
{ | ||
var cont = InventoryManager.Instance()->GetInventoryContainer(inv); | ||
for (var i = 0; i < cont->Size; ++i) | ||
if (cont->GetInventorySlot(i)->ItemId != 0) | ||
items.Add(cont->GetInventorySlot(i)); | ||
} | ||
return items; | ||
} | ||
} | ||
|
||
private unsafe List<Pointer<InventoryItem>> FilteredItems => InventoryItems.Where(x => GetRow<Item>(x.Value->ItemId)?.Name.ExtractText().ToLowerInvariant().Contains(searchFilter.ToLowerInvariant()) ?? false).ToList(); | ||
private string searchFilter = ""; | ||
|
||
public override void Draw() | ||
{ | ||
ImGui.InputText("Filter", ref searchFilter, 256); | ||
foreach (var item in FilteredItems) | ||
{ | ||
var data = GetRow<Item>(item.Value->ItemId)!; | ||
ImGui.TextUnformatted($"[{item.Value->ItemId}] {item.Value->Container} {item.Value->Slot} {data.Value.Name}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using ImGuiNET; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
internal unsafe class PlayerExTab : DebugTab | ||
{ | ||
public override void Draw() | ||
{ | ||
var pi = typeof(PlayerEx).GetProperties(); | ||
foreach (var p in pi) | ||
{ | ||
try | ||
{ | ||
ImGui.TextColored(new Vector4(0.2f, 0.6f, 0.4f, 1), $"{p.Name}: "); | ||
ImGui.SameLine(); | ||
ImGui.TextDisabled($"{p.GetValue(typeof(PlayerEx))}"); | ||
} | ||
catch (Exception e) | ||
{ | ||
ImGui.TextColored(new Vector4(1, 0, 0, 1), $"[ERROR] {e.Message}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Dalamud.Interface.Utility.Raii; | ||
using FFXIVClientStructs.FFXIV.Client.UI.Agent; | ||
using ImGuiNET; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
internal unsafe class TasksTab : DebugTab | ||
{ | ||
public override void Draw() | ||
{ | ||
using (ImRaii.Disabled(!P.Automation.Running)) | ||
if (ImGui.Button("Stop current task")) | ||
P.Automation.Stop(); | ||
ImGuiX.TaskState(); | ||
|
||
if (AgentMap.Instance()->IsFlagMarkerSet != 0) | ||
{ | ||
var closest = Coords.FindClosestAetheryte(PlayerEx.MapFlag.TerritoryId, PlayerEx.MapFlag.ToVector3()); | ||
ImGui.TextUnformatted($"{closest}"); | ||
ImGui.TextUnformatted($"{Coords.FindPrimaryAetheryte(closest)}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using ECommons.Automation; | ||
using ECommons.ImGuiMethods; | ||
using FFXIVClientStructs.FFXIV.Client.Game; | ||
using FFXIVClientStructs.FFXIV.Client.Game.Object; | ||
using FFXIVClientStructs.FFXIV.Client.UI.Agent; | ||
using FFXIVClientStructs.FFXIV.Component.GUI; | ||
using ImGuiNET; | ||
using Lumina.Excel.Sheets; | ||
|
||
namespace Automaton.UI.Debug.Tabs; | ||
internal unsafe class ToolsTab : DebugTab | ||
{ | ||
public override void Draw() | ||
{ | ||
List<string> cantSpend = []; | ||
if (ImGui.Button("Spend Nuts")) | ||
{ | ||
if (TryGetAddonByName<AtkUnitBase>("ShopExchangeCurrency", out var addon)) | ||
{ | ||
const uint nuts = 26533; | ||
var nutsAmt = InventoryManager.Instance()->GetInventoryItemCount(nuts); | ||
var nutsCost = 25; | ||
var freeslots = InventoryManager.Instance()->GetEmptySlotsInBag() + Inventory.GetEmptySlots([InventoryType.ArmoryRings]); | ||
var tobuy = (uint)Math.Min(nutsAmt / nutsCost, freeslots); | ||
Svc.Log.Info($"{InventoryManager.Instance()->GetEmptySlotsInBag()} {Inventory.GetEmptySlots([InventoryType.ArmoryRings])} {nutsAmt} {nutsAmt / nutsCost} {tobuy}"); | ||
Callback.Fire(addon, true, 0, 49, tobuy); | ||
} | ||
else | ||
cantSpend.Add("ShopExchangeCurrency not open"); | ||
} | ||
if (ImGui.IsItemHovered()) ImGui.SetTooltip($"Buys the most amount of {GetRow<Item>(34922)?.Name}"); | ||
cantSpend.ForEach(x => ImGuiEx.Text((uint)Colors.Red, x)); | ||
|
||
if (ImGui.Button("Use all items")) | ||
{ | ||
foreach (var c in Inventory.PlayerInventory) | ||
{ | ||
var cont = InventoryManager.Instance()->GetInventoryContainer(c); | ||
for (var i = 0; i < cont->Size; ++i) | ||
{ | ||
var slot = cont->GetInventorySlot(i); | ||
var item = GetRow<Item>(slot->ItemId)!; | ||
if (item.Value.ItemSortCategory.Value.Param is 175 or 160) | ||
{ | ||
P.TaskManager.Enqueue(() => AgentInventoryContext.Instance()->UseItem(slot->ItemId)); | ||
P.TaskManager.Enqueue(() => !Player.IsAnimationLocked && !PlayerEx.IsBusy && !PlayerEx.IsCasting); | ||
} | ||
//ActionManager.Instance()->UseAction(ActionType.Item, slot->ItemId); | ||
} | ||
} | ||
} | ||
|
||
if (Dalamud.SafeMemory.ReadBytes(Svc.SigScanner.ScanText(Memory.Signatures.ItemIsUniqueConditionalJump), 2, out var obj)) | ||
{ | ||
ImGui.TextUnformatted($"{BitConverter.ToString(obj)}"); | ||
} | ||
|
||
if (ImGui.Button("hg")) | ||
{ | ||
var player = (FFXIVClientStructs.FFXIV.Client.Game.Character.Character*)GameObjectManager.Instance()->Objects.IndexSorted[0].Value; | ||
player->GetStatusManager()->SetStatus(20, 210, 5.0f, 100, 0xE0000000, true); | ||
} | ||
} | ||
} |
Oops, something went wrong.