Skip to content

Commit a041fc6

Browse files
committed
Update for 7.4
1 parent 67430ed commit a041fc6

17 files changed

Lines changed: 83 additions & 83 deletions

Benchmark/Craftimizer.Benchmark.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
@@ -17,10 +17,10 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
21-
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.14.0" />
22-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.14.0" />
23-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.199">
20+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
21+
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.15.8" />
22+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.8" />
23+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.264">
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>

Craftimizer/Craftimizer.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
2+
<Project Sdk="Dalamud.NET.Sdk/14.0.1">
33
<PropertyGroup>
44
<Authors>Asriel Camora</Authors>
5-
<Version>2.8.0.0</Version>
5+
<Version>2.9.0.0</Version>
66
<PackageProjectUrl>https://github.com/WorkingRobot/Craftimizer.git</PackageProjectUrl>
77
<Configurations>Debug;Release</Configurations>
88
</PropertyGroup>
99

1010
<PropertyGroup>
11-
<TargetFramework>net9.0-windows7.0</TargetFramework>
11+
<TargetFramework>net10.0-windows</TargetFramework>
1212
<Platforms>x64</Platforms>
1313
<Nullable>enable</Nullable>
1414
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -33,7 +33,7 @@
3333

3434
<ItemGroup>
3535
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
36-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.199">
36+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.264">
3737
<PrivateAssets>all</PrivateAssets>
3838
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3939
</PackageReference>

Craftimizer/Plugin.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public Plugin(IDalamudPluginInterface pluginInterface)
7575
var editorWindow = (EditorWindow?.IsOpen ?? false) ? EditorWindow : null;
7676
var recipeData = editorWindow?.RecipeData ?? Service.Plugin.RecipeNoteWindow.RecipeData;
7777
var characterStats = editorWindow?.CharacterStats ?? Service.Plugin.RecipeNoteWindow.CharacterStats;
78-
var buffs = editorWindow?.Buffs ?? (RecipeNoteWindow.CharacterStats != null ? new(Service.ClientState.LocalPlayer?.StatusList) : null);
78+
var buffs = editorWindow?.Buffs ?? (RecipeNoteWindow.CharacterStats != null ? new(Service.Objects.LocalPlayer?.StatusList) : null);
7979

8080
return (characterStats, recipeData, buffs);
8181
}
@@ -143,7 +143,7 @@ public void OpenMacroListWindow()
143143
ListWindow.BringToFront();
144144
}
145145

146-
public void OpenCraftingLog()
146+
public static void OpenCraftingLog()
147147
{
148148
Chat.SendMessage("/craftinglog");
149149
}
@@ -154,15 +154,15 @@ public void OpenMacroClipboard(List<string> macros)
154154
ClipboardWindow = new(macros);
155155
}
156156

157-
public IActiveNotification DisplaySolverWarning(string text) =>
157+
public static IActiveNotification DisplaySolverWarning(string text) =>
158158
DisplayNotification(new()
159159
{
160160
Content = text,
161161
Title = "Solver Warning",
162162
Type = NotificationType.Warning
163163
});
164164

165-
public IActiveNotification DisplayNotification(Notification notification)
165+
public static IActiveNotification DisplayNotification(Notification notification)
166166
{
167167
var ret = Service.NotificationManager.AddNotification(notification);
168168
// ret.SetIconTexture(Icon.RentAsync().ContinueWith(t => (IDalamudTextureWrap?)t));

Craftimizer/Utils/FoodStatus.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static FoodStatus()
3333
if (item.ItemAction.ValueNullable is not { } itemAction)
3434
continue;
3535

36-
if (itemAction.Type is not (844 or 845 or 846))
36+
if (itemAction.Action.RowId is not (844 or 845 or 846))
3737
continue;
3838

3939
if (LuminaSheets.ItemFoodSheet.GetRowOrDefault(itemAction.Data[1]) is not { } itemFood)
@@ -66,12 +66,12 @@ static FoodStatus()
6666
lut.TryAdd(itemFood.RowId, item.RowId);
6767
}
6868

69-
ItemFoodToItemLUT = lut.ToFrozenDictionary();
69+
ItemFoodToItemLUT = lut.ToFrozenDictionary();
7070
FoodItems = foods.ToFrozenDictionary();
7171
MedicineItems = medicines.ToFrozenDictionary();
7272

73-
FoodOrder = FoodItems.OrderByDescending(a => a.Value.Item.LevelItem.RowId).Select(a => a.Key).ToImmutableArray();
74-
MedicineOrder = MedicineItems.OrderByDescending(a => a.Value.Item.LevelItem.RowId).Select(a => a.Key).ToImmutableArray();
73+
FoodOrder = [.. FoodItems.OrderByDescending(a => a.Value.Item.LevelItem.RowId).Select(a => a.Key)];
74+
MedicineOrder = [.. MedicineItems.OrderByDescending(a => a.Value.Item.LevelItem.RowId).Select(a => a.Key)];
7575
}
7676

7777
public static void Initialize() { }

Craftimizer/Utils/Hooks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private bool UseActionDetour(ActionManager* manager, CSActionType actionType, ui
3737
var ret = UseActionHook.Original(manager, actionType, actionId, targetId, extraParam, mode, comboRouteId, optOutAreaTargeted);
3838
if (canCast && ret && actionType is CSActionType.CraftAction or CSActionType.Action)
3939
{
40-
var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.ClientState.LocalPlayer?.ClassJob.RowId ?? 0));
40+
var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.Objects.LocalPlayer?.ClassJob.RowId ?? 0));
4141
if (classJob != null)
4242
{
4343
var simActionType = ActionUtils.GetActionTypeFromId(actionId, classJob.Value, actionType == CSActionType.CraftAction);
@@ -75,7 +75,7 @@ private byte IsActionHighlightedDetour(ActionManager* manager, CSActionType acti
7575
if (actionType is not (CSActionType.CraftAction or CSActionType.Action))
7676
return ret;
7777

78-
var jobId = Service.ClientState.LocalPlayer?.ClassJob.RowId;
78+
var jobId = Service.Objects.LocalPlayer?.ClassJob.RowId;
7979
if (jobId == null)
8080
return ret;
8181

Craftimizer/Utils/Ipc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Ipc()
2626
if (prop.GetMethod is not { } getMethod)
2727
throw new InvalidOperationException("Property must have a getter");
2828

29-
if (getMethod.GetCustomAttribute<CompilerGeneratedAttribute>() is null)
29+
if (!getMethod.IsDefined<CompilerGeneratedAttribute>())
3030
throw new InvalidOperationException("Property must have an auto getter");
3131

3232
var type = prop.PropertyType;

Craftimizer/Utils/MacroCopy.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static void Copy(IReadOnlyList<ActionType> actions)
2020
{
2121
if (actions.Count == 0)
2222
{
23-
Service.Plugin.DisplayNotification(new()
23+
Plugin.Plugin.DisplayNotification(new()
2424
{
2525
Content = "Cannot copy an empty macro.",
2626
MinimizedText = "Cannot copy empty macro",
@@ -152,7 +152,7 @@ private static void CopyToMacro(List<string> macros)
152152

153153
if (config.ShowCopiedMessage)
154154
{
155-
Service.Plugin.DisplayNotification(new()
155+
Plugin.Plugin.DisplayNotification(new()
156156
{
157157
Content = i > 1 ? "Copied macro to User Macros." : $"Copied {i} macros to User Macros.",
158158
MinimizedText = i > 1 ? "Copied macro" : $"Copied {i} macros",
@@ -164,7 +164,7 @@ private static void CopyToMacro(List<string> macros)
164164
{
165165
Service.Plugin.OpenMacroClipboard(macros);
166166
var rest = macros.Count - i;
167-
Service.Plugin.DisplayNotification(new()
167+
Plugin.Plugin.DisplayNotification(new()
168168
{
169169
Content = $"Couldn't copy {rest} macro{(rest == 1 ? "" : "s")}, so a window was opened with all of them.",
170170
Minimized = false,
@@ -201,7 +201,7 @@ private static void CopyToClipboard(List<string> macros)
201201
ImGui.SetClipboardText(string.Join(Environment.NewLine + Environment.NewLine, macros));
202202
if (Service.Configuration.MacroCopy.ShowCopiedMessage)
203203
{
204-
Service.Plugin.DisplayNotification(new()
204+
Plugin.Plugin.DisplayNotification(new()
205205
{
206206
Content = macros.Count == 1 ? "Copied macro to clipboard." : $"Copied {macros.Count} macros to clipboard.",
207207
MinimizedText = macros.Count == 1 ? "Copied macro" : $"Copied {macros.Count} macros",
@@ -215,7 +215,7 @@ private static void CopyToMacroMate(string macro)
215215
{
216216
if (!Service.Ipc.MacroMateIsAvailable())
217217
{
218-
Service.Plugin.DisplayNotification(new()
218+
Plugin.Plugin.DisplayNotification(new()
219219
{
220220
Content = "Please check if it installed and enabled.",
221221
MinimizedText = "Macro Mate is unavailable",
@@ -232,7 +232,7 @@ private static void CopyToMacroMate(string macro)
232232
var (isValidParent, parentError) = Service.Ipc.MacroMateValidateGroupPath(parentPath);
233233
if (!isValidParent)
234234
{
235-
Service.Plugin.DisplayNotification(new()
235+
Plugin.Plugin.DisplayNotification(new()
236236
{
237237
Content = parentError!,
238238
MinimizedText = parentError,
@@ -246,7 +246,7 @@ private static void CopyToMacroMate(string macro)
246246

247247
if (Service.Configuration.MacroCopy.ShowCopiedMessage)
248248
{
249-
Service.Plugin.DisplayNotification(new()
249+
Plugin.Plugin.DisplayNotification(new()
250250
{
251251
Content = "Copied macro to Macro Mate.",
252252
MinimizedText = "Copied macro",

Craftimizer/Windows/MacroClipboard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private void DrawMacro(int idx, string macro)
5858
ImGui.SetClipboardText(macro);
5959
if (Service.Configuration.MacroCopy.ShowCopiedMessage)
6060
{
61-
Service.Plugin.DisplayNotification(new()
61+
Plugin.Plugin.DisplayNotification(new()
6262
{
6363
Content = Macros.Count == 1 ? "Copied macro to clipboard." : $"Copied macro {idx + 1} to clipboard.",
6464
MinimizedText = Macros.Count == 1 ? "Copied macro" : $"Copied macro {idx + 1}",

Craftimizer/Windows/MacroEditor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,13 +1008,13 @@ private void DrawIngredientHQEntry(int idx)
10081008
}
10091009

10101010
private const int MAX_LEVEL = 100;
1011-
private float GetLevelEntryWidth()
1011+
private static float GetLevelEntryWidth()
10121012
{
10131013
var levelTextWidth = ImGui.CalcTextSize(SqText.ToLevelString(MAX_LEVEL)).X + ImGui.GetStyle().FramePadding.X * 2 + 5;
10141014
return ImGui.CalcTextSize(SqText.LevelPrefix.ToIconString()).X + 5 + levelTextWidth;
10151015
}
10161016

1017-
private bool DrawLevelEntry(ref int level)
1017+
private static bool DrawLevelEntry(ref int level)
10181018
{
10191019
static int LevelInputCallback(ImGuiInputTextCallbackDataPtr data)
10201020
{
@@ -1570,7 +1570,7 @@ private void DrawImportPopup()
15701570
foreach (var action in parsedActions)
15711571
AddStep(action);
15721572

1573-
Service.Plugin.DisplayNotification(new()
1573+
Plugin.Plugin.DisplayNotification(new()
15741574
{
15751575
Content = $"Imported macro with {parsedActions.Count} step{(parsedActions.Count != 1 ? "s" : "")}",
15761576
MinimizedText = $"Imported {parsedActions.Count} step macro",
@@ -1626,7 +1626,7 @@ private void DrawImportPopup()
16261626
Macro.Clear();
16271627
foreach (var action in actions)
16281628
AddStep(action);
1629-
Service.Plugin.DisplayNotification(new()
1629+
Plugin.Plugin.DisplayNotification(new()
16301630
{
16311631
Content = $"Imported macro \"{name}\"",
16321632
Title = "Macro Imported",
@@ -1677,7 +1677,7 @@ private int CalculateBestMacroTask(SimulationState state, CancellationToken toke
16771677

16781678
var solver = new Solver.Solver(config, state) { Token = token };
16791679
solver.OnLog += Log.Debug;
1680-
solver.OnWarn += t => Service.Plugin.DisplaySolverWarning(t);
1680+
solver.OnWarn += t => Plugin.Plugin.DisplaySolverWarning(t);
16811681
solver.OnNewAction += a => Macro.Enqueue(a);
16821682
solver.OnSuggestSolution += a => Macro.EnqueueEphemeral(a.Actions);
16831683
SolverObject = solver;

Craftimizer/Windows/MacroList.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class MacroList : Window, IDisposable
2323
public CharacterStats? CharacterStats { get; private set; }
2424
public RecipeData? RecipeData { get; private set; }
2525

26-
private IReadOnlyList<Macro> Macros => Service.Configuration.Macros;
26+
private static IReadOnlyList<Macro> Macros => Service.Configuration.Macros;
2727
private Dictionary<Macro, SimulationState> MacroStateCache { get; } = [];
2828

2929
public MacroList() : base("Craftimizer Macro List", WindowFlags, false)
@@ -60,7 +60,7 @@ public MacroList() : base("Craftimizer Macro List", WindowFlags, false)
6060

6161
public override bool DrawConditions()
6262
{
63-
return Service.ClientState.LocalPlayer != null;
63+
return Service.Objects.LocalPlayer != null;
6464
}
6565

6666
public override void PreDraw()
@@ -129,7 +129,7 @@ public override void Draw()
129129
ImGuiUtils.TextCentered(text2);
130130
ImGuiUtils.AlignCentered(buttonRowWidth);
131131
if (ImGui.Button(text3))
132-
Service.Plugin.OpenCraftingLog();
132+
Plugin.Plugin.OpenCraftingLog();
133133
ImGui.SameLine();
134134
if (ImGui.Button(text4))
135135
OpenEditor(null);
@@ -356,7 +356,7 @@ private void RefreshSearch()
356356
sortedMacros = [.. query];
357357
}
358358

359-
private void OpenEditor(Macro? macro)
359+
private static void OpenEditor(Macro? macro)
360360
{
361361
var stats = Service.Plugin.GetDefaultStats();
362362
Service.Plugin.OpenMacroEditor(stats.Character, stats.Recipe, stats.Buffs, null, macro?.Actions ?? Enumerable.Empty<ActionType>(), macro != null ? (actions => { macro.ActionEnumerable = actions; Service.Configuration.Save(); }) : null);

0 commit comments

Comments
 (0)