From 2105cb5b7c0536fe5f757970588f382f76931cac Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Tue, 30 Mar 2021 01:41:36 +0200 Subject: [PATCH] stuff --- Dalamud/Fools2021.cs | 6 +++- Dalamud/Interface/DalamudDataWindow.cs | 40 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Dalamud/Fools2021.cs b/Dalamud/Fools2021.cs index ad6d1f7c4..e993a9740 100644 --- a/Dalamud/Fools2021.cs +++ b/Dalamud/Fools2021.cs @@ -292,7 +292,11 @@ namespace Dalamud break; case TippyState.Timeout: if (this.tippyLogicTimer.ElapsedMilliseconds > 60000) { - SetNewTip(); + SetTippyAnim(TippyAnimState.Idle, true); + this.tippyText = string.Empty; + this.showTippyButton = false; + + this.tippyLogicTimer.Restart(); this.tippyState = TippyState.Tips; } break; diff --git a/Dalamud/Interface/DalamudDataWindow.cs b/Dalamud/Interface/DalamudDataWindow.cs index 3899697bc..96373794f 100644 --- a/Dalamud/Interface/DalamudDataWindow.cs +++ b/Dalamud/Interface/DalamudDataWindow.cs @@ -332,11 +332,26 @@ namespace Dalamud.Interface this.inputAddonName, this.inputAddonIndex); } + if (ImGui.Button("Find Agent")) { + this.findAgentInterfacePtr = FindAgentInterface(this.inputAddonName); + } + if (this.resultAddon != null) { ImGui.TextUnformatted( $"{this.resultAddon.Name} - 0x{this.resultAddon.Address.ToInt64():x}\n v:{this.resultAddon.Visible} x:{this.resultAddon.X} y:{this.resultAddon.Y} s:{this.resultAddon.Scale}, w:{this.resultAddon.Width}, h:{this.resultAddon.Height}"); } + if (this.findAgentInterfacePtr != IntPtr.Zero) { + ImGui.TextUnformatted( + $"Agent: 0x{this.findAgentInterfacePtr.ToInt64():x}"); + ImGui.SameLine(); + + if (ImGui.Button("C")) + { + ImGui.SetClipboardText(this.findAgentInterfacePtr.ToInt64().ToString("x")); + } + } + if (ImGui.Button("Get Base UI object")) { var addr = this.dalamud.Framework.Gui.GetBaseUIObject().ToInt64().ToString("x"); Log.Information("{0}", addr); @@ -409,6 +424,31 @@ namespace Dalamud.Interface return isOpen; } + private IntPtr findAgentInterfacePtr; + + private unsafe IntPtr FindAgentInterface(string addonName) + { + var addon = this.dalamud.Framework.Gui.GetUiObjectByName(addonName, 1); + if (addon == IntPtr.Zero) return IntPtr.Zero; + SafeMemory.Read(addon + 0x1CE, out var id); + + if (id == 0) + _ = SafeMemory.Read(addon + 0x1CC, out id); + + var framework = this.dalamud.Framework.Address.BaseAddress; + var uiModule = *(IntPtr*)(framework + 0x29F8); + var agentModule = uiModule + 0xC3E78; + for (var i = 0; i < 379; i++) + { + var agent = *(IntPtr*)(agentModule + 0x20 + i * 8); + if (agent == IntPtr.Zero) + continue; + if (*(short*)(agent + 0x20) == id) + return agent; + } + return IntPtr.Zero; + } + private void PrintActor(Actor actor, string tag) { var actorString = $"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{tag}] - {actor.ObjectKind} - {actor.Name} - X{actor.Position.X} Y{actor.Position.Y} Z{actor.Position.Z} D{actor.YalmDistanceX} R{actor.Rotation} - Target: {actor.TargetActorID:X}\n";