1
0
forked from liza/Questionable

Minor cleanup

This commit is contained in:
Liza 2024-06-09 16:37:26 +02:00
parent 81e849abc3
commit 375a289659
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 25 additions and 11 deletions

View File

@ -12,6 +12,7 @@ using Lumina.Excel.GeneratedSheets;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Questionable.Model.V1; using Questionable.Model.V1;
using Quest = Questionable.Model.Quest; using Quest = Questionable.Model.Quest;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
namespace Questionable.Controller; namespace Questionable.Controller;
@ -84,7 +85,10 @@ internal sealed class GameUiController : IDisposable
List<string?> answers = new(); List<string?> answers = new();
for (ushort i = 7; i < addonSelectString->AtkUnitBase.AtkValuesCount; ++i) for (ushort i = 7; i < addonSelectString->AtkUnitBase.AtkValuesCount; ++i)
{
if (addonSelectString->AtkUnitBase.AtkValues[i].Type == ValueType.String)
answers.Add(addonSelectString->AtkUnitBase.AtkValues[i].ReadAtkString()); answers.Add(addonSelectString->AtkUnitBase.AtkValues[i].ReadAtkString());
}
int? answer = HandleListChoice(actualPrompt, answers, checkAllSteps); int? answer = HandleListChoice(actualPrompt, answers, checkAllSteps);
if (answer != null) if (answer != null)

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
@ -75,14 +76,19 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig, IDisposab
return currentQuest == null || !currentQuest.Quest.Data.TerritoryBlacklist.Contains(_clientState.TerritoryType); return currentQuest == null || !currentQuest.Quest.Data.TerritoryBlacklist.Contains(_clientState.TerritoryType);
} }
public override unsafe void Draw() public override void Draw()
{ {
if (!_clientState.IsLoggedIn || _clientState.LocalPlayer == null) DrawQuest();
{ ImGui.Separator();
ImGui.Text("Not logged in.");
return; DrawCreationUtils();
ImGui.Separator();
DrawQuickAccessButtons();
} }
private unsafe void DrawQuest()
{
var currentQuest = _questController.CurrentQuest; var currentQuest = _questController.CurrentQuest;
if (currentQuest != null) if (currentQuest != null)
{ {
@ -146,8 +152,11 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig, IDisposab
} }
else else
ImGui.Text("No active quest"); ImGui.Text("No active quest");
}
ImGui.Separator(); private unsafe void DrawCreationUtils()
{
Debug.Assert(_clientState.LocalPlayer != null, "_clientState.LocalPlayer != null");
ImGui.Text( ImGui.Text(
$"Current TerritoryId: {_clientState.TerritoryType}, Flying: {(_gameFunctions.IsFlyingUnlockedInCurrentZone() ? "Yes" : "No")}"); $"Current TerritoryId: {_clientState.TerritoryType}, Flying: {(_gameFunctions.IsFlyingUnlockedInCurrentZone() ? "Yes" : "No")}");
@ -209,7 +218,7 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig, IDisposab
if (ImGui.Button("Interact")) if (ImGui.Button("Interact"))
{ {
ulong result = TargetSystem.Instance()->InteractWithObject( ulong result = TargetSystem.Instance()->InteractWithObject(
(FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)_targetManager.Target.Address, false); (GameObject*)_targetManager.Target.Address, false);
_logger.LogInformation("XXXXX Interaction Result: {Result}", result); _logger.LogInformation("XXXXX Interaction Result: {Result}", result);
} }
@ -251,9 +260,10 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig, IDisposab
"""); """);
} }
} }
}
ImGui.Separator(); private unsafe void DrawQuickAccessButtons()
{
var map = AgentMap.Instance(); var map = AgentMap.Instance();
ImGui.BeginDisabled(map == null || map->IsFlagMarkerSet == 0 || ImGui.BeginDisabled(map == null || map->IsFlagMarkerSet == 0 ||
map->FlagMapMarker.TerritoryId != _clientState.TerritoryType); map->FlagMapMarker.TerritoryId != _clientState.TerritoryType);