Remove AgentRecipeNote dependency after field changes
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Craftimizer.Utils;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 2880)]
|
||||
public unsafe struct CSRecipeNote
|
||||
{
|
||||
[FieldOffset(0x118)] public ushort ActiveCraftRecipeId;
|
||||
|
||||
public static CSRecipeNote* Instance()
|
||||
{
|
||||
return (CSRecipeNote*)RecipeNote.Instance();
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Shell;
|
||||
using ImGuiNET;
|
||||
using System;
|
||||
@@ -161,10 +160,9 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
if (!Service.Configuration.EnableSynthHelper)
|
||||
return false;
|
||||
|
||||
var agent = AgentRecipeNote.Instance();
|
||||
var recipeId = (ushort)agent->ActiveCraftRecipeId;
|
||||
var recipeId = CSRecipeNote.Instance()->ActiveCraftRecipeId;
|
||||
|
||||
if (agent->ActiveCraftRecipeId == 0)
|
||||
if (recipeId == 0)
|
||||
{
|
||||
RecipeData = null;
|
||||
return false;
|
||||
@@ -173,7 +171,10 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
Addon = (AddonSynthesis*)Service.GameGui.GetAddonByName("Synthesis");
|
||||
|
||||
if (Addon == null)
|
||||
{
|
||||
RecipeData = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if Synthesis addon is visible
|
||||
if (Addon->AtkUnitBase.WindowNode == null)
|
||||
@@ -198,7 +199,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
if (RecipeData?.RecipeId != agent->ActiveCraftRecipeId)
|
||||
if (RecipeData?.RecipeId != recipeId)
|
||||
OnStartCrafting(recipeId);
|
||||
|
||||
if (IsRecalculateQueued)
|
||||
|
||||
@@ -24,9 +24,9 @@ public record struct SimulationState
|
||||
17, 18, 18, 18, 19, 19, 20, 20, 21, 22, 23, 24, 26, 28, 31, 34, 38, 42, 47, 52, 58, 64, 68, 71,
|
||||
74, 76, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 96, 98, 100
|
||||
];
|
||||
public readonly int HQPercent => HQPercentTable[(int)Math.Clamp((float)Quality / Input.Recipe.MaxQuality * 100, 0, 100)];
|
||||
public readonly int HQPercent => HQPercentTable[(int)Math.Clamp((float)Quality / (Input?.Recipe.MaxQuality ?? 1) * 100, 0, 100)];
|
||||
public readonly int Collectability => Math.Max(Quality / 10, 1);
|
||||
public readonly int MaxCollectability => Math.Max(Input.Recipe.MaxQuality / 10, 1);
|
||||
public readonly int MaxCollectability => Math.Max((Input?.Recipe.MaxQuality ?? 1) / 10, 1);
|
||||
|
||||
public readonly bool IsFirstStep => StepCount == 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user