API 10 (beta)
This commit is contained in:
parent
517dcd5ed5
commit
52a8ea6066
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "LLib"]
|
||||||
|
path = LLib
|
||||||
|
url = https://git.carvel.li/liza/LLib
|
@ -1,21 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<Import Project="..\LLib\LLib.targets"/>
|
||||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
|
||||||
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
||||||
@ -24,24 +13,14 @@
|
|||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Need to be explicitly added for test projects, as it otherwise won't find the DLLs -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Dalamud">
|
<Reference Include="Dalamud"/>
|
||||||
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
|
<Reference Include="Lumina"/>
|
||||||
</Reference>
|
<Reference Include="Lumina.Excel"/>
|
||||||
<Reference Include="Lumina">
|
|
||||||
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Lumina.Excel">
|
|
||||||
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Gearsetter\Gearsetter.csproj"/>
|
<ProjectReference Include="..\Gearsetter\Gearsetter.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Using Include="Xunit"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
6
Gearsetter.Test/Gearsetter.Test.json
Normal file
6
Gearsetter.Test/Gearsetter.Test.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"Name": "Gearsetter.Test",
|
||||||
|
"Author": "Liza Carvelli",
|
||||||
|
"Punchline": "",
|
||||||
|
"Description": ""
|
||||||
|
}
|
@ -1,12 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Gearsetter.GameData;
|
using Gearsetter.GameData;
|
||||||
using Gearsetter.Model;
|
using Gearsetter.Model;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
namespace Gearsetter.Test;
|
namespace Gearsetter.Test;
|
||||||
|
|
||||||
public sealed class ItemSortingTest
|
public sealed class ItemSortingTest
|
||||||
{
|
{
|
||||||
Lumina.GameData _lumina = new( "C:/Program Files (x86)/steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" );
|
Lumina.GameData _lumina = new("C:/Program Files (x86)/steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack");
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void Test1()
|
||||||
@ -33,7 +37,6 @@ public sealed class ItemSortingTest
|
|||||||
Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false))
|
Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false))
|
||||||
.Cast<BaseItem>()
|
.Cast<BaseItem>()
|
||||||
.ToList(),
|
.ToList(),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var primaryStats = _lumina.GetExcelSheet<ClassJob>()!
|
var primaryStats = _lumina.GetExcelSheet<ClassJob>()!
|
||||||
|
1108
Gearsetter.Test/packages.lock.json
Normal file
1108
Gearsetter.Test/packages.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gearsetter", "Gearsetter\Ge
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gearsetter.Test", "Gearsetter.Test\Gearsetter.Test.csproj", "{19044F87-4C6D-4926-B5C8-5BB7760DC44C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gearsetter.Test", "Gearsetter.Test\Gearsetter.Test.csproj", "{19044F87-4C6D-4926-B5C8-5BB7760DC44C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{66144F9D-AC38-4F16-B269-A610F8EB7A3F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -18,5 +20,9 @@ Global
|
|||||||
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{19044F87-4C6D-4926-B5C8-5BB7760DC44C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{66144F9D-AC38-4F16-B269-A610F8EB7A3F}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{66144F9D-AC38-4F16-B269-A610F8EB7A3F}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{66144F9D-AC38-4F16-B269-A610F8EB7A3F}.Release|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{66144F9D-AC38-4F16-B269-A610F8EB7A3F}.Release|Any CPU.Build.0 = Debug|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud;
|
using Dalamud;
|
||||||
|
using Dalamud.Game;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using Gearsetter.Model;
|
using Gearsetter.Model;
|
||||||
@ -63,8 +64,8 @@ internal sealed class GameDataHolder
|
|||||||
{ EClassJob.Dancer, x.DNC },
|
{ EClassJob.Dancer, x.DNC },
|
||||||
{ EClassJob.Reaper, x.RPR },
|
{ EClassJob.Reaper, x.RPR },
|
||||||
{ EClassJob.Sage, x.SGE },
|
{ EClassJob.Sage, x.SGE },
|
||||||
{ EClassJob.Viper, x.Unknown42 },
|
{ EClassJob.Viper, x.VPR },
|
||||||
{ EClassJob.Pictomancer, x.Unknown43 }
|
{ EClassJob.Pictomancer, x.PCT }
|
||||||
}
|
}
|
||||||
.Where(y => y.Value)
|
.Where(y => y.Value)
|
||||||
.Select(y => y.Key)
|
.Select(y => y.Key)
|
||||||
|
@ -1,60 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<Version>1.0</Version>
|
||||||
<Version>0.7</Version>
|
|
||||||
<LangVersion>12</LangVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
|
||||||
<OutputPath>dist</OutputPath>
|
<OutputPath>dist</OutputPath>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<DebugType>portable</DebugType>
|
|
||||||
<PathMap Condition="$(SolutionDir) != ''">$(SolutionDir)=X:\</PathMap>
|
|
||||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
|
||||||
<DebugType>portable</DebugType>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<Import Project="..\LLib\LLib.targets"/>
|
||||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
<Import Project="..\LLib\RenameZip.targets"/>
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
|
||||||
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
<ProjectReference Include="..\LLib\LLib.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Dalamud">
|
|
||||||
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ImGui.NET">
|
|
||||||
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Lumina">
|
|
||||||
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Lumina.Excel">
|
|
||||||
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json">
|
|
||||||
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="FFXIVClientStructs">
|
|
||||||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
|
||||||
<Private>false</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin" Condition="'$(Configuration)' == 'Release'">
|
|
||||||
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
|
|
||||||
</Target>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
@ -25,7 +24,7 @@ namespace Gearsetter;
|
|||||||
public sealed class GearsetterPlugin : IDalamudPlugin
|
public sealed class GearsetterPlugin : IDalamudPlugin
|
||||||
{
|
{
|
||||||
private readonly WindowSystem _windowSystem = new(nameof(GearsetterPlugin));
|
private readonly WindowSystem _windowSystem = new(nameof(GearsetterPlugin));
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
private readonly ICommandManager _commandManager;
|
private readonly ICommandManager _commandManager;
|
||||||
private readonly IChatGui _chatGui;
|
private readonly IChatGui _chatGui;
|
||||||
private readonly IDataManager _dataManager;
|
private readonly IDataManager _dataManager;
|
||||||
@ -39,7 +38,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
private readonly IReadOnlyDictionary<byte, DalamudLinkPayload> _linkPayloads;
|
private readonly IReadOnlyDictionary<byte, DalamudLinkPayload> _linkPayloads;
|
||||||
private readonly Dictionary<EClassJob, byte> _classJobToArrayIndex;
|
private readonly Dictionary<EClassJob, byte> _classJobToArrayIndex;
|
||||||
|
|
||||||
public GearsetterPlugin(DalamudPluginInterface pluginInterface, ICommandManager commandManager, IChatGui chatGui,
|
public GearsetterPlugin(IDalamudPluginInterface pluginInterface, ICommandManager commandManager, IChatGui chatGui,
|
||||||
IDataManager dataManager, IPluginLog pluginLog, IClientState clientState)
|
IDataManager dataManager, IPluginLog pluginLog, IClientState clientState)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(dataManager);
|
ArgumentNullException.ThrowIfNull(dataManager);
|
||||||
@ -158,27 +157,27 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
name.Contains("Bozja", StringComparison.OrdinalIgnoreCase))
|
name.Contains("Bozja", StringComparison.OrdinalIgnoreCase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
List<SeString> Handle(string label, int[] spanIds, EEquipSlotCategory category)
|
List<SeString> Handle(string label, RaptureGearsetModule.GearsetItemIndex[] spanIds, EEquipSlotCategory category)
|
||||||
{
|
{
|
||||||
return HandleGearsetItem(label, gearset, spanIds.Select(x => gearset->ItemsSpan[x]).ToArray(),
|
return HandleGearsetItem(label, gearset, spanIds.Select(x => gearset->GetItem(x)).ToArray(),
|
||||||
inventoryItems, category, level);
|
inventoryItems, category, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<List<SeString>> upgrades = new()
|
List<List<SeString>> upgrades = new()
|
||||||
{
|
{
|
||||||
Handle("Main Hand", [0], EEquipSlotCategory.None),
|
Handle("Main Hand", [RaptureGearsetModule.GearsetItemIndex.MainHand], EEquipSlotCategory.None),
|
||||||
HandleOffHand(gearset, inventoryItems, level),
|
HandleOffHand(gearset, inventoryItems, level),
|
||||||
|
|
||||||
Handle("Head", [2], EEquipSlotCategory.Head),
|
Handle("Head", [RaptureGearsetModule.GearsetItemIndex.Head], EEquipSlotCategory.Head),
|
||||||
Handle("Body", [3], EEquipSlotCategory.Body),
|
Handle("Body", [RaptureGearsetModule.GearsetItemIndex.Body], EEquipSlotCategory.Body),
|
||||||
Handle("Hands", [4], EEquipSlotCategory.Hands),
|
Handle("Hands", [RaptureGearsetModule.GearsetItemIndex.Hands], EEquipSlotCategory.Hands),
|
||||||
Handle("Legs", [6], EEquipSlotCategory.Legs),
|
Handle("Legs", [RaptureGearsetModule.GearsetItemIndex.Legs], EEquipSlotCategory.Legs),
|
||||||
Handle("Feet", [7], EEquipSlotCategory.Feet),
|
Handle("Feet", [RaptureGearsetModule.GearsetItemIndex.Feet], EEquipSlotCategory.Feet),
|
||||||
|
|
||||||
Handle("Ears", [8], EEquipSlotCategory.Ears),
|
Handle("Ears", [RaptureGearsetModule.GearsetItemIndex.Ears], EEquipSlotCategory.Ears),
|
||||||
Handle("Neck", [9], EEquipSlotCategory.Neck),
|
Handle("Neck", [RaptureGearsetModule.GearsetItemIndex.Neck], EEquipSlotCategory.Neck),
|
||||||
Handle("Wrists", [10], EEquipSlotCategory.Wrists),
|
Handle("Wrists", [RaptureGearsetModule.GearsetItemIndex.Wrists], EEquipSlotCategory.Wrists),
|
||||||
Handle("Rings", [11, 12], EEquipSlotCategory.Rings),
|
Handle("Rings", [RaptureGearsetModule.GearsetItemIndex.RingLeft, RaptureGearsetModule.GearsetItemIndex.RingRight], EEquipSlotCategory.Rings),
|
||||||
};
|
};
|
||||||
|
|
||||||
List<SeString> flatUpgrades = upgrades.SelectMany(x => x).ToList();
|
List<SeString> flatUpgrades = upgrades.SelectMany(x => x).ToList();
|
||||||
@ -189,8 +188,8 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
new SeStringBuilder()
|
new SeStringBuilder()
|
||||||
.Append("Gearset ")
|
.Append("Gearset ")
|
||||||
.AddUiForeground(1)
|
.AddUiForeground(1)
|
||||||
.Add(_linkPayloads[gearset->ID])
|
.Add(_linkPayloads[gearset->Id])
|
||||||
.Append($"#{gearset->ID + 1}: ")
|
.Append($"#{gearset->Id + 1}: ")
|
||||||
.Append(name)
|
.Append(name)
|
||||||
.Add(RawPayload.LinkTerminator)
|
.Add(RawPayload.LinkTerminator)
|
||||||
.AddUiForegroundOff()
|
.AddUiForegroundOff()
|
||||||
@ -208,7 +207,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
/// the string ends after the name (and not render ANY text on the same line after the name).
|
/// the string ends after the name (and not render ANY text on the same line after the name).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private unsafe string GetGearsetName(RaptureGearsetModule.GearsetEntry* gearset)
|
private unsafe string GetGearsetName(RaptureGearsetModule.GearsetEntry* gearset)
|
||||||
=> Encoding.UTF8.GetString(gearset->Name, 0x2F).Split((char)0)[0];
|
=> gearset->NameString.Split((char)0)[0];
|
||||||
|
|
||||||
private unsafe List<SeString> HandleGearsetItem(string label, RaptureGearsetModule.GearsetEntry* gearset,
|
private unsafe List<SeString> HandleGearsetItem(string label, RaptureGearsetModule.GearsetEntry* gearset,
|
||||||
RaptureGearsetModule.GearsetItem[] gearsetItem,
|
RaptureGearsetModule.GearsetItem[] gearsetItem,
|
||||||
@ -218,11 +217,11 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
EClassJob classJob = (EClassJob)gearset->ClassJob;
|
EClassJob classJob = (EClassJob)gearset->ClassJob;
|
||||||
var itemLists = _gameDataHolder.GetItemLists(classJob);
|
var itemLists = _gameDataHolder.GetItemLists(classJob);
|
||||||
|
|
||||||
if (gearsetItem.Any(x => x.ItemID > 0))
|
if (gearsetItem.Any(x => x.ItemId > 0))
|
||||||
{
|
{
|
||||||
var firstEquippedItem = gearsetItem.First(x => x.ItemID > 0);
|
var firstEquippedItem = gearsetItem.First(x => x.ItemId > 0);
|
||||||
equipSlotCategory = (EEquipSlotCategory)(_dataManager.GetExcelSheet<Item>()!
|
equipSlotCategory = (EEquipSlotCategory)(_dataManager.GetExcelSheet<Item>()!
|
||||||
.GetRow(firstEquippedItem.ItemID % 1_000_000)
|
.GetRow(firstEquippedItem.ItemId % 1_000_000)
|
||||||
?.EquipSlotCategory?.Row ?? 0);
|
?.EquipSlotCategory?.Row ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +233,8 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
BaseItem?[] currentItems = gearsetItem.Select(x => new
|
BaseItem?[] currentItems = gearsetItem.Select(x => new
|
||||||
{
|
{
|
||||||
ItemId = x.ItemID % 1_000_000,
|
ItemId = x.ItemId % 1_000_000,
|
||||||
Hq = x.ItemID > 1_000_000
|
Hq = x.ItemId > 1_000_000
|
||||||
})
|
})
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
@ -264,8 +263,8 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
.Where(x => x is Model.InventoryItem)
|
.Where(x => x is Model.InventoryItem)
|
||||||
.Take(gearsetItem.Length)
|
.Take(gearsetItem.Length)
|
||||||
.ToList();
|
.ToList();
|
||||||
_pluginLog.Debug(
|
//_pluginLog.Debug(
|
||||||
$"{equipSlotCategory}: {string.Join(" ", currentItems.Select(x => $"{x?.ItemId}|{x?.Hq}"))}");
|
// $"{equipSlotCategory}: {string.Join(" ", currentItems.Select(x => $"{x?.ItemId}|{x?.Hq}"))}");
|
||||||
foreach (var currentItem in currentItems)
|
foreach (var currentItem in currentItems)
|
||||||
{
|
{
|
||||||
var foundIndex = bestItems.FindIndex(x =>
|
var foundIndex = bestItems.FindIndex(x =>
|
||||||
@ -288,17 +287,17 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
private unsafe List<SeString> HandleOffHand(RaptureGearsetModule.GearsetEntry* gearset,
|
private unsafe List<SeString> HandleOffHand(RaptureGearsetModule.GearsetEntry* gearset,
|
||||||
Dictionary<(uint ItemId, bool Hq), List<MateriaStats>> inventoryItems, byte? level)
|
Dictionary<(uint ItemId, bool Hq), List<MateriaStats>> inventoryItems, byte? level)
|
||||||
{
|
{
|
||||||
var mainHand = gearset->ItemsSpan[0];
|
var mainHand = gearset->GetItem(RaptureGearsetModule.GearsetItemIndex.MainHand);
|
||||||
if (mainHand.ItemID == 0)
|
if (mainHand.ItemId == 0)
|
||||||
return new List<SeString>();
|
return new List<SeString>();
|
||||||
|
|
||||||
// if it's a twohanded weapon, ignore it
|
// if it's a twohanded weapon, ignore it
|
||||||
EEquipSlotCategory equipSlotCategory =
|
EEquipSlotCategory equipSlotCategory =
|
||||||
(EEquipSlotCategory)(_dataManager.GetExcelSheet<Item>()!.GetRow(mainHand.ItemID % 1_000_000)?.RowId ?? 0);
|
(EEquipSlotCategory)(_dataManager.GetExcelSheet<Item>()!.GetRow(mainHand.ItemId % 1_000_000)?.RowId ?? 0);
|
||||||
if (equipSlotCategory != EEquipSlotCategory.OneHandedMainHand)
|
if (equipSlotCategory != EEquipSlotCategory.OneHandedMainHand)
|
||||||
return new List<SeString>();
|
return new List<SeString>();
|
||||||
|
|
||||||
return HandleGearsetItem("Off Hand", gearset, [gearset->ItemsSpan[1]], inventoryItems,
|
return HandleGearsetItem("Off Hand", gearset, [gearset->GetItem(RaptureGearsetModule.GearsetItemIndex.OffHand)], inventoryItems,
|
||||||
EEquipSlotCategory.Shield, level);
|
EEquipSlotCategory.Shield, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,29 +314,27 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
for (int i = 0; i < container->Size; ++i)
|
for (int i = 0; i < container->Size; ++i)
|
||||||
{
|
{
|
||||||
var item = container->GetInventorySlot(i);
|
var item = container->GetInventorySlot(i);
|
||||||
if (item != null && item->ItemID != 0)
|
if (item != null && item->ItemId != 0)
|
||||||
{
|
{
|
||||||
var key = (item->ItemID, item->Flags.HasFlag(InventoryItem.ItemFlags.HQ));
|
var key = (item->ItemId, item->Flags.HasFlag(InventoryItem.ItemFlags.HighQuality));
|
||||||
if (!inventoryItems.TryGetValue(key, out var list))
|
if (!inventoryItems.TryGetValue(key, out var list))
|
||||||
{
|
{
|
||||||
list = new List<MateriaStats>();
|
list = new List<MateriaStats>();
|
||||||
inventoryItems[key] = list;
|
inventoryItems[key] = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME item->GetMateriaCount is broken on API 10, so this seems to be somewhat slow
|
||||||
byte materiaCount = item->GetMateriaCount();
|
List<(MateriaStat, byte)> materias = new();
|
||||||
var materias = Enumerable.Range(0, materiaCount)
|
for (int slot = 0; slot < 5; ++slot)
|
||||||
.Select<int, (MateriaStat, byte)?>(slot =>
|
|
||||||
{
|
{
|
||||||
if (_gameDataHolder.Materias.TryGetValue(item->GetMateriaId((byte)slot),
|
var materiaId = item->Materia[slot];
|
||||||
out MateriaStat? value))
|
if (materiaId == 0)
|
||||||
return (value, item->GetMateriaGrade((byte)slot));
|
break;
|
||||||
else
|
|
||||||
return null;
|
if (_gameDataHolder.Materias.TryGetValue(materiaId, out MateriaStat? value))
|
||||||
})
|
materias.Add((value, item->MateriaGrades[slot]));
|
||||||
.Where(x => x != null)
|
}
|
||||||
.Select(x => x!.Value)
|
|
||||||
.ToList();
|
|
||||||
list.Add(new MateriaStats(materias));
|
list.Add(new MateriaStats(materias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,7 +349,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin
|
|||||||
if (playerState == null)
|
if (playerState == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (byte)playerState->ClassJobLevelArray[_classJobToArrayIndex[classJob]];
|
return (byte)playerState->ClassJobLevels[_classJobToArrayIndex[classJob]];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin;
|
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using LLib.ImGui;
|
||||||
|
|
||||||
namespace Gearsetter.Windows;
|
namespace Gearsetter.Windows;
|
||||||
|
|
||||||
internal sealed class ConfigWindow : Window
|
internal sealed class ConfigWindow : LWindow
|
||||||
{
|
{
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
private readonly Configuration _configuration;
|
private readonly Configuration _configuration;
|
||||||
|
|
||||||
public ConfigWindow(DalamudPluginInterface pluginInterface, Configuration configuration)
|
public ConfigWindow(IDalamudPluginInterface pluginInterface, Configuration configuration)
|
||||||
: base("Gearsetter - Config###GearsetterConfig", ImGuiWindowFlags.AlwaysAutoResize)
|
: base("Gearsetter - Config###GearsetterConfig", ImGuiWindowFlags.AlwaysAutoResize)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
|
@ -6,15 +6,15 @@ using System.Numerics;
|
|||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Windowing;
|
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Gearsetter.GameData;
|
using Gearsetter.GameData;
|
||||||
using Gearsetter.Model;
|
using Gearsetter.Model;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using LLib.ImGui;
|
||||||
|
|
||||||
namespace Gearsetter.Windows;
|
namespace Gearsetter.Windows;
|
||||||
|
|
||||||
internal sealed class EquipmentBrowserWindow : Window
|
internal sealed class EquipmentBrowserWindow : LWindow
|
||||||
{
|
{
|
||||||
private readonly GearsetterPlugin _plugin;
|
private readonly GearsetterPlugin _plugin;
|
||||||
private readonly GameDataHolder _dataHolder;
|
private readonly GameDataHolder _dataHolder;
|
||||||
|
@ -4,9 +4,83 @@
|
|||||||
"net8.0-windows7.0": {
|
"net8.0-windows7.0": {
|
||||||
"DalamudPackager": {
|
"DalamudPackager": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.1.12, )",
|
"requested": "[2.1.13, )",
|
||||||
"resolved": "2.1.12",
|
"resolved": "2.1.13",
|
||||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
|
||||||
|
},
|
||||||
|
"DotNet.ReproducibleBuilds": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.1.1, )",
|
||||||
|
"resolved": "1.1.1",
|
||||||
|
"contentHash": "+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.SourceLink.AzureRepos.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.Bitbucket.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.GitHub": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.GitLab": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.Gitea": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[8.0.0, )",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "KOBodmDnlWGIqZt2hT47Q69TIoGhIApDVLCyyj9TT5ct8ju16AbHYcB4XeknoHX562wO1pMS/1DfBIZK+V+sxg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Build.Tasks.Git": "8.0.0",
|
||||||
|
"Microsoft.SourceLink.Common": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Build.Tasks.Git": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.AzureRepos.Git": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.1",
|
||||||
|
"contentHash": "qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Build.Tasks.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.Common": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.Bitbucket.Git": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.1",
|
||||||
|
"contentHash": "cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Build.Tasks.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.Common": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.GitHub": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.1",
|
||||||
|
"contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Build.Tasks.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.Common": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.SourceLink.GitLab": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.1",
|
||||||
|
"contentHash": "tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Build.Tasks.Git": "1.1.1",
|
||||||
|
"Microsoft.SourceLink.Common": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"llib": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"DalamudPackager": "[2.1.13, )"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
LLib
Submodule
1
LLib
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 7027d291efbbff6a55944dd521d3907210ddecbe
|
Loading…
Reference in New Issue
Block a user