Code formatting fixes
This commit is contained in:
@@ -98,7 +98,7 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.Stop();
|
s.Stop();
|
||||||
Console.WriteLine($"{s.Elapsed.TotalMilliseconds/60:0.00}ms/cycle");
|
Console.WriteLine($"{s.Elapsed.TotalMilliseconds / 60:0.00}ms/cycle");
|
||||||
Console.WriteLine(string.Join(',', q));
|
Console.WriteLine(string.Join(',', q));
|
||||||
q.Sort();
|
q.Sort();
|
||||||
Console.WriteLine($"Min: {Quartile(q, 0)}, Max: {Quartile(q, 4)}, Avg: {Quartile(q, 2)}, Q1: {Quartile(q, 1)}, Q3: {Quartile(q, 3)}");
|
Console.WriteLine($"Min: {Quartile(q, 0)}, Max: {Quartile(q, 4)}, Avg: {Quartile(q, 2)}, Q1: {Quartile(q, 1)}, Q3: {Quartile(q, 3)}");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Lumina.Excel.GeneratedSheets;
|
|
||||||
using Lumina.Excel;
|
|
||||||
using Dalamud;
|
using Dalamud;
|
||||||
|
using Lumina.Excel;
|
||||||
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
|
||||||
namespace Craftimizer.Plugin;
|
namespace Craftimizer.Plugin;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
|
||||||
using Dalamud.Game.ClientState;
|
|
||||||
using Dalamud.Game.Gui;
|
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
|
using Dalamud.Game.ClientState;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
|
using Dalamud.Game.ClientState.Objects;
|
||||||
|
using Dalamud.Game.Command;
|
||||||
|
using Dalamud.Game.Gui;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Game.ClientState.Conditions;
|
|
||||||
using Dalamud.Game.Command;
|
|
||||||
using Dalamud.Interface.Windowing;
|
|
||||||
|
|
||||||
namespace Craftimizer.Plugin;
|
namespace Craftimizer.Plugin;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
using ImGuiScene;
|
using Craftimizer.Simulator;
|
||||||
using Dalamud.Utility;
|
|
||||||
using Lumina.Excel.GeneratedSheets;
|
|
||||||
using System.Linq;
|
|
||||||
using Craftimizer.Simulator.Actions;
|
using Craftimizer.Simulator.Actions;
|
||||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
using ImGuiScene;
|
||||||
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
|
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||||
using Condition = Craftimizer.Simulator.Condition;
|
using Condition = Craftimizer.Simulator.Condition;
|
||||||
using Craftimizer.Simulator;
|
|
||||||
using System.Text;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace Craftimizer.Plugin;
|
namespace Craftimizer.Plugin;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ internal static class ActionUtils
|
|||||||
var actionId = actionType.Base().ActionId;
|
var actionId = actionType.Base().ActionId;
|
||||||
if (LuminaSheets.CraftActionSheet.GetRow(actionId) is CraftAction baseCraftAction)
|
if (LuminaSheets.CraftActionSheet.GetRow(actionId) is CraftAction baseCraftAction)
|
||||||
{
|
{
|
||||||
foreach(var classJob in classJobs)
|
foreach (var classJob in classJobs)
|
||||||
{
|
{
|
||||||
ActionRows[(int)actionType, (int)classJob] = (classJob switch
|
ActionRows[(int)actionType, (int)classJob] = (classJob switch
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ internal static class ActionUtils
|
|||||||
|
|
||||||
public static ActionType? GetActionTypeFromId(uint actionId, ClassJob classJob, bool isCraftAction)
|
public static ActionType? GetActionTypeFromId(uint actionId, ClassJob classJob, bool isCraftAction)
|
||||||
{
|
{
|
||||||
foreach(var action in Enum.GetValues<ActionType>())
|
foreach (var action in Enum.GetValues<ActionType>())
|
||||||
{
|
{
|
||||||
var row = action.GetActionRow(classJob);
|
var row = action.GetActionRow(classJob);
|
||||||
if (isCraftAction)
|
if (isCraftAction)
|
||||||
@@ -197,7 +197,7 @@ internal static class ConditionUtils
|
|||||||
_ => Vector3.Zero // Unknown
|
_ => Vector3.Zero // Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
private const float ConditionCyclePeriod = 19/30f;
|
private const float ConditionCyclePeriod = 19 / 30f;
|
||||||
// The real period of all condition color cycles are 0.633... (19/30) seconds
|
// The real period of all condition color cycles are 0.633... (19/30) seconds
|
||||||
// Interp accepts 0-1
|
// Interp accepts 0-1
|
||||||
public static Vector4 GetColor(this Condition me, float interp)
|
public static Vector4 GetColor(this Condition me, float interp)
|
||||||
@@ -210,7 +210,7 @@ internal static class ConditionUtils
|
|||||||
{
|
{
|
||||||
addRgb = interp switch
|
addRgb = interp switch
|
||||||
{
|
{
|
||||||
< 0.155f => Vector3.Lerp(new(128,0,0), new(128,80,0), (interp - 0) / 0.155f),
|
< 0.155f => Vector3.Lerp(new(128, 0, 0), new(128, 80, 0), (interp - 0) / 0.155f),
|
||||||
< 0.315f => Vector3.Lerp(new(128, 80, 0), new(128, 128, 0), (interp - 0.155f) / 0.16f),
|
< 0.315f => Vector3.Lerp(new(128, 80, 0), new(128, 128, 0), (interp - 0.155f) / 0.16f),
|
||||||
< 0.475f => Vector3.Lerp(new(128, 128, 0), new(0, 64, 0), (interp - 0.315f) / 0.16f),
|
< 0.475f => Vector3.Lerp(new(128, 128, 0), new(0, 64, 0), (interp - 0.315f) / 0.16f),
|
||||||
< 0.630f => Vector3.Lerp(new(0, 64, 0), new(0, 128, 128), (interp - 0.475f) / 0.155f),
|
< 0.630f => Vector3.Lerp(new(0, 64, 0), new(0, 128, 128), (interp - 0.475f) / 0.155f),
|
||||||
@@ -293,7 +293,7 @@ internal static class EffectUtils
|
|||||||
public static ushort GetIconId(this EffectType me, int strength)
|
public static ushort GetIconId(this EffectType me, int strength)
|
||||||
{
|
{
|
||||||
var status = me.Status();
|
var status = me.Status();
|
||||||
uint iconId = status.Icon;
|
var iconId = status.Icon;
|
||||||
if (status.MaxStacks != 0)
|
if (status.MaxStacks != 0)
|
||||||
iconId += (uint)Math.Clamp(strength, 1, status.MaxStacks) - 1;
|
iconId += (uint)Math.Clamp(strength, 1, status.MaxStacks) - 1;
|
||||||
return (ushort)iconId;
|
return (ushort)iconId;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ internal static unsafe class Gearsets
|
|||||||
foreach (var statIncrease in item.UnkData73)
|
foreach (var statIncrease in item.UnkData73)
|
||||||
IncreaseStat(statIncrease.BaseParamSpecial, statIncrease.BaseParamValueSpecial);
|
IncreaseStat(statIncrease.BaseParamSpecial, statIncrease.BaseParamValueSpecial);
|
||||||
|
|
||||||
foreach(var gearsetMateria in gearsetItem.materia)
|
foreach (var gearsetMateria in gearsetItem.materia)
|
||||||
{
|
{
|
||||||
if (gearsetMateria.Type == 0)
|
if (gearsetMateria.Type == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
using Craftimizer.Simulator.Actions;
|
using Craftimizer.Plugin;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Dalamud.Utility.Signatures;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using System;
|
using System;
|
||||||
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
||||||
using CSActionType = FFXIVClientStructs.FFXIV.Client.Game.ActionType;
|
|
||||||
using Condition = Craftimizer.Simulator.Condition;
|
|
||||||
using Craftimizer.Plugin;
|
|
||||||
using ActionUtils = Craftimizer.Plugin.ActionUtils;
|
using ActionUtils = Craftimizer.Plugin.ActionUtils;
|
||||||
|
using CSActionType = FFXIVClientStructs.FFXIV.Client.Game.ActionType;
|
||||||
|
|
||||||
namespace Craftimizer.Utils;
|
namespace Craftimizer.Utils;
|
||||||
|
|
||||||
@@ -35,7 +31,8 @@ public sealed unsafe class Hooks : IDisposable
|
|||||||
if (canCast && ret && (actionType == CSActionType.CraftAction || actionType == CSActionType.Spell))
|
if (canCast && ret && (actionType == CSActionType.CraftAction || actionType == CSActionType.Spell))
|
||||||
{
|
{
|
||||||
var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.ClientState.LocalPlayer?.ClassJob.Id ?? 0));
|
var classJob = ClassJobUtils.GetClassJobFromIdx((byte)(Service.ClientState.LocalPlayer?.ClassJob.Id ?? 0));
|
||||||
if (classJob != null) {
|
if (classJob != null)
|
||||||
|
{
|
||||||
var simActionType = ActionUtils.GetActionTypeFromId(actionId, classJob.Value, actionType == CSActionType.CraftAction);
|
var simActionType = ActionUtils.GetActionTypeFromId(actionId, classJob.Value, actionType == CSActionType.CraftAction);
|
||||||
if (simActionType != null)
|
if (simActionType != null)
|
||||||
OnActionUsed?.Invoke(simActionType.Value);
|
OnActionUsed?.Invoke(simActionType.Value);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public unsafe class CraftingLog : Window
|
|||||||
private CharacterStats CharacterStatsConsumable { get; set; } = null!;
|
private CharacterStats CharacterStatsConsumable { get; set; } = null!;
|
||||||
private CannotCraftReason CharacterCannotCraftReason { get; set; }
|
private CannotCraftReason CharacterCannotCraftReason { get; set; }
|
||||||
private SimulationInput CharacterSimulationInput { get; set; } = null!;
|
private SimulationInput CharacterSimulationInput { get; set; } = null!;
|
||||||
|
|
||||||
// Set in UI
|
// Set in UI
|
||||||
private int QualityNotches { get; set; }
|
private int QualityNotches { get; set; }
|
||||||
private int StartingQuality =>
|
private int StartingQuality =>
|
||||||
@@ -144,7 +144,7 @@ public unsafe class CraftingLog : Window
|
|||||||
CP = CharacterStatsNoConsumable.CP + CharacterConsumableBonus.CP,
|
CP = CharacterStatsNoConsumable.CP + CharacterConsumableBonus.CP,
|
||||||
};
|
};
|
||||||
CharacterCannotCraftReason = Config.OverrideUncraftability ? CannotCraftReason.OK : CanCraftRecipe(CharacterEquipment, CharacterStatsConsumable);
|
CharacterCannotCraftReason = Config.OverrideUncraftability ? CannotCraftReason.OK : CanCraftRecipe(CharacterEquipment, CharacterStatsConsumable);
|
||||||
|
|
||||||
if (CharacterCannotCraftReason == CannotCraftReason.OK)
|
if (CharacterCannotCraftReason == CannotCraftReason.OK)
|
||||||
CharacterSimulationInput = new(CharacterStatsConsumable, RecipeUtils.Info, StartingQuality, Random);
|
CharacterSimulationInput = new(CharacterStatsConsumable, RecipeUtils.Info, StartingQuality, Random);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ public unsafe class CraftingLog : Window
|
|||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
ImGui.BeginTable("craftfood", 2, ImGuiTableFlags.BordersInnerV);
|
ImGui.BeginTable("craftfood", 2, ImGuiTableFlags.BordersInnerV);
|
||||||
|
|
||||||
ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed, LeftSideWidth - 120);
|
ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed, LeftSideWidth - 120);
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
@@ -283,7 +283,8 @@ public unsafe class CraftingLog : Window
|
|||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
|
|
||||||
SimulationState? state = null;
|
SimulationState? state = null;
|
||||||
if (CharacterCannotCraftReason == CannotCraftReason.OK) {
|
if (CharacterCannotCraftReason == CannotCraftReason.OK)
|
||||||
|
{
|
||||||
state = new(CharacterSimulationInput);
|
state = new(CharacterSimulationInput);
|
||||||
foreach (var action in macro.Actions)
|
foreach (var action in macro.Actions)
|
||||||
(_, state) = simulation.Execute(state.Value, action);
|
(_, state) = simulation.Execute(state.Value, action);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Dalamud.Interface.Windowing;
|
|
||||||
using Dalamud.Interface;
|
|
||||||
using ImGuiNET;
|
|
||||||
using System.Numerics;
|
|
||||||
using System;
|
|
||||||
using Craftimizer.Solver.Crafty;
|
using Craftimizer.Solver.Crafty;
|
||||||
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
|
using ImGuiNET;
|
||||||
|
using System;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Craftimizer.Plugin.Windows;
|
namespace Craftimizer.Plugin.Windows;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
using Craftimizer.Simulator.Actions;
|
|
||||||
using Craftimizer.Simulator;
|
using Craftimizer.Simulator;
|
||||||
using Dalamud.Interface.Windowing;
|
using Craftimizer.Simulator.Actions;
|
||||||
using ImGuiNET;
|
|
||||||
using System.Numerics;
|
|
||||||
using Dalamud.Interface;
|
|
||||||
using Dalamud.Utility;
|
|
||||||
using System;
|
|
||||||
using ImGuiScene;
|
|
||||||
using Dalamud.Interface.Components;
|
|
||||||
using System.Linq;
|
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Components;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
using ImGuiNET;
|
||||||
|
using ImGuiScene;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Craftimizer.Plugin.Windows;
|
namespace Craftimizer.Plugin.Windows;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public enum ActionType : byte
|
|||||||
Veneration,
|
Veneration,
|
||||||
WasteNot,
|
WasteNot,
|
||||||
WasteNot2,
|
WasteNot2,
|
||||||
|
|
||||||
StandardTouchCombo,
|
StandardTouchCombo,
|
||||||
AdvancedTouchCombo,
|
AdvancedTouchCombo,
|
||||||
FocusedSynthesisCombo,
|
FocusedSynthesisCombo,
|
||||||
@@ -48,7 +48,7 @@ public enum ActionType : byte
|
|||||||
public static class ActionUtils
|
public static class ActionUtils
|
||||||
{
|
{
|
||||||
private static readonly BaseAction[] Actions;
|
private static readonly BaseAction[] Actions;
|
||||||
|
|
||||||
static ActionUtils()
|
static ActionUtils()
|
||||||
{
|
{
|
||||||
var types = typeof(BaseAction).Assembly.GetTypes()
|
var types = typeof(BaseAction).Assembly.GetTypes()
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public record struct Effects
|
|||||||
public readonly byte GetStrength(EffectType effect) =>
|
public readonly byte GetStrength(EffectType effect) =>
|
||||||
effect == EffectType.InnerQuiet ? InnerQuiet :
|
effect == EffectType.InnerQuiet ? InnerQuiet :
|
||||||
(byte)(HasEffect(effect) ? 1 : 0);
|
(byte)(HasEffect(effect) ? 1 : 0);
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly bool HasEffect(EffectType effect) =>
|
public readonly bool HasEffect(EffectType effect) =>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public sealed class SimulationInput
|
|||||||
|
|
||||||
public SimulationInput(CharacterStats stats, RecipeInfo recipe, int startingQuality = 0, int? seed = null) : this(stats, recipe, startingQuality, seed == null ? new Random() : new Random(seed.Value))
|
public SimulationInput(CharacterStats stats, RecipeInfo recipe, int startingQuality = 0, int? seed = null) : this(stats, recipe, startingQuality, seed == null ? new Random() : new Random(seed.Value))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Condition[] AvailableConditions => ConditionUtils.GetPossibleConditions(Recipe.ConditionsFlag);
|
public Condition[] AvailableConditions => ConditionUtils.GetPossibleConditions(Recipe.ConditionsFlag);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Craftimizer.Solver.Crafty;
|
|||||||
public struct ActionSet
|
public struct ActionSet
|
||||||
{
|
{
|
||||||
private const bool IsDeterministic = false;
|
private const bool IsDeterministic = false;
|
||||||
|
|
||||||
private uint bits;
|
private uint bits;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
|
|||||||
@@ -586,5 +586,5 @@ public sealed class Solver
|
|||||||
};
|
};
|
||||||
return func(config, state, actionCallback, token);
|
return func(config, state, actionCallback, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user