mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-30 07:50:32 +00:00
Cleanup
handle messages for dirty cleaning :)
This commit is contained in:
parent
64a5c30356
commit
e3efa65160
57 changed files with 279 additions and 235 deletions
|
@ -8,12 +8,12 @@ namespace PKHeX.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class StringInstructionSet
|
public sealed class StringInstructionSet
|
||||||
{
|
{
|
||||||
public IList<StringInstruction> Filters { get; private set; }
|
public readonly IReadOnlyList<StringInstruction> Filters;
|
||||||
public IList<StringInstruction> Instructions { get; private set; }
|
public readonly IReadOnlyList<StringInstruction> Instructions;
|
||||||
|
|
||||||
private const string SetSeparator = ";";
|
private const string SetSeparator = ";";
|
||||||
|
|
||||||
public StringInstructionSet(IList<StringInstruction> filters, IList<StringInstruction> instructions)
|
public StringInstructionSet(IReadOnlyList<StringInstruction> filters, IReadOnlyList<StringInstruction> instructions)
|
||||||
{
|
{
|
||||||
Filters = filters;
|
Filters = filters;
|
||||||
Instructions = instructions;
|
Instructions = instructions;
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default <see cref="MarkingMethod"/> when applying markings.
|
/// Default <see cref="MarkingMethod"/> when applying markings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
|
||||||
public static Func<PKM, Func<int, int, int>> MarkingMethod { get; set; } = FlagHighLow;
|
public static Func<PKM, Func<int, int, int>> MarkingMethod { get; set; } = FlagHighLow;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -629,8 +630,8 @@ namespace PKHeX.Core
|
||||||
/// Gets a moveset for the provided <see cref="PKM"/> data.
|
/// Gets a moveset for the provided <see cref="PKM"/> data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pkm">PKM to generate for</param>
|
/// <param name="pkm">PKM to generate for</param>
|
||||||
/// <param name="random">Full movepool & shuffling</param>
|
|
||||||
/// <param name="la">Precomputed optional</param>
|
/// <param name="la">Precomputed optional</param>
|
||||||
|
/// <param name="random">Full movepool & shuffling</param>
|
||||||
/// <returns>4 moves</returns>
|
/// <returns>4 moves</returns>
|
||||||
public static int[] GetMoveSet(this PKM pkm, LegalityAnalysis la, bool random = false)
|
public static int[] GetMoveSet(this PKM pkm, LegalityAnalysis la, bool random = false)
|
||||||
{
|
{
|
||||||
|
@ -638,8 +639,8 @@ namespace PKHeX.Core
|
||||||
if (m == null)
|
if (m == null)
|
||||||
return pkm.Moves;
|
return pkm.Moves;
|
||||||
|
|
||||||
if (!m.All(z => la.AllSuggestedMovesAndRelearn.Contains(z)))
|
if (!m.All(z => la.AllSuggestedMovesAndRelearn().Contains(z)))
|
||||||
m = m.Intersect(la.AllSuggestedMovesAndRelearn).ToArray();
|
m = m.Intersect(la.AllSuggestedMovesAndRelearn()).ToArray();
|
||||||
|
|
||||||
if (random)
|
if (random)
|
||||||
Util.Shuffle(m);
|
Util.Shuffle(m);
|
||||||
|
|
|
@ -163,6 +163,7 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private void ParseLines(IEnumerable<string> lines)
|
private void ParseLines(IEnumerable<string> lines)
|
||||||
{
|
{
|
||||||
|
// ReSharper disable once GenericEnumeratorNotDisposed
|
||||||
using var e = lines.GetEnumerator();
|
using var e = lines.GetEnumerator();
|
||||||
if (!e.MoveNext())
|
if (!e.MoveNext())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -96,7 +96,6 @@ namespace PKHeX.Core
|
||||||
return met_list;
|
return met_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static List<ComboItem> CreateGen3CXD(GameStrings s)
|
private static List<ComboItem> CreateGen3CXD(GameStrings s)
|
||||||
{
|
{
|
||||||
return Util.GetCBList(s.metCXD_00000, Enumerable.Range(0, s.metCXD_00000.Length).ToArray()).Where(c => c.Text.Length > 0).ToList();
|
return Util.GetCBList(s.metCXD_00000, Enumerable.Range(0, s.metCXD_00000.Length).ToArray()).Where(c => c.Text.Length > 0).ToList();
|
||||||
|
@ -113,6 +112,7 @@ namespace PKHeX.Core
|
||||||
Util.AddCBWithOffset(met_list, s.metHGSS_03000, 3000, Legal.Met_HGSS_3);
|
Util.AddCBWithOffset(met_list, s.metHGSS_03000, 3000, Legal.Met_HGSS_3);
|
||||||
return met_list;
|
return met_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ComboItem> CreateGen5(GameStrings s)
|
private static List<ComboItem> CreateGen5(GameStrings s)
|
||||||
{
|
{
|
||||||
var met_list = Util.GetCBList(s.metBW2_00000, 0);
|
var met_list = Util.GetCBList(s.metBW2_00000, 0);
|
||||||
|
|
|
@ -79,25 +79,25 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Country string for a given Country ID
|
/// Gets the Country string for a given Country ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="country">Country ID</param>
|
|
||||||
/// <param name="language">Language ID</param>
|
/// <param name="language">Language ID</param>
|
||||||
|
/// <param name="country">Country ID</param>
|
||||||
/// <returns>Country ID string</returns>
|
/// <returns>Country ID string</returns>
|
||||||
public static string GetCountryName(string language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
public static string GetCountryName(string language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Region string for a specified country ID.
|
/// Gets the Region string for a specified country ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="language">Language ID</param>
|
||||||
/// <param name="country">Country ID</param>
|
/// <param name="country">Country ID</param>
|
||||||
/// <param name="region">Region ID</param>
|
/// <param name="region">Region ID</param>
|
||||||
/// <param name="language">Language ID</param>
|
|
||||||
/// <returns>Region ID string</returns>
|
/// <returns>Region ID string</returns>
|
||||||
public static string GetRegionName(string language, int country, int region) => GetRegionName(country, region, GetLanguageIndex(language));
|
public static string GetRegionName(string language, int country, int region) => GetRegionName(country, region, GetLanguageIndex(language));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Country string for a given Country ID
|
/// Gets the Country string for a given Country ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="country">Country ID</param>
|
|
||||||
/// <param name="language">Language ID</param>
|
/// <param name="language">Language ID</param>
|
||||||
|
/// <param name="country">Country ID</param>
|
||||||
/// <returns>Country ID string</returns>
|
/// <returns>Country ID string</returns>
|
||||||
public static string GetCountryName(LanguageID language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
public static string GetCountryName(LanguageID language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[]? _allSuggestedMoves, _allSuggestedRelearnMoves;
|
private int[]? _allSuggestedMoves, _allSuggestedRelearnMoves;
|
||||||
public int[] AllSuggestedMovesAndRelearn => AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray();
|
public int[] AllSuggestedMovesAndRelearn() => AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray();
|
||||||
|
|
||||||
private string EncounterName
|
private string EncounterName
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,7 +206,6 @@ namespace PKHeX.Core
|
||||||
if (eggMysteryCurrent != eggMysteryPrevious)
|
if (eggMysteryCurrent != eggMysteryPrevious)
|
||||||
{
|
{
|
||||||
AddLine(pa.pkm, ca.pkm, "EC sharing across RNG encounters detected.", ident);
|
AddLine(pa.pkm, ca.pkm, "EC sharing across RNG encounters detected.", ident);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +235,6 @@ namespace PKHeX.Core
|
||||||
if (eggMysteryCurrent != eggMysteryPrevious)
|
if (eggMysteryCurrent != eggMysteryPrevious)
|
||||||
{
|
{
|
||||||
AddLine(pa.pkm, ca.pkm, "PID sharing across RNG encounters detected.", ident);
|
AddLine(pa.pkm, ca.pkm, "PID sharing across RNG encounters detected.", ident);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private static HashSet<WB7> GetWB7DB(byte[] wc7full) => new HashSet<WB7>(ArrayUtil.EnumerateSplit(wc7full, WB7.SizeFull).Select(d => new WB7(d)));
|
private static HashSet<WB7> GetWB7DB(byte[] wc7full) => new HashSet<WB7>(ArrayUtil.EnumerateSplit(wc7full, WB7.SizeFull).Select(d => new WB7(d)));
|
||||||
|
|
||||||
|
|
||||||
public static void RefreshMGDB(params string[] paths)
|
public static void RefreshMGDB(params string[] paths)
|
||||||
{
|
{
|
||||||
var g4 = GetPCDDB(Util.GetBinaryResource("wc4.pkl"));
|
var g4 = GetPCDDB(Util.GetBinaryResource("wc4.pkl"));
|
||||||
|
|
|
@ -24,10 +24,11 @@ namespace PKHeX.Core
|
||||||
TutorMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Machine: false, MoveReminder: false, RemoveTransferHM: false);
|
TutorMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Machine: false, MoveReminder: false, RemoveTransferHM: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidEncounterMoves(List<int>[] levelup)
|
public ValidEncounterMoves(IReadOnlyList<int>[] levelup)
|
||||||
{
|
{
|
||||||
LevelUpMoves = levelup;
|
LevelUpMoves = levelup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidEncounterMoves()
|
public ValidEncounterMoves()
|
||||||
{
|
{
|
||||||
LevelUpMoves = Array.Empty<int[]>();
|
LevelUpMoves = Array.Empty<int[]>();
|
||||||
|
|
|
@ -74,12 +74,10 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private static bool CanVersionRecieveGift(int format, int version4bit, int version)
|
private static bool CanVersionRecieveGift(int format, int version4bit, int version)
|
||||||
{
|
{
|
||||||
switch (format)
|
return format switch
|
||||||
{
|
{
|
||||||
// todo
|
_ => false
|
||||||
default:
|
};
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CurrentOTMatchesReplaced(int format, string pkOtName)
|
private static bool CurrentOTMatchesReplaced(int format, string pkOtName)
|
||||||
|
@ -97,12 +95,10 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private static bool IsMatchName(string pkOtName, int generation)
|
private static bool IsMatchName(string pkOtName, int generation)
|
||||||
{
|
{
|
||||||
switch (generation)
|
return generation switch
|
||||||
{
|
{
|
||||||
// todo
|
_ => false
|
||||||
default:
|
};
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,17 +95,15 @@ namespace PKHeX.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BugContest = 1 << 15,
|
BugContest = 1 << 15,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Slot is encountered via the Bug Catching Contest.
|
||||||
|
/// </summary>
|
||||||
|
GoPark = 1 << 16,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Slot is encountered in the Safari Zone.
|
/// Slot is encountered in the Safari Zone.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Safari = 1 << 16, // always used as a modifier to another slot type
|
Safari = 1 << 30, // always used as a modifier to another slot type
|
||||||
|
|
||||||
Rough_Terrain = 1 << 17,
|
|
||||||
Yellow_Flowers = 1 << 18,
|
|
||||||
Purple_Flowers = 1 << 19,
|
|
||||||
Red_Flowers = 1 << 20,
|
|
||||||
|
|
||||||
GoPark = 1 << 21,
|
|
||||||
|
|
||||||
// Combined
|
// Combined
|
||||||
Headbutt_Special = Headbutt | Special,
|
Headbutt_Special = Headbutt | Special,
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
public readonly LeadRequired Lead;
|
public readonly LeadRequired Lead;
|
||||||
|
|
||||||
private readonly FrameType FrameType;
|
private readonly FrameType FrameType;
|
||||||
private readonly RNG RNG;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starting seed for the frame (to generate the frame).
|
/// Starting seed for the frame (to generate the frame).
|
||||||
|
@ -28,12 +27,11 @@
|
||||||
|
|
||||||
public bool LevelSlotModified => Lead.IsLevelOrSlotModified() || (Lead & LeadRequired.UsesLevelCall) != 0;
|
public bool LevelSlotModified => Lead.IsLevelOrSlotModified() || (Lead & LeadRequired.UsesLevelCall) != 0;
|
||||||
|
|
||||||
public Frame(uint seed, FrameType type, RNG rng, LeadRequired lead)
|
public Frame(uint seed, FrameType type, LeadRequired lead)
|
||||||
{
|
{
|
||||||
Seed = seed;
|
Seed = seed;
|
||||||
Lead = lead;
|
Lead = lead;
|
||||||
FrameType = type;
|
FrameType = type;
|
||||||
RNG = rng;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PKHeX.Core
|
namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generator class for Gen3/4 Frame patterns
|
||||||
|
/// </summary>
|
||||||
public sealed class FrameGenerator
|
public sealed class FrameGenerator
|
||||||
{
|
{
|
||||||
public uint Nature;
|
public uint Nature;
|
||||||
|
@ -11,13 +14,13 @@ namespace PKHeX.Core
|
||||||
public readonly bool DPPt;
|
public readonly bool DPPt;
|
||||||
public readonly bool AllowLeads;
|
public readonly bool AllowLeads;
|
||||||
public readonly FrameType FrameType = FrameType.None;
|
public readonly FrameType FrameType = FrameType.None;
|
||||||
public readonly RNG RNG;
|
public readonly RNG RNG = RNG.LCRNG;
|
||||||
public readonly bool Safari3;
|
public readonly bool Safari3;
|
||||||
|
|
||||||
public Frame GetFrame(uint seed, LeadRequired lead) => new Frame(seed, FrameType, RNG, lead);
|
public Frame GetFrame(uint seed, LeadRequired lead) => new Frame(seed, FrameType, lead);
|
||||||
public Frame GetFrame(uint seed, LeadRequired lead, uint esv, uint origin) => GetFrame(seed, lead, esv, esv, origin);
|
public Frame GetFrame(uint seed, LeadRequired lead, uint esv, uint origin) => GetFrame(seed, lead, esv, esv, origin);
|
||||||
|
|
||||||
public Frame GetFrame(uint seed, LeadRequired lead, uint esv, uint lvl, uint origin) => new Frame(seed, FrameType, RNG, lead)
|
public Frame GetFrame(uint seed, LeadRequired lead, uint esv, uint lvl, uint origin) => new Frame(seed, FrameType, lead)
|
||||||
{
|
{
|
||||||
RandESV = esv,
|
RandESV = esv,
|
||||||
RandLevel = lvl,
|
RandLevel = lvl,
|
||||||
|
@ -31,7 +34,6 @@ namespace PKHeX.Core
|
||||||
/// <returns>Object containing search criteria to be passed by reference to search/filter methods.</returns>
|
/// <returns>Object containing search criteria to be passed by reference to search/filter methods.</returns>
|
||||||
public FrameGenerator(PKM pk)
|
public FrameGenerator(PKM pk)
|
||||||
{
|
{
|
||||||
RNG = RNG.LCRNG;
|
|
||||||
var ver = (GameVersion)pk.Version;
|
var ver = (GameVersion)pk.Version;
|
||||||
switch (ver)
|
switch (ver)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +71,6 @@ namespace PKHeX.Core
|
||||||
DPPt = true;
|
DPPt = true;
|
||||||
AllowLeads = true;
|
AllowLeads = true;
|
||||||
FrameType = FrameType.MethodJ;
|
FrameType = FrameType.MethodJ;
|
||||||
RNG = RNG.LCRNG;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Method K
|
// Method K
|
||||||
|
@ -78,7 +79,6 @@ namespace PKHeX.Core
|
||||||
DPPt = false;
|
DPPt = false;
|
||||||
AllowLeads = true;
|
AllowLeads = true;
|
||||||
FrameType = FrameType.MethodK;
|
FrameType = FrameType.MethodK;
|
||||||
RNG = RNG.LCRNG;
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException(nameof(ver));
|
throw new ArgumentException(nameof(ver));
|
||||||
|
|
|
@ -27,12 +27,11 @@ namespace PKHeX.Core
|
||||||
PressureHustleSpiritFail = PressureHustleSpirit | Fail,
|
PressureHustleSpiritFail = PressureHustleSpirit | Fail,
|
||||||
|
|
||||||
AllFlags = UsesLevelCall | Fail,
|
AllFlags = UsesLevelCall | Fail,
|
||||||
NoFlags = ~AllFlags,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static partial class Extensions
|
public static partial class Extensions
|
||||||
{
|
{
|
||||||
internal static bool IsLevelOrSlotModified(this LeadRequired Lead) => Lead.RemoveFlags() > LeadRequired.Synchronize;
|
internal static bool IsLevelOrSlotModified(this LeadRequired Lead) => Lead.RemoveFlags() > LeadRequired.Synchronize;
|
||||||
internal static LeadRequired RemoveFlags(this LeadRequired Lead) => Lead & LeadRequired.NoFlags;
|
internal static LeadRequired RemoveFlags(this LeadRequired Lead) => Lead & ~LeadRequired.AllFlags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ namespace PKHeX.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class MethodFinder
|
public static class MethodFinder
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Analyzes a <see cref="PKM"/> to find a matching PIDIV method.
|
/// Analyzes a <see cref="PKM"/> to find a matching PIDIV method.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
// ReSharper disable RedundantEmptyObjectOrCollectionInitializer todo
|
||||||
|
|
||||||
namespace PKHeX.Core
|
namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
|
@ -105,7 +106,7 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
internal static readonly HashSet<int> TransferrableGalar = new HashSet<int>
|
internal static readonly HashSet<int> TransferrableGalar = new HashSet<int>()
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using static PKHeX.Core.LegalityCheckStrings;
|
||||||
using static PKHeX.Core.LegalityCheckStrings;
|
|
||||||
|
|
||||||
namespace PKHeX.Core
|
namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
public override void Verify(LegalityAnalysis data)
|
public override void Verify(LegalityAnalysis data)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new Exception("Don't call via this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VerifyTransferLegalityG12(LegalityAnalysis data)
|
public void VerifyTransferLegalityG12(LegalityAnalysis data)
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace PKHeX.Core
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a deep copy of the <see cref="MysteryGift"/> object data.
|
/// Creates a deep copy of the <see cref="MysteryGift"/> object data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -175,7 +174,7 @@ namespace PKHeX.Core
|
||||||
public virtual int BeanCount { get => 0; set { } }
|
public virtual int BeanCount { get => 0; set { } }
|
||||||
|
|
||||||
public virtual string CardHeader => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";
|
public virtual string CardHeader => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";
|
||||||
|
|
||||||
// Search Properties
|
// Search Properties
|
||||||
public virtual int[] Moves { get => Array.Empty<int>(); set { } }
|
public virtual int[] Moves { get => Array.Empty<int>(); set { } }
|
||||||
public virtual int[] RelearnMoves { get => Array.Empty<int>(); set { } }
|
public virtual int[] RelearnMoves { get => Array.Empty<int>(); set { } }
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace PKHeX.Core
|
namespace PKHeX.Core
|
||||||
|
@ -248,9 +247,5 @@ namespace PKHeX.Core
|
||||||
if (value.Length > 3) RelearnMove4 = value[3];
|
if (value.Length > 3) RelearnMove4 = value[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EggEncounter => IsEgg;
|
|
||||||
|
|
||||||
public string Name => "Pokémon Link";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -432,8 +432,10 @@ namespace PKHeX.Core
|
||||||
if (IsUntraded)
|
if (IsUntraded)
|
||||||
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
|
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
|
||||||
if (GenNumber < 6)
|
if (GenNumber < 6)
|
||||||
|
{
|
||||||
/* OT_Affection = */
|
/* OT_Affection = */
|
||||||
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
|
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this.SanitizeGeoLocationData();
|
this.SanitizeGeoLocationData();
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace PKHeX.Core
|
||||||
private int StringLength => Japanese ? STRLEN_J : STRLEN_U;
|
private int StringLength => Japanese ? STRLEN_J : STRLEN_U;
|
||||||
public override bool Japanese => otname.Length == STRLEN_J;
|
public override bool Japanese => otname.Length == STRLEN_J;
|
||||||
public override byte[] Data { get; }
|
public override byte[] Data { get; }
|
||||||
|
|
||||||
protected _K12(byte[] data, bool jp = false)
|
protected _K12(byte[] data, bool jp = false)
|
||||||
{
|
{
|
||||||
int partySize = SIZE_PARTY;
|
int partySize = SIZE_PARTY;
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace PKHeX.Core
|
||||||
{0xB7, 'x'},
|
{0xB7, 'x'},
|
||||||
{0xB8, 'y'},
|
{0xB8, 'y'},
|
||||||
{0xB9, 'z'},
|
{0xB9, 'z'},
|
||||||
|
|
||||||
// unused characters
|
// unused characters
|
||||||
{0xBA, 'à'},
|
{0xBA, 'à'},
|
||||||
{0xBB, 'è'},
|
{0xBB, 'è'},
|
||||||
|
@ -516,7 +516,7 @@ namespace PKHeX.Core
|
||||||
{'x', 0xB7},
|
{'x', 0xB7},
|
||||||
{'y', 0xB8},
|
{'y', 0xB8},
|
||||||
{'z', 0xB9},
|
{'z', 0xB9},
|
||||||
|
|
||||||
// unused characters
|
// unused characters
|
||||||
{'à', 0xBA},
|
{'à', 0xBA},
|
||||||
{'è', 0xBB},
|
{'è', 0xBB},
|
||||||
|
|
|
@ -695,31 +695,29 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private static string[] GetFormsUnown(int generation)
|
private static string[] GetFormsUnown(int generation)
|
||||||
{
|
{
|
||||||
switch (generation)
|
return generation switch
|
||||||
{
|
{
|
||||||
case 2:
|
2 => new[]
|
||||||
return new[]
|
{
|
||||||
{
|
"A", "B", "C", "D", "E",
|
||||||
"A", "B", "C", "D", "E",
|
"F", "G", "H", "I", "J",
|
||||||
"F", "G", "H", "I", "J",
|
"K", "L", "M", "N", "O",
|
||||||
"K", "L", "M", "N", "O",
|
"P", "Q", "R", "S", "T",
|
||||||
"P", "Q", "R", "S", "T",
|
"U", "V", "W", "X", "Y",
|
||||||
"U", "V", "W", "X", "Y",
|
"Z",
|
||||||
"Z",
|
// "!", "?", not in Gen II
|
||||||
// "!", "?", not in Gen II
|
},
|
||||||
};
|
_ => new[]
|
||||||
default:
|
{
|
||||||
return new[]
|
"A", "B", "C", "D", "E",
|
||||||
{
|
"F", "G", "H", "I", "J",
|
||||||
"A", "B", "C", "D", "E",
|
"K", "L", "M", "N", "O",
|
||||||
"F", "G", "H", "I", "J",
|
"P", "Q", "R", "S", "T",
|
||||||
"K", "L", "M", "N", "O",
|
"U", "V", "W", "X", "Y",
|
||||||
"P", "Q", "R", "S", "T",
|
"Z",
|
||||||
"U", "V", "W", "X", "Y",
|
"!", "?",
|
||||||
"Z",
|
}
|
||||||
"!", "?",
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsFormListSingleMega(int species) => Mega_6_Single.Contains(species);
|
private static bool IsFormListSingleMega(int species) => Mega_6_Single.Contains(species);
|
||||||
|
|
|
@ -118,9 +118,9 @@ namespace PKHeX.Core
|
||||||
offset += (StringLength * 2) + 0x20; // nick/ot/pkm
|
offset += (StringLength * 2) + 0x20; // nick/ot/pkm
|
||||||
DaycareFlags[1] = Data[offset];
|
DaycareFlags[1] = Data[offset];
|
||||||
offset++;
|
offset++;
|
||||||
byte steps = Data[offset];
|
//byte steps = Data[offset];
|
||||||
offset++;
|
offset++;
|
||||||
byte BreedMotherOrNonDitto = Data[offset];
|
//byte BreedMotherOrNonDitto = Data[offset];
|
||||||
offset++;
|
offset++;
|
||||||
var pk2 = ReadPKMFromOffset(offset); // parent 2
|
var pk2 = ReadPKMFromOffset(offset); // parent 2
|
||||||
var daycare2 = new PokeList2(pk2);
|
var daycare2 = new PokeList2(pk2);
|
||||||
|
@ -319,7 +319,11 @@ namespace PKHeX.Core
|
||||||
set => SetString(value, (Korean ? 2 : 1) * OTLength).CopyTo(Data, Offsets.Trainer1 + 2);
|
set => SetString(value, (Korean ? 2 : 1) * OTLength).CopyTo(Data, Offsets.Trainer1 + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] OT_Trash { get => GetData(Offsets.Trainer1 + 2, StringLength); set { if (value?.Length == StringLength) SetData(value, Offsets.Trainer1 + 2); } }
|
public byte[] OT_Trash
|
||||||
|
{
|
||||||
|
get => GetData(Offsets.Trainer1 + 2, StringLength);
|
||||||
|
set { if (value?.Length == StringLength) SetData(value, Offsets.Trainer1 + 2); }
|
||||||
|
}
|
||||||
|
|
||||||
public override int Gender
|
public override int Gender
|
||||||
{
|
{
|
||||||
|
@ -335,7 +339,8 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
public override int TID
|
public override int TID
|
||||||
{
|
{
|
||||||
get => BigEndian.ToUInt16(Data, Offsets.Trainer1); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, Offsets.Trainer1);
|
get => BigEndian.ToUInt16(Data, Offsets.Trainer1);
|
||||||
|
set => BigEndian.GetBytes((ushort)value).CopyTo(Data, Offsets.Trainer1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int SID { get => 0; set { } }
|
public override int SID { get => 0; set { } }
|
||||||
|
@ -448,10 +453,10 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ushort[] LegalItems => Legal.Pouch_Items_GSC;
|
private static ushort[] LegalItems => Legal.Pouch_Items_GSC;
|
||||||
private ushort[] LegalKeyItems => Legal.Pouch_Ball_GSC;
|
private static ushort[] LegalKeyItems => Legal.Pouch_Ball_GSC;
|
||||||
private ushort[] LegalBalls => Version == GameVersion.C ? Legal.Pouch_Key_C : Legal.Pouch_Key_GS;
|
private ushort[] LegalBalls => Version == GameVersion.C ? Legal.Pouch_Key_C : Legal.Pouch_Key_GS;
|
||||||
private ushort[] LegalTMHMs => Legal.Pouch_TMHM_GSC;
|
private static ushort[] LegalTMHMs => Legal.Pouch_TMHM_GSC;
|
||||||
|
|
||||||
public override InventoryPouch[] Inventory
|
public override InventoryPouch[] Inventory
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace PKHeX.Core
|
||||||
return chunkOffset;
|
return chunkOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PersonalTable _personal { get; set; }
|
private PersonalTable _personal;
|
||||||
public override PersonalTable Personal => _personal;
|
public override PersonalTable Personal => _personal;
|
||||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
||||||
|
|
||||||
|
@ -273,8 +273,8 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private int ActiveSAV;
|
private int ActiveSAV;
|
||||||
private int ABO => ActiveSAV*SIZE_BLOCK*0xE;
|
private int ABO => ActiveSAV*SIZE_BLOCK*0xE;
|
||||||
private int[] BlockOrder;
|
private readonly int[] BlockOrder;
|
||||||
private int[] BlockOfs;
|
private readonly int[] BlockOfs;
|
||||||
public int GetBlockOffset(int block) => BlockOfs[block];
|
public int GetBlockOffset(int block) => BlockOfs[block];
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
|
@ -402,12 +402,12 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
switch (Version)
|
return Version switch
|
||||||
{
|
{
|
||||||
case GameVersion.E: return BitConverter.ToUInt32(Data, BlockOfs[0] + 0xAC);
|
GameVersion.E => BitConverter.ToUInt32(Data, BlockOfs[0] + 0xAC),
|
||||||
case GameVersion.FRLG: return BitConverter.ToUInt32(Data, BlockOfs[0] + 0xF20);
|
GameVersion.FRLG => BitConverter.ToUInt32(Data, BlockOfs[0] + 0xF20),
|
||||||
default: return 0;
|
_ => 0u
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ namespace PKHeX.Core
|
||||||
public sealed class RTC3
|
public sealed class RTC3
|
||||||
{
|
{
|
||||||
public readonly byte[] Data;
|
public readonly byte[] Data;
|
||||||
private const int Size = 8;
|
public const int Size = 8;
|
||||||
|
|
||||||
public RTC3(byte[] data) => Data = data;
|
public RTC3(byte[] data) => Data = data;
|
||||||
|
|
||||||
|
@ -936,7 +936,7 @@ namespace PKHeX.Core
|
||||||
if (FRLG)
|
if (FRLG)
|
||||||
throw new ArgumentException(nameof(ClockInitial));
|
throw new ArgumentException(nameof(ClockInitial));
|
||||||
int block0 = GetBlockOffset(0);
|
int block0 = GetBlockOffset(0);
|
||||||
return new RTC3(GetData(block0 + 0x98, 8));
|
return new RTC3(GetData(block0 + 0x98, RTC3.Size));
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -954,7 +954,7 @@ namespace PKHeX.Core
|
||||||
if (FRLG)
|
if (FRLG)
|
||||||
throw new ArgumentException(nameof(ClockElapsed));
|
throw new ArgumentException(nameof(ClockElapsed));
|
||||||
int block0 = GetBlockOffset(0);
|
int block0 = GetBlockOffset(0);
|
||||||
return new RTC3(GetData(block0 + 0xA0, 8));
|
return new RTC3(GetData(block0 + 0xA0, RTC3.Size));
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace PKHeX.Core
|
||||||
private int SaveCount = -1;
|
private int SaveCount = -1;
|
||||||
private int SaveIndex = -1;
|
private int SaveIndex = -1;
|
||||||
private readonly StrategyMemo StrategyMemo;
|
private readonly StrategyMemo StrategyMemo;
|
||||||
public int MaxShadowID => 0x80; // 128
|
public const int MaxShadowID = 0x80; // 128
|
||||||
private int Memo;
|
private int Memo;
|
||||||
public SAV3Colosseum(byte[] data, SAV3GCMemoryCard MC) : this(data, MC.Data) { this.MC = MC; }
|
public SAV3Colosseum(byte[] data, SAV3GCMemoryCard MC) : this(data, MC.Data) { this.MC = MC; }
|
||||||
public SAV3Colosseum(byte[] data) : this(data, (byte[])data.Clone()) { }
|
public SAV3Colosseum(byte[] data) : this(data, (byte[])data.Clone()) { }
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace PKHeX.Core
|
||||||
protected int AdventureInfo = int.MinValue;
|
protected int AdventureInfo = int.MinValue;
|
||||||
protected int Seal = int.MinValue;
|
protected int Seal = int.MinValue;
|
||||||
public int GTS { get; protected set; } = int.MinValue;
|
public int GTS { get; protected set; } = int.MinValue;
|
||||||
|
|
||||||
// Storage
|
// Storage
|
||||||
public override int PartyCount
|
public override int PartyCount
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace PKHeX.Core
|
||||||
Storage[GetBoxWallpaperOffset(box)] = (byte)value;
|
Storage[GetBoxWallpaperOffset(box)] = (byte)value;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override InventoryPouch[] Inventory
|
public override InventoryPouch[] Inventory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
Edited = true;
|
Edited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override GameVersion Version
|
public override GameVersion Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -169,7 +169,7 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
protected override bool[] MysteryGiftReceivedFlags { get => Blocks.MysteryGift.MysteryGiftReceivedFlags; set => Blocks.MysteryGift.MysteryGiftReceivedFlags = value; }
|
protected override bool[] MysteryGiftReceivedFlags { get => Blocks.MysteryGift.MysteryGiftReceivedFlags; set => Blocks.MysteryGift.MysteryGiftReceivedFlags = value; }
|
||||||
protected override DataMysteryGift[] MysteryGiftCards { get => Blocks.MysteryGift.MysteryGiftCards; set => Blocks.MysteryGift.MysteryGiftCards = value; }
|
protected override DataMysteryGift[] MysteryGiftCards { get => Blocks.MysteryGift.MysteryGiftCards; set => Blocks.MysteryGift.MysteryGiftCards = value; }
|
||||||
|
|
||||||
public override bool GetCaught(int species) => Blocks.Zukan.GetCaught(species);
|
public override bool GetCaught(int species) => Blocks.Zukan.GetCaught(species);
|
||||||
public override bool GetSeen(int species) => Blocks.Zukan.GetSeen(species);
|
public override bool GetSeen(int species) => Blocks.Zukan.GetSeen(species);
|
||||||
public override void SetSeen(int species, bool seen) => Blocks.Zukan.SetSeen(species, seen);
|
public override void SetSeen(int species, bool seen) => Blocks.Zukan.SetSeen(species, seen);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PKHeX.Core
|
namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace PKHeX.Core
|
||||||
public sealed class BV6 : BattleVideo
|
public sealed class BV6 : BattleVideo
|
||||||
{
|
{
|
||||||
internal const int SIZE = 0x2E60;
|
internal const int SIZE = 0x2E60;
|
||||||
|
private const string NPC = "NPC";
|
||||||
|
private readonly byte[] Data;
|
||||||
|
|
||||||
internal new static bool IsValid(byte[] data)
|
internal new static bool IsValid(byte[] data)
|
||||||
{
|
{
|
||||||
|
@ -15,15 +17,8 @@ namespace PKHeX.Core
|
||||||
return BitConverter.ToUInt64(data, 0xE18) != 0 && BitConverter.ToUInt16(data, 0xE12) == 0;
|
return BitConverter.ToUInt64(data, 0xE18) != 0 && BitConverter.ToUInt16(data, 0xE12) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BV6(byte[] data)
|
public BV6(byte[] data) => Data = (byte[])data.Clone();
|
||||||
{
|
|
||||||
Data = (byte[])data.Clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly byte[] Data;
|
|
||||||
|
|
||||||
public int Mode { get => Data[0x00]; set => Data[0x00] = (byte)value; }
|
public int Mode { get => Data[0x00]; set => Data[0x00] = (byte)value; }
|
||||||
|
|
||||||
public int Style { get => Data[0x01]; set => Data[0x01] = (byte)value; }
|
public int Style { get => Data[0x01]; set => Data[0x01] = (byte)value; }
|
||||||
|
|
||||||
public string Debug1
|
public string Debug1
|
||||||
|
@ -51,8 +46,6 @@ namespace PKHeX.Core
|
||||||
public override PKM[] BattlePKMs => PlayerTeams.SelectMany(t => t).ToArray();
|
public override PKM[] BattlePKMs => PlayerTeams.SelectMany(t => t).ToArray();
|
||||||
public override int Generation => 6;
|
public override int Generation => 6;
|
||||||
|
|
||||||
private const string NPC = "NPC";
|
|
||||||
|
|
||||||
public string[] PlayerNames
|
public string[] PlayerNames
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -113,21 +106,21 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int MatchYear { get => BitConverter.ToUInt16(Data, 0x2E50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E50); }
|
public int MatchYear { get => BitConverter.ToUInt16(Data, 0x2E50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E50); }
|
||||||
private int MatchDay { get => Data[0x2E52]; set => Data[0x2E52] = (byte)value; }
|
public int MatchDay { get => Data[0x2E52]; set => Data[0x2E52] = (byte)value; }
|
||||||
private int MatchMonth { get => Data[0x2E53]; set => Data[0x2E53] = (byte)value; }
|
public int MatchMonth { get => Data[0x2E53]; set => Data[0x2E53] = (byte)value; }
|
||||||
private int MatchHour { get => Data[0x2E54]; set => Data[0x2E54] = (byte)value; }
|
public int MatchHour { get => Data[0x2E54]; set => Data[0x2E54] = (byte)value; }
|
||||||
private int MatchMinute { get => Data[0x2E55]; set => Data[0x2E55] = (byte)value; }
|
public int MatchMinute { get => Data[0x2E55]; set => Data[0x2E55] = (byte)value; }
|
||||||
private int MatchSecond { get => Data[0x2E56]; set => Data[0x2E56] = (byte)value; }
|
public int MatchSecond { get => Data[0x2E56]; set => Data[0x2E56] = (byte)value; }
|
||||||
private int MatchFlags { get => Data[0x2E57]; set => Data[0x2E57] = (byte)value; }
|
public int MatchFlags { get => Data[0x2E57]; set => Data[0x2E57] = (byte)value; }
|
||||||
|
|
||||||
private int UploadYear { get => BitConverter.ToUInt16(Data, 0x2E58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E58); }
|
public int UploadYear { get => BitConverter.ToUInt16(Data, 0x2E58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E58); }
|
||||||
private int UploadDay { get => Data[0x2E5A]; set => Data[0x2E5A] = (byte)value; }
|
public int UploadDay { get => Data[0x2E5A]; set => Data[0x2E5A] = (byte)value; }
|
||||||
private int UploadMonth { get => Data[0x2E5B]; set => Data[0x2E5B] = (byte)value; }
|
public int UploadMonth { get => Data[0x2E5B]; set => Data[0x2E5B] = (byte)value; }
|
||||||
private int UploadHour { get => Data[0x2E5C]; set => Data[0x2E5C] = (byte)value; }
|
public int UploadHour { get => Data[0x2E5C]; set => Data[0x2E5C] = (byte)value; }
|
||||||
private int UploadMinute { get => Data[0x2E5D]; set => Data[0x2E5D] = (byte)value; }
|
public int UploadMinute { get => Data[0x2E5D]; set => Data[0x2E5D] = (byte)value; }
|
||||||
private int UploadSecond { get => Data[0x2E5E]; set => Data[0x2E5E] = (byte)value; }
|
public int UploadSecond { get => Data[0x2E5E]; set => Data[0x2E5E] = (byte)value; }
|
||||||
private int UploadFlags { get => Data[0x2E5F]; set => Data[0x2E5F] = (byte)value; }
|
public int UploadFlags { get => Data[0x2E5F]; set => Data[0x2E5F] = (byte)value; }
|
||||||
|
|
||||||
public DateTime? MatchStamp
|
public DateTime? MatchStamp
|
||||||
{
|
{
|
||||||
|
@ -181,23 +174,68 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battle Instruction Parsing
|
private enum TurnAction
|
||||||
private static readonly string[] Action = { "0", "Fight", "2", "Switch", "Run", "5", "Rotate", "7", "MegaEvolve" };
|
|
||||||
|
|
||||||
private static readonly string[] Target =
|
|
||||||
{
|
{
|
||||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Opposite Enemy", "11", "12", "13",
|
None = 0,
|
||||||
"All except User", "Everyone"
|
Fight = 1,
|
||||||
};
|
Unk2 = 2,
|
||||||
|
Switch = 3,
|
||||||
|
Run = 4,
|
||||||
|
Unk5 = 5,
|
||||||
|
Rotate = 6,
|
||||||
|
Unk7 = 7,
|
||||||
|
MegaEvolve = 8,
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly string[] Rotate = { "0", "Right", "Left", "3" };
|
private enum TurnTarget
|
||||||
|
|
||||||
public static readonly string[] BVmode =
|
|
||||||
{
|
{
|
||||||
"Link", "Maison", "Super Maison", "Battle Spot - Free", "Battle Spot - Rating",
|
U0 = 0,
|
||||||
"Battle Spot - Special", "UNUSED", "JP-1", "JP-2", "BROKEN",
|
U1 = 1,
|
||||||
};
|
U2 = 2,
|
||||||
|
U3 = 3,
|
||||||
|
U4 = 4,
|
||||||
|
U5 = 5,
|
||||||
|
U6 = 6,
|
||||||
|
U7 = 7,
|
||||||
|
U8 = 8,
|
||||||
|
U9 = 9,
|
||||||
|
OppositeEnemy,
|
||||||
|
U11 = 11,
|
||||||
|
U12 = 12,
|
||||||
|
U13 = 13,
|
||||||
|
AllExceptUser = 14,
|
||||||
|
Everyone = 15,
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly string[] BVstyle = { "Single", "Double", "Triple", "Rotation", "Multi", };
|
private enum TurnRotate
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Right,
|
||||||
|
Left,
|
||||||
|
Unk3,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BVType
|
||||||
|
{
|
||||||
|
Link = 0,
|
||||||
|
Maison = 1,
|
||||||
|
SuperMaison = 2,
|
||||||
|
BattleSpotFree = 3,
|
||||||
|
BattleSpotRating = 4,
|
||||||
|
BattleSpotSpecial = 5,
|
||||||
|
UNUSED = 6,
|
||||||
|
JP1 = 7,
|
||||||
|
JP2 = 8,
|
||||||
|
BROKEN = 9,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BVStyle
|
||||||
|
{
|
||||||
|
Single = 0,
|
||||||
|
Double = 1,
|
||||||
|
Triple = 2,
|
||||||
|
Rotation = 3,
|
||||||
|
Multi = 4,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,22 @@
|
||||||
|
|
||||||
public struct TurnActionInstruction
|
public struct TurnActionInstruction
|
||||||
{
|
{
|
||||||
public int PlayerID;
|
public readonly int PlayerID;
|
||||||
public int Count;
|
public readonly int Count;
|
||||||
|
public readonly int Bit;
|
||||||
|
|
||||||
public TurnActionInstruction(byte Op)
|
public TurnActionInstruction(byte Op)
|
||||||
{
|
{
|
||||||
PlayerID = Op >> 5;
|
PlayerID = Op >> 5;
|
||||||
|
Bit = (Op >> 4) & 1;
|
||||||
Count = Op & 0xF;
|
Count = Op & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte GetRawValue => (byte)((Count & 0xF) | ((byte)Bit << 4) | (PlayerID << 5));
|
||||||
|
|
||||||
|
public override bool Equals(object obj) => obj is TurnStartInstruction t && t.GetRawValue == GetRawValue;
|
||||||
|
public override int GetHashCode() => GetRawValue;
|
||||||
|
public static bool operator ==(TurnActionInstruction left, TurnActionInstruction right) => left.Equals(right);
|
||||||
|
public static bool operator !=(TurnActionInstruction left, TurnActionInstruction right) => !(left == right);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,5 +10,12 @@
|
||||||
TurnCode = (TurnStartCode)(Op >> 4);
|
TurnCode = (TurnStartCode)(Op >> 4);
|
||||||
Count = Op & 0xF;
|
Count = Op & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte GetRawValue => (byte) ((Count & 0xF) | ((byte) TurnCode << 4));
|
||||||
|
|
||||||
|
public override bool Equals(object obj) => obj is TurnStartInstruction t && t.GetRawValue == GetRawValue;
|
||||||
|
public override int GetHashCode() => GetRawValue;
|
||||||
|
public static bool operator ==(TurnStartInstruction left, TurnStartInstruction right) => left.Equals(right);
|
||||||
|
public static bool operator !=(TurnStartInstruction left, TurnStartInstruction right) => !(left == right);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,7 +79,6 @@ namespace PKHeX.Core
|
||||||
SAV.EventSpawnFlags = SpawnFlags;
|
SAV.EventSpawnFlags = SpawnFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<FlagPairG1Detail> GetFlagPairs()
|
public IEnumerable<FlagPairG1Detail> GetFlagPairs()
|
||||||
{
|
{
|
||||||
var pz = ReflectUtil.GetPropertiesStartWithPrefix(GetType(), "Flag");
|
var pz = ReflectUtil.GetPropertiesStartWithPrefix(GetType(), "Flag");
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
private const int MaxReceivedFlag = 2048;
|
private const int MaxReceivedFlag = 2048;
|
||||||
private const int MaxCardsPresent = 12;
|
private const int MaxCardsPresent = 12;
|
||||||
private const int FlagRegionSize = (MaxReceivedFlag / 8); // 0x100
|
private const int FlagRegionSize = (MaxReceivedFlag / 8); // 0x100
|
||||||
private const int CardStart = FlagStart + (MaxReceivedFlag / 8);
|
private const int CardStart = FlagStart + FlagRegionSize;
|
||||||
|
|
||||||
private const int DataSize = 0xA90;
|
private const int DataSize = 0xA90;
|
||||||
private int SeedOffset => Offset + DataSize;
|
private int SeedOffset => Offset + DataSize;
|
||||||
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
||||||
for (int i = 0; i < Info.Gifts.Length; i++)
|
for (int i = 0; i < Info.Gifts.Length; i++)
|
||||||
{
|
{
|
||||||
var data = new byte[PGF.Size];
|
var data = new byte[PGF.Size];
|
||||||
Array.Copy(wcData, FlagRegionSize + (i * PGF.Size), data, 0, PGF.Size);
|
Array.Copy(wcData, CardStart + (i * PGF.Size), data, 0, PGF.Size);
|
||||||
Info.Gifts[i] = new PGF(data);
|
Info.Gifts[i] = new PGF(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < value.Gifts.Length; i++)
|
for (int i = 0; i < value.Gifts.Length; i++)
|
||||||
value.Gifts[i].Data.CopyTo(wcData, 0x100 + (i * PGF.Size));
|
value.Gifts[i].Data.CopyTo(wcData, CardStart + (i * PGF.Size));
|
||||||
|
|
||||||
// Decrypted, Encrypt
|
// Decrypted, Encrypt
|
||||||
PKX.CryptArray(wcData, value.Seed);
|
PKX.CryptArray(wcData, value.Seed);
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace PKHeX.Core
|
||||||
set => Data[Offset + 7] = (byte)value;
|
set => Data[Offset + 7] = (byte)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GameSyncIDSize => 16; // 64 bits
|
public const int GameSyncIDSize = 16; // 64 bits
|
||||||
|
|
||||||
public string GameSyncID
|
public string GameSyncID
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
public string OT_Nick
|
public string OT_Nick
|
||||||
{
|
{
|
||||||
get => SAV.GetString(Offset + 0x62, SAV6XY.ShortStringLength / 2);
|
get => SAV.GetString(Offset + 0x62, SAV6.ShortStringLength / 2);
|
||||||
set => SAV.SetData(SAV.SetString(value, SAV6XY.ShortStringLength / 2), Offset + 0x62);
|
set => SAV.SetData(SAV.SetString(value, SAV6.ShortStringLength / 2), Offset + 0x62);
|
||||||
}
|
}
|
||||||
|
|
||||||
public short EyeColor
|
public short EyeColor
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace PKHeX.Core
|
||||||
public F6HairStyle Hair { get => (F6HairStyle)GetBits(data0, 19, 4); set => data0 = SetBits(data0, 19, 4, (uint)value); }
|
public F6HairStyle Hair { get => (F6HairStyle)GetBits(data0, 19, 4); set => data0 = SetBits(data0, 19, 4, (uint)value); }
|
||||||
public uint Face { get => GetBits(data0, 23, 3); set => data0 = SetBits(data0, 23, 3, value); }
|
public uint Face { get => GetBits(data0, 23, 3); set => data0 = SetBits(data0, 23, 3, value); }
|
||||||
public uint Arms { get => GetBits(data0, 26, 2); set => data0 = SetBits(data0, 26, 2, value); }
|
public uint Arms { get => GetBits(data0, 26, 2); set => data0 = SetBits(data0, 26, 2, value); }
|
||||||
public uint _0 { get => GetBits(data0, 28, 2); set => data0 = SetBits(data0, 28, 2, value); }
|
public uint Unknown0 { get => GetBits(data0, 28, 2); set => data0 = SetBits(data0, 28, 2, value); }
|
||||||
public uint Unused0 { get => GetBits(data0, 30, 2); set => data0 = SetBits(data0, 30, 2, value); }
|
public uint Unused0 { get => GetBits(data0, 30, 2); set => data0 = SetBits(data0, 30, 2, value); }
|
||||||
|
|
||||||
public F6Top Top { get => (F6Top)GetBits(data1, 0, 6); set => data1 = SetBits(data1, 0, 6, (uint)value); }
|
public F6Top Top { get => (F6Top)GetBits(data1, 0, 6); set => data1 = SetBits(data1, 0, 6, (uint)value); }
|
||||||
|
@ -95,7 +95,7 @@ namespace PKHeX.Core
|
||||||
public F6Shoes Shoes { get => (F6Shoes)GetBits(data1, 14, 5); set => data1 = SetBits(data1, 14, 5, (uint)value); }
|
public F6Shoes Shoes { get => (F6Shoes)GetBits(data1, 14, 5); set => data1 = SetBits(data1, 14, 5, (uint)value); }
|
||||||
public F6Bag Bag { get => (F6Bag)GetBits(data1, 19, 4); set => data1 = SetBits(data1, 19, 4, (uint)value); }
|
public F6Bag Bag { get => (F6Bag)GetBits(data1, 19, 4); set => data1 = SetBits(data1, 19, 4, (uint)value); }
|
||||||
public F6Accessory AHat { get => (F6Accessory)GetBits(data1, 23, 4); set => data1 = SetBits(data1, 23, 4, (uint)value); }
|
public F6Accessory AHat { get => (F6Accessory)GetBits(data1, 23, 4); set => data1 = SetBits(data1, 23, 4, (uint)value); }
|
||||||
public uint _1 { get => GetBits(data1, 27, 2); set => data1 = SetBits(data1, 27, 2, value); }
|
public uint Unknown1 { get => GetBits(data1, 27, 2); set => data1 = SetBits(data1, 27, 2, value); }
|
||||||
public uint Unused1 { get => GetBits(data1, 29, 3); set => data1 = SetBits(data1, 29, 3, value); }
|
public uint Unused1 { get => GetBits(data1, 29, 3); set => data1 = SetBits(data1, 29, 3, value); }
|
||||||
|
|
||||||
public bool Contacts { get => GetBits(data2, 0, 1) == 1; set => data2 = SetBits(data2, 0, 1, value ? 1u : 0); }
|
public bool Contacts { get => GetBits(data2, 0, 1) == 1; set => data2 = SetBits(data2, 0, 1, value ? 1u : 0); }
|
||||||
|
@ -286,7 +286,7 @@ namespace PKHeX.Core
|
||||||
public F6HairStyle Hair { get => (F6HairStyle)GetBits(data0, 20, 4); set => data0 = SetBits(data0, 20, 4, (uint)value); }
|
public F6HairStyle Hair { get => (F6HairStyle)GetBits(data0, 20, 4); set => data0 = SetBits(data0, 20, 4, (uint)value); }
|
||||||
public uint Face { get => GetBits(data0, 24, 3); set => data0 = SetBits(data0, 24, 3, value); }
|
public uint Face { get => GetBits(data0, 24, 3); set => data0 = SetBits(data0, 24, 3, value); }
|
||||||
public uint Arms { get => GetBits(data0, 27, 2); set => data0 = SetBits(data0, 27, 2, value); }
|
public uint Arms { get => GetBits(data0, 27, 2); set => data0 = SetBits(data0, 27, 2, value); }
|
||||||
public uint _0 { get => GetBits(data0, 29, 2); set => data0 = SetBits(data0, 29, 2, value); }
|
public uint Unknown0 { get => GetBits(data0, 29, 2); set => data0 = SetBits(data0, 29, 2, value); }
|
||||||
public uint Unused0 { get => GetBits(data0, 31, 1); set => data0 = SetBits(data0, 31, 1, value); }
|
public uint Unused0 { get => GetBits(data0, 31, 1); set => data0 = SetBits(data0, 31, 1, value); }
|
||||||
|
|
||||||
public F6Top Top { get => (F6Top)GetBits(data1, 0, 6); set => data1 = SetBits(data1, 0, 6, (uint)value); }
|
public F6Top Top { get => (F6Top)GetBits(data1, 0, 6); set => data1 = SetBits(data1, 0, 6, (uint)value); }
|
||||||
|
@ -294,7 +294,7 @@ namespace PKHeX.Core
|
||||||
public F6Dress Dress { get => (F6Dress)GetBits(data1, 13, 4); set => data1 = SetBits(data1, 13, 4, (uint)value); }
|
public F6Dress Dress { get => (F6Dress)GetBits(data1, 13, 4); set => data1 = SetBits(data1, 13, 4, (uint)value); }
|
||||||
public F6Socks Socks { get => (F6Socks)GetBits(data1, 17, 5); set => data1 = SetBits(data1, 17, 5, (uint)value); }
|
public F6Socks Socks { get => (F6Socks)GetBits(data1, 17, 5); set => data1 = SetBits(data1, 17, 5, (uint)value); }
|
||||||
public F6Shoes Shoes { get => (F6Shoes)GetBits(data1, 22, 6); set => data1 = SetBits(data1, 22, 6, (uint)value); }
|
public F6Shoes Shoes { get => (F6Shoes)GetBits(data1, 22, 6); set => data1 = SetBits(data1, 22, 6, (uint)value); }
|
||||||
public uint _1 { get => GetBits(data1, 28, 2); set => data1 = SetBits(data1, 28, 2, value); }
|
public uint Unknown1 { get => GetBits(data1, 28, 2); set => data1 = SetBits(data1, 28, 2, value); }
|
||||||
public uint Unused1 { get => GetBits(data1, 30, 2); set => data1 = SetBits(data1, 30, 2, value); }
|
public uint Unused1 { get => GetBits(data1, 30, 2); set => data1 = SetBits(data1, 30, 2, value); }
|
||||||
|
|
||||||
public F6Bag Bag { get => (F6Bag)GetBits(data2, 0, 5); set => data2 = SetBits(data2, 0, 5, (uint)value); }
|
public F6Bag Bag { get => (F6Bag)GetBits(data2, 0, 5); set => data2 = SetBits(data2, 0, 5, (uint)value); }
|
||||||
|
|
|
@ -42,23 +42,13 @@ namespace PKHeX.Core
|
||||||
numStored = 0;
|
numStored = 0;
|
||||||
for (int i = 0; i < numStored; i++)
|
for (int i = 0; i < numStored; i++)
|
||||||
{
|
{
|
||||||
switch (Type)
|
items[i] = Type switch
|
||||||
{
|
{
|
||||||
case InventoryType.KeyItems:
|
InventoryType.KeyItems =>
|
||||||
items[i] = new InventoryItem
|
new InventoryItem {Index = Data[Offset + i + 1], Count = 1},
|
||||||
{
|
_ =>
|
||||||
Index = Data[Offset + i + 1],
|
new InventoryItem {Index = Data[Offset + (i * 2) + 1], Count = Data[Offset + (i * 2) + 2]}
|
||||||
Count = 1
|
};
|
||||||
};
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
items[i] = new InventoryItem
|
|
||||||
{
|
|
||||||
Index = Data[Offset + (i * 2) + 1],
|
|
||||||
Count = Data[Offset + (i * 2) + 2]
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (int i = numStored; i < items.Length; i++)
|
for (int i = numStored; i < items.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
public const int SIZE = 0x24;
|
public const int SIZE = 0x24;
|
||||||
private readonly bool JP;
|
private readonly bool JP;
|
||||||
|
|
||||||
public Mail3() : base(new byte[SIZE], -1) => ResetData();
|
public Mail3() : base(new byte[SIZE], -1) => ResetData();
|
||||||
public Mail3(byte[] data, int ofs, bool japanese) : base(data, ofs) => JP = japanese;
|
public Mail3(byte[] data, int ofs, bool japanese) : base(data, ofs) => JP = japanese;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core
|
||||||
public Mail4(byte[] data, int ofs) : base(data, ofs) { }
|
public Mail4(byte[] data, int ofs) : base(data, ofs) { }
|
||||||
|
|
||||||
public Mail4(byte[] data) : base(data, -1) { }
|
public Mail4(byte[] data) : base(data, -1) { }
|
||||||
|
|
||||||
public Mail4(byte? lang, byte? ver) : base(new byte[SIZE])
|
public Mail4(byte? lang, byte? ver) : base(new byte[SIZE])
|
||||||
{
|
{
|
||||||
if (lang != null) AuthorLanguage = (byte)lang;
|
if (lang != null) AuthorLanguage = (byte)lang;
|
||||||
|
@ -59,6 +59,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetBlank() => SetBlank(0, 0);
|
public override void SetBlank() => SetBlank(0, 0);
|
||||||
|
|
||||||
public void SetBlank(byte lang, byte ver)
|
public void SetBlank(byte lang, byte ver)
|
||||||
{
|
{
|
||||||
Array.Clear(Data, 0, Data.Length);
|
Array.Clear(Data, 0, Data.Length);
|
||||||
|
|
|
@ -43,18 +43,18 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
public OPower6(SaveFile sav, int offset) : base(sav) => Offset = offset;
|
public OPower6(SaveFile sav, int offset) : base(sav) => Offset = offset;
|
||||||
|
|
||||||
private OPowerFlagSet this[OPower6Type type] => Array.Find(Mapping, t => t.Identifier == type);
|
private static OPowerFlagSet Get(OPower6Type type) => Array.Find(Mapping, t => t.Identifier == type);
|
||||||
public int GetOPowerCount(OPower6Type type) => this[type].BaseCount;
|
public static int GetOPowerCount(OPower6Type type) => Get(type).BaseCount;
|
||||||
public int GetOPowerLevel(OPower6Type type) => this[type].GetOPowerLevel(Data, Offset);
|
public int GetOPowerLevel(OPower6Type type) => Get(type).GetOPowerLevel(Data, Offset);
|
||||||
|
|
||||||
public bool GetHasOPowerS(OPower6Type type) => this[type].HasOPowerS;
|
public static bool GetHasOPowerS(OPower6Type type) => Get(type).HasOPowerS;
|
||||||
public bool GetHasOPowerMAX(OPower6Type type) => this[type].HasOPowerMAX;
|
public static bool GetHasOPowerMAX(OPower6Type type) => Get(type).HasOPowerMAX;
|
||||||
public bool GetOPowerS(OPower6Type type) => this[type].GetOPowerS(Data, Offset);
|
public bool GetOPowerS(OPower6Type type) => Get(type).GetOPowerS(Data, Offset);
|
||||||
public bool GetOPowerMAX(OPower6Type type) => this[type].GetOPowerMAX(Data, Offset);
|
public bool GetOPowerMAX(OPower6Type type) => Get(type).GetOPowerMAX(Data, Offset);
|
||||||
|
|
||||||
public void SetOPowerLevel(OPower6Type type, int lvl) => this[type].SetOPowerLevel(Data, Offset, lvl);
|
public void SetOPowerLevel(OPower6Type type, int lvl) => Get(type).SetOPowerLevel(Data, Offset, lvl);
|
||||||
public void SetOPowerS(OPower6Type type, bool value) => this[type].SetOPowerS(Data, Offset, value);
|
public void SetOPowerS(OPower6Type type, bool value) => Get(type).SetOPowerS(Data, Offset, value);
|
||||||
public void SetOPowerMAX(OPower6Type type, bool value) => this[type].SetOPowerMAX(Data, Offset, value);
|
public void SetOPowerMAX(OPower6Type type, bool value) => Get(type).SetOPowerMAX(Data, Offset, value);
|
||||||
|
|
||||||
public bool MasterFlag
|
public bool MasterFlag
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,9 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
public abstract class Zukan
|
public abstract class Zukan
|
||||||
{
|
{
|
||||||
protected SaveFile SAV { get; set; }
|
protected readonly SaveFile SAV;
|
||||||
public int PokeDex { get; private set; }
|
public readonly int PokeDex;
|
||||||
protected int PokeDexLanguageFlags { get; set; }
|
protected readonly int PokeDexLanguageFlags;
|
||||||
|
|
||||||
protected Zukan(SaveFile sav, int dex, int langflag)
|
protected Zukan(SaveFile sav, int dex, int langflag)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
public virtual void SetDex(PKM pkm)
|
public virtual void SetDex(PKM pkm)
|
||||||
{
|
{
|
||||||
if (PokeDex < 0 || SAV.Version == GameVersion.Invalid) // sanity
|
if (SAV.Version == GameVersion.Invalid) // sanity
|
||||||
return;
|
return;
|
||||||
if (pkm.Species == 0 || pkm.Species > SAV.MaxSpeciesID) // out of range
|
if (pkm.Species == 0 || pkm.Species > SAV.MaxSpeciesID) // out of range
|
||||||
return;
|
return;
|
||||||
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int species = pkm.Species;
|
int species = pkm.Species;
|
||||||
if (species == 327) // Spinda
|
if (species == (int)Species.Spinda)
|
||||||
SetSpindaDexData(pkm, GetSeen(species));
|
SetSpindaDexData(pkm, GetSeen(species));
|
||||||
|
|
||||||
int bit = pkm.Species - 1;
|
int bit = pkm.Species - 1;
|
||||||
|
|
|
@ -296,7 +296,7 @@ namespace PKHeX.WinForms.Controls
|
||||||
return;
|
return;
|
||||||
// Resort moves
|
// Resort moves
|
||||||
FieldsLoaded = false;
|
FieldsLoaded = false;
|
||||||
LegalMoveSource.ReloadMoves(Legality.AllSuggestedMovesAndRelearn);
|
LegalMoveSource.ReloadMoves(Legality.AllSuggestedMovesAndRelearn());
|
||||||
FieldsLoaded = true;
|
FieldsLoaded = true;
|
||||||
LegalityChanged?.Invoke(Legality.Valid, EventArgs.Empty);
|
LegalityChanged?.Invoke(Legality.Valid, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace PKHeX.WinForms
|
||||||
private set => GameInfo.CurrentLanguage = value;
|
private set => GameInfo.CurrentLanguage = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool _unicode { get; set; }
|
private static bool _unicode;
|
||||||
|
|
||||||
public static bool Unicode
|
public static bool Unicode
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace PKHeX.WinForms.Properties
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace PKHeX.WinForms.Properties
|
||||||
{
|
{
|
||||||
// This class allows you to handle specific events on the settings class:
|
// This class allows you to handle specific events on the settings class:
|
||||||
// The SettingChanging event is raised before a setting's value is changed.
|
// The SettingChanging event is raised before a setting's value is changed.
|
||||||
|
@ -7,21 +9,19 @@
|
||||||
// The SettingsSaving event is raised before the setting values are saved.
|
// The SettingsSaving event is raised before the setting values are saved.
|
||||||
internal sealed partial class Settings
|
internal sealed partial class Settings
|
||||||
{
|
{
|
||||||
public Settings() {
|
private Settings()
|
||||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
{
|
||||||
//
|
SettingChanging += SettingChangingEventHandler;
|
||||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
SettingsSaving += SettingsSavingEventHandler;
|
||||||
//
|
|
||||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
private static void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||||
|
Debug.WriteLine($"Changed setting: {e.SettingName}");
|
||||||
// Add code to handle the SettingChangingEvent event here.
|
// Add code to handle the SettingChangingEvent event here.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
private static void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||||
// Add code to handle the SettingsSaving event here.
|
Debug.WriteLine("Saving settings...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
this.RB_Boxes = new System.Windows.Forms.RadioButton();
|
this.RB_Boxes = new System.Windows.Forms.RadioButton();
|
||||||
this.RB_Path = new System.Windows.Forms.RadioButton();
|
this.RB_Path = new System.Windows.Forms.RadioButton();
|
||||||
this.FLP_RB = new System.Windows.Forms.FlowLayoutPanel();
|
this.FLP_RB = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
@ -43,6 +44,9 @@
|
||||||
this.L_PropType = new System.Windows.Forms.Label();
|
this.L_PropType = new System.Windows.Forms.Label();
|
||||||
this.L_PropValue = new System.Windows.Forms.Label();
|
this.L_PropValue = new System.Windows.Forms.Label();
|
||||||
this.b = new System.ComponentModel.BackgroundWorker();
|
this.b = new System.ComponentModel.BackgroundWorker();
|
||||||
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
|
this.toolTip2 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
|
this.toolTip3 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.FLP_RB.SuspendLayout();
|
this.FLP_RB.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -263,5 +267,8 @@
|
||||||
private System.Windows.Forms.Label L_PropValue;
|
private System.Windows.Forms.Label L_PropValue;
|
||||||
private System.Windows.Forms.RadioButton RB_Party;
|
private System.Windows.Forms.RadioButton RB_Party;
|
||||||
private System.ComponentModel.BackgroundWorker b;
|
private System.ComponentModel.BackgroundWorker b;
|
||||||
|
private System.Windows.Forms.ToolTip toolTip1;
|
||||||
|
private System.Windows.Forms.ToolTip toolTip2;
|
||||||
|
private System.Windows.Forms.ToolTip toolTip3;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,9 +29,9 @@ namespace PKHeX.WinForms
|
||||||
CB_Format.Items.Add(MsgAll);
|
CB_Format.Items.Add(MsgAll);
|
||||||
|
|
||||||
CB_Format.SelectedIndex = CB_Require.SelectedIndex = 0;
|
CB_Format.SelectedIndex = CB_Require.SelectedIndex = 0;
|
||||||
new ToolTip().SetToolTip(CB_Property, MsgBEToolTipPropName);
|
toolTip1.SetToolTip(CB_Property, MsgBEToolTipPropName);
|
||||||
new ToolTip().SetToolTip(L_PropType, MsgBEToolTipPropType);
|
toolTip2.SetToolTip(L_PropType, MsgBEToolTipPropType);
|
||||||
new ToolTip().SetToolTip(L_PropValue, MsgBEToolTipPropValue);
|
toolTip3.SetToolTip(L_PropValue, MsgBEToolTipPropValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly PKM pkmref;
|
private readonly PKM pkmref;
|
||||||
|
@ -184,7 +184,7 @@ namespace PKHeX.WinForms
|
||||||
b.RunWorkerAsync();
|
b.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunBatchEditFolder(IList<StringInstructionSet> sets, string source, string destination)
|
private void RunBatchEditFolder(IReadOnlyCollection<StringInstructionSet> sets, string source, string destination)
|
||||||
{
|
{
|
||||||
var files = Directory.GetFiles(source, "*", SearchOption.AllDirectories);
|
var files = Directory.GetFiles(source, "*", SearchOption.AllDirectories);
|
||||||
SetupProgressBar(files.Length * sets.Count);
|
SetupProgressBar(files.Length * sets.Count);
|
||||||
|
@ -192,7 +192,7 @@ namespace PKHeX.WinForms
|
||||||
ProcessFolder(files, set.Filters, set.Instructions, destination);
|
ProcessFolder(files, set.Filters, set.Instructions, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunBatchEditSaveFile(IList<StringInstructionSet> sets, bool boxes = false, bool party = false)
|
private void RunBatchEditSaveFile(IReadOnlyCollection<StringInstructionSet> sets, bool boxes = false, bool party = false)
|
||||||
{
|
{
|
||||||
IList<PKM> data;
|
IList<PKM> data;
|
||||||
if (party && SAV.HasParty && process(data = SAV.PartyData))
|
if (party && SAV.HasParty && process(data = SAV.PartyData))
|
||||||
|
@ -229,7 +229,7 @@ namespace PKHeX.WinForms
|
||||||
// Mass Editing
|
// Mass Editing
|
||||||
private Core.BatchEditor editor = new Core.BatchEditor();
|
private Core.BatchEditor editor = new Core.BatchEditor();
|
||||||
|
|
||||||
private void ProcessSAV(IList<PKM> data, IList<StringInstruction> Filters, IList<StringInstruction> Instructions)
|
private void ProcessSAV(IList<PKM> data, IReadOnlyList<StringInstruction> Filters, IReadOnlyList<StringInstruction> Instructions)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -238,7 +238,7 @@ namespace PKHeX.WinForms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessFolder(IReadOnlyList<string> files, IList<StringInstruction> Filters, IList<StringInstruction> Instructions, string destPath)
|
private void ProcessFolder(IReadOnlyList<string> files, IReadOnlyList<StringInstruction> Filters, IReadOnlyList<StringInstruction> Instructions, string destPath)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < files.Count; i++)
|
for (int i = 0; i < files.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace PKHeX.WinForms
|
||||||
{
|
{
|
||||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgReportExportCSV) != DialogResult.Yes)
|
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgReportExportCSV) != DialogResult.Yes)
|
||||||
return;
|
return;
|
||||||
SaveFileDialog savecsv = new SaveFileDialog
|
using var savecsv = new SaveFileDialog
|
||||||
{
|
{
|
||||||
Filter = "Spreadsheet|*.csv",
|
Filter = "Spreadsheet|*.csv",
|
||||||
FileName = "Box Data Dump.csv"
|
FileName = "Box Data Dump.csv"
|
||||||
|
|
|
@ -6,7 +6,7 @@ using PKHeX.Drawing;
|
||||||
|
|
||||||
namespace PKHeX.WinForms
|
namespace PKHeX.WinForms
|
||||||
{
|
{
|
||||||
public static class CGearExtensions
|
public static class CGearImage
|
||||||
{
|
{
|
||||||
public static Bitmap GetBitmap(CGearBackground bg)
|
public static Bitmap GetBitmap(CGearBackground bg)
|
||||||
{
|
{
|
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms
|
||||||
byte[] data = SAV.CGearSkinData;
|
byte[] data = SAV.CGearSkinData;
|
||||||
bg = new CGearBackground(data);
|
bg = new CGearBackground(data);
|
||||||
|
|
||||||
PB_Background.Image = CGearExtensions.GetBitmap(bg);
|
PB_Background.Image = CGearImage.GetBitmap(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CGearBackground bg;
|
private CGearBackground bg;
|
||||||
|
@ -42,8 +42,8 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bg = CGearExtensions.GetCGearBackground(img);
|
bg = CGearImage.GetCGearBackground(img);
|
||||||
PB_Background.Image = CGearExtensions.GetBitmap(bg);
|
PB_Background.Image = CGearImage.GetBitmap(bg);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
byte[] data = File.ReadAllBytes(path);
|
byte[] data = File.ReadAllBytes(path);
|
||||||
bg = new CGearBackground(data);
|
bg = new CGearBackground(data);
|
||||||
PB_Background.Image = CGearExtensions.GetBitmap(bg);
|
PB_Background.Image = CGearImage.GetBitmap(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_ExportCGB_Click(object sender, EventArgs e)
|
private void B_ExportCGB_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -122,12 +122,6 @@ namespace PKHeX.WinForms
|
||||||
GB_KeySystem.Visible = false;
|
GB_KeySystem.Visible = false;
|
||||||
// Roamer
|
// Roamer
|
||||||
cbr = new[] { CB_Roamer642, CB_Roamer641 };
|
cbr = new[] { CB_Roamer642, CB_Roamer641 };
|
||||||
List<ComboItem> getStates() => new List<ComboItem> {
|
|
||||||
new ComboItem("Not roamed", 0),
|
|
||||||
new ComboItem("Roaming", 1),
|
|
||||||
new ComboItem("Defeated", 2),
|
|
||||||
new ComboItem("Captured", 3),
|
|
||||||
};
|
|
||||||
// CurrentStat:ComboboxSource
|
// CurrentStat:ComboboxSource
|
||||||
// Not roamed: Not roamed/Defeated/Captured
|
// Not roamed: Not roamed/Defeated/Captured
|
||||||
// Roaming: Roaming/Defeated/Captured
|
// Roaming: Roaming/Defeated/Captured
|
||||||
|
@ -137,8 +131,7 @@ namespace PKHeX.WinForms
|
||||||
for (int i = 0; i < cbr.Length; i++)
|
for (int i = 0; i < cbr.Length; i++)
|
||||||
{
|
{
|
||||||
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
||||||
|
var states = GetStates();
|
||||||
var states = getStates();
|
|
||||||
if (states.All(z => z.Value != c))
|
if (states.All(z => z.Value != c))
|
||||||
states.Add(new ComboItem($"Unknown (0x{c:X2})", c));
|
states.Add(new ComboItem($"Unknown (0x{c:X2})", c));
|
||||||
cbr[i].Items.Clear();
|
cbr[i].Items.Clear();
|
||||||
|
@ -179,6 +172,17 @@ namespace PKHeX.WinForms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<ComboItem> GetStates()
|
||||||
|
{
|
||||||
|
return new List<ComboItem>
|
||||||
|
{
|
||||||
|
new ComboItem("Not roamed", 0),
|
||||||
|
new ComboItem("Roaming", 1),
|
||||||
|
new ComboItem("Defeated", 2),
|
||||||
|
new ComboItem("Captured", 3),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void SaveMain()
|
private void SaveMain()
|
||||||
{
|
{
|
||||||
uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly);
|
uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly);
|
||||||
|
|
|
@ -57,15 +57,15 @@ namespace PKHeX.WinForms
|
||||||
Current = Types[CB_Type.SelectedIndex];
|
Current = Types[CB_Type.SelectedIndex];
|
||||||
|
|
||||||
CB_Value.Items.Clear();
|
CB_Value.Items.Clear();
|
||||||
int count = Data.GetOPowerCount(Current);
|
int count = OPower6.GetOPowerCount(Current);
|
||||||
for (int i = 0; i <= count; i++)
|
for (int i = 0; i <= count; i++)
|
||||||
CB_Value.Items.Add(Values[i]);
|
CB_Value.Items.Add(Values[i]);
|
||||||
|
|
||||||
CB_Value.SelectedIndex = Data.GetOPowerLevel(Current);
|
CB_Value.SelectedIndex = Data.GetOPowerLevel(Current);
|
||||||
|
|
||||||
CHK_S.Enabled = Data.GetHasOPowerS(Current);
|
CHK_S.Enabled = OPower6.GetHasOPowerS(Current);
|
||||||
CHK_S.Checked = Data.GetOPowerS(Current);
|
CHK_S.Checked = Data.GetOPowerS(Current);
|
||||||
CHK_MAX.Enabled = Data.GetHasOPowerMAX(Current);
|
CHK_MAX.Enabled = OPower6.GetHasOPowerMAX(Current);
|
||||||
CHK_MAX.Checked = Data.GetOPowerMAX(Current);
|
CHK_MAX.Checked = Data.GetOPowerMAX(Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
//
|
//
|
||||||
// IL_Pouch
|
// IL_Pouch
|
||||||
//
|
//
|
||||||
this.IL_Pouch.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("IL_Pouch.ImageStream")));
|
this.IL_Pouch.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject($"IL_Pouch.ImageStream")));
|
||||||
this.IL_Pouch.TransparentColor = System.Drawing.Color.Transparent;
|
this.IL_Pouch.TransparentColor = System.Drawing.Color.Transparent;
|
||||||
this.IL_Pouch.Images.SetKeyName(0, "Bag_Items.png");
|
this.IL_Pouch.Images.SetKeyName(0, "Bag_Items.png");
|
||||||
this.IL_Pouch.Images.SetKeyName(1, "Bag_Key.png");
|
this.IL_Pouch.Images.SetKeyName(1, "Bag_Key.png");
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace PKHeX.WinForms
|
||||||
m = new Mail3[6 + 10];
|
m = new Mail3[6 + 10];
|
||||||
for (int i = 0; i < m.Length; i++)
|
for (int i = 0; i < m.Length; i++)
|
||||||
{
|
{
|
||||||
var ofs = sav3.GetMailOffset(i);
|
var ofs = sav3.GetMailOffset(i);
|
||||||
var data = sav.GetData(ofs, Mail3.SIZE);
|
var data = sav.GetData(ofs, Mail3.SIZE);
|
||||||
m[i] = new Mail3(data, ofs, sav3.Japanese);
|
m[i] = new Mail3(data, ofs, sav3.Japanese);
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,8 @@ namespace PKHeX.WinForms
|
||||||
if (s.Count(v => v != null) == 0)
|
if (s.Count(v => v != null) == 0)
|
||||||
return ret;
|
return ret;
|
||||||
System.Media.SystemSounds.Question.Play();
|
System.Media.SystemSounds.Question.Play();
|
||||||
ret = MessageBox.Show($"{s.Select((v, i) => v != null ? $"{Environment.NewLine} {PKMLabels[i].Text}: {PKMHeldItems[i].Text} -> {CB_MailType.Items[0]}" : string.Empty).Aggregate($"Modify PKM's HeldItem?{Environment.NewLine}", (tmp, v) => $"{tmp}{v}")}{Environment.NewLine}{Environment.NewLine}Yes: Delete Mail & Modify PKM{Environment.NewLine}No: Delete Mail", "Prompt", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button3);
|
var msg = $"{s.Select((v, i) => v == null ? string.Empty : $"{Environment.NewLine} {PKMLabels[i].Text}: {PKMHeldItems[i].Text} -> {CB_MailType.Items[0]}").Aggregate($"Modify PKM's HeldItem?{Environment.NewLine}", (tmp, v) => $"{tmp}{v}")}{Environment.NewLine}{Environment.NewLine}Yes: Delete Mail & Modify PKM{Environment.NewLine}No: Delete Mail";
|
||||||
|
ret = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, msg);
|
||||||
if (ret != DialogResult.Yes)
|
if (ret != DialogResult.Yes)
|
||||||
return ret;
|
return ret;
|
||||||
foreach (PKM pkm in s)
|
foreach (PKM pkm in s)
|
||||||
|
|
|
@ -85,12 +85,11 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
private static object GetValue(IDisposable control)
|
private static object GetValue(IDisposable control)
|
||||||
{
|
{
|
||||||
switch (control)
|
return control switch
|
||||||
{
|
{
|
||||||
case CheckBox cb:
|
CheckBox cb => cb.Checked,
|
||||||
return cb.Checked;
|
_ => (object)null
|
||||||
default: return null;
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsEditor_KeyDown(object sender, KeyEventArgs e)
|
private void SettingsEditor_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue