Skip to content

Commit

Permalink
added GetClassJobId
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Nov 15, 2023
1 parent f1c6f6b commit 0afd98e
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 1 deletion.
94 changes: 94 additions & 0 deletions SomethingNeedDoing/Grammar/Commands/CallbackCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//using System.Collections.Generic;
//using System.Linq;
//using System.Text.RegularExpressions;
//using System.Threading;
//using System.Threading.Tasks;
//using ECommons.DalamudServices;
//using FFXIVClientStructs.FFXIV.Component.GUI;
//using SomethingNeedDoing.Grammar.Modifiers;
//using SomethingNeedDoing.Misc;
//using static ECommons.GenericHelpers;
//using ECommons.Automation;

//namespace SomethingNeedDoing.Grammar.Commands;

//internal class CallbackCommand : MacroCommand
//{
// private static readonly Regex Regex = new(@"^/callback\s+(?<name>.*?)\s*$", RegexOptions.Compiled);
// private AtkUnitBase addon;
// private bool updateState;
// private List<object> valueArgs = new();

// private unsafe CallbackCommand(string text)
// : base(text, WaitModifier.TryParse(0, out var wm))
// {
// var args = text.Split(' ').ToList();
// if (!TryGetAddonByName<AtkUnitBase>(args[0], out var addonArg))
// {
// Svc.Log.Info($"Invalid addon {args[0]}. Please follow \"callback <addon> <bool> <atkValues>\"");
// return;
// }
// if (!bool.TryParse(args[1], out var boolArg))
// {
// Svc.Log.Info($"Invalid bool. Please follow \"callback <addon> <bool> <atkValues>\"");
// return;
// }
// }

// public static CallbackCommand Parse(List<string> args)
// {

// var valueArgs = new List<object>();

// var current = "";
// var inQuotes = false;

// for (var i = 0; i < args.Count; i++)
// {
// if (!inQuotes)
// {
// if (args[i].StartsWith("\""))
// {
// inQuotes = true;
// current = args[i].TrimStart('"');
// }
// else
// {
// if (int.TryParse(args[i], out var iValue)) valueArgs.Add(iValue);
// else if (uint.TryParse(args[i].TrimEnd('U', 'u'), out var uValue)) valueArgs.Add(uValue);
// else if (bool.TryParse(args[i], out var bValue)) valueArgs.Add(bValue);
// else valueArgs.Add(args[i]);
// }
// }
// else
// {
// if (args[i].EndsWith("\""))
// {
// inQuotes = false;
// current += " " + args[i].TrimEnd('"');
// valueArgs.Add(current);
// current = "";
// }
// else
// {
// current += " " + args[i];
// }
// }
// }

// if (!string.IsNullOrEmpty(current))
// {
// Svc.Log.Error("Error: Unclosed quotes.");
// }

// return new CallbackCommand(text);
// }

// /// <inheritdoc/>
// public async override Task Execute(ActiveMacro macro, CancellationToken token)
// {
// Callback.Fire(IsAddonReady,)

// await this.PerformWait(token);
// }
//}
4 changes: 4 additions & 0 deletions SomethingNeedDoing/Interface/HelpWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ static void DisplayChangelog(string date, string changes, bool separator = true)

ImGui.PushFont(UiBuilder.MonoFont);

DisplayChangelog(
"2023-11-15",
"- Added GetClassJobId()\n");

DisplayChangelog(
"2023-11-14",
"- Fixed the targeting system to ignore untargetable objects.\n" +
Expand Down
5 changes: 4 additions & 1 deletion SomethingNeedDoing/Misc/CommandInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using Dalamud.Game.ClientState.Conditions;
using Dalamud.Logging;
using ECommons.DalamudServices;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
Expand Down Expand Up @@ -450,7 +451,7 @@ public int GetZoneID() =>
/// <inheritdoc/>
public string GetCharacterName(bool includeWorld = false) =>
Service.ClientState.LocalPlayer == null ? "null"
: includeWorld ? $"{Service.ClientState.LocalPlayer.Name}@{Service.ClientState.LocalPlayer.HomeWorld.GameData.Name}"
: includeWorld ? $"{Service.ClientState.LocalPlayer.Name}@{Service.ClientState.LocalPlayer.HomeWorld.GameData!.Name}"
: Service.ClientState.LocalPlayer.Name.ToString();

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

public unsafe uint GetGil() => InventoryManager.Instance()->GetGil();

public uint GetClassJobId() => Svc.ClientState.LocalPlayer!.ClassJob.Id;

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

0 comments on commit 0afd98e

Please sign in to comment.