diff --git a/pkNX.Structures.FlatBuffers.SV/pkNX.Structures.FlatBuffers.SV.Personal/Personal/Types/PersonalInfoStats.cs b/pkNX.Structures.FlatBuffers.SV/pkNX.Structures.FlatBuffers.SV.Personal/Personal/Types/PersonalInfoStats.cs index 348a28e9..1411e21b 100644 --- a/pkNX.Structures.FlatBuffers.SV/pkNX.Structures.FlatBuffers.SV.Personal/Personal/Types/PersonalInfoStats.cs +++ b/pkNX.Structures.FlatBuffers.SV/pkNX.Structures.FlatBuffers.SV.Personal/Personal/Types/PersonalInfoStats.cs @@ -6,5 +6,5 @@ namespace pkNX.Structures.FlatBuffers.SV; public partial class PersonalInfoStats { - public ushort U16() => (ushort)((HP & 0b11) | ((ATK & 0b11) << 2) | ((DEF & 0b11) << 4) | ((SPA & 0b11) << 6) | ((SPD & 0b11) << 8) | ((SPE & 0b11) << 10)); + public ushort U16() => (ushort)((HP & 0b11) | ((ATK & 0b11) << 2) | ((DEF & 0b11) << 4) | ((SPE & 0b11) << 6) | ((SPA & 0b11) << 8) | ((SPD & 0b11) << 10)); } diff --git a/pkNX.Structures/Text/TextConfig.cs b/pkNX.Structures/Text/TextConfig.cs index 897ba3ba..746125e8 100644 --- a/pkNX.Structures/Text/TextConfig.cs +++ b/pkNX.Structures/Text/TextConfig.cs @@ -17,7 +17,7 @@ public class TextConfig(GameVersion game) public IEnumerable GetVariableList() => Variables.Select(z => $"{z.Code:X4}={z.Name}"); private TextVariableCode? GetCode(string name) => Array.Find(Variables, v => v.Name == name); - private TextVariableCode? GetName(int value) => Array.Find(Variables, v => v.Code == value); + private TextVariableCode? GetName(ushort value) => Array.Find(Variables, v => v.Code == value); /// /// Gets the machine-friendly variable instruction code to be written to the data. @@ -27,7 +27,7 @@ public ushort GetVariableNumber(string variable) { var v = GetCode(variable); if (v != null) - return (ushort)v.Code; + return v.Code; if (ushort.TryParse(variable.TrimStart(_trim_hex), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var result)) return result; throw new ArgumentException($"Variable parse error: {variable}. Expected a hexadecimal value or standard variable code."); diff --git a/pkNX.Structures/Text/TextVariableCode.cs b/pkNX.Structures/Text/TextVariableCode.cs index ba571429..f10c3e17 100644 --- a/pkNX.Structures/Text/TextVariableCode.cs +++ b/pkNX.Structures/Text/TextVariableCode.cs @@ -1,18 +1,7 @@ -using System; - namespace pkNX.Structures; -public sealed class TextVariableCode +public sealed record TextVariableCode(ushort Code, string Name) { - public readonly string Name; - public readonly int Code; - - private TextVariableCode(int code, string name) - { - Code = code; - Name = name; - } - public static TextVariableCode[] GetVariables(GameVersion game) { if (game == GameVersion.Any)