mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Misc refactoring
expose some useful IEnumerable methods (sorting / bin->pkm / copy) to simplify some common operations change some explicit arrays to IList for flexibility remove old memecrypto bool (no longer necessary as XP is not supported) rename some methods for more clarity
This commit is contained in:
parent
212a489335
commit
ed1b934374
25 changed files with 159 additions and 138 deletions
|
@ -40,7 +40,7 @@ namespace PKHeX.Core
|
|||
public override int AltForm { get => Species == 201 ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
|
||||
public override bool IsNicknamed { get => PKX.IsNicknamedAnyLanguage(Species, Nickname, Format); set { } }
|
||||
public override int Gender { get => PKX.GetGender(Species, PID); set { } }
|
||||
public override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
|
||||
public override int Characteristic => -1;
|
||||
public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; }
|
||||
public override int Ability { get { int[] abils = PersonalTable.RS.GetAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace PKHeX.Core
|
|||
public override int AltForm { get => Species == 201 ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
|
||||
public override bool IsNicknamed { get => PKX.IsNicknamedAnyLanguage(Species, Nickname, Format); set { } }
|
||||
public override int Gender { get => PKX.GetGender(Species, PID); set { } }
|
||||
public override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
|
||||
public override int Characteristic => -1;
|
||||
public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; }
|
||||
public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[AbilityBit && abils[1] != 0 ? 1 : 0]; } set { } }
|
||||
|
@ -280,7 +280,7 @@ namespace PKHeX.Core
|
|||
|
||||
// Set Final Data
|
||||
pk4.Met_Level = PKX.GetLevel(pk4.Species, pk4.EXP);
|
||||
pk4.Gender = PKX.GetGender(pk4.Species, pk4.PID);
|
||||
pk4.Gender = PKX.GetGenderFromPID(pk4.Species, pk4.PID);
|
||||
pk4.IsNicknamed = IsNicknamed;
|
||||
|
||||
// Unown Form
|
||||
|
|
|
@ -621,7 +621,7 @@ namespace PKHeX.Core
|
|||
if (GenNumber >= 6)
|
||||
return true;
|
||||
|
||||
return gender == PKX.GetGender(PID, gv);
|
||||
return gender == PKX.GetGenderFromPIDAndRatio(PID, gv);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -332,7 +332,7 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
/// <param name="s">Gender string</param>
|
||||
/// <returns>Gender integer</returns>
|
||||
public static int GetGender(string s)
|
||||
public static int GetGenderFromPID(string s)
|
||||
{
|
||||
if (s == null)
|
||||
return -1;
|
||||
|
@ -528,7 +528,7 @@ namespace PKHeX.Core
|
|||
return pid; // PID can be anything
|
||||
|
||||
// Gen 3/4/5: Gender derived from PID
|
||||
if (cg == GetGender(pid, gt))
|
||||
if (cg == GetGenderFromPIDAndRatio(pid, gt))
|
||||
return pid;
|
||||
}
|
||||
}
|
||||
|
@ -708,12 +708,12 @@ namespace PKHeX.Core
|
|||
/// <param name="PID">Personality ID.</param>
|
||||
/// <returns>Gender ID (0/1/2)</returns>
|
||||
/// <remarks>This method should only be used for Generations 3-5 origin.</remarks>
|
||||
public static int GetGender(int species, uint PID)
|
||||
public static int GetGenderFromPID(int species, uint PID)
|
||||
{
|
||||
int genderratio = Personal[species].Gender;
|
||||
return GetGender(PID, genderratio);
|
||||
return GetGenderFromPIDAndRatio(PID, genderratio);
|
||||
}
|
||||
public static int GetGender(uint PID, int gr)
|
||||
public static int GetGenderFromPIDAndRatio(uint PID, int gr)
|
||||
{
|
||||
switch (gr)
|
||||
{
|
||||
|
@ -875,5 +875,52 @@ namespace PKHeX.Core
|
|||
IVs + " " + EVs,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies an <see cref="Enumerable"/> list to the destination list, with an option to copy to a starting point.
|
||||
/// </summary>
|
||||
/// <param name="list">Source list to copy from</param>
|
||||
/// <param name="dest">Destination list/array</param>
|
||||
/// <param name="start">Starting point to copy to</param>
|
||||
public static void CopyTo(this IEnumerable<PKM> list, IList<PKM> dest, int start = 0)
|
||||
{
|
||||
int ctr = 0;
|
||||
foreach (var z in list)
|
||||
dest[start + ctr++] = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Enumerable"/> list of PKM data from a concatenated byte array binary.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="len">Length of each PKM byte[]</param>
|
||||
/// <returns>Enumerable list of PKM byte arrays</returns>
|
||||
public static IEnumerable<byte[]> GetPKMDataFromConcatenatedBinary(byte[] data, int len)
|
||||
{
|
||||
// split up data to individual pkm
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
{
|
||||
int offset = i * len;
|
||||
var pk = new byte[len];
|
||||
Buffer.BlockCopy(data, offset, pk, 0, len);
|
||||
yield return pk;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts an <see cref="Enumerable"/> list of <see cref="PKM"/> objects according to common-usage.
|
||||
/// </summary>
|
||||
/// <param name="list">Source list to sort</param>
|
||||
/// <returns>Enumerable list that is sorted</returns>
|
||||
public static IEnumerable<PKM> SortPKMs(IEnumerable<PKM> list)
|
||||
{
|
||||
return list
|
||||
.OrderBy(p => p.Species == 0) // empty slots at end
|
||||
.ThenBy(p => p.IsEgg) // eggs to the end
|
||||
.ThenBy(p => p.Species) // species sorted
|
||||
.ThenBy(p => p.AltForm) // altforms sorted
|
||||
.ThenBy(p => p.Gender) // gender sorted
|
||||
.ThenBy(p => p.IsNicknamed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
public override int AltForm { get => Species == 201 ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
|
||||
public override bool IsNicknamed { get => PKX.IsNicknamedAnyLanguage(Species, Nickname, Format); set { } }
|
||||
public override int Gender { get => PKX.GetGender(Species, PID); set { } }
|
||||
public override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
|
||||
public override int Characteristic => -1;
|
||||
public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; }
|
||||
public override int Ability { get { int[] abils = PersonalTable.RS.GetAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
|
||||
|
|
|
@ -1302,8 +1302,6 @@ namespace PKHeX.Core
|
|||
// Data[0x1F22] = (byte)((Data[0x1F22] & 0xFE) | (value ? 1 : 0)); // event
|
||||
}
|
||||
|
||||
public override bool RequiresMemeCrypto => true;
|
||||
|
||||
public override string GetString(int Offset, int Count) => StringConverter.GetString7(Data, Offset, Count);
|
||||
public override byte[] SetString(string value, int maxLength, int PadToSize = 0, ushort PadWith = 0)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -57,8 +58,8 @@ namespace PKHeX.Core
|
|||
return Header.Concat(Data).ToArray();
|
||||
return Data;
|
||||
}
|
||||
public virtual string MiscSaveChecks() { return ""; }
|
||||
public virtual string MiscSaveInfo() { return ""; }
|
||||
public virtual string MiscSaveChecks() => string.Empty;
|
||||
public virtual string MiscSaveInfo() => string.Empty;
|
||||
public virtual GameVersion Version { get; protected set; }
|
||||
public abstract bool ChecksumsValid { get; }
|
||||
public abstract string ChecksumInfo { get; }
|
||||
|
@ -149,7 +150,7 @@ namespace PKHeX.Core
|
|||
public int HoF { get; protected set; } = int.MinValue;
|
||||
|
||||
// SAV Properties
|
||||
public PKM[] BoxData
|
||||
public IList<PKM> BoxData
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -168,16 +169,16 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException();
|
||||
if (value.Length != BoxCount*BoxSlotCount)
|
||||
throw new ArgumentException($"Expected {BoxCount*BoxSlotCount}, got {value.Length}");
|
||||
if (value.Count != BoxCount*BoxSlotCount)
|
||||
throw new ArgumentException($"Expected {BoxCount*BoxSlotCount}, got {value.Count}");
|
||||
if (value.Any(pk => PKMType != pk.GetType()))
|
||||
throw new ArgumentException($"Not {PKMType} array.");
|
||||
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
for (int i = 0; i < value.Count; i++)
|
||||
SetStoredSlot(value[i], GetBoxOffset(i/BoxSlotCount) + SIZE_STORED*(i%BoxSlotCount));
|
||||
}
|
||||
}
|
||||
public PKM[] PartyData
|
||||
public IList<PKM> PartyData
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -190,12 +191,12 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException();
|
||||
if (value.Length == 0 || value.Length > 6)
|
||||
throw new ArgumentException("Expected 1-6, got " + value.Length);
|
||||
if (value.Count == 0 || value.Count > 6)
|
||||
throw new ArgumentException("Expected 1-6, got " + value.Count);
|
||||
if (value.Any(pk => PKMType != pk.GetType()))
|
||||
throw new ArgumentException($"Not {PKMType} array.");
|
||||
if (value[0].Species == 0)
|
||||
Debug.WriteLine($"Empty first slot, received {value.Length}.");
|
||||
Debug.WriteLine($"Empty first slot, received {value.Count}.");
|
||||
|
||||
PKM[] newParty = value.Where(pk => pk.Species != 0).ToArray();
|
||||
|
||||
|
@ -207,7 +208,7 @@ namespace PKHeX.Core
|
|||
SetPartySlot(newParty[i], GetPartyOffset(i));
|
||||
}
|
||||
}
|
||||
public PKM[] BattleBoxData
|
||||
public IList<PKM> BattleBoxData
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -368,7 +369,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
|
||||
var party = PartyData;
|
||||
return party.Length == party.Where((t, i) => t.IsEgg || except.Contains(i)).Count();
|
||||
return party.Count == party.Where((t, i) => t.IsEgg || except.Contains(i)).Count();
|
||||
}
|
||||
|
||||
// Varied Methods
|
||||
|
@ -435,7 +436,7 @@ namespace PKHeX.Core
|
|||
++ctr;
|
||||
b = ctr++;
|
||||
}
|
||||
Array.Copy(boxdata, len*i, Data, GetBoxOffset(b), len);
|
||||
Buffer.BlockCopy(boxdata, len*i, Data, GetBoxOffset(b), len);
|
||||
SetBoxName(b, boxNames[i]);
|
||||
SetBoxWallpaper(b, boxWallpapers[i]);
|
||||
}
|
||||
|
@ -467,9 +468,9 @@ namespace PKHeX.Core
|
|||
int b2o = GetBoxOffset(box2);
|
||||
int len = BoxSlotCount*SIZE_STORED;
|
||||
byte[] b1 = new byte[len];
|
||||
Array.Copy(Data, b1o, b1, 0, len);
|
||||
Array.Copy(Data, b2o, Data, b1o, len);
|
||||
Array.Copy(b1, 0, Data, b2o, len);
|
||||
Buffer.BlockCopy(Data, b1o, b1, 0, len);
|
||||
Buffer.BlockCopy(Data, b2o, Data, b1o, len);
|
||||
Buffer.BlockCopy(b1, 0, Data, b2o, len);
|
||||
|
||||
// Name
|
||||
string b1n = GetBoxName(box1);
|
||||
|
@ -570,20 +571,15 @@ namespace PKHeX.Core
|
|||
|
||||
public void SortBoxes(int BoxStart = 0, int BoxEnd = -1)
|
||||
{
|
||||
PKM[] BD = BoxData;
|
||||
var Section = BD.Skip(BoxStart*BoxSlotCount);
|
||||
var BD = BoxData;
|
||||
int start = BoxSlotCount * BoxStart;
|
||||
var Section = BD.Skip(start);
|
||||
if (BoxEnd > BoxStart)
|
||||
Section = Section.Take(BoxSlotCount*(BoxEnd - BoxStart));
|
||||
Section = Section.Take(BoxSlotCount * (BoxEnd - BoxStart));
|
||||
|
||||
var Sorted = Section
|
||||
.OrderBy(p => p.Species == 0) // empty slots at end
|
||||
.ThenBy(p => p.IsEgg) // eggs to the end
|
||||
.ThenBy(p => p.Species) // species sorted
|
||||
.ThenBy(p => p.AltForm) // altforms sorted
|
||||
.ThenBy(p => p.Gender) // gender sorted
|
||||
.ThenBy(p => p.IsNicknamed).ToArray();
|
||||
var Sorted = PKX.SortPKMs(Section);
|
||||
|
||||
Array.Copy(Sorted, 0, BD, BoxStart*BoxSlotCount, Sorted.Length);
|
||||
Sorted.CopyTo(BD, start);
|
||||
BoxData = BD;
|
||||
}
|
||||
public void ClearBoxes(int BoxStart = 0, int BoxEnd = -1)
|
||||
|
@ -612,43 +608,25 @@ namespace PKHeX.Core
|
|||
if (data.Length != PCBinary.Length)
|
||||
return false;
|
||||
|
||||
int len = BlankPKM.EncryptedBoxData.Length;
|
||||
|
||||
// split up data to individual pkm
|
||||
byte[][] pkdata = new byte[data.Length/len][];
|
||||
for (int i = 0; i < data.Length; i += len)
|
||||
{
|
||||
pkdata[i/len] = new byte[len];
|
||||
Array.Copy(data, i, pkdata[i/len], 0, len);
|
||||
}
|
||||
|
||||
PKM[] pkms = BoxData;
|
||||
for (int i = 0; i < pkms.Length; i++)
|
||||
pkms[i] = GetPKM(DecryptPKM(pkdata[i]));
|
||||
BoxData = pkms;
|
||||
var BD = BoxData;
|
||||
var pkdata = PKX.GetPKMDataFromConcatenatedBinary(data, BlankPKM.EncryptedBoxData.Length);
|
||||
pkdata.Select(z => GetPKM(DecryptPKM(z))).CopyTo(BD);
|
||||
BoxData = BD;
|
||||
return true;
|
||||
}
|
||||
public bool SetBoxBinary(byte[] data, int box)
|
||||
{
|
||||
if (LockedSlots.Any(slot => box * BoxSlotCount <= slot && slot < (box + 1) * BoxSlotCount))
|
||||
int start = box * BoxSlotCount;
|
||||
int end = start + BoxSlotCount;
|
||||
if (LockedSlots.Any(slot => start <= slot && slot < end))
|
||||
return false;
|
||||
if (data.Length != GetBoxBinary(box).Length)
|
||||
return false;
|
||||
|
||||
int len = BlankPKM.EncryptedBoxData.Length;
|
||||
|
||||
// split up data to individual pkm
|
||||
byte[][] pkdata = new byte[data.Length/len][];
|
||||
for (int i = 0; i < data.Length; i += len)
|
||||
{
|
||||
pkdata[i/len] = new byte[len];
|
||||
Array.Copy(data, i, pkdata[i/len], 0, len);
|
||||
}
|
||||
|
||||
PKM[] pkms = BoxData;
|
||||
for (int i = 0; i < BoxSlotCount; i++)
|
||||
pkms[box*BoxSlotCount + i] = GetPKM(DecryptPKM(pkdata[i]));
|
||||
BoxData = pkms;
|
||||
var BD = BoxData;
|
||||
var pkdata = PKX.GetPKMDataFromConcatenatedBinary(data, BlankPKM.EncryptedBoxData.Length);
|
||||
pkdata.Select(z => GetPKM(DecryptPKM(z))).CopyTo(BD, start);
|
||||
BoxData = BD;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -668,7 +646,7 @@ namespace PKHeX.Core
|
|||
return null;
|
||||
|
||||
byte[] data = new byte[Length];
|
||||
Array.Copy(Data, Offset, data, 0, Length);
|
||||
Buffer.BlockCopy(Data, Offset, data, 0, Length);
|
||||
return data;
|
||||
}
|
||||
public void SetData(byte[] input, int Offset)
|
||||
|
@ -680,8 +658,6 @@ namespace PKHeX.Core
|
|||
public abstract string GetString(int Offset, int Length);
|
||||
public abstract byte[] SetString(string value, int maxLength, int PadToSize = 0, ushort PadWith = 0);
|
||||
|
||||
public virtual bool RequiresMemeCrypto => false;
|
||||
|
||||
public virtual string EBerryName => string.Empty;
|
||||
public virtual bool IsEBerryIsEnigma => true;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace PKHeX.WinForms.Controls
|
|||
ck3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
|
||||
|
||||
ck3.FatefulEncounter = CHK_Fateful.Checked;
|
||||
ck3.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
ck3.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
ck3.EV_HP = Util.ToInt32(TB_HPEV.Text);
|
||||
ck3.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
ck3.EV_DEF = Util.ToInt32(TB_DEFEV.Text);
|
||||
|
@ -182,7 +182,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
ck3.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
ck3.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
ck3.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
ck3.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
ck3.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
ck3.Language = WinFormsUtil.GetIndex(CB_Language);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk2.HeldItem = WinFormsUtil.GetIndex(CB_HeldItem);
|
||||
pk2.IsEgg = CHK_IsEgg.Checked;
|
||||
pk2.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);
|
||||
pk2.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk2.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk2.Met_Location = WinFormsUtil.GetIndex(CB_MetLocation);
|
||||
pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex;
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
|
||||
|
||||
pk3.FatefulEncounter = CHK_Fateful.Checked;
|
||||
pk3.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pk3.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pk3.EV_HP = Util.ToInt32(TB_HPEV.Text);
|
||||
pk3.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
pk3.EV_DEF = Util.ToInt32(TB_DEFEV.Text);
|
||||
|
@ -161,7 +161,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk3.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
pk3.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk3.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk3.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk3.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
pk3.Language = WinFormsUtil.GetIndex(CB_Language);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
|
||||
pk4.FatefulEncounter = CHK_Fateful.Checked;
|
||||
pk4.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pk4.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pk4.AltForm = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
|
||||
pk4.EV_HP = Util.ToInt32(TB_HPEV.Text);
|
||||
pk4.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
|
@ -204,7 +204,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk4.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
pk4.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk4.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk4.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk4.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
|
||||
pk4.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
pk4.Language = WinFormsUtil.GetIndex(CB_Language);
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk5.Nature = (byte)WinFormsUtil.GetIndex(CB_Nature);
|
||||
pk5.FatefulEncounter = CHK_Fateful.Checked;
|
||||
pk5.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pk5.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pk5.AltForm = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
|
||||
pk5.EV_HP = Util.ToInt32(TB_HPEV.Text);
|
||||
pk5.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
|
@ -221,7 +221,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk5.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
pk5.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk5.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk5.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk5.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
|
||||
pk5.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
pk5.Language = WinFormsUtil.GetIndex(CB_Language);
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk6.PID = Util.GetHexValue(TB_PID.Text);
|
||||
pk6.Nature = (byte)WinFormsUtil.GetIndex(CB_Nature);
|
||||
pk6.FatefulEncounter = CHK_Fateful.Checked;
|
||||
pk6.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pk6.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pk6.AltForm = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
|
||||
pk6.EV_HP = Util.ToInt32(TB_HPEV.Text); // EVs
|
||||
pk6.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
|
@ -234,7 +234,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk6.HT_Name = TB_OTt2.Text;
|
||||
|
||||
// 0x90-0xAF
|
||||
pk6.HT_Gender = PKX.GetGender(Label_CTGender.Text) & 1;
|
||||
pk6.HT_Gender = PKX.GetGenderFromPID(Label_CTGender.Text) & 1;
|
||||
// Plus more, set by MemoryAmie (already in buff)
|
||||
|
||||
// Block D
|
||||
|
@ -262,7 +262,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk6.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
pk6.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk6.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk6.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk6.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
|
||||
pk6.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
pk6.Country = WinFormsUtil.GetIndex(CB_Country);
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk7.PID = Util.GetHexValue(TB_PID.Text);
|
||||
pk7.Nature = (byte)WinFormsUtil.GetIndex(CB_Nature);
|
||||
pk7.FatefulEncounter = CHK_Fateful.Checked;
|
||||
pk7.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pk7.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pk7.AltForm = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
|
||||
pk7.EV_HP = Util.ToInt32(TB_HPEV.Text); // EVs
|
||||
pk7.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
|
@ -233,7 +233,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pk7.HT_Name = TB_OTt2.Text;
|
||||
|
||||
// 0x90-0xAF
|
||||
pk7.HT_Gender = PKX.GetGender(Label_CTGender.Text) & 1;
|
||||
pk7.HT_Gender = PKX.GetGenderFromPID(Label_CTGender.Text) & 1;
|
||||
// Plus more, set by MemoryAmie (already in buff)
|
||||
|
||||
// Block D
|
||||
|
@ -261,7 +261,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
pk7.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
pk7.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
pk7.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
pk7.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
pk7.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
|
||||
pk7.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
pk7.Country = WinFormsUtil.GetIndex(CB_Country);
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace PKHeX.WinForms.Controls
|
|||
xk3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
|
||||
|
||||
xk3.FatefulEncounter = CHK_Fateful.Checked;
|
||||
xk3.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
xk3.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
xk3.EV_HP = Util.ToInt32(TB_HPEV.Text);
|
||||
xk3.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
|
||||
xk3.EV_DEF = Util.ToInt32(TB_DEFEV.Text);
|
||||
|
@ -182,7 +182,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
xk3.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
xk3.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
||||
xk3.OT_Gender = PKX.GetGender(Label_OTGender.Text);
|
||||
xk3.OT_Gender = PKX.GetGenderFromPID(Label_OTGender.Text);
|
||||
xk3.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
xk3.Language = WinFormsUtil.GetIndex(CB_Language);
|
||||
|
||||
|
|
|
@ -284,12 +284,12 @@ namespace PKHeX.WinForms.Controls
|
|||
TB_Nickname.Font = TB_OT.Font = TB_OTt2.Font = FontUtil.GetPKXFont(11);
|
||||
}
|
||||
// Switch active gender labels to new if they are active.
|
||||
if (PKX.GetGender(Label_Gender.Text) < 2)
|
||||
Label_Gender.Text = gendersymbols[PKX.GetGender(Label_Gender.Text)];
|
||||
if (PKX.GetGender(Label_OTGender.Text) < 2)
|
||||
Label_OTGender.Text = gendersymbols[PKX.GetGender(Label_OTGender.Text)];
|
||||
if (PKX.GetGender(Label_CTGender.Text) < 2)
|
||||
Label_CTGender.Text = gendersymbols[PKX.GetGender(Label_CTGender.Text)];
|
||||
if (PKX.GetGenderFromPID(Label_Gender.Text) < 2)
|
||||
Label_Gender.Text = gendersymbols[PKX.GetGenderFromPID(Label_Gender.Text)];
|
||||
if (PKX.GetGenderFromPID(Label_OTGender.Text) < 2)
|
||||
Label_OTGender.Text = gendersymbols[PKX.GetGenderFromPID(Label_OTGender.Text)];
|
||||
if (PKX.GetGenderFromPID(Label_CTGender.Text) < 2)
|
||||
Label_CTGender.Text = gendersymbols[PKX.GetGenderFromPID(Label_CTGender.Text)];
|
||||
}
|
||||
private void UpdateSprite()
|
||||
{
|
||||
|
@ -446,7 +446,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
private void UpdateGender()
|
||||
{
|
||||
int cg = PKX.GetGender(Label_Gender.Text);
|
||||
int cg = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
int gt = pkm.PersonalInfo.Gender;
|
||||
|
||||
int Gender;
|
||||
|
@ -531,11 +531,11 @@ namespace PKHeX.WinForms.Controls
|
|||
if (gt >= 255) return;
|
||||
// If not a single gender(less) species: (should be <254 but whatever, 255 never happens)
|
||||
|
||||
int newGender = PKX.GetGender(Label_Gender.Text) ^ 1;
|
||||
int newGender = PKX.GetGenderFromPID(Label_Gender.Text) ^ 1;
|
||||
if (pkm.Format <= 2)
|
||||
{
|
||||
do { TB_ATKIV.Text = (pkm.IV_ATK = (int)(Util.Rand32() & pkm.MaxIV)).ToString(); }
|
||||
while (PKX.GetGender(Label_Gender.Text = gendersymbols[pkm.Gender]) != newGender);
|
||||
while (PKX.GetGenderFromPID(Label_Gender.Text = gendersymbols[pkm.Gender]) != newGender);
|
||||
SetIsShiny(null);
|
||||
}
|
||||
else if (pkm.Format <= 4)
|
||||
|
@ -553,8 +553,8 @@ namespace PKHeX.WinForms.Controls
|
|||
Label_Gender.Text = gendersymbols[pkm.Gender];
|
||||
Label_Gender.ForeColor = GetGenderColor(pkm.Gender);
|
||||
|
||||
if (PKX.GetGender(CB_Form.Text) < 2) // Gendered Forms
|
||||
CB_Form.SelectedIndex = PKX.GetGender(Label_Gender.Text);
|
||||
if (PKX.GetGenderFromPID(CB_Form.Text) < 2) // Gendered Forms
|
||||
CB_Form.SelectedIndex = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
|
||||
UpdatePreviewSprite(Label_Gender, null);
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ namespace PKHeX.WinForms.Controls
|
|||
Label lbl = sender as Label;
|
||||
if (!string.IsNullOrWhiteSpace(lbl?.Text)) // set gender label (toggle M/F)
|
||||
{
|
||||
int gender = PKX.GetGender(lbl.Text) ^ 1;
|
||||
int gender = PKX.GetGenderFromPID(lbl.Text) ^ 1;
|
||||
lbl.Text = gendersymbols[gender];
|
||||
lbl.ForeColor = GetGenderColor(gender);
|
||||
}
|
||||
|
@ -1133,10 +1133,10 @@ namespace PKHeX.WinForms.Controls
|
|||
UpdateRandomIVs(null, null);
|
||||
}
|
||||
}
|
||||
else if (PKX.GetGender(CB_Form.Text) < 2)
|
||||
else if (PKX.GetGenderFromPID(CB_Form.Text) < 2)
|
||||
{
|
||||
if (CB_Form.Items.Count == 2) // actually M/F; Pumpkaboo formes in German are S,M,L,XL
|
||||
Label_Gender.Text = gendersymbols[PKX.GetGender(CB_Form.Text)];
|
||||
Label_Gender.Text = gendersymbols[PKX.GetGenderFromPID(CB_Form.Text)];
|
||||
}
|
||||
|
||||
if (changingFields)
|
||||
|
@ -1576,7 +1576,7 @@ namespace PKHeX.WinForms.Controls
|
|||
pkm.SID = Util.ToInt32(TB_SID.Text);
|
||||
pkm.PID = Util.GetHexValue(TB_PID.Text);
|
||||
pkm.Nature = WinFormsUtil.GetIndex(CB_Nature);
|
||||
pkm.Gender = PKX.GetGender(Label_Gender.Text);
|
||||
pkm.Gender = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
pkm.AltForm = CB_Form.SelectedIndex;
|
||||
pkm.Version = WinFormsUtil.GetIndex(CB_GameOrigin);
|
||||
|
||||
|
@ -1984,7 +1984,7 @@ namespace PKHeX.WinForms.Controls
|
|||
TB_Nickname.Text = Set.Nickname;
|
||||
if (Set.Gender != null)
|
||||
{
|
||||
int Gender = PKX.GetGender(Set.Gender);
|
||||
int Gender = PKX.GetGenderFromPID(Set.Gender);
|
||||
Label_Gender.Text = gendersymbols[Gender];
|
||||
Label_Gender.ForeColor = GetGenderColor(Gender);
|
||||
}
|
||||
|
|
|
@ -236,18 +236,18 @@ namespace PKHeX.WinForms.Controls
|
|||
// Refresh slots
|
||||
if (SAV.HasParty)
|
||||
{
|
||||
PKM[] party = SAV.PartyData;
|
||||
for (int i = 0; i < party.Length; i++)
|
||||
var party = SAV.PartyData;
|
||||
for (int i = 0; i < party.Count; i++)
|
||||
SlotPictureBoxes[i + 30].Image = GetSprite(party[i], i + 30);
|
||||
for (int i = party.Length; i < 6; i++)
|
||||
for (int i = party.Count; i < 6; i++)
|
||||
SlotPictureBoxes[i + 30].Image = null;
|
||||
}
|
||||
if (SAV.HasBattleBox)
|
||||
{
|
||||
PKM[] battle = SAV.BattleBoxData;
|
||||
for (int i = 0; i < battle.Length; i++)
|
||||
var battle = SAV.BattleBoxData;
|
||||
for (int i = 0; i < battle.Count; i++)
|
||||
SlotPictureBoxes[i + 36].Image = GetSprite(battle[i], i + 36);
|
||||
for (int i = battle.Length; i < 6; i++)
|
||||
for (int i = battle.Count; i < 6; i++)
|
||||
SlotPictureBoxes[i + 36].Image = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace PKHeX.WinForms.Controls
|
|||
byte[] data = File.ReadAllBytes(file);
|
||||
MysteryGift mg = MysteryGift.GetMysteryGift(data, fi.Extension);
|
||||
PKM temp = mg?.ConvertToPKM(SAV) ?? PKMConverter.GetPKMfromBytes(data,
|
||||
prefer: fi.Extension.Length > 0 ? (fi.Extension.Last() - 0x30) & 7 : SAV.Generation);
|
||||
prefer: fi.Extension.Length > 0 ? (fi.Extension.Last() - '0') & 0xF : SAV.Generation);
|
||||
|
||||
PKM pk = PKMConverter.ConvertToType(temp, SAV.PKMType, out string c);
|
||||
if (pk == null)
|
||||
|
|
|
@ -435,7 +435,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private void ClickShowdownExportParty(object sender, EventArgs e)
|
||||
{
|
||||
if (C_SAV.SAV.PartyData.Length <= 0) return;
|
||||
if (C_SAV.SAV.PartyData.Count <= 0) return;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(
|
||||
|
@ -447,7 +447,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private void ClickShowdownExportBattleBox(object sender, EventArgs e)
|
||||
{
|
||||
if (C_SAV.SAV.BattleBoxData.Length <= 0) return;
|
||||
if (C_SAV.SAV.BattleBoxData.Count <= 0) return;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(
|
||||
|
@ -575,7 +575,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private bool TryLoadPKM(byte[] input, string path, string ext, SaveFile SAV)
|
||||
{
|
||||
var temp = PKMConverter.GetPKMfromBytes(input, prefer: ext.Length > 0 ? (ext.Last() - 0x30) & 7 : C_SAV.SAV.Generation);
|
||||
var temp = PKMConverter.GetPKMfromBytes(input, prefer: ext.Length > 0 ? (ext.Last() - '0') & 0xF : C_SAV.SAV.Generation);
|
||||
if (temp == null)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -216,16 +216,16 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private void RunBatchEditSaveFile(StringInstruction[] Filters, StringInstruction[] Instructions)
|
||||
{
|
||||
PKM[] data;
|
||||
IList<PKM> data;
|
||||
if (SAV.HasParty && process(data = SAV.PartyData))
|
||||
SAV.PartyData = data;
|
||||
if (SAV.HasBox && process(data = SAV.BoxData))
|
||||
SAV.BoxData = data;
|
||||
bool process(PKM[] d)
|
||||
bool process(IList<PKM> d)
|
||||
{
|
||||
SetupProgressBar(d.Length);
|
||||
SetupProgressBar(d.Count);
|
||||
ProcessSAV(d, Filters, Instructions);
|
||||
return d.Length != 0;
|
||||
return d.Count != 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,17 +247,17 @@ namespace PKHeX.WinForms
|
|||
|
||||
// Mass Editing
|
||||
private int ctr, len, err;
|
||||
private void ProcessSAV(PKM[] data, StringInstruction[] Filters, StringInstruction[] Instructions)
|
||||
private void ProcessSAV(IList<PKM> data, StringInstruction[] Filters, StringInstruction[] Instructions)
|
||||
{
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
ProcessPKM(data[i], Filters, Instructions);
|
||||
b.ReportProgress(i);
|
||||
}
|
||||
}
|
||||
private void ProcessFolder(string[] files, StringInstruction[] Filters, StringInstruction[] Instructions, string destPath)
|
||||
private void ProcessFolder(IReadOnlyList<string> files, StringInstruction[] Filters, StringInstruction[] Instructions, string destPath)
|
||||
{
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
for (int i = 0; i < files.Count; i++)
|
||||
{
|
||||
string file = files[i];
|
||||
var fi = new FileInfo(file);
|
||||
|
@ -267,7 +267,7 @@ namespace PKHeX.WinForms
|
|||
continue;
|
||||
}
|
||||
|
||||
int format = fi.Extension.Length > 0 ? (fi.Extension.Last() - 0x30) & 7 : SAV.Generation;
|
||||
int format = fi.Extension.Length > 0 ? (fi.Extension.Last() - '0') & 0xF : SAV.Generation;
|
||||
byte[] data = File.ReadAllBytes(file);
|
||||
var pkm = PKMConverter.GetPKMfromBytes(data, prefer: format);
|
||||
if (ProcessPKM(pkm, Filters, Instructions))
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
dgData.ContextMenuStrip = mnu;
|
||||
}
|
||||
public void PopulateData(PKM[] Data)
|
||||
public void PopulateData(IList<PKM> Data)
|
||||
{
|
||||
SuspendLayout();
|
||||
BoxBar.Step = 1;
|
||||
|
@ -174,7 +174,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
dgData.DataSource = PL;
|
||||
dgData.AutoGenerateColumns = true;
|
||||
BoxBar.Maximum = Data.Length + dgData.Columns.Count;
|
||||
BoxBar.Maximum = Data.Count + dgData.Columns.Count;
|
||||
for (int i = 0; i < dgData.Columns.Count; i++)
|
||||
{
|
||||
BoxBar.PerformStep();
|
||||
|
|
|
@ -334,7 +334,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
FileInfo fi = new FileInfo(file);
|
||||
if (!fi.Extension.Contains(".pk") || !PKX.IsPKM(fi.Length)) return;
|
||||
var pk = PKMConverter.GetPKMfromBytes(File.ReadAllBytes(file), file, prefer: (fi.Extension.Last() - 0x30) & 7);
|
||||
var pk = PKMConverter.GetPKMfromBytes(File.ReadAllBytes(file), file, prefer: (fi.Extension.Last() - '0') & 0xF);
|
||||
if (pk != null)
|
||||
dbTemp.Add(pk);
|
||||
});
|
||||
|
|
|
@ -258,7 +258,7 @@ namespace PKHeX.WinForms
|
|||
uint rawslgf = BitConverter.ToUInt32(data, offset + 0x14);
|
||||
uint slgf = 0;
|
||||
slgf |= (uint)(CB_Form.SelectedIndex & 0x1F);
|
||||
slgf |= (uint)((PKX.GetGender(Label_Gender.Text) & 0x3) << 5);
|
||||
slgf |= (uint)((PKX.GetGenderFromPID(Label_Gender.Text) & 0x3) << 5);
|
||||
slgf |= (uint)((Convert.ToUInt16(TB_Level.Text) & 0x7F) << 7);
|
||||
if (CHK_Shiny.Checked)
|
||||
slgf |= 1 << 14;
|
||||
|
@ -291,7 +291,7 @@ namespace PKHeX.WinForms
|
|||
vnd |= rawvnd & 0x80000000;
|
||||
Array.Copy(BitConverter.GetBytes(vnd), 0, data, offset + 0x1B0, 4);
|
||||
|
||||
bpkx.Image = PKMUtil.GetSprite(WinFormsUtil.GetIndex(CB_Species), CB_Form.SelectedIndex & 0x1F, PKX.GetGender(Label_Gender.Text), WinFormsUtil.GetIndex(CB_HeldItem), false, CHK_Shiny.Checked);
|
||||
bpkx.Image = PKMUtil.GetSprite(WinFormsUtil.GetIndex(CB_Species), CB_Form.SelectedIndex & 0x1F, PKX.GetGenderFromPID(Label_Gender.Text), WinFormsUtil.GetIndex(CB_HeldItem), false, CHK_Shiny.Checked);
|
||||
DisplayEntry(null, null); // refresh text view
|
||||
}
|
||||
private void Validate_TextBoxes()
|
||||
|
@ -340,7 +340,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
if (!editing)
|
||||
return; //Don't do writing until loaded
|
||||
bpkx.Image = PKMUtil.GetSprite(WinFormsUtil.GetIndex(CB_Species), CB_Form.SelectedIndex & 0x1F, PKX.GetGender(Label_Gender.Text), WinFormsUtil.GetIndex(CB_HeldItem), false, CHK_Shiny.Checked);
|
||||
bpkx.Image = PKMUtil.GetSprite(WinFormsUtil.GetIndex(CB_Species), CB_Form.SelectedIndex & 0x1F, PKX.GetGenderFromPID(Label_Gender.Text), WinFormsUtil.GetIndex(CB_HeldItem), false, CHK_Shiny.Checked);
|
||||
|
||||
Write_Entry(null, null);
|
||||
}
|
||||
|
@ -362,16 +362,16 @@ namespace PKHeX.WinForms
|
|||
|
||||
if (gt < 256) // If not a single gender(less) species:
|
||||
{
|
||||
Label_Gender.Text = PKX.GetGender(Label_Gender.Text) == 0 ? gendersymbols[1] : gendersymbols[0];
|
||||
Label_Gender.Text = PKX.GetGenderFromPID(Label_Gender.Text) == 0 ? gendersymbols[1] : gendersymbols[0];
|
||||
|
||||
if (PKX.GetGender(CB_Form.Text) == 0 && Label_Gender.Text != gendersymbols[0])
|
||||
if (PKX.GetGenderFromPID(CB_Form.Text) == 0 && Label_Gender.Text != gendersymbols[0])
|
||||
CB_Form.SelectedIndex = 1;
|
||||
else if (PKX.GetGender(CB_Form.Text) == 1 && Label_Gender.Text != gendersymbols[1])
|
||||
else if (PKX.GetGenderFromPID(CB_Form.Text) == 1 && Label_Gender.Text != gendersymbols[1])
|
||||
CB_Form.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
if (species == 668)
|
||||
CB_Form.SelectedIndex = PKX.GetGender(Label_Gender.Text);
|
||||
CB_Form.SelectedIndex = PKX.GetGenderFromPID(Label_Gender.Text);
|
||||
|
||||
Write_Entry(null, null);
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace PKHeX.WinForms
|
|||
pkm[0x14] = (byte)WinFormsUtil.GetIndex(CB_Nature);
|
||||
|
||||
int fegform = 0;
|
||||
fegform += PKX.GetGender(Label_Gender.Text) << 1;
|
||||
fegform += PKX.GetGenderFromPID(Label_Gender.Text) << 1;
|
||||
fegform += CB_Form.SelectedIndex << 3;
|
||||
pkm[0x15] = (byte)fegform;
|
||||
|
||||
|
@ -463,7 +463,7 @@ namespace PKHeX.WinForms
|
|||
SetAbilityList();
|
||||
|
||||
// If form has a single gender, account for it.
|
||||
if (PKX.GetGender(CB_Form.Text) < 2)
|
||||
if (PKX.GetGenderFromPID(CB_Form.Text) < 2)
|
||||
Label_Gender.Text = Main.GenderSymbols[CB_Form.SelectedIndex];
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ namespace PKHeX.WinForms
|
|||
return;
|
||||
|
||||
if (gt < 256) // If not a single gender(less) species:
|
||||
Label_Gender.Text = Main.GenderSymbols[PKX.GetGender(Label_Gender.Text) ^ 1];
|
||||
Label_Gender.Text = Main.GenderSymbols[PKX.GetGenderFromPID(Label_Gender.Text) ^ 1];
|
||||
}
|
||||
private void SetGenderLabel()
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms
|
|||
/// <returns></returns>
|
||||
public static bool DumpBoxes(this SaveFile SAV, string path, out string result, bool boxFolders = false)
|
||||
{
|
||||
PKM[] boxdata = SAV.BoxData;
|
||||
var boxdata = SAV.BoxData;
|
||||
if (boxdata == null)
|
||||
{ result = "Invalid Box Data, unable to dump."; return false; }
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace PKHeX.WinForms
|
|||
/// <returns></returns>
|
||||
public static bool DumpBox(this SaveFile SAV, string path, out string result, int currentBox)
|
||||
{
|
||||
PKM[] boxdata = SAV.BoxData;
|
||||
var boxdata = SAV.BoxData;
|
||||
if (boxdata == null)
|
||||
{ result = "Invalid Box Data, unable to dump."; return false; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue