Add gen6->gen7 transfer skeleton

Ingame font changed the order of the faces as noted in #734, this is
just temp until someone tests.

Check old ability & force to new if valid

I bet the transfer method doesn't touch the chars (screwing up faces),
so it can be removed if proven.
This commit is contained in:
Kurt 2017-01-24 23:09:34 -08:00
parent 2cff51be61
commit 7797af4baa
2 changed files with 54 additions and 2 deletions

View file

@ -601,5 +601,57 @@ namespace PKHeX.Core
public override bool WasEventEgg => ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location == 30002)) && Met_Level == 1;
public override bool WasTradedEgg => Egg_Location == 30002;
public override bool WasIngameTrade => Met_Location == 30001;
public PK7 convertToPK7()
{
PK7 pk7 = new PK7(Data)
{
Markings = Markings, // Clears old Super Training Bag & Hits Remaining
Data = { [0x2A] = 0 }, // Clears old Marking Value
};
switch (AbilityNumber)
{
case 1: case 2: case 4: // Valid Ability Numbers
int index = AbilityNumber >> 1;
if (PersonalInfo.Abilities[index] == Ability) // correct pair
pk7.Ability = pk7.PersonalInfo.Abilities[index];
break;
}
// Fix Name Strings
pk7.Nickname = convertString(pk7.Nickname);
pk7.OT_Name = convertString(pk7.OT_Name);
pk7.HT_Name = convertString(pk7.HT_Name);
// Fix Checksum
pk7.RefreshChecksum();
return pk7; // Done!
}
private static string convertString(string input)
{
string s = "";
foreach (char c in input)
{
// Faces get shuffled.
switch (c)
{
case '\uE081':
s += c + 3;
break;
case '\uE082':
case '\uE083':
case '\uE084':
s += c - 1;
break;
default:
s += c;
break;
}
}
return s;
}
}
}

View file

@ -108,7 +108,7 @@ namespace PKHeX.Core
return new PK5(data, ident);
case 6:
PKM pkx = new PK6(data, ident);
if (pkx.SM)
if (pkx.SM || pkx.VC || pkx.Horohoro)
pkx = new PK7(data, ident);
return pkx;
default:
@ -221,7 +221,7 @@ namespace PKHeX.Core
break;
goto case nameof(PK6);
case nameof(PK6):
pkm = new PK7(pkm.Data, pkm.Identifier);
pkm = ((PK6)pkm).convertToPK7();
if (toFormat == 7)
break;
goto case nameof(PK7);