Apply csharpier reflow across source tree
Reformats the entire Craftimizer source tree with dotnet csharpier 1.2.6 to match the Hellion Forge house style (matches what HellionChat enforces in its pre-push pipeline). Pure whitespace + using-block sorting; no semantic changes. This is a one-time noisy commit. Future code edits in this fork should land csharpier-clean because the pre-push hook (introduced in the next commit) runs `dotnet csharpier check Craftimizer/` as Block C of the preflight gate. Trade-off acknowledged: this widens the merge gap with upstream Craftimizer should Asriel ever resume maintenance. Given the upstream has been dormant since FFXIV 7.4 and the fork is light-rename only (internal namespaces unchanged), the marginal cost is acceptable.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
using Craftimizer.Simulator;
|
||||
using Craftimizer.Simulator.Actions;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Craftimizer.Simulator;
|
||||
using Craftimizer.Simulator.Actions;
|
||||
using Craftimizer.Utils;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Event;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Lumina.Text.Payloads;
|
||||
using Lumina.Text.ReadOnly;
|
||||
using Action = Lumina.Excel.Sheets.Action;
|
||||
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||
using Condition = Craftimizer.Simulator.Condition;
|
||||
using Status = Lumina.Excel.Sheets.Status;
|
||||
using Craftimizer.Utils;
|
||||
using Lumina.Text.ReadOnly;
|
||||
using Lumina.Text.Payloads;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Event;
|
||||
|
||||
namespace Craftimizer.Plugin;
|
||||
|
||||
@@ -27,7 +27,10 @@ internal static class ActionUtils
|
||||
{
|
||||
var actionTypes = Enum.GetValues<ActionType>();
|
||||
var classJobs = Enum.GetValues<ClassJob>();
|
||||
ActionRows = new (CraftAction? CraftAction, Action? Action)[actionTypes.Length, classJobs.Length];
|
||||
ActionRows = new (CraftAction? CraftAction, Action? Action)[
|
||||
actionTypes.Length,
|
||||
classJobs.Length
|
||||
];
|
||||
foreach (var actionType in actionTypes)
|
||||
{
|
||||
var actionId = actionType.Base().ActionId;
|
||||
@@ -35,37 +38,48 @@ internal static class ActionUtils
|
||||
{
|
||||
foreach (var classJob in classJobs)
|
||||
{
|
||||
ActionRows[(int)actionType, (int)classJob] = (classJob switch
|
||||
{
|
||||
ClassJob.Carpenter => baseCraftAction.CRP.Value,
|
||||
ClassJob.Blacksmith => baseCraftAction.BSM.Value,
|
||||
ClassJob.Armorer => baseCraftAction.ARM.Value,
|
||||
ClassJob.Goldsmith => baseCraftAction.GSM.Value,
|
||||
ClassJob.Leatherworker => baseCraftAction.LTW.Value,
|
||||
ClassJob.Weaver => baseCraftAction.WVR.Value,
|
||||
ClassJob.Alchemist => baseCraftAction.ALC.Value,
|
||||
ClassJob.Culinarian => baseCraftAction.CUL.Value,
|
||||
_ => baseCraftAction
|
||||
}, null);
|
||||
ActionRows[(int)actionType, (int)classJob] = (
|
||||
classJob switch
|
||||
{
|
||||
ClassJob.Carpenter => baseCraftAction.CRP.Value,
|
||||
ClassJob.Blacksmith => baseCraftAction.BSM.Value,
|
||||
ClassJob.Armorer => baseCraftAction.ARM.Value,
|
||||
ClassJob.Goldsmith => baseCraftAction.GSM.Value,
|
||||
ClassJob.Leatherworker => baseCraftAction.LTW.Value,
|
||||
ClassJob.Weaver => baseCraftAction.WVR.Value,
|
||||
ClassJob.Alchemist => baseCraftAction.ALC.Value,
|
||||
ClassJob.Culinarian => baseCraftAction.CUL.Value,
|
||||
_ => baseCraftAction,
|
||||
},
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
if (LuminaSheets.ActionSheet.GetRowOrDefault(actionId) is { } baseAction)
|
||||
{
|
||||
var possibleActions = LuminaSheets.ActionSheet.Where(r =>
|
||||
r.Icon == baseAction.Icon &&
|
||||
r.ActionCategory.RowId == baseAction.ActionCategory.RowId &&
|
||||
r.Name.Equals(baseAction.Name));
|
||||
r.Icon == baseAction.Icon
|
||||
&& r.ActionCategory.RowId == baseAction.ActionCategory.RowId
|
||||
&& r.Name.Equals(baseAction.Name)
|
||||
);
|
||||
|
||||
foreach (var classJob in classJobs)
|
||||
ActionRows[(int)actionType, (int)classJob] = (null, possibleActions.First(r => r.ClassJobCategory.ValueNullable?.IsClassJob(classJob) ?? false));
|
||||
ActionRows[(int)actionType, (int)classJob] = (
|
||||
null,
|
||||
possibleActions.First(r =>
|
||||
r.ClassJobCategory.ValueNullable?.IsClassJob(classJob) ?? false
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize() { }
|
||||
|
||||
public static (CraftAction? CraftAction, Action? Action) GetActionRow(this ActionType me, ClassJob classJob) =>
|
||||
ActionRows[(int)me, (int)classJob];
|
||||
public static (CraftAction? CraftAction, Action? Action) GetActionRow(
|
||||
this ActionType me,
|
||||
ClassJob classJob
|
||||
) => ActionRows[(int)me, (int)classJob];
|
||||
|
||||
public static uint GetId(this ActionType me, ClassJob classJob)
|
||||
{
|
||||
@@ -86,7 +100,11 @@ internal static class ActionUtils
|
||||
return Service.IconManager.GetIconCached(craftAction?.Icon ?? action?.Icon ?? 1953);
|
||||
}
|
||||
|
||||
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>())
|
||||
{
|
||||
@@ -119,7 +137,7 @@ internal static class ClassJobUtils
|
||||
ClassJob.Weaver => 13,
|
||||
ClassJob.Alchemist => 14,
|
||||
ClassJob.Culinarian => 15,
|
||||
_ => 0
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
public static ClassJob? GetClassJobFromIdx(byte classJobIdx) =>
|
||||
@@ -133,7 +151,7 @@ internal static class ClassJobUtils
|
||||
13 => ClassJob.Weaver,
|
||||
14 => ClassJob.Alchemist,
|
||||
15 => ClassJob.Culinarian,
|
||||
_ => null
|
||||
_ => null,
|
||||
};
|
||||
|
||||
public static sbyte GetExpArrayIdx(this ClassJob me) =>
|
||||
@@ -158,7 +176,11 @@ internal static class ClassJobUtils
|
||||
}
|
||||
|
||||
public static unsafe bool CanPlayerUseManipulation(this ClassJob me) =>
|
||||
UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(ActionType.Manipulation.GetActionRow(me).Action!.Value.UnlockLink.RowId);
|
||||
UIState
|
||||
.Instance()
|
||||
->IsUnlockLinkUnlockedOrQuestCompleted(
|
||||
ActionType.Manipulation.GetActionRow(me).Action!.Value.UnlockLink.RowId
|
||||
);
|
||||
|
||||
public static string GetName(this ClassJob me)
|
||||
{
|
||||
@@ -186,8 +208,7 @@ internal static class ClassJobUtils
|
||||
public static Quest GetUnlockQuest(this ClassJob me) =>
|
||||
LuminaSheets.QuestSheet.GetRow(65720 + (uint)me);
|
||||
|
||||
public static ushort GetIconId(this ClassJob me) =>
|
||||
(ushort)(62000 + me.GetClassJobIndex());
|
||||
public static ushort GetIconId(this ClassJob me) => (ushort)(62000 + me.GetClassJobIndex());
|
||||
|
||||
public static bool IsClassJob(this ClassJobCategory me, ClassJob classJob) =>
|
||||
classJob switch
|
||||
@@ -200,7 +221,7 @@ internal static class ClassJobUtils
|
||||
ClassJob.Weaver => me.WVR,
|
||||
ClassJob.Alchemist => me.ALC,
|
||||
ClassJob.Culinarian => me.CUL,
|
||||
_ => false
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -219,7 +240,7 @@ internal static class ConditionUtils
|
||||
Condition.Malleable => (13455, 14208),
|
||||
Condition.Primed => (13454, 14207),
|
||||
Condition.GoodOmen => (14214, 14215),
|
||||
_ => (226, 14200) // Unknown
|
||||
_ => (226, 14200), // Unknown
|
||||
};
|
||||
|
||||
private static Vector3 AddRGB(this Condition me) =>
|
||||
@@ -235,10 +256,11 @@ internal static class ConditionUtils
|
||||
Condition.Malleable => new(-80, -40, 180),
|
||||
Condition.Primed => new(30, -155, 200),
|
||||
Condition.GoodOmen => new(100, 20, 0),
|
||||
_ => Vector3.Zero // Unknown
|
||||
_ => Vector3.Zero, // Unknown
|
||||
};
|
||||
|
||||
private const float ConditionCyclePeriod = 19 / 30f;
|
||||
|
||||
// The real period of all condition color cycles are 0.633... (19/30) seconds
|
||||
// Interp accepts 0-1
|
||||
public static Vector4 GetColor(this Condition me, float interp)
|
||||
@@ -252,12 +274,32 @@ internal static class ConditionUtils
|
||||
addRgb = interp switch
|
||||
{
|
||||
< 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.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.790f => Vector3.Lerp(new(0, 128, 128), new(0, 0, 128), (interp - 0.630f) / 0.16f),
|
||||
< 0.945f => Vector3.Lerp(new(0, 0, 128), new(64, 0, 64), (interp - 0.790f) / 0.155f),
|
||||
_ => new(64, 0, 64)
|
||||
< 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.630f => Vector3.Lerp(
|
||||
new(0, 64, 0),
|
||||
new(0, 128, 128),
|
||||
(interp - 0.475f) / 0.155f
|
||||
),
|
||||
< 0.790f => Vector3.Lerp(
|
||||
new(0, 128, 128),
|
||||
new(0, 0, 128),
|
||||
(interp - 0.630f) / 0.16f
|
||||
),
|
||||
< 0.945f => Vector3.Lerp(
|
||||
new(0, 0, 128),
|
||||
new(64, 0, 64),
|
||||
(interp - 0.790f) / 0.155f
|
||||
),
|
||||
_ => new(64, 0, 64),
|
||||
};
|
||||
}
|
||||
// Period is twice as fast so we oscillate at twice that speed
|
||||
@@ -285,7 +327,7 @@ internal static class ConditionUtils
|
||||
Condition.Pliant => Vector3.Lerp(new(0, 150, 0), new(0, 249, 0), interp),
|
||||
Condition.Primed => Vector3.Lerp(new(-30, -255, 50), new(29, -156, 199), interp),
|
||||
Condition.GoodOmen => Vector3.Lerp(new(100, 20, 0), new(100, 99, 99), interp),
|
||||
_ => default
|
||||
_ => default,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -294,7 +336,9 @@ internal static class ConditionUtils
|
||||
|
||||
public static Vector4 GetColor(this Condition me, TimeSpan time)
|
||||
{
|
||||
return me.GetColor((float)(time.TotalSeconds % ConditionCyclePeriod / ConditionCyclePeriod));
|
||||
return me.GetColor(
|
||||
(float)(time.TotalSeconds % ConditionCyclePeriod / ConditionCyclePeriod)
|
||||
);
|
||||
}
|
||||
|
||||
public static string Name(this Condition me) =>
|
||||
@@ -310,7 +354,11 @@ internal static class ConditionUtils
|
||||
foreach (var payload in text)
|
||||
{
|
||||
if (payload is { Type: ReadOnlySePayloadType.Macro, MacroCode: MacroCode.Float })
|
||||
finalText += new ReadOnlySePayload(ReadOnlySePayloadType.Text, default, Encoding.UTF8.GetBytes(isRelic ? "1.75" : "1.5"));
|
||||
finalText += new ReadOnlySePayload(
|
||||
ReadOnlySePayloadType.Text,
|
||||
default,
|
||||
Encoding.UTF8.GetBytes(isRelic ? "1.75" : "1.5")
|
||||
);
|
||||
else
|
||||
finalText += payload;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user