diff --git a/Benchmark/Craftimizer.Benchmark.csproj b/Benchmark/Craftimizer.Benchmark.csproj index 9d2fb8a..6ee6142 100644 --- a/Benchmark/Craftimizer.Benchmark.csproj +++ b/Benchmark/Craftimizer.Benchmark.csproj @@ -17,10 +17,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Craftimizer/Craftimizer.csproj b/Craftimizer/Craftimizer.csproj index 094f93c..cc30dfc 100644 --- a/Craftimizer/Craftimizer.csproj +++ b/Craftimizer/Craftimizer.csproj @@ -38,12 +38,9 @@ - - - - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Craftimizer/LuminaSheets.cs b/Craftimizer/LuminaSheets.cs index 110bb6e..1c16272 100644 --- a/Craftimizer/LuminaSheets.cs +++ b/Craftimizer/LuminaSheets.cs @@ -1,27 +1,26 @@ -using Dalamud.Utility; -using ExdSheets; -using ExdSheets.Sheets; using Lumina.Data; +using Lumina.Excel; +using Lumina.Excel.Sheets; namespace Craftimizer.Plugin; public static class LuminaSheets { - private static readonly Module Module = new(Service.DataManager.GameData, Service.DataManager.Language.ToLumina()); + private static readonly ExcelModule Module = Service.DataManager.GameData.Excel; - public static readonly Sheet RecipeSheet = Module.GetSheet(); - public static readonly Sheet ActionSheet = Module.GetSheet(); - public static readonly Sheet CraftActionSheet = Module.GetSheet(); - public static readonly Sheet StatusSheet = Module.GetSheet(); - public static readonly Sheet AddonSheet = Module.GetSheet(); - public static readonly Sheet ClassJobSheet = Module.GetSheet(); - public static readonly Sheet ItemSheet = Module.GetSheet(); - public static readonly Sheet ItemSheetEnglish = Module.GetSheet(Language.English)!; - public static readonly Sheet ENpcResidentSheet = Module.GetSheet(); - public static readonly Sheet LevelSheet = Module.GetSheet(); - public static readonly Sheet QuestSheet = Module.GetSheet(); - public static readonly Sheet MateriaSheet = Module.GetSheet(); - public static readonly Sheet BaseParamSheet = Module.GetSheet(); - public static readonly Sheet ItemFoodSheet = Module.GetSheet(); - public static readonly Sheet SatisfactionSupplySheet = Module.GetSheet(); + public static readonly ExcelSheet RecipeSheet = Module.GetSheet(); + public static readonly ExcelSheet ActionSheet = Module.GetSheet(); + public static readonly ExcelSheet CraftActionSheet = Module.GetSheet(); + public static readonly ExcelSheet StatusSheet = Module.GetSheet(); + public static readonly ExcelSheet AddonSheet = Module.GetSheet(); + public static readonly ExcelSheet ClassJobSheet = Module.GetSheet(); + public static readonly ExcelSheet ItemSheet = Module.GetSheet(); + public static readonly ExcelSheet ItemSheetEnglish = Module.GetSheet(Language.English)!; + public static readonly ExcelSheet ENpcResidentSheet = Module.GetSheet(); + public static readonly ExcelSheet LevelSheet = Module.GetSheet(); + public static readonly ExcelSheet QuestSheet = Module.GetSheet(); + public static readonly ExcelSheet MateriaSheet = Module.GetSheet(); + public static readonly ExcelSheet BaseParamSheet = Module.GetSheet(); + public static readonly ExcelSheet ItemFoodSheet = Module.GetSheet(); + public static readonly SubrowExcelSheet SatisfactionSupplySheet = Module.GetSubrowSheet(); } diff --git a/Craftimizer/SimulatorUtils.cs b/Craftimizer/SimulatorUtils.cs index 729bde4..a84509d 100644 --- a/Craftimizer/SimulatorUtils.cs +++ b/Craftimizer/SimulatorUtils.cs @@ -5,15 +5,15 @@ using System.Linq; using System.Numerics; using System.Text; -using Action = ExdSheets.Sheets.Action; +using Action = Lumina.Excel.Sheets.Action; using ActionType = Craftimizer.Simulator.Actions.ActionType; using ClassJob = Craftimizer.Simulator.ClassJob; using Condition = Craftimizer.Simulator.Condition; -using Status = ExdSheets.Sheets.Status; +using Status = Lumina.Excel.Sheets.Status; using Craftimizer.Utils; -using ExdSheets.Sheets; using Lumina.Text.ReadOnly; using Lumina.Text.Payloads; +using Lumina.Excel.Sheets; namespace Craftimizer.Plugin; @@ -29,7 +29,7 @@ static ActionUtils() foreach (var actionType in actionTypes) { var actionId = actionType.Base().ActionId; - if (LuminaSheets.CraftActionSheet.TryGetRow(actionId) is { } baseCraftAction) + if (LuminaSheets.CraftActionSheet.GetRowOrDefault(actionId) is { } baseCraftAction) { foreach (var classJob in classJobs) { @@ -47,7 +47,7 @@ static ActionUtils() }, null); } } - if (LuminaSheets.ActionSheet.TryGetRow(actionId) is { } baseAction) + if (LuminaSheets.ActionSheet.GetRowOrDefault(actionId) is { } baseAction) { var possibleActions = LuminaSheets.ActionSheet.Where(r => r.Icon == baseAction.Icon && @@ -327,13 +327,13 @@ public static bool IsIndefinite(this EffectType me) => public static Status Status(this EffectType me) => LuminaSheets.StatusSheet.GetRow(me.StatusId())!; - public static ushort GetIconId(this EffectType me, int strength) + public static uint GetIconId(this EffectType me, int strength) { var status = me.Status(); var iconId = status.Icon; if (status.MaxStacks != 0) iconId += (uint)Math.Clamp(strength, 1, status.MaxStacks) - 1; - return (ushort)iconId; + return iconId; } public static ITextureIcon GetIcon(this EffectType me, int strength) => diff --git a/Craftimizer/Utils/Chat.cs b/Craftimizer/Utils/Chat.cs index f276073..057f06c 100644 --- a/Craftimizer/Utils/Chat.cs +++ b/Craftimizer/Utils/Chat.cs @@ -11,7 +11,7 @@ public sealed unsafe class Chat { private delegate void SendChatDelegate(UIModule* @this, Utf8String* message, Utf8String* historyMessage, bool pushToHistory); - [Signature("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 45 84 C9")] + [Signature("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F2 48 8B F9 45 84 C9")] private readonly SendChatDelegate sendChat = null!; public Chat() diff --git a/Craftimizer/Utils/FoodStatus.cs b/Craftimizer/Utils/FoodStatus.cs index 8629651..d56f52b 100644 --- a/Craftimizer/Utils/FoodStatus.cs +++ b/Craftimizer/Utils/FoodStatus.cs @@ -1,5 +1,5 @@ using Craftimizer.Plugin; -using ExdSheets.Sheets; +using Lumina.Excel.Sheets; using System.Collections.Frozen; using System.Collections.Generic; using System.Collections.Immutable; @@ -36,7 +36,7 @@ static FoodStatus() if (itemAction.Type is not (844 or 845 or 846)) continue; - if (LuminaSheets.ItemFoodSheet.TryGetRow(itemAction.Data[1]) is not { } itemFood) + if (LuminaSheets.ItemFoodSheet.GetRowOrDefault(itemAction.Data[1]) is not { } itemFood) continue; FoodStat? craftsmanship = null, control = null, cp = null; diff --git a/Craftimizer/Utils/Gearsets.cs b/Craftimizer/Utils/Gearsets.cs index a868862..7d8ce2e 100644 --- a/Craftimizer/Utils/Gearsets.cs +++ b/Craftimizer/Utils/Gearsets.cs @@ -2,7 +2,7 @@ using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.UI.Misc; -using ExdSheets.Sheets; +using Lumina.Excel.Sheets; using System; using System.Linq; using Craftimizer.Plugin; diff --git a/Craftimizer/Utils/Hooks.cs b/Craftimizer/Utils/Hooks.cs index 41e6258..2dce956 100644 --- a/Craftimizer/Utils/Hooks.cs +++ b/Craftimizer/Utils/Hooks.cs @@ -37,7 +37,7 @@ private bool UseActionDetour(ActionManager* manager, CSActionType actionType, ui var ret = UseActionHook.Original(manager, actionType, actionId, targetId, extraParam, mode, comboRouteId, optOutAreaTargeted); if (canCast && ret && actionType is CSActionType.CraftAction or CSActionType.Action) { - var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.ClientState.LocalPlayer?.ClassJob.Id ?? 0)); + var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.ClientState.LocalPlayer?.ClassJob.RowId ?? 0)); if (classJob != null) { var simActionType = ActionUtils.GetActionTypeFromId(actionId, classJob.Value, actionType == CSActionType.CraftAction); @@ -75,7 +75,7 @@ private byte IsActionHighlightedDetour(ActionManager* manager, CSActionType acti if (actionType is not (CSActionType.CraftAction or CSActionType.Action)) return ret; - var jobId = Service.ClientState.LocalPlayer?.ClassJob.Id; + var jobId = Service.ClientState.LocalPlayer?.ClassJob.RowId; if (jobId == null) return ret; diff --git a/Craftimizer/Utils/MacroCopy.cs b/Craftimizer/Utils/MacroCopy.cs index 066b0b0..d078583 100644 --- a/Craftimizer/Utils/MacroCopy.cs +++ b/Craftimizer/Utils/MacroCopy.cs @@ -183,7 +183,7 @@ private static unsafe void SetMacro(int idx, bool isShared, string macroText, in var module = RaptureMacroModule.Instance(); var macro = module->GetMacro(set, (uint)idx); - if (macro->IsEmpty()) + if (!macro->IsNotEmpty()) { macro->Name.SetString($"Craftimizer Macro {macroIdx}"); macro->SetIcon((uint)(macroIdx > 10 ? 66161 : (66161 + macroIdx))); diff --git a/Craftimizer/Utils/RecipeData.cs b/Craftimizer/Utils/RecipeData.cs index 8d8f7c4..d1bde84 100644 --- a/Craftimizer/Utils/RecipeData.cs +++ b/Craftimizer/Utils/RecipeData.cs @@ -1,6 +1,6 @@ using Craftimizer.Plugin; using Craftimizer.Simulator; -using ExdSheets.Sheets; +using Lumina.Excel.Sheets; using System; using System.Collections.Generic; using System.Linq; @@ -27,7 +27,7 @@ public RecipeData(ushort recipeId) { RecipeId = recipeId; - Recipe = LuminaSheets.RecipeSheet.TryGetRow(recipeId) ?? + Recipe = LuminaSheets.RecipeSheet.GetRowOrDefault(recipeId) ?? throw new ArgumentException($"Invalid recipe id {recipeId}", nameof(recipeId)); Table = Recipe.RecipeLevelTable.Value; @@ -47,9 +47,9 @@ public RecipeData(ushort recipeId) }; int[]? thresholds = null; - if (Recipe.CollectableMetadata.TryGetValue() is { } row) + if (Recipe.CollectableMetadata.GetValueOrDefault() is { } row) thresholds = [row.LowCollectability, row.MidCollectability, row.HighCollectability]; - else if (Recipe.CollectableMetadata.TryGetValue() is { } row2) + else if (Recipe.CollectableMetadata.GetValueOrDefault() is { } row2) { foreach (var entry in row2.HWDCrafterSupplyParams) { @@ -60,12 +60,10 @@ public RecipeData(ushort recipeId) } } } - else if (Recipe.CollectableMetadata.TryGetValue() is { } row3) + else if (Recipe.CollectableMetadata.GetValueOrDefaultSubrow() is { } row3) { - var subrowCount = LuminaSheets.SatisfactionSupplySheet.GetSubrowCount(row3.RowId); - for (ushort i = 0; i < subrowCount; ++i) + foreach (var subrow in row3) { - var subrow = LuminaSheets.SatisfactionSupplySheet.GetRow(row3.RowId, i); if (subrow.Item.RowId == Recipe.ItemResult.RowId) { thresholds = [subrow.CollectabilityLow, subrow.CollectabilityMid, subrow.CollectabilityHigh]; @@ -73,7 +71,7 @@ public RecipeData(ushort recipeId) } } } - else if (Recipe.CollectableMetadata.TryGetValue() is { } row5) + else if (Recipe.CollectableMetadata.GetValueOrDefault() is { } row5) { foreach (var item in row5.Item) { @@ -84,7 +82,7 @@ public RecipeData(ushort recipeId) } } } - else if (Recipe.CollectableMetadata.TryGetValue() is { } row6) + else if (Recipe.CollectableMetadata.GetValueOrDefault() is { } row6) { if (row6.CollectabilityHigh != 0) thresholds = [row6.CollectabilityLow, row6.CollectabilityMid, row6.CollectabilityHigh]; diff --git a/Craftimizer/Windows/MacroEditor.cs b/Craftimizer/Windows/MacroEditor.cs index b1aaf6d..6b5a390 100644 --- a/Craftimizer/Windows/MacroEditor.cs +++ b/Craftimizer/Windows/MacroEditor.cs @@ -22,7 +22,7 @@ using System.Threading.Tasks; using Sim = Craftimizer.Simulator.Simulator; using SimNoRandom = Craftimizer.Simulator.SimulatorNoRandom; -using Recipe = ExdSheets.Sheets.Recipe; +using Recipe = Lumina.Excel.Sheets.Recipe; namespace Craftimizer.Windows; @@ -586,7 +586,7 @@ private static string FormatItemBuff((uint ItemId, bool IsHQ) input) if (input.ItemId == 0) return "None"; - var name = LuminaSheets.ItemSheet.TryGetRow(input.ItemId)?.Name.ExtractText() ?? $"Unknown ({input.ItemId})"; + var name = LuminaSheets.ItemSheet.GetRowOrDefault(input.ItemId)?.Name.ExtractText() ?? $"Unknown ({input.ItemId})"; return input.IsHQ ? $"{name} (HQ)" : name; } diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index f57a16d..a003025 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -1097,23 +1097,21 @@ private CraftableStatus CalculateCraftStatus(Gearsets.GearsetItem[] gearItems) private static (string NpcName, string Territory, Vector2 MapLocation, MapLinkPayload Payload) ResolveLevelData(uint levelRowId) { - var level = LuminaSheets.LevelSheet.TryGetRow(levelRowId) ?? - throw new ArgumentNullException(nameof(levelRowId), $"Invalid level row {levelRowId}"); + var level = LuminaSheets.LevelSheet.GetRow(levelRowId); var territory = level.Territory.Value.PlaceName.Value.Name.ExtractText(); var location = WorldToMap2(new(level.X, level.Z), level.Map.Value!); return (ResolveNpcResidentName(level.Object.RowId), territory, location, new(level.Territory.RowId, level.Map.RowId, location.X, location.Y)); } - private static Vector2 WorldToMap2(Vector2 worldCoordinates, ExdSheets.Sheets.Map map) + private static Vector2 WorldToMap2(Vector2 worldCoordinates, Lumina.Excel.Sheets.Map map) { return MapUtil.WorldToMap(worldCoordinates, map.OffsetX, map.OffsetY, map.SizeFactor); } private static string ResolveNpcResidentName(uint npcRowId) { - var resident = LuminaSheets.ENpcResidentSheet.TryGetRow(npcRowId) ?? - throw new ArgumentNullException(nameof(npcRowId), $"Invalid npc row {npcRowId}"); + var resident = LuminaSheets.ENpcResidentSheet.GetRow(npcRowId); return resident.Singular.ExtractText(); } diff --git a/Craftimizer/Windows/Settings.cs b/Craftimizer/Windows/Settings.cs index 00db707..35eb6d0 100644 --- a/Craftimizer/Windows/Settings.cs +++ b/Craftimizer/Windows/Settings.cs @@ -451,7 +451,7 @@ ref isDirty v => { Config.MacroCopy.IntermediateNotificationSound = v; - UIModule.PlayChatSoundEffect((uint)v); + UIGlobals.PlayChatSoundEffect((uint)v); }, ref isDirty ); @@ -466,7 +466,7 @@ ref isDirty v => { Config.MacroCopy.EndNotificationSound = v; - UIModule.PlayChatSoundEffect((uint)v); + UIGlobals.PlayChatSoundEffect((uint)v); }, ref isDirty ); diff --git a/Craftimizer/packages.lock.json b/Craftimizer/packages.lock.json index a0cedaa..a260f5f 100644 --- a/Craftimizer/packages.lock.json +++ b/Craftimizer/packages.lock.json @@ -4,27 +4,9 @@ "net8.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[2.1.13, )", - "resolved": "2.1.13", - "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" - }, - "ExdSheets": { - "type": "Direct", - "requested": "[2.1.0, )", - "resolved": "2.1.0", - "contentHash": "SfvLFyL8LYsW4AzPLFVfFwtKPl9xegGraIe9oFar3IlWW8Z4kf5dkM+1CiSr/J+PQt4xt2QZc/ydZ4ibs3RosA==", - "dependencies": { - "Lumina": "4.1.1" - } - }, - "Lumina": { - "type": "Direct", - "requested": "[4.1.1, )", - "resolved": "4.1.1", - "contentHash": "Hd+iTtdaPACTpViXaJ/+sQ3ZQ8MEpApCSD+mxTXnUTYDSZOAipuC4LsZqhAkLMeQHSK/R/jiXEXaXS7e0mTXyA==", - "dependencies": { - "Microsoft.Extensions.ObjectPool": "9.0.0-preview.1.24081.5" - } + "requested": "[11.0.0, )", + "resolved": "11.0.0", + "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA==" }, "MathNet.Numerics": { "type": "Direct", @@ -34,20 +16,14 @@ }, "Meziantou.Analyzer": { "type": "Direct", - "requested": "[2.0.163, )", - "resolved": "2.0.163", - "contentHash": "vN0YmOkuvPLukMsefLHYCWYaLPzpc6SfoR74aPwuLeK8QdxgxkavywQ1q/II0shLEEaN1RhlMjmL1RxMPW853w==" - }, - "Microsoft.Extensions.ObjectPool": { - "type": "Direct", - "requested": "[9.0.0-preview.1.24081.5, )", - "resolved": "9.0.0-preview.1.24081.5", - "contentHash": "aAR7YW+pUUdvHk3vj7GtAi71dWGDIuY9270lsmQ6lKw23zzY+r8pLP3cGNbJdlnA9VWl+S+gnIVkBCqj2ROlEg==" + "requested": "[2.0.179, )", + "resolved": "2.0.179", + "contentHash": "F5zRPPi1A1lLq4AkBxKWk32gCo9xy8b46InSBUx47gj3DZFfAYi1TtYeChBJedkDETaVKX0+0YtXh/nVAJ/aQw==" }, "DotNext": { "type": "Transitive", - "resolved": "5.11.0", - "contentHash": "aLWtURne05gwWFFsOg9/X1g4V5yHyuWHX5paQIN7pJIDLCbaCDHcQlLeRRvzvksjAflZJ7tTHkowN/Xi1NXPrA==", + "resolved": "5.14.0", + "contentHash": "wyRjcjQISQJpLtKTKacLKUGP80AT28WVRHq0etmFJywdeHrUfjyLgrfnSA5sk1ZcdL/55jRalRfm6MyhXOImMw==", "dependencies": { "System.IO.Hashing": "8.0.0" } @@ -64,7 +40,7 @@ "type": "Project", "dependencies": { "Craftimizer.Simulator": "[1.0.0, )", - "DotNext": "[5.11.0, )" + "DotNext": "[5.14.0, )" } } } diff --git a/Simulator/Craftimizer.Simulator.csproj b/Simulator/Craftimizer.Simulator.csproj index 35c55fa..445f910 100644 --- a/Simulator/Craftimizer.Simulator.csproj +++ b/Simulator/Craftimizer.Simulator.csproj @@ -9,7 +9,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Solver/Craftimizer.Solver.csproj b/Solver/Craftimizer.Solver.csproj index 29c8a39..8a52408 100644 --- a/Solver/Craftimizer.Solver.csproj +++ b/Solver/Craftimizer.Solver.csproj @@ -10,8 +10,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Test/Craftimizer.Test.csproj b/Test/Craftimizer.Test.csproj index 8b0dd57..52bd63a 100644 --- a/Test/Craftimizer.Test.csproj +++ b/Test/Craftimizer.Test.csproj @@ -11,17 +11,13 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + all runtime; build; native; contentfiles; analyzers; buildtransitive + + +