Move around custom CS structs
This commit is contained in:
@@ -15,6 +15,7 @@ using Lumina.Text.ReadOnly;
|
||||
using Lumina.Text.Payloads;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Event;
|
||||
|
||||
namespace Craftimizer.Plugin;
|
||||
|
||||
@@ -144,7 +145,7 @@ internal static class ClassJobUtils
|
||||
public static unsafe ushort GetWKSSyncedLevel(this ClassJob me)
|
||||
{
|
||||
var jobLevel = (ushort)me.GetPlayerLevel();
|
||||
var handler = CSCraftEventHandler.Instance();
|
||||
var handler = EventFramework.Instance()->GetCraftEventHandler();
|
||||
if (handler != null)
|
||||
{
|
||||
for (var i = 0; i < 2; ++i)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Event;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Craftimizer.Utils;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct CSCraftEventHandler
|
||||
{
|
||||
[FieldOffset(0x48A)] public unsafe fixed ushort WKSClassLevels[2];
|
||||
[FieldOffset(0x48E)] public unsafe fixed byte WKSClassJobs[2];
|
||||
|
||||
public static CSCraftEventHandler* Instance()
|
||||
{
|
||||
return (CSCraftEventHandler*)EventFramework.Instance()->GetCraftEventHandler();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Craftimizer.Utils;
|
||||
@@ -12,4 +13,29 @@ public unsafe struct CSRecipeNote
|
||||
{
|
||||
return (CSRecipeNote*)RecipeNote.Instance();
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 136)]
|
||||
public struct RecipeIngredient
|
||||
{
|
||||
[FieldOffset(8)]
|
||||
public byte NQCount;
|
||||
|
||||
[FieldOffset(9)]
|
||||
public byte HQCount;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public Utf8String Name;
|
||||
|
||||
[FieldOffset(120)]
|
||||
public uint ItemId;
|
||||
|
||||
[FieldOffset(124)]
|
||||
public uint IconId;
|
||||
|
||||
[FieldOffset(130)]
|
||||
public byte Amount;
|
||||
|
||||
[FieldOffset(131)]
|
||||
public byte Flags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Runtime.InteropServices;
|
||||
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||
using CSRecipeNote = FFXIVClientStructs.FFXIV.Client.Game.UI.RecipeNote;
|
||||
using RecipeIngredient2 = Craftimizer.Utils.CSRecipeNote.RecipeIngredient;
|
||||
|
||||
namespace Craftimizer.Windows;
|
||||
|
||||
@@ -312,31 +313,6 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
return true;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 136)]
|
||||
public struct RecipeIngredient2
|
||||
{
|
||||
[FieldOffset(8)]
|
||||
public byte NQCount;
|
||||
|
||||
[FieldOffset(9)]
|
||||
public byte HQCount;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public Utf8String Name;
|
||||
|
||||
[FieldOffset(120)]
|
||||
public uint ItemId;
|
||||
|
||||
[FieldOffset(124)]
|
||||
public uint IconId;
|
||||
|
||||
[FieldOffset(130)]
|
||||
public byte Amount;
|
||||
|
||||
[FieldOffset(131)]
|
||||
public byte Flags;
|
||||
}
|
||||
|
||||
private IEnumerable<int> CalculateIngredientHqCounts()
|
||||
{
|
||||
if (RecipeData == null)
|
||||
|
||||
Reference in New Issue
Block a user