mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-25 11:57:10 +00:00
Simplify qr gender
use personalinfo object to do majority of work, end result has the 4 sequential bytes set neatly
This commit is contained in:
parent
286df71c5a
commit
934595126f
1 changed files with 15 additions and 22 deletions
|
@ -40,7 +40,7 @@ namespace PKHeX.Core
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,29 +48,22 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
var basedata = (byte[])BaseQR.Clone();
|
var basedata = (byte[])BaseQR.Clone();
|
||||||
BitConverter.GetBytes((ushort)species).CopyTo(basedata, 0x28);
|
BitConverter.GetBytes((ushort)species).CopyTo(basedata, 0x28);
|
||||||
|
|
||||||
|
var pi = PersonalTable.USUM.GetFormeEntry(species, formnum);
|
||||||
|
bool biGender = false;
|
||||||
|
if (pi.OnlyMale)
|
||||||
|
gender = 0;
|
||||||
|
else if (pi.OnlyFemale)
|
||||||
|
gender = 1;
|
||||||
|
else if (pi.Genderless)
|
||||||
|
gender = 2;
|
||||||
|
else
|
||||||
|
biGender = !GenderDifferences.Contains(species);
|
||||||
|
|
||||||
basedata[0x2A] = (byte)formnum;
|
basedata[0x2A] = (byte)formnum;
|
||||||
|
basedata[0x2B] = (byte)gender;
|
||||||
basedata[0x2C] = (byte)(shiny ? 1 : 0);
|
basedata[0x2C] = (byte)(shiny ? 1 : 0);
|
||||||
var forme_index = PersonalTable.USUM[species].FormeIndex(species, formnum);
|
basedata[0x2D] = (byte)(biGender ? 1 : 0);
|
||||||
var raw_gender = PersonalTable.USUM[forme_index].Gender;
|
|
||||||
switch (raw_gender)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
basedata[0x2D] = 0;
|
|
||||||
basedata[0x2B] = 0;
|
|
||||||
break;
|
|
||||||
case 0xFE:
|
|
||||||
basedata[0x2D] = 0;
|
|
||||||
basedata[0x2B] = 1;
|
|
||||||
break;
|
|
||||||
case 0xFF:
|
|
||||||
basedata[0x2D] = 0;
|
|
||||||
basedata[0x2B] = 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
basedata[0x2D] = (byte)(GenderDifferences.Contains(species) ? 0 : 1);
|
|
||||||
basedata[0x2B] = (byte)gender;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return basedata;
|
return basedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue