Skip to content

Commit

Permalink
added GetLevel()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Dec 6, 2023
1 parent 62033d8 commit 7b7db9c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
6 changes: 3 additions & 3 deletions SomethingNeedDoing/IPC/Deliveroo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ internal static class DeliverooIPC
private const string TurnInStartedStr = "Deliveroo.TurnInStarted";
private const string TurnInStoppedStr = "Deliveroo.TurnInStopped";

internal static ICallGateSubscriber<bool> IsTurnInRunning;
internal static ICallGateSubscriber<object> TurnInStarted;
internal static ICallGateSubscriber<object> TurnInStopped;
internal static ICallGateSubscriber<bool>? IsTurnInRunning;
internal static ICallGateSubscriber<object>? TurnInStarted;
internal static ICallGateSubscriber<object>? TurnInStopped;

internal static void Init()
{
Expand Down
32 changes: 31 additions & 1 deletion SomethingNeedDoing/Interface/HelpWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using ECommons;
using ECommons.DalamudServices;
using ImGuiNET;
using Lumina.Excel;
using Lumina.Excel.GeneratedSheets;

namespace SomethingNeedDoing.Interface;

Expand Down Expand Up @@ -268,7 +272,7 @@ public override void Draw()
{
if (ImGui.BeginTabBar("HelpTab"))
{
var tabs = new (string Title, Action Dele)[]
var tabs = new (string Title, System.Action Dele)[]
{
("Changelog", this.DrawChangelog),
("Options", this.DrawOptions),
Expand All @@ -279,6 +283,7 @@ public override void Draw()
("Clicks", this.DrawClicks),
("Sends", this.DrawVirtualKeys),
("Conditions", this.DrawAllConditions),
("Game Data", this.DrawGameData),
};

foreach (var (title, dele) in tabs)
Expand Down Expand Up @@ -315,6 +320,12 @@ static void DisplayChangelog(string date, string changes, bool separator = true)
}

ImGui.PushFont(UiBuilder.MonoFont);

DisplayChangelog(
"2023-11-23",
"- Added GetLevel()\n" +
"- Added \"Game Data\" tab to the help menu.");

DisplayChangelog(
"2023-11-23",
"- Added GetPlayerRawXPos()\n" +
Expand Down Expand Up @@ -932,6 +943,8 @@ float GetPlayerRawXPos()
float GetPlayerRawYPos()
float GetPlayerRawZPos()
float GetDistanceToPoint(float x, float y, float z))
int GetLevel(uint ExpArrayIndex = -1)
".Trim();

ImGui.TextWrapped(text);
Expand Down Expand Up @@ -1007,4 +1020,21 @@ private void DrawAllConditions()
ImGui.PopStyleColor();
}
}

private readonly IEnumerable<ClassJob> classJobSheet = Svc.Data.GetExcelSheet<ClassJob>(Svc.ClientState.ClientLanguage)!.Where(x => !x.Name.RawString.IsNullOrEmpty());
private void DrawGameData()
{
using var font = ImRaii.PushFont(UiBuilder.MonoFont);

ImGui.TextWrapped("Misc Game Data Information");
ImGui.Separator();

ImGui.TextWrapped("ClassJob");
ImGui.PushStyleColor(ImGuiCol.Text, ShadedColor);
foreach (var cj in classJobSheet)
{
ImGui.Text($"{cj.Name}: Key={cj.RowId}; ExpArrayIndex={cj.ExpArrayIndex}");
}
ImGui.PopStyleColor();
}
}
8 changes: 7 additions & 1 deletion SomethingNeedDoing/Misc/CommandInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public unsafe int GetItemCount(int itemID, bool includeHQ = true) =>
public unsafe bool DeliverooIsTurnInRunning()
{
DeliverooIPC.Init();
return DeliverooIPC.IsTurnInRunning.InvokeFunc();
return DeliverooIPC.IsTurnInRunning!.InvokeFunc();
}

/// <inheritdoc/>
Expand Down Expand Up @@ -533,6 +533,12 @@ private unsafe (uint Progress, uint Quality) GetActionResult(uint id)

public float GetDistanceToPoint(float x, float y, float z) => Vector3.Distance(Svc.ClientState.LocalPlayer!.Position, new Vector3(x, y, z));

public unsafe int GetLevel(int expArrayIndex = -1)
{
if (expArrayIndex == -1) expArrayIndex = Svc.ClientState.LocalPlayer!.ClassJob.GameData!.ExpArrayIndex;
return UIState.Instance()->PlayerState.ClassJobLevelArray[expArrayIndex];
}

private unsafe int GetNodeTextAsInt(AtkTextNode* node, string error)
{
try
Expand Down

0 comments on commit 7b7db9c

Please sign in to comment.