mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Hanle some compiler messages
This commit is contained in:
parent
8936c58417
commit
ee1cfa8912
7 changed files with 28 additions and 32 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static PKHeX.Core.GameVersion;
|
||||
using static PKHeX.Core.Legal;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -13,32 +14,21 @@ namespace PKHeX.Core
|
|||
/// </remarks>
|
||||
public sealed class EvolutionTree
|
||||
{
|
||||
private static readonly EvolutionTree Evolves1;
|
||||
private static readonly EvolutionTree Evolves2;
|
||||
private static readonly EvolutionTree Evolves3;
|
||||
private static readonly EvolutionTree Evolves4;
|
||||
private static readonly EvolutionTree Evolves5;
|
||||
private static readonly EvolutionTree Evolves6;
|
||||
private static readonly EvolutionTree Evolves7;
|
||||
private static readonly EvolutionTree Evolves7b;
|
||||
private static readonly EvolutionTree Evolves8;
|
||||
private static readonly EvolutionTree Evolves1 = new EvolutionTree(new[] { Get("rby") }, Gen1, PersonalTable.Y, MaxSpeciesID_1);
|
||||
private static readonly EvolutionTree Evolves2 = new EvolutionTree(new[] { Get("gsc") }, Gen2, PersonalTable.C, MaxSpeciesID_2);
|
||||
private static readonly EvolutionTree Evolves3 = new EvolutionTree(new[] { Get("g3") }, Gen3, PersonalTable.RS, MaxSpeciesID_3);
|
||||
private static readonly EvolutionTree Evolves4 = new EvolutionTree(new[] { Get("g4") }, Gen4, PersonalTable.DP, MaxSpeciesID_4);
|
||||
private static readonly EvolutionTree Evolves5 = new EvolutionTree(new[] { Get("g5") }, Gen5, PersonalTable.BW, MaxSpeciesID_5);
|
||||
private static readonly EvolutionTree Evolves6 = new EvolutionTree(Unpack("ao"), Gen6, PersonalTable.AO, MaxSpeciesID_6);
|
||||
private static readonly EvolutionTree Evolves7 = new EvolutionTree(Unpack("uu"), Gen7, PersonalTable.USUM, MaxSpeciesID_7_USUM);
|
||||
private static readonly EvolutionTree Evolves7b = new EvolutionTree(Unpack("gg"), Gen7, PersonalTable.GG, MaxSpeciesID_7b);
|
||||
private static readonly EvolutionTree Evolves8 = new EvolutionTree(Unpack("ss"), Gen8, PersonalTable.SWSH, MaxSpeciesID_8);
|
||||
|
||||
private static byte[] Get(string resource) => Util.GetBinaryResource($"evos_{resource}.pkl");
|
||||
private static byte[][] Unpack(string resource) => BinLinker.Unpack(Get(resource), resource);
|
||||
|
||||
static EvolutionTree()
|
||||
{
|
||||
// Evolution tables need Personal Tables initialized beforehand, hence why the EvolutionTree data is initialized here.
|
||||
static byte[] get(string resource) => Util.GetBinaryResource($"evos_{resource}.pkl");
|
||||
static byte[][] unpack(string resource) => BinLinker.Unpack(get(resource), resource);
|
||||
|
||||
Evolves1 = new EvolutionTree(new[] { get("rby") }, Gen1, PersonalTable.Y, Legal.MaxSpeciesID_1);
|
||||
Evolves2 = new EvolutionTree(new[] { get("gsc") }, Gen2, PersonalTable.C, Legal.MaxSpeciesID_2);
|
||||
Evolves3 = new EvolutionTree(new[] { get("g3") }, Gen3, PersonalTable.RS, Legal.MaxSpeciesID_3);
|
||||
Evolves4 = new EvolutionTree(new[] { get("g4") }, Gen4, PersonalTable.DP, Legal.MaxSpeciesID_4);
|
||||
Evolves5 = new EvolutionTree(new[] { get("g5") }, Gen5, PersonalTable.BW, Legal.MaxSpeciesID_5);
|
||||
Evolves6 = new EvolutionTree(unpack("ao"), Gen6, PersonalTable.AO, Legal.MaxSpeciesID_6);
|
||||
Evolves7 = new EvolutionTree(unpack("uu"), Gen7, PersonalTable.USUM, Legal.MaxSpeciesID_7_USUM);
|
||||
Evolves7b = new EvolutionTree(unpack("gg"), Gen7, PersonalTable.GG, Legal.MaxSpeciesID_7b);
|
||||
Evolves8 = new EvolutionTree(unpack("ss"), Gen8, PersonalTable.SWSH, Legal.MaxSpeciesID_8);
|
||||
|
||||
// Throw in banned evolution data!
|
||||
Evolves7.FixEvoTreeSM();
|
||||
Evolves8.FixEvoTreeSS();
|
||||
|
|
|
@ -68,5 +68,13 @@ namespace PKHeX.Core
|
|||
x |= x >> 16;
|
||||
return x;
|
||||
}
|
||||
|
||||
// ReSharper disable once NonReadonlyMemberInGetHashCode
|
||||
// ReSharper disable once NonReadonlyMemberInGetHashCode
|
||||
public override int GetHashCode() => (int)s0;
|
||||
public override bool Equals(object obj) => obj is Xoroshiro128Plus s && Equals(s);
|
||||
public bool Equals(Xoroshiro128Plus obj) => obj.s0 == s0 && obj.s1 == s1;
|
||||
public static bool operator ==(Xoroshiro128Plus left, Xoroshiro128Plus right) => left.Equals(right);
|
||||
public static bool operator !=(Xoroshiro128Plus left, Xoroshiro128Plus right) => !(left == right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ namespace PKHeX.Core
|
|||
|
||||
// Trainer Info (offset 0x78, length 0xB18, end @ 0xB90)
|
||||
public override string OT { get => GetString(0x78, 20); set { SetString(value, 10).CopyTo(Data, 0x78); OT2 = value; } }
|
||||
private string OT2 { get => GetString(0x8C, 20); set => SetString(value, 10).CopyTo(Data, 0x8C); }
|
||||
public string OT2 { get => GetString(0x8C, 20); set => SetString(value, 10).CopyTo(Data, 0x8C); }
|
||||
public override int SID { get => BigEndian.ToUInt16(Data, 0xA4); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xA4); }
|
||||
public override int TID { get => BigEndian.ToUInt16(Data, 0xA6); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xA6); }
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace PKHeX.Core
|
|||
|
||||
#region Savedata Container Handling
|
||||
public byte[] GetData(int offset, int length) => GetData(Data, offset, length);
|
||||
public byte[] GetData(byte[] data, int offset, int length) => data.Slice(offset, length);
|
||||
protected static byte[] GetData(byte[] data, int offset, int length) => data.Slice(offset, length);
|
||||
public void SetData(byte[] input, int offset) => SetData(Data, input, offset);
|
||||
|
||||
public void SetData(byte[] dest, byte[] input, int offset)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
private int TotalFestaCoins
|
||||
public int TotalFestaCoins
|
||||
{
|
||||
get => BitConverter.ToInt32(Data, Offset + 0x50C);
|
||||
set
|
||||
|
|
|
@ -64,10 +64,6 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
public bool GetIsTeamLocked(int team) => true;
|
||||
|
||||
public void SetIsTeamLocked(int team, bool value)
|
||||
{
|
||||
|
||||
}
|
||||
public void SetIsTeamLocked(int team, bool value) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,8 @@ namespace PKHeX.WinForms
|
|||
try
|
||||
{
|
||||
var pi = t.GetProperty(name);
|
||||
if (pi == null)
|
||||
throw new ArgumentNullException(name);
|
||||
if (pi.PropertyType == typeof(Color))
|
||||
{
|
||||
var color = Color.FromArgb(int.Parse(value));
|
||||
|
|
Loading…
Reference in a new issue