mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +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>
|
||||
public sealed class StringInstructionSet
|
||||
{
|
||||
public IList<StringInstruction> Filters { get; private set; }
|
||||
public IList<StringInstruction> Instructions { get; private set; }
|
||||
public readonly IReadOnlyList<StringInstruction> Filters;
|
||||
public readonly IReadOnlyList<StringInstruction> Instructions;
|
||||
|
||||
private const string SetSeparator = ";";
|
||||
|
||||
public StringInstructionSet(IList<StringInstruction> filters, IList<StringInstruction> instructions)
|
||||
public StringInstructionSet(IReadOnlyList<StringInstruction> filters, IReadOnlyList<StringInstruction> instructions)
|
||||
{
|
||||
Filters = filters;
|
||||
Instructions = instructions;
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Default <see cref="MarkingMethod"/> when applying markings.
|
||||
/// </summary>
|
||||
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
|
||||
public static Func<PKM, Func<int, int, int>> MarkingMethod { get; set; } = FlagHighLow;
|
||||
|
||||
/// <summary>
|
||||
|
@ -629,8 +630,8 @@ namespace PKHeX.Core
|
|||
/// Gets a moveset for the provided <see cref="PKM"/> data.
|
||||
/// </summary>
|
||||
/// <param name="pkm">PKM to generate for</param>
|
||||
/// <param name="random">Full movepool & shuffling</param>
|
||||
/// <param name="la">Precomputed optional</param>
|
||||
/// <param name="random">Full movepool & shuffling</param>
|
||||
/// <returns>4 moves</returns>
|
||||
public static int[] GetMoveSet(this PKM pkm, LegalityAnalysis la, bool random = false)
|
||||
{
|
||||
|
@ -638,8 +639,8 @@ namespace PKHeX.Core
|
|||
if (m == null)
|
||||
return pkm.Moves;
|
||||
|
||||
if (!m.All(z => la.AllSuggestedMovesAndRelearn.Contains(z)))
|
||||
m = m.Intersect(la.AllSuggestedMovesAndRelearn).ToArray();
|
||||
if (!m.All(z => la.AllSuggestedMovesAndRelearn().Contains(z)))
|
||||
m = m.Intersect(la.AllSuggestedMovesAndRelearn()).ToArray();
|
||||
|
||||
if (random)
|
||||
Util.Shuffle(m);
|
||||
|
|
|
@ -163,6 +163,7 @@ namespace PKHeX.Core
|
|||
|
||||
private void ParseLines(IEnumerable<string> lines)
|
||||
{
|
||||
// ReSharper disable once GenericEnumeratorNotDisposed
|
||||
using var e = lines.GetEnumerator();
|
||||
if (!e.MoveNext())
|
||||
return;
|
||||
|
|
|
@ -96,7 +96,6 @@ namespace PKHeX.Core
|
|||
return met_list;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
@ -113,6 +112,7 @@ namespace PKHeX.Core
|
|||
Util.AddCBWithOffset(met_list, s.metHGSS_03000, 3000, Legal.Met_HGSS_3);
|
||||
return met_list;
|
||||
}
|
||||
|
||||
private static List<ComboItem> CreateGen5(GameStrings s)
|
||||
{
|
||||
var met_list = Util.GetCBList(s.metBW2_00000, 0);
|
||||
|
|
|
@ -79,25 +79,25 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Gets the Country string for a given Country ID
|
||||
/// </summary>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <param name="language">Language ID</param>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <returns>Country ID string</returns>
|
||||
public static string GetCountryName(string language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Region string for a specified country ID.
|
||||
/// </summary>
|
||||
/// <param name="language">Language ID</param>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <param name="region">Region ID</param>
|
||||
/// <param name="language">Language ID</param>
|
||||
/// <returns>Region ID string</returns>
|
||||
public static string GetRegionName(string language, int country, int region) => GetRegionName(country, region, GetLanguageIndex(language));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Country string for a given Country ID
|
||||
/// </summary>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <param name="language">Language ID</param>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <returns>Country ID string</returns>
|
||||
public static string GetCountryName(LanguageID language, int country) => GetCountryName(country, GetLanguageIndex(language));
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
private int[]? _allSuggestedMoves, _allSuggestedRelearnMoves;
|
||||
public int[] AllSuggestedMovesAndRelearn => AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray();
|
||||
public int[] AllSuggestedMovesAndRelearn() => AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray();
|
||||
|
||||
private string EncounterName
|
||||
{
|
||||
|
|
|
@ -206,7 +206,6 @@ namespace PKHeX.Core
|
|||
if (eggMysteryCurrent != eggMysteryPrevious)
|
||||
{
|
||||
AddLine(pa.pkm, ca.pkm, "EC sharing across RNG encounters detected.", ident);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +235,6 @@ namespace PKHeX.Core
|
|||
if (eggMysteryCurrent != eggMysteryPrevious)
|
||||
{
|
||||
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)));
|
||||
|
||||
|
||||
public static void RefreshMGDB(params string[] paths)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public ValidEncounterMoves(List<int>[] levelup)
|
||||
public ValidEncounterMoves(IReadOnlyList<int>[] levelup)
|
||||
{
|
||||
LevelUpMoves = levelup;
|
||||
}
|
||||
|
||||
public ValidEncounterMoves()
|
||||
{
|
||||
LevelUpMoves = Array.Empty<int[]>();
|
||||
|
|
|
@ -74,12 +74,10 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool CanVersionRecieveGift(int format, int version4bit, int version)
|
||||
{
|
||||
switch (format)
|
||||
return format switch
|
||||
{
|
||||
// todo
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
private static bool CurrentOTMatchesReplaced(int format, string pkOtName)
|
||||
|
@ -97,12 +95,10 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool IsMatchName(string pkOtName, int generation)
|
||||
{
|
||||
switch (generation)
|
||||
return generation switch
|
||||
{
|
||||
// todo
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,17 +95,15 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
BugContest = 1 << 15,
|
||||
|
||||
/// <summary>
|
||||
/// Slot is encountered via the Bug Catching Contest.
|
||||
/// </summary>
|
||||
GoPark = 1 << 16,
|
||||
|
||||
/// <summary>
|
||||
/// Slot is encountered in the Safari Zone.
|
||||
/// </summary>
|
||||
Safari = 1 << 16, // 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,
|
||||
Safari = 1 << 30, // always used as a modifier to another slot type
|
||||
|
||||
// Combined
|
||||
Headbutt_Special = Headbutt | Special,
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
public readonly LeadRequired Lead;
|
||||
|
||||
private readonly FrameType FrameType;
|
||||
private readonly RNG RNG;
|
||||
|
||||
/// <summary>
|
||||
/// Starting seed for the frame (to generate the frame).
|
||||
|
@ -28,12 +27,11 @@
|
|||
|
||||
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;
|
||||
Lead = lead;
|
||||
FrameType = type;
|
||||
RNG = rng;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Generator class for Gen3/4 Frame patterns
|
||||
/// </summary>
|
||||
public sealed class FrameGenerator
|
||||
{
|
||||
public uint Nature;
|
||||
|
@ -11,13 +14,13 @@ namespace PKHeX.Core
|
|||
public readonly bool DPPt;
|
||||
public readonly bool AllowLeads;
|
||||
public readonly FrameType FrameType = FrameType.None;
|
||||
public readonly RNG RNG;
|
||||
public readonly RNG RNG = RNG.LCRNG;
|
||||
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 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,
|
||||
RandLevel = lvl,
|
||||
|
@ -31,7 +34,6 @@ namespace PKHeX.Core
|
|||
/// <returns>Object containing search criteria to be passed by reference to search/filter methods.</returns>
|
||||
public FrameGenerator(PKM pk)
|
||||
{
|
||||
RNG = RNG.LCRNG;
|
||||
var ver = (GameVersion)pk.Version;
|
||||
switch (ver)
|
||||
{
|
||||
|
@ -69,7 +71,6 @@ namespace PKHeX.Core
|
|||
DPPt = true;
|
||||
AllowLeads = true;
|
||||
FrameType = FrameType.MethodJ;
|
||||
RNG = RNG.LCRNG;
|
||||
return;
|
||||
|
||||
// Method K
|
||||
|
@ -78,7 +79,6 @@ namespace PKHeX.Core
|
|||
DPPt = false;
|
||||
AllowLeads = true;
|
||||
FrameType = FrameType.MethodK;
|
||||
RNG = RNG.LCRNG;
|
||||
return;
|
||||
default:
|
||||
throw new ArgumentException(nameof(ver));
|
||||
|
|
|
@ -27,12 +27,11 @@ namespace PKHeX.Core
|
|||
PressureHustleSpiritFail = PressureHustleSpirit | Fail,
|
||||
|
||||
AllFlags = UsesLevelCall | Fail,
|
||||
NoFlags = ~AllFlags,
|
||||
}
|
||||
|
||||
public static partial class Extensions
|
||||
{
|
||||
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>
|
||||
public static class MethodFinder
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Analyzes a <see cref="PKM"/> to find a matching PIDIV method.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
// ReSharper disable RedundantEmptyObjectOrCollectionInitializer todo
|
||||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override void Verify(LegalityAnalysis data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new Exception("Don't call via this.");
|
||||
}
|
||||
|
||||
public void VerifyTransferLegalityG12(LegalityAnalysis data)
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace PKHeX.Core
|
|||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the <see cref="MysteryGift"/> object data.
|
||||
/// </summary>
|
||||
|
@ -175,7 +174,7 @@ namespace PKHeX.Core
|
|||
public virtual int BeanCount { get => 0; set { } }
|
||||
|
||||
public virtual string CardHeader => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";
|
||||
|
||||
|
||||
// Search Properties
|
||||
public virtual int[] Moves { get => Array.Empty<int>(); set { } }
|
||||
public virtual int[] RelearnMoves { get => Array.Empty<int>(); set { } }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
@ -248,9 +247,5 @@ namespace PKHeX.Core
|
|||
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)
|
||||
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
|
||||
if (GenNumber < 6)
|
||||
{
|
||||
/* OT_Affection = */
|
||||
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
|
||||
}
|
||||
|
||||
this.SanitizeGeoLocationData();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace PKHeX.Core
|
|||
private int StringLength => Japanese ? STRLEN_J : STRLEN_U;
|
||||
public override bool Japanese => otname.Length == STRLEN_J;
|
||||
public override byte[] Data { get; }
|
||||
|
||||
protected _K12(byte[] data, bool jp = false)
|
||||
{
|
||||
int partySize = SIZE_PARTY;
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace PKHeX.Core
|
|||
{0xB7, 'x'},
|
||||
{0xB8, 'y'},
|
||||
{0xB9, 'z'},
|
||||
|
||||
|
||||
// unused characters
|
||||
{0xBA, 'à'},
|
||||
{0xBB, 'è'},
|
||||
|
@ -516,7 +516,7 @@ namespace PKHeX.Core
|
|||
{'x', 0xB7},
|
||||
{'y', 0xB8},
|
||||
{'z', 0xB9},
|
||||
|
||||
|
||||
// unused characters
|
||||
{'à', 0xBA},
|
||||
{'è', 0xBB},
|
||||
|
|
|
@ -695,31 +695,29 @@ namespace PKHeX.Core
|
|||
|
||||
private static string[] GetFormsUnown(int generation)
|
||||
{
|
||||
switch (generation)
|
||||
return generation switch
|
||||
{
|
||||
case 2:
|
||||
return new[]
|
||||
{
|
||||
"A", "B", "C", "D", "E",
|
||||
"F", "G", "H", "I", "J",
|
||||
"K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T",
|
||||
"U", "V", "W", "X", "Y",
|
||||
"Z",
|
||||
// "!", "?", not in Gen II
|
||||
};
|
||||
default:
|
||||
return new[]
|
||||
{
|
||||
"A", "B", "C", "D", "E",
|
||||
"F", "G", "H", "I", "J",
|
||||
"K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T",
|
||||
"U", "V", "W", "X", "Y",
|
||||
"Z",
|
||||
"!", "?",
|
||||
};
|
||||
}
|
||||
2 => new[]
|
||||
{
|
||||
"A", "B", "C", "D", "E",
|
||||
"F", "G", "H", "I", "J",
|
||||
"K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T",
|
||||
"U", "V", "W", "X", "Y",
|
||||
"Z",
|
||||
// "!", "?", not in Gen II
|
||||
},
|
||||
_ => new[]
|
||||
{
|
||||
"A", "B", "C", "D", "E",
|
||||
"F", "G", "H", "I", "J",
|
||||
"K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T",
|
||||
"U", "V", "W", "X", "Y",
|
||||
"Z",
|
||||
"!", "?",
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
||||
DaycareFlags[1] = Data[offset];
|
||||
offset++;
|
||||
byte steps = Data[offset];
|
||||
//byte steps = Data[offset];
|
||||
offset++;
|
||||
byte BreedMotherOrNonDitto = Data[offset];
|
||||
//byte BreedMotherOrNonDitto = Data[offset];
|
||||
offset++;
|
||||
var pk2 = ReadPKMFromOffset(offset); // parent 2
|
||||
var daycare2 = new PokeList2(pk2);
|
||||
|
@ -319,7 +319,11 @@ namespace PKHeX.Core
|
|||
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
|
||||
{
|
||||
|
@ -335,7 +339,8 @@ namespace PKHeX.Core
|
|||
|
||||
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 { } }
|
||||
|
@ -448,10 +453,10 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
private ushort[] LegalItems => Legal.Pouch_Items_GSC;
|
||||
private ushort[] LegalKeyItems => Legal.Pouch_Ball_GSC;
|
||||
private static ushort[] LegalItems => Legal.Pouch_Items_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[] LegalTMHMs => Legal.Pouch_TMHM_GSC;
|
||||
private static ushort[] LegalTMHMs => Legal.Pouch_TMHM_GSC;
|
||||
|
||||
public override InventoryPouch[] Inventory
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace PKHeX.Core
|
|||
return chunkOffset;
|
||||
}
|
||||
|
||||
private PersonalTable _personal { get; set; }
|
||||
private PersonalTable _personal;
|
||||
public override PersonalTable Personal => _personal;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
|
||||
|
@ -273,8 +273,8 @@ namespace PKHeX.Core
|
|||
|
||||
private int ActiveSAV;
|
||||
private int ABO => ActiveSAV*SIZE_BLOCK*0xE;
|
||||
private int[] BlockOrder;
|
||||
private int[] BlockOfs;
|
||||
private readonly int[] BlockOrder;
|
||||
private readonly int[] BlockOfs;
|
||||
public int GetBlockOffset(int block) => BlockOfs[block];
|
||||
|
||||
// Configuration
|
||||
|
@ -402,12 +402,12 @@ namespace PKHeX.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
switch (Version)
|
||||
return Version switch
|
||||
{
|
||||
case GameVersion.E: return BitConverter.ToUInt32(Data, BlockOfs[0] + 0xAC);
|
||||
case GameVersion.FRLG: return BitConverter.ToUInt32(Data, BlockOfs[0] + 0xF20);
|
||||
default: return 0;
|
||||
}
|
||||
GameVersion.E => BitConverter.ToUInt32(Data, BlockOfs[0] + 0xAC),
|
||||
GameVersion.FRLG => BitConverter.ToUInt32(Data, BlockOfs[0] + 0xF20),
|
||||
_ => 0u
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -919,7 +919,7 @@ namespace PKHeX.Core
|
|||
public sealed class RTC3
|
||||
{
|
||||
public readonly byte[] Data;
|
||||
private const int Size = 8;
|
||||
public const int Size = 8;
|
||||
|
||||
public RTC3(byte[] data) => Data = data;
|
||||
|
||||
|
@ -936,7 +936,7 @@ namespace PKHeX.Core
|
|||
if (FRLG)
|
||||
throw new ArgumentException(nameof(ClockInitial));
|
||||
int block0 = GetBlockOffset(0);
|
||||
return new RTC3(GetData(block0 + 0x98, 8));
|
||||
return new RTC3(GetData(block0 + 0x98, RTC3.Size));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -954,7 +954,7 @@ namespace PKHeX.Core
|
|||
if (FRLG)
|
||||
throw new ArgumentException(nameof(ClockElapsed));
|
||||
int block0 = GetBlockOffset(0);
|
||||
return new RTC3(GetData(block0 + 0xA0, 8));
|
||||
return new RTC3(GetData(block0 + 0xA0, RTC3.Size));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace PKHeX.Core
|
|||
private int SaveCount = -1;
|
||||
private int SaveIndex = -1;
|
||||
private readonly StrategyMemo StrategyMemo;
|
||||
public int MaxShadowID => 0x80; // 128
|
||||
public const int MaxShadowID = 0x80; // 128
|
||||
private int Memo;
|
||||
public SAV3Colosseum(byte[] data, SAV3GCMemoryCard MC) : this(data, MC.Data) { this.MC = MC; }
|
||||
public SAV3Colosseum(byte[] data) : this(data, (byte[])data.Clone()) { }
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace PKHeX.Core
|
|||
protected int AdventureInfo = int.MinValue;
|
||||
protected int Seal = int.MinValue;
|
||||
public int GTS { get; protected set; } = int.MinValue;
|
||||
|
||||
|
||||
// Storage
|
||||
public override int PartyCount
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace PKHeX.Core
|
|||
Storage[GetBoxWallpaperOffset(box)] = (byte)value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public override InventoryPouch[] Inventory
|
||||
{
|
||||
get
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
Edited = true;
|
||||
}
|
||||
|
||||
|
||||
public override GameVersion Version
|
||||
{
|
||||
get
|
||||
|
@ -169,7 +169,7 @@ namespace PKHeX.Core
|
|||
|
||||
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; }
|
||||
|
||||
|
||||
public override bool GetCaught(int species) => Blocks.Zukan.GetCaught(species);
|
||||
public override bool GetSeen(int species) => Blocks.Zukan.GetSeen(species);
|
||||
public override void SetSeen(int species, bool seen) => Blocks.Zukan.SetSeen(species, seen);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace PKHeX.Core
|
|||
public sealed class BV6 : BattleVideo
|
||||
{
|
||||
internal const int SIZE = 0x2E60;
|
||||
private const string NPC = "NPC";
|
||||
private readonly 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;
|
||||
}
|
||||
|
||||
public BV6(byte[] data)
|
||||
{
|
||||
Data = (byte[])data.Clone();
|
||||
}
|
||||
|
||||
private readonly byte[] Data;
|
||||
|
||||
public BV6(byte[] data) => Data = (byte[])data.Clone();
|
||||
public int Mode { get => Data[0x00]; set => Data[0x00] = (byte)value; }
|
||||
|
||||
public int Style { get => Data[0x01]; set => Data[0x01] = (byte)value; }
|
||||
|
||||
public string Debug1
|
||||
|
@ -51,8 +46,6 @@ namespace PKHeX.Core
|
|||
public override PKM[] BattlePKMs => PlayerTeams.SelectMany(t => t).ToArray();
|
||||
public override int Generation => 6;
|
||||
|
||||
private const string NPC = "NPC";
|
||||
|
||||
public string[] PlayerNames
|
||||
{
|
||||
get
|
||||
|
@ -113,21 +106,21 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
private 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; }
|
||||
private int MatchMonth { get => Data[0x2E53]; set => Data[0x2E53] = (byte)value; }
|
||||
private int MatchHour { get => Data[0x2E54]; set => Data[0x2E54] = (byte)value; }
|
||||
private int MatchMinute { get => Data[0x2E55]; set => Data[0x2E55] = (byte)value; }
|
||||
private int MatchSecond { get => Data[0x2E56]; set => Data[0x2E56] = (byte)value; }
|
||||
private int MatchFlags { get => Data[0x2E57]; set => Data[0x2E57] = (byte)value; }
|
||||
public int MatchYear { get => BitConverter.ToUInt16(Data, 0x2E50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E50); }
|
||||
public int MatchDay { get => Data[0x2E52]; set => Data[0x2E52] = (byte)value; }
|
||||
public int MatchMonth { get => Data[0x2E53]; set => Data[0x2E53] = (byte)value; }
|
||||
public int MatchHour { get => Data[0x2E54]; set => Data[0x2E54] = (byte)value; }
|
||||
public int MatchMinute { get => Data[0x2E55]; set => Data[0x2E55] = (byte)value; }
|
||||
public int MatchSecond { get => Data[0x2E56]; set => Data[0x2E56] = (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); }
|
||||
private int UploadDay { get => Data[0x2E5A]; set => Data[0x2E5A] = (byte)value; }
|
||||
private int UploadMonth { get => Data[0x2E5B]; set => Data[0x2E5B] = (byte)value; }
|
||||
private int UploadHour { get => Data[0x2E5C]; set => Data[0x2E5C] = (byte)value; }
|
||||
private int UploadMinute { get => Data[0x2E5D]; set => Data[0x2E5D] = (byte)value; }
|
||||
private int UploadSecond { get => Data[0x2E5E]; set => Data[0x2E5E] = (byte)value; }
|
||||
private int UploadFlags { get => Data[0x2E5F]; set => Data[0x2E5F] = (byte)value; }
|
||||
public int UploadYear { get => BitConverter.ToUInt16(Data, 0x2E58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E58); }
|
||||
public int UploadDay { get => Data[0x2E5A]; set => Data[0x2E5A] = (byte)value; }
|
||||
public int UploadMonth { get => Data[0x2E5B]; set => Data[0x2E5B] = (byte)value; }
|
||||
public int UploadHour { get => Data[0x2E5C]; set => Data[0x2E5C] = (byte)value; }
|
||||
public int UploadMinute { get => Data[0x2E5D]; set => Data[0x2E5D] = (byte)value; }
|
||||
public int UploadSecond { get => Data[0x2E5E]; set => Data[0x2E5E] = (byte)value; }
|
||||
public int UploadFlags { get => Data[0x2E5F]; set => Data[0x2E5F] = (byte)value; }
|
||||
|
||||
public DateTime? MatchStamp
|
||||
{
|
||||
|
@ -181,23 +174,68 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
// Battle Instruction Parsing
|
||||
private static readonly string[] Action = { "0", "Fight", "2", "Switch", "Run", "5", "Rotate", "7", "MegaEvolve" };
|
||||
|
||||
private static readonly string[] Target =
|
||||
private enum TurnAction
|
||||
{
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Opposite Enemy", "11", "12", "13",
|
||||
"All except User", "Everyone"
|
||||
};
|
||||
None = 0,
|
||||
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" };
|
||||
|
||||
public static readonly string[] BVmode =
|
||||
private enum TurnTarget
|
||||
{
|
||||
"Link", "Maison", "Super Maison", "Battle Spot - Free", "Battle Spot - Rating",
|
||||
"Battle Spot - Special", "UNUSED", "JP-1", "JP-2", "BROKEN",
|
||||
};
|
||||
U0 = 0,
|
||||
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 int PlayerID;
|
||||
public int Count;
|
||||
public readonly int PlayerID;
|
||||
public readonly int Count;
|
||||
public readonly int Bit;
|
||||
|
||||
public TurnActionInstruction(byte Op)
|
||||
{
|
||||
PlayerID = Op >> 5;
|
||||
Bit = (Op >> 4) & 1;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<FlagPairG1Detail> GetFlagPairs()
|
||||
{
|
||||
var pz = ReflectUtil.GetPropertiesStartWithPrefix(GetType(), "Flag");
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
|||
private const int MaxReceivedFlag = 2048;
|
||||
private const int MaxCardsPresent = 12;
|
||||
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 int SeedOffset => Offset + DataSize;
|
||||
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
|||
for (int i = 0; i < Info.Gifts.Length; i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
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
|
||||
PKX.CryptArray(wcData, value.Seed);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace PKHeX.Core
|
|||
set => Data[Offset + 7] = (byte)value;
|
||||
}
|
||||
|
||||
public int GameSyncIDSize => 16; // 64 bits
|
||||
public const int GameSyncIDSize = 16; // 64 bits
|
||||
|
||||
public string GameSyncID
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@ namespace PKHeX.Core
|
|||
|
||||
public string OT_Nick
|
||||
{
|
||||
get => SAV.GetString(Offset + 0x62, SAV6XY.ShortStringLength / 2);
|
||||
set => SAV.SetData(SAV.SetString(value, SAV6XY.ShortStringLength / 2), Offset + 0x62);
|
||||
get => SAV.GetString(Offset + 0x62, SAV6.ShortStringLength / 2);
|
||||
set => SAV.SetData(SAV.SetString(value, SAV6.ShortStringLength / 2), Offset + 0x62);
|
||||
}
|
||||
|
||||
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 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 _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 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 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 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 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 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 _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 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 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 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 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;
|
||||
for (int i = 0; i < numStored; i++)
|
||||
{
|
||||
switch (Type)
|
||||
items[i] = Type switch
|
||||
{
|
||||
case InventoryType.KeyItems:
|
||||
items[i] = new InventoryItem
|
||||
{
|
||||
Index = Data[Offset + i + 1],
|
||||
Count = 1
|
||||
};
|
||||
break;
|
||||
default:
|
||||
items[i] = new InventoryItem
|
||||
{
|
||||
Index = Data[Offset + (i * 2) + 1],
|
||||
Count = Data[Offset + (i * 2) + 2]
|
||||
};
|
||||
break;
|
||||
}
|
||||
InventoryType.KeyItems =>
|
||||
new InventoryItem {Index = Data[Offset + i + 1], Count = 1},
|
||||
_ =>
|
||||
new InventoryItem {Index = Data[Offset + (i * 2) + 1], Count = Data[Offset + (i * 2) + 2]}
|
||||
};
|
||||
}
|
||||
for (int i = numStored; i < items.Length; i++)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public const int SIZE = 0x24;
|
||||
private readonly bool JP;
|
||||
|
||||
|
||||
public Mail3() : base(new byte[SIZE], -1) => ResetData();
|
||||
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) : base(data, -1) { }
|
||||
|
||||
|
||||
public Mail4(byte? lang, byte? ver) : base(new byte[SIZE])
|
||||
{
|
||||
if (lang != null) AuthorLanguage = (byte)lang;
|
||||
|
@ -59,6 +59,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
public override void SetBlank() => SetBlank(0, 0);
|
||||
|
||||
public void SetBlank(byte lang, byte ver)
|
||||
{
|
||||
Array.Clear(Data, 0, Data.Length);
|
||||
|
|
|
@ -43,18 +43,18 @@ namespace PKHeX.Core
|
|||
|
||||
public OPower6(SaveFile sav, int offset) : base(sav) => Offset = offset;
|
||||
|
||||
private OPowerFlagSet this[OPower6Type type] => Array.Find(Mapping, t => t.Identifier == type);
|
||||
public int GetOPowerCount(OPower6Type type) => this[type].BaseCount;
|
||||
public int GetOPowerLevel(OPower6Type type) => this[type].GetOPowerLevel(Data, Offset);
|
||||
private static OPowerFlagSet Get(OPower6Type type) => Array.Find(Mapping, t => t.Identifier == type);
|
||||
public static int GetOPowerCount(OPower6Type type) => Get(type).BaseCount;
|
||||
public int GetOPowerLevel(OPower6Type type) => Get(type).GetOPowerLevel(Data, Offset);
|
||||
|
||||
public bool GetHasOPowerS(OPower6Type type) => this[type].HasOPowerS;
|
||||
public bool GetHasOPowerMAX(OPower6Type type) => this[type].HasOPowerMAX;
|
||||
public bool GetOPowerS(OPower6Type type) => this[type].GetOPowerS(Data, Offset);
|
||||
public bool GetOPowerMAX(OPower6Type type) => this[type].GetOPowerMAX(Data, Offset);
|
||||
public static bool GetHasOPowerS(OPower6Type type) => Get(type).HasOPowerS;
|
||||
public static bool GetHasOPowerMAX(OPower6Type type) => Get(type).HasOPowerMAX;
|
||||
public bool GetOPowerS(OPower6Type type) => Get(type).GetOPowerS(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 SetOPowerS(OPower6Type type, bool value) => this[type].SetOPowerS(Data, Offset, value);
|
||||
public void SetOPowerMAX(OPower6Type type, bool value) => this[type].SetOPowerMAX(Data, Offset, value);
|
||||
public void SetOPowerLevel(OPower6Type type, int lvl) => Get(type).SetOPowerLevel(Data, Offset, lvl);
|
||||
public void SetOPowerS(OPower6Type type, bool value) => Get(type).SetOPowerS(Data, Offset, value);
|
||||
public void SetOPowerMAX(OPower6Type type, bool value) => Get(type).SetOPowerMAX(Data, Offset, value);
|
||||
|
||||
public bool MasterFlag
|
||||
{
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace PKHeX.Core
|
|||
{
|
||||
public abstract class Zukan
|
||||
{
|
||||
protected SaveFile SAV { get; set; }
|
||||
public int PokeDex { get; private set; }
|
||||
protected int PokeDexLanguageFlags { get; set; }
|
||||
protected readonly SaveFile SAV;
|
||||
public readonly int PokeDex;
|
||||
protected readonly int PokeDexLanguageFlags;
|
||||
|
||||
protected Zukan(SaveFile sav, int dex, int langflag)
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ namespace PKHeX.Core
|
|||
|
||||
public virtual void SetDex(PKM pkm)
|
||||
{
|
||||
if (PokeDex < 0 || SAV.Version == GameVersion.Invalid) // sanity
|
||||
if (SAV.Version == GameVersion.Invalid) // sanity
|
||||
return;
|
||||
if (pkm.Species == 0 || pkm.Species > SAV.MaxSpeciesID) // out of range
|
||||
return;
|
||||
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
return;
|
||||
|
||||
int species = pkm.Species;
|
||||
if (species == 327) // Spinda
|
||||
if (species == (int)Species.Spinda)
|
||||
SetSpindaDexData(pkm, GetSeen(species));
|
||||
|
||||
int bit = pkm.Species - 1;
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace PKHeX.WinForms.Controls
|
|||
return;
|
||||
// Resort moves
|
||||
FieldsLoaded = false;
|
||||
LegalMoveSource.ReloadMoves(Legality.AllSuggestedMovesAndRelearn);
|
||||
LegalMoveSource.ReloadMoves(Legality.AllSuggestedMovesAndRelearn());
|
||||
FieldsLoaded = true;
|
||||
LegalityChanged?.Invoke(Legality.Valid, EventArgs.Empty);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace PKHeX.WinForms
|
|||
private set => GameInfo.CurrentLanguage = value;
|
||||
}
|
||||
|
||||
private static bool _unicode { get; set; }
|
||||
private 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:
|
||||
// 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.
|
||||
internal sealed partial class Settings
|
||||
{
|
||||
public Settings() {
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
private Settings()
|
||||
{
|
||||
SettingChanging += SettingChangingEventHandler;
|
||||
SettingsSaving += 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.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
private static void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
Debug.WriteLine("Saving settings...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.RB_Boxes = new System.Windows.Forms.RadioButton();
|
||||
this.RB_Path = new System.Windows.Forms.RadioButton();
|
||||
this.FLP_RB = new System.Windows.Forms.FlowLayoutPanel();
|
||||
|
@ -43,6 +44,9 @@
|
|||
this.L_PropType = new System.Windows.Forms.Label();
|
||||
this.L_PropValue = new System.Windows.Forms.Label();
|
||||
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.SuspendLayout();
|
||||
//
|
||||
|
@ -263,5 +267,8 @@
|
|||
private System.Windows.Forms.Label L_PropValue;
|
||||
private System.Windows.Forms.RadioButton RB_Party;
|
||||
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.SelectedIndex = CB_Require.SelectedIndex = 0;
|
||||
new ToolTip().SetToolTip(CB_Property, MsgBEToolTipPropName);
|
||||
new ToolTip().SetToolTip(L_PropType, MsgBEToolTipPropType);
|
||||
new ToolTip().SetToolTip(L_PropValue, MsgBEToolTipPropValue);
|
||||
toolTip1.SetToolTip(CB_Property, MsgBEToolTipPropName);
|
||||
toolTip2.SetToolTip(L_PropType, MsgBEToolTipPropType);
|
||||
toolTip3.SetToolTip(L_PropValue, MsgBEToolTipPropValue);
|
||||
}
|
||||
|
||||
private readonly PKM pkmref;
|
||||
|
@ -184,7 +184,7 @@ namespace PKHeX.WinForms
|
|||
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);
|
||||
SetupProgressBar(files.Length * sets.Count);
|
||||
|
@ -192,7 +192,7 @@ namespace PKHeX.WinForms
|
|||
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;
|
||||
if (party && SAV.HasParty && process(data = SAV.PartyData))
|
||||
|
@ -229,7 +229,7 @@ namespace PKHeX.WinForms
|
|||
// Mass Editing
|
||||
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++)
|
||||
{
|
||||
|
@ -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++)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgReportExportCSV) != DialogResult.Yes)
|
||||
return;
|
||||
SaveFileDialog savecsv = new SaveFileDialog
|
||||
using var savecsv = new SaveFileDialog
|
||||
{
|
||||
Filter = "Spreadsheet|*.csv",
|
||||
FileName = "Box Data Dump.csv"
|
||||
|
|
|
@ -6,7 +6,7 @@ using PKHeX.Drawing;
|
|||
|
||||
namespace PKHeX.WinForms
|
||||
{
|
||||
public static class CGearExtensions
|
||||
public static class CGearImage
|
||||
{
|
||||
public static Bitmap GetBitmap(CGearBackground bg)
|
||||
{
|
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms
|
|||
byte[] data = SAV.CGearSkinData;
|
||||
bg = new CGearBackground(data);
|
||||
|
||||
PB_Background.Image = CGearExtensions.GetBitmap(bg);
|
||||
PB_Background.Image = CGearImage.GetBitmap(bg);
|
||||
}
|
||||
|
||||
private CGearBackground bg;
|
||||
|
@ -42,8 +42,8 @@ namespace PKHeX.WinForms
|
|||
|
||||
try
|
||||
{
|
||||
bg = CGearExtensions.GetCGearBackground(img);
|
||||
PB_Background.Image = CGearExtensions.GetBitmap(bg);
|
||||
bg = CGearImage.GetCGearBackground(img);
|
||||
PB_Background.Image = CGearImage.GetBitmap(bg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
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)
|
||||
|
|
|
@ -122,12 +122,6 @@ namespace PKHeX.WinForms
|
|||
GB_KeySystem.Visible = false;
|
||||
// Roamer
|
||||
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
|
||||
// Not roamed: Not roamed/Defeated/Captured
|
||||
// Roaming: Roaming/Defeated/Captured
|
||||
|
@ -137,8 +131,7 @@ namespace PKHeX.WinForms
|
|||
for (int i = 0; i < cbr.Length; i++)
|
||||
{
|
||||
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
||||
|
||||
var states = getStates();
|
||||
var states = GetStates();
|
||||
if (states.All(z => z.Value != c))
|
||||
states.Add(new ComboItem($"Unknown (0x{c:X2})", c));
|
||||
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()
|
||||
{
|
||||
uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly);
|
||||
|
|
|
@ -57,15 +57,15 @@ namespace PKHeX.WinForms
|
|||
Current = Types[CB_Type.SelectedIndex];
|
||||
|
||||
CB_Value.Items.Clear();
|
||||
int count = Data.GetOPowerCount(Current);
|
||||
int count = OPower6.GetOPowerCount(Current);
|
||||
for (int i = 0; i <= count; i++)
|
||||
CB_Value.Items.Add(Values[i]);
|
||||
|
||||
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_MAX.Enabled = Data.GetHasOPowerMAX(Current);
|
||||
CHK_MAX.Enabled = OPower6.GetHasOPowerMAX(Current);
|
||||
CHK_MAX.Checked = Data.GetOPowerMAX(Current);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
//
|
||||
// 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.Images.SetKeyName(0, "Bag_Items.png");
|
||||
this.IL_Pouch.Images.SetKeyName(1, "Bag_Key.png");
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace PKHeX.WinForms
|
|||
m = new Mail3[6 + 10];
|
||||
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);
|
||||
m[i] = new Mail3(data, ofs, sav3.Japanese);
|
||||
}
|
||||
|
@ -442,7 +442,8 @@ namespace PKHeX.WinForms
|
|||
if (s.Count(v => v != null) == 0)
|
||||
return ret;
|
||||
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)
|
||||
return ret;
|
||||
foreach (PKM pkm in s)
|
||||
|
|
|
@ -85,12 +85,11 @@ namespace PKHeX.WinForms
|
|||
|
||||
private static object GetValue(IDisposable control)
|
||||
{
|
||||
switch (control)
|
||||
return control switch
|
||||
{
|
||||
case CheckBox cb:
|
||||
return cb.Checked;
|
||||
default: return null;
|
||||
}
|
||||
CheckBox cb => cb.Checked,
|
||||
_ => (object)null
|
||||
};
|
||||
}
|
||||
|
||||
private void SettingsEditor_KeyDown(object sender, KeyEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue