mirror of
https://github.com/kwsch/pkNX.git
synced 2026-04-21 09:07:50 -05:00
Fix EV yield bit ordering
oopsies https://github.com/kwsch/PKHeX/issues/4252 also includes a minor clean for TextVariableCode
This commit is contained in:
parent
95d0937fd8
commit
dcf6b0043b
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class TextConfig(GameVersion game)
|
|||
public IEnumerable<string> 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);
|
||||
|
||||
/// <summary>
|
||||
/// 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.");
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user