Skip to content

Commit 3dbd09d

Browse files
committed
Move around custom CS structs
1 parent 050fddb commit 3dbd09d

File tree

4 files changed

+30
-43
lines changed

4 files changed

+30
-43
lines changed

Craftimizer/SimulatorUtils.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Lumina.Text.Payloads;
1616
using Lumina.Excel.Sheets;
1717
using Dalamud.Utility;
18+
using FFXIVClientStructs.FFXIV.Client.Game.Event;
1819

1920
namespace Craftimizer.Plugin;
2021

@@ -54,7 +55,7 @@ static ActionUtils()
5455
r.Icon == baseAction.Icon &&
5556
r.ActionCategory.RowId == baseAction.ActionCategory.RowId &&
5657
r.Name.Equals(baseAction.Name));
57-
58+
5859
foreach (var classJob in classJobs)
5960
ActionRows[(int)actionType, (int)classJob] = (null, possibleActions.First(r => r.ClassJobCategory.ValueNullable?.IsClassJob(classJob) ?? false));
6061
}
@@ -144,7 +145,7 @@ public static unsafe short GetPlayerLevel(this ClassJob me) =>
144145
public static unsafe ushort GetWKSSyncedLevel(this ClassJob me)
145146
{
146147
var jobLevel = (ushort)me.GetPlayerLevel();
147-
var handler = CSCraftEventHandler.Instance();
148+
var handler = EventFramework.Instance()->GetCraftEventHandler();
148149
if (handler != null)
149150
{
150151
for (var i = 0; i < 2; ++i)

Craftimizer/Utils/CSCraftEventHandler.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

Craftimizer/Utils/CSRecipeNote.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using FFXIVClientStructs.FFXIV.Client.Game.UI;
2+
using FFXIVClientStructs.FFXIV.Client.System.String;
23
using System.Runtime.InteropServices;
34

45
namespace Craftimizer.Utils;
@@ -12,4 +13,29 @@ public unsafe struct CSRecipeNote
1213
{
1314
return (CSRecipeNote*)RecipeNote.Instance();
1415
}
16+
17+
[StructLayout(LayoutKind.Explicit, Size = 136)]
18+
public struct RecipeIngredient
19+
{
20+
[FieldOffset(8)]
21+
public byte NQCount;
22+
23+
[FieldOffset(9)]
24+
public byte HQCount;
25+
26+
[FieldOffset(16)]
27+
public Utf8String Name;
28+
29+
[FieldOffset(120)]
30+
public uint ItemId;
31+
32+
[FieldOffset(124)]
33+
public uint IconId;
34+
35+
[FieldOffset(130)]
36+
public byte Amount;
37+
38+
[FieldOffset(131)]
39+
public byte Flags;
40+
}
1541
}

Craftimizer/Windows/RecipeNote.cs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using ActionType = Craftimizer.Simulator.Actions.ActionType;
3131
using ClassJob = Craftimizer.Simulator.ClassJob;
3232
using CSRecipeNote = FFXIVClientStructs.FFXIV.Client.Game.UI.RecipeNote;
33+
using RecipeIngredient2 = Craftimizer.Utils.CSRecipeNote.RecipeIngredient;
3334

3435
namespace Craftimizer.Windows;
3536

@@ -312,31 +313,6 @@ bool ShouldUseWKSRecipeNote()
312313
return true;
313314
}
314315

315-
[StructLayout(LayoutKind.Explicit, Size = 136)]
316-
public struct RecipeIngredient2
317-
{
318-
[FieldOffset(8)]
319-
public byte NQCount;
320-
321-
[FieldOffset(9)]
322-
public byte HQCount;
323-
324-
[FieldOffset(16)]
325-
public Utf8String Name;
326-
327-
[FieldOffset(120)]
328-
public uint ItemId;
329-
330-
[FieldOffset(124)]
331-
public uint IconId;
332-
333-
[FieldOffset(130)]
334-
public byte Amount;
335-
336-
[FieldOffset(131)]
337-
public byte Flags;
338-
}
339-
340316
private IEnumerable<int> CalculateIngredientHqCounts()
341317
{
342318
if (RecipeData == null)

0 commit comments

Comments
 (0)