Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
09fa5a0b9b | |||
a46b394652 | |||
a40ad24b53 |
2
LLib
2
LLib
@ -1 +1 @@
|
|||||||
Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a
|
Subproject commit 2d214b133847130d3382c0baaff26b32332a8f2d
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project>
|
<Project>
|
||||||
<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
|
<Target Name="PackagePluginDebug" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
|
||||||
<DalamudPackager
|
<DalamudPackager
|
||||||
ProjectDir="$(ProjectDir)"
|
ProjectDir="$(ProjectDir)"
|
||||||
OutputPath="$(OutputPath)"
|
OutputPath="$(OutputPath)"
|
||||||
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.Sheets;
|
||||||
|
|
||||||
namespace Squadronista.Solver;
|
namespace Squadronista.Solver;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ internal sealed class SquadronMember : IEquatable<SquadronMember>
|
|||||||
public required uint ClassJob { get; init; }
|
public required uint ClassJob { get; init; }
|
||||||
|
|
||||||
public required Race Race { get; init; }
|
public required Race Race { get; init; }
|
||||||
public required uint EnlistmentTimestamp { get; init; }
|
public required int EnlistmentTimestamp { get; init; }
|
||||||
public uint Experience { get; init; }
|
public uint Experience { get; init; }
|
||||||
public int PhysicalAbility => GrowthParams[Level].PhysicalAbility;
|
public int PhysicalAbility => GrowthParams[Level].PhysicalAbility;
|
||||||
public int MentalAbility => GrowthParams[Level].MentalAbility;
|
public int MentalAbility => GrowthParams[Level].MentalAbility;
|
||||||
@ -29,13 +29,13 @@ internal sealed class SquadronMember : IEquatable<SquadronMember>
|
|||||||
public SquadronMember InitializeFrom(IDataManager dataManager)
|
public SquadronMember InitializeFrom(IDataManager dataManager)
|
||||||
{
|
{
|
||||||
List<(byte, byte, byte)> growthAsList = new();
|
List<(byte, byte, byte)> growthAsList = new();
|
||||||
var growth = dataManager.GetExcelSheet<GcArmyMemberGrow>()!.Single(x => x.ClassJob.Row == ClassJob);
|
var growth = dataManager.GetExcelSheet<GcArmyMemberGrow>().Single(x => x.ClassJob.RowId == ClassJob);
|
||||||
for (int i = 0; i <= 59; ++i)
|
foreach (GcArmyMemberGrow.MemberParamsStruct memberParams in growth.MemberParams)
|
||||||
{
|
{
|
||||||
growthAsList.Add((growth.Physical[i], growth.Mental[i], growth.Tactical[i]));
|
growthAsList.Add((memberParams.Physical, memberParams.Mental, memberParams.Tactical));
|
||||||
}
|
}
|
||||||
|
|
||||||
growthAsList.Add((growth.Unknown123, growth.Unknown184, growth.Unknown245));
|
growthAsList.Add((growth.Unknown1, growth.Unknown2, growth.Unknown3));
|
||||||
GrowthParams = growthAsList;
|
GrowthParams = growthAsList;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ internal sealed class SquadronSolver
|
|||||||
_newTrainings = _calculatedTrainings.Keys.ToList();
|
_newTrainings = _calculatedTrainings.Keys.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<CalculationResult> SolveFor(SquadronMission mission, int requiredMatchingStats)
|
public IEnumerable<CalculationResult> SolveFor(SquadronMission mission, Attributes missionAttributes, int requiredMatchingStats)
|
||||||
{
|
{
|
||||||
int minPhysical = mission.CurrentAttributes!.PhysicalAbility;
|
int minPhysical = missionAttributes.PhysicalAbility;
|
||||||
int minMental = mission.CurrentAttributes!.MentalAbility;
|
int minMental = missionAttributes.MentalAbility;
|
||||||
int minTactical = mission.CurrentAttributes!.TacticalAbility;
|
int minTactical = missionAttributes.TacticalAbility;
|
||||||
|
|
||||||
bool foundWithoutTraining = false;
|
bool foundWithoutTraining = false;
|
||||||
List<CalculationResult> intermediates = CalculateForAllMemberCombinations(mission.Level, _state.Bonus);
|
List<CalculationResult> intermediates = CalculateForAllMemberCombinations(mission.Level, _state.Bonus);
|
||||||
|
@ -5,15 +5,20 @@ namespace Squadronista.Solver;
|
|||||||
|
|
||||||
internal sealed class SquadronState
|
internal sealed class SquadronState
|
||||||
{
|
{
|
||||||
private readonly Dictionary<SquadronMission, Task<SquadronSolver.CalculationResults>> _calculationResults = new();
|
private readonly Dictionary<(int id, Attributes attributes), Task<SquadronSolver.CalculationResults>> _calculationResults = new();
|
||||||
|
|
||||||
public required IReadOnlyList<SquadronMember> Members { get; init; }
|
public required IReadOnlyList<SquadronMember> Members { get; init; }
|
||||||
public required BonusAttributes Bonus { get; set; }
|
public required BonusAttributes Bonus { get; set; }
|
||||||
public required uint CurrentTraining { get; set; }
|
public required uint CurrentTraining { get; set; }
|
||||||
|
|
||||||
public Task<SquadronSolver.CalculationResults>? GetCalculation(SquadronMission mission)
|
public Task<SquadronSolver.CalculationResults>? GetCalculation(SquadronMission mission, Attributes? attributes)
|
||||||
=> _calculationResults.TryGetValue(mission, out var task) ? task : null;
|
{
|
||||||
|
if (attributes == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
public void SetCalculation(SquadronMission mission, Task<SquadronSolver.CalculationResults> task)
|
return _calculationResults.GetValueOrDefault((mission.Id, attributes));
|
||||||
=> _calculationResults[mission] = task;
|
}
|
||||||
|
|
||||||
|
public void SetCalculation(SquadronMission mission, Attributes attributes, Task<SquadronSolver.CalculationResults> task)
|
||||||
|
=> _calculationResults[(mission.Id, attributes)] = task;
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,4 @@ internal sealed class SquadronMission
|
|||||||
public required bool IsFlaggedMission { get; init; }
|
public required bool IsFlaggedMission { get; init; }
|
||||||
|
|
||||||
public required IReadOnlyList<Attributes> PossibleAttributes { get; init; }
|
public required IReadOnlyList<Attributes> PossibleAttributes { get; init; }
|
||||||
public Attributes? CurrentAttributes { get; set; }
|
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Dalamud.NET.Sdk/11.0.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<Version>5.0</Version>
|
||||||
<Version>3.0</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>
|
||||||
<ProjectReference Include="..\LLib\LLib.csproj" />
|
<ProjectReference Include="..\LLib\LLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
|
||||||
</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>
|
||||||
|
@ -9,7 +9,7 @@ using Dalamud.Plugin;
|
|||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.Sheets;
|
||||||
using Squadronista.Solver;
|
using Squadronista.Solver;
|
||||||
using Squadronista.Windows;
|
using Squadronista.Windows;
|
||||||
using Race = Squadronista.Solver.Race;
|
using Race = Squadronista.Solver.Race;
|
||||||
@ -20,7 +20,7 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
{
|
{
|
||||||
private readonly WindowSystem _windowSystem = new(nameof(SquadronistaPlugin));
|
private readonly WindowSystem _windowSystem = new(nameof(SquadronistaPlugin));
|
||||||
|
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
private readonly IClientState _clientState;
|
private readonly IClientState _clientState;
|
||||||
private readonly IPluginLog _pluginLog;
|
private readonly IPluginLog _pluginLog;
|
||||||
private readonly IDataManager _dataManager;
|
private readonly IDataManager _dataManager;
|
||||||
@ -28,7 +28,7 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
private readonly IReadOnlyList<SquadronMission> _allMissions;
|
private readonly IReadOnlyList<SquadronMission> _allMissions;
|
||||||
private readonly MainWindow _mainWindow;
|
private readonly MainWindow _mainWindow;
|
||||||
|
|
||||||
public SquadronistaPlugin(DalamudPluginInterface pluginInterface, IClientState clientState, IPluginLog pluginLog,
|
public SquadronistaPlugin(IDalamudPluginInterface pluginInterface, IClientState clientState, IPluginLog pluginLog,
|
||||||
IDataManager dataManager, IAddonLifecycle addonLifecycle, IGameGui gameGui)
|
IDataManager dataManager, IAddonLifecycle addonLifecycle, IGameGui gameGui)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(dataManager);
|
ArgumentNullException.ThrowIfNull(dataManager);
|
||||||
@ -39,7 +39,7 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
_dataManager = dataManager;
|
_dataManager = dataManager;
|
||||||
_addonLifecycle = addonLifecycle;
|
_addonLifecycle = addonLifecycle;
|
||||||
|
|
||||||
_allMissions = dataManager.GetExcelSheet<GcArmyExpedition>()!
|
_allMissions = dataManager.GetExcelSheet<GcArmyExpedition>()
|
||||||
.Where(x => x.RowId > 0)
|
.Where(x => x.RowId > 0)
|
||||||
.Select(x => new SquadronMission
|
.Select(x => new SquadronMission
|
||||||
{
|
{
|
||||||
@ -49,12 +49,12 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
// 13 and 14 seems to be a duplicate
|
// 13 and 14 seems to be a duplicate
|
||||||
IsFlaggedMission = x.RowId is 7 or 14 or 15 or 34,
|
IsFlaggedMission = x.RowId is 7 or 14 or 15 or 34,
|
||||||
PossibleAttributes = Enumerable.Range(0, x.RequiredPhysical.Length)
|
PossibleAttributes = Enumerable.Range(0, x.ExpeditionParams.Count)
|
||||||
.Select(i => new Attributes
|
.Select(i => new Attributes
|
||||||
{
|
{
|
||||||
PhysicalAbility = x.RequiredPhysical[i],
|
PhysicalAbility = x.ExpeditionParams[i].RequiredPhysical,
|
||||||
MentalAbility = x.RequiredMental[i],
|
MentalAbility = x.ExpeditionParams[i].RequiredMental,
|
||||||
TacticalAbility = x.RequiredTactical[i],
|
TacticalAbility = x.ExpeditionParams[i].RequiredTactical,
|
||||||
})
|
})
|
||||||
.ToList()
|
.ToList()
|
||||||
.AsReadOnly(),
|
.AsReadOnly(),
|
||||||
@ -62,7 +62,7 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
.ToList()
|
.ToList()
|
||||||
.AsReadOnly();
|
.AsReadOnly();
|
||||||
|
|
||||||
Trainings = dataManager.GetExcelSheet<GcArmyTraining>()!
|
Trainings = dataManager.GetExcelSheet<GcArmyTraining>()
|
||||||
.Where(x => x.RowId > 0 && x.RowId != 7)
|
.Where(x => x.RowId > 0 && x.RowId != 7)
|
||||||
.Select(x => new Training
|
.Select(x => new Training
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
return new SquadronMember
|
return new SquadronMember
|
||||||
{
|
{
|
||||||
Name = _dataManager.GetExcelSheet<ENpcResident>()!.GetRow(member->ENpcResidentId)!
|
Name = _dataManager.GetExcelSheet<ENpcResident>().GetRow(member->ENpcResidentId)
|
||||||
.Singular.ToString(),
|
.Singular.ToString(),
|
||||||
Level = member->Level,
|
Level = member->Level,
|
||||||
ClassJob = member->ClassJob,
|
ClassJob = member->ClassJob,
|
||||||
@ -194,10 +194,10 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
private void ResetCharacterSpecificData()
|
private void ResetCharacterSpecificData()
|
||||||
{
|
{
|
||||||
SquadronState = null;
|
SquadronState = null;
|
||||||
foreach (var mission in _allMissions)
|
|
||||||
mission.CurrentAttributes = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ResetCharacterSpecificData(int type, int code) => ResetCharacterSpecificData();
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_mainWindow.Dispose();
|
_mainWindow.Dispose();
|
||||||
@ -208,8 +208,8 @@ public sealed class SquadronistaPlugin : IDalamudPlugin
|
|||||||
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 0xB18)]
|
[StructLayout(LayoutKind.Explicit, Size = 0xB28)]
|
||||||
private struct ExtendedGcArmyData {
|
private struct ExtendedGcArmyData {
|
||||||
[FieldOffset(0x284)] public ushort CurrentTraining;
|
[FieldOffset(0x2C4)] public ushort CurrentTraining;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,9 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
var selectedMission = _plugin.AvailableMissions[agentExpedition->SelectedRow];
|
var selectedMission = _plugin.AvailableMissions[agentExpedition->SelectedRow];
|
||||||
if (selectedMission.CurrentAttributes != null)
|
var missionAttributes = FindCurrentAttributeIndex(agentExpedition, selectedMission);
|
||||||
ImGui.Text($"{selectedMission.Name} ({selectedMission.CurrentAttributes})");
|
if (missionAttributes != null)
|
||||||
|
ImGui.Text($"{selectedMission.Name} ({missionAttributes})");
|
||||||
else
|
else
|
||||||
ImGui.Text($"{selectedMission.Name}");
|
ImGui.Text($"{selectedMission.Name}");
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var task = state.GetCalculation(selectedMission);
|
var task = state.GetCalculation(selectedMission, missionAttributes);
|
||||||
if (task != null)
|
if (task != null)
|
||||||
{
|
{
|
||||||
if (task.IsCompletedSuccessfully)
|
if (task.IsCompletedSuccessfully)
|
||||||
@ -175,21 +176,21 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
ImGui.Text("Final Stats:");
|
ImGui.Text("Final Stats:");
|
||||||
ImGui.SameLine(0);
|
ImGui.SameLine(0);
|
||||||
ImGui.TextColored(
|
ImGui.TextColored(
|
||||||
result.PhysicalAbility >= selectedMission.CurrentAttributes!.PhysicalAbility
|
result.PhysicalAbility >= missionAttributes!.PhysicalAbility
|
||||||
? ImGuiColors.HealerGreen
|
? ImGuiColors.HealerGreen
|
||||||
: ImGuiColors.DalamudYellow, $"{result.PhysicalAbility}");
|
: ImGuiColors.DalamudYellow, $"{result.PhysicalAbility}");
|
||||||
ImGui.SameLine(0);
|
ImGui.SameLine(0);
|
||||||
ImGui.Text("/");
|
ImGui.Text("/");
|
||||||
ImGui.SameLine(0);
|
ImGui.SameLine(0);
|
||||||
ImGui.TextColored(
|
ImGui.TextColored(
|
||||||
result.MentalAbility >= selectedMission.CurrentAttributes!.MentalAbility
|
result.MentalAbility >= missionAttributes.MentalAbility
|
||||||
? ImGuiColors.HealerGreen
|
? ImGuiColors.HealerGreen
|
||||||
: ImGuiColors.DalamudYellow, $"{result.MentalAbility}");
|
: ImGuiColors.DalamudYellow, $"{result.MentalAbility}");
|
||||||
ImGui.SameLine(0);
|
ImGui.SameLine(0);
|
||||||
ImGui.Text("/");
|
ImGui.Text("/");
|
||||||
ImGui.SameLine(0);
|
ImGui.SameLine(0);
|
||||||
ImGui.TextColored(
|
ImGui.TextColored(
|
||||||
result.TacticalAbility >= selectedMission.CurrentAttributes!.TacticalAbility
|
result.TacticalAbility >= missionAttributes.TacticalAbility
|
||||||
? ImGuiColors.HealerGreen
|
? ImGuiColors.HealerGreen
|
||||||
: ImGuiColors.DalamudYellow, $"{result.TacticalAbility}");
|
: ImGuiColors.DalamudYellow, $"{result.TacticalAbility}");
|
||||||
|
|
||||||
@ -198,7 +199,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudRed, $"No combination of members/trainings can achieve\n{(selectedMission.IsFlaggedMission ? "all" : "2 out of 3")} attributes for {selectedMission.CurrentAttributes}.");
|
ImGui.TextColored(ImGuiColors.DalamudRed, $"No combination of members/trainings can achieve\n{(selectedMission.IsFlaggedMission ? "all" : "2 out of 3")} attributes for {missionAttributes}.");
|
||||||
ImGui.Text("Level the squadron further and check again.");
|
ImGui.Text("Level the squadron further and check again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,16 +210,13 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (selectedMission.CurrentAttributes == null)
|
if (missionAttributes == null)
|
||||||
FindCurrentAttributeIndex(agentExpedition, selectedMission);
|
|
||||||
|
|
||||||
if (selectedMission.CurrentAttributes == null)
|
|
||||||
{
|
{
|
||||||
ImGui.Text("No matching mission found...?");
|
ImGui.Text("No matching mission found...?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.SetCalculation(selectedMission, Task.Factory.StartNew(() =>
|
state.SetCalculation(selectedMission, missionAttributes, Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
var solver = new SquadronSolver(_pluginLog, state, _plugin.Trainings);
|
var solver = new SquadronSolver(_pluginLog, state, _plugin.Trainings);
|
||||||
|
|
||||||
@ -230,7 +228,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
if (selectedMission.IsFlaggedMission)
|
if (selectedMission.IsFlaggedMission)
|
||||||
{
|
{
|
||||||
// only relevant when all 3 stats match
|
// only relevant when all 3 stats match
|
||||||
var perfectMatches = solver.SolveFor(selectedMission, 3).ToList();
|
var perfectMatches = solver.SolveFor(selectedMission, missionAttributes, 3).ToList();
|
||||||
if (perfectMatches.Count > 0)
|
if (perfectMatches.Count > 0)
|
||||||
{
|
{
|
||||||
results.Results.Add(perfectMatches
|
results.Results.Add(perfectMatches
|
||||||
@ -241,7 +239,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var matches = solver.SolveFor(selectedMission, 2)
|
var matches = solver.SolveFor(selectedMission, missionAttributes, 2)
|
||||||
.OrderByDescending(x => x.MatchingAttributes)
|
.OrderByDescending(x => x.MatchingAttributes)
|
||||||
.ThenBy(x => x.Trainings.Count)
|
.ThenBy(x => x.Trainings.Count)
|
||||||
.ThenBy(x => x.Members.Sum(y => y.Level))
|
.ThenBy(x => x.Members.Sum(y => y.Level))
|
||||||
@ -284,7 +282,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void FindCurrentAttributeIndex(AgentGcArmyExpedition* agentExpedition,
|
private unsafe Attributes? FindCurrentAttributeIndex(AgentGcArmyExpedition* agentExpedition,
|
||||||
SquadronMission selectedMission)
|
SquadronMission selectedMission)
|
||||||
{
|
{
|
||||||
AddonGcArmyExpedition* addonExpedition =
|
AddonGcArmyExpedition* addonExpedition =
|
||||||
@ -292,11 +290,11 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
|
|
||||||
// should never happen
|
// should never happen
|
||||||
if (addonExpedition == null || !LAddon.IsAddonReady(&addonExpedition->AtkUnitBase))
|
if (addonExpedition == null || !LAddon.IsAddonReady(&addonExpedition->AtkUnitBase))
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
AtkComponentBase* requiredAttribComponent = addonExpedition->RequiredAttributesComponentNode;
|
AtkComponentBase* requiredAttribComponent = addonExpedition->RequiredAttributesComponentNode;
|
||||||
if (requiredAttribComponent == null)
|
if (requiredAttribComponent == null)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
AtkComponentNode* physicalComponent = GetNodeById<AtkComponentNode>(requiredAttribComponent->UldManager, 2);
|
AtkComponentNode* physicalComponent = GetNodeById<AtkComponentNode>(requiredAttribComponent->UldManager, 2);
|
||||||
AtkComponentNode* mentalComponent = GetNodeById<AtkComponentNode>(requiredAttribComponent->UldManager, 4);
|
AtkComponentNode* mentalComponent = GetNodeById<AtkComponentNode>(requiredAttribComponent->UldManager, 4);
|
||||||
@ -304,7 +302,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
if (physicalComponent == null || mentalComponent == null || tacticalComponent == null)
|
if (physicalComponent == null || mentalComponent == null || tacticalComponent == null)
|
||||||
{
|
{
|
||||||
_pluginLog.Warning("Could not parse required attribute children");
|
_pluginLog.Warning("Could not parse required attribute children");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtkTextNode* physicalText = GetNodeById<AtkTextNode>(physicalComponent->Component->UldManager, 2);
|
AtkTextNode* physicalText = GetNodeById<AtkTextNode>(physicalComponent->Component->UldManager, 2);
|
||||||
@ -313,7 +311,7 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
if (physicalText == null || mentalText == null || tacticalText == null)
|
if (physicalText == null || mentalText == null || tacticalText == null)
|
||||||
{
|
{
|
||||||
_pluginLog.Warning("Could not parse required attribute texts");
|
_pluginLog.Warning("Could not parse required attribute texts");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int physical = int.Parse(physicalText->NodeText.ToString(), CultureInfo.InvariantCulture);
|
int physical = int.Parse(physicalText->NodeText.ToString(), CultureInfo.InvariantCulture);
|
||||||
@ -327,9 +325,12 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
TacticalAbility = tactical,
|
TacticalAbility = tactical,
|
||||||
};
|
};
|
||||||
if (selectedMission.PossibleAttributes.Contains(newAttributes))
|
if (selectedMission.PossibleAttributes.Contains(newAttributes))
|
||||||
selectedMission.CurrentAttributes = newAttributes;
|
return newAttributes;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_pluginLog.Warning($"Wrong attributes for {selectedMission.Name}: {newAttributes}");
|
_pluginLog.Warning($"Wrong attributes for {selectedMission.Name}: {newAttributes}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe T* GetNodeById<T>(AtkUldManager uldManager, uint nodeId, NodeType? type = null)
|
private static unsafe T* GetNodeById<T>(AtkUldManager uldManager, uint nodeId, NodeType? type = null)
|
||||||
@ -338,8 +339,8 @@ internal sealed class MainWindow : LWindow, IDisposable
|
|||||||
for (var i = 0; i < uldManager.NodeListCount; i++)
|
for (var i = 0; i < uldManager.NodeListCount; i++)
|
||||||
{
|
{
|
||||||
var n = uldManager.NodeList[i];
|
var n = uldManager.NodeList[i];
|
||||||
if (n->NodeID != nodeId || type != null && n->Type != type.Value) continue;
|
if (n->NodeId != nodeId || type != null && n->Type != type.Value) continue;
|
||||||
if (!n->IsVisible) continue;
|
if (!n->IsVisible()) continue;
|
||||||
return (T*)n;
|
return (T*)n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,83 @@
|
|||||||
"net8.0-windows7.0": {
|
"net8.0-windows7.0": {
|
||||||
"DalamudPackager": {
|
"DalamudPackager": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.1.12, )",
|
"requested": "[11.0.0, )",
|
||||||
"resolved": "2.1.12",
|
"resolved": "11.0.0",
|
||||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
|
||||||
|
},
|
||||||
|
"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": {
|
"llib": {
|
||||||
"type": "Project"
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"DalamudPackager": "[11.0.0, )"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user