master v3.0
Liza 2024-03-23 11:16:49 +01:00
parent cf0e72ba4d
commit 2228338a33
Signed by: liza
GPG Key ID: 7199F8D727D55F67
11 changed files with 1044 additions and 21 deletions

2
LLib

@ -1 +1 @@
Subproject commit 865a6080319f8ccbcd5fd5b0004404822b6e60d4
Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a

1017
Squadronista/.editorconfig Normal file

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ internal sealed class BonusAttributes : Attributes, IEquatable<BonusAttributes>
}
}
private void Fix(ref int mainStat, int mainGained, ref int otherStatA, int otherGainedA, ref int otherStatB, int otherGainedB)
private static void Fix(ref int mainStat, int mainGained, ref int otherStatA, int otherGainedA, ref int otherStatB, int otherGainedB)
{
if (mainStat >= 0 || mainGained > 0)
return;

View File

@ -3,7 +3,7 @@
namespace Squadronista.Solver;
[Flags]
public enum SquadronMemberUiFlags : int
public enum SquadronMemberUiInfo : int
{
Unknown1 = 1,
IsPartOfMission = 2,

View File

@ -78,7 +78,7 @@ internal sealed class SquadronSolver
}
}
private int CountStatMatches(CalculationResult x, int minPhysical, int minMental, int minTactical)
private static int CountStatMatches(CalculationResult x, int minPhysical, int minMental, int minTactical)
{
return (x.PhysicalAbility >= minPhysical ? 1 : 0) +
(x.MentalAbility >= minMental ? 1 : 0) +

View File

@ -12,7 +12,7 @@ public class Training
public int CappedMentalGained => CalculateCapped(MentalGained, PhysicalGained, TacticalGained);
public int CappedTacticalGained => CalculateCapped(TacticalGained, PhysicalGained, MentalGained);
private int CalculateCapped(int mainStat, int otherA, int otherB)
private static int CalculateCapped(int mainStat, int otherA, int otherB)
{
if (mainStat > 0)
return mainStat;

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.0</Version>
<LangVersion>11.0</LangVersion>
<TargetFramework>net8.0-windows</TargetFramework>
<Version>3.0</Version>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Dalamud.Game.Addon.Lifecycle;
@ -15,7 +16,7 @@ using Race = Squadronista.Solver.Race;
namespace Squadronista;
public class SquadronistaPlugin : IDalamudPlugin
public sealed class SquadronistaPlugin : IDalamudPlugin
{
private readonly WindowSystem _windowSystem = new(nameof(SquadronistaPlugin));
@ -30,6 +31,8 @@ public class SquadronistaPlugin : IDalamudPlugin
public SquadronistaPlugin(DalamudPluginInterface pluginInterface, IClientState clientState, IPluginLog pluginLog,
IDataManager dataManager, IAddonLifecycle addonLifecycle, IGameGui gameGui)
{
ArgumentNullException.ThrowIfNull(dataManager);
_pluginInterface = pluginInterface;
_clientState = clientState;
_pluginLog = pluginLog;

View File

@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using Dalamud.Game.Text;
@ -12,15 +15,15 @@ using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
using LLib;
using LLib.GameUI;
using LLib.ImGui;
using Squadronista.Solver;
using Task = System.Threading.Tasks.Task;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
namespace Squadronista.Windows;
internal sealed class MainWindow : LImGui.LWindow, IDisposable
internal sealed class MainWindow : LWindow, IDisposable
{
private readonly SquadronistaPlugin _plugin;
private readonly IPluginLog _pluginLog;
@ -92,7 +95,7 @@ internal sealed class MainWindow : LImGui.LWindow, IDisposable
var agentExpedition = AgentGcArmyExpedition.Instance();
if (agentExpedition == null || agentExpedition->SelectedRow >= _plugin.AvailableMissions.Count)
{
ImGui.Text($"Could not find mission... ({(agentExpedition != null ? agentExpedition->SelectedRow.ToString() : "null")}; {_plugin.AvailableMissions.Count})");
ImGui.Text($"Could not find mission... ({(agentExpedition != null ? agentExpedition->SelectedRow.ToString(CultureInfo.InvariantCulture) : "null")}; {_plugin.AvailableMissions.Count})");
return;
}
@ -128,7 +131,7 @@ internal sealed class MainWindow : LImGui.LWindow, IDisposable
{
var atkValues = addonMemberList->AtkValues;
activeMembers = Enumerable.Range(0, (int)atkValues[4].UInt)
.Where(i => ((SquadronMemberUiFlags)atkValues[5 + i * 15].Int).HasFlag(SquadronMemberUiFlags.IsPartOfMission))
.Where(i => ((SquadronMemberUiInfo)atkValues[5 + i * 15].Int).HasFlag(SquadronMemberUiInfo.IsPartOfMission))
.Select(i => atkValues[6 + i * 15].ReadAtkString())
.Where(x => !string.IsNullOrEmpty(x))
.Cast<string>()
@ -268,7 +271,7 @@ internal sealed class MainWindow : LImGui.LWindow, IDisposable
if (matches.Count > 0)
{
var suboptimalMatch = matches.First();
if (suboptimalMatch.Trainings.Count == 0 && perfectMatchesWithTraining.Any())
if (suboptimalMatch.Trainings.Count == 0 && perfectMatchesWithTraining.Count != 0)
results.Results.Insert(results.Results.Count - 1, suboptimalMatch);
else
results.Results.Add(suboptimalMatch);
@ -276,7 +279,7 @@ internal sealed class MainWindow : LImGui.LWindow, IDisposable
}
return results;
}));
}, default, TaskCreationOptions.LongRunning, TaskScheduler.Default));
}
}
}
@ -313,9 +316,9 @@ internal sealed class MainWindow : LImGui.LWindow, IDisposable
return;
}
int physical = int.Parse(physicalText->NodeText.ToString());
int mental = int.Parse(mentalText->NodeText.ToString());
int tactical = int.Parse(tacticalText->NodeText.ToString());
int physical = int.Parse(physicalText->NodeText.ToString(), CultureInfo.InvariantCulture);
int mental = int.Parse(mentalText->NodeText.ToString(), CultureInfo.InvariantCulture);
int tactical = int.Parse(tacticalText->NodeText.ToString(), CultureInfo.InvariantCulture);
var newAttributes = new Attributes
{

View File

@ -1,7 +1,7 @@
{
"version": 1,
"dependencies": {
"net7.0-windows7.0": {
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.12, )",

View File

@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.0",
"version": "8.0.0",
"rollForward": "latestMinor",
"allowPrerelease": false
}