mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add wr7->pkm
Not sure if one of the 'level' fields is a move ID instead. Pound=1, Level=1 Maybe a Chansey record would shed more light.
This commit is contained in:
parent
78ff441e8b
commit
e7531dca30
3 changed files with 24 additions and 6 deletions
|
@ -38,6 +38,8 @@ namespace PKHeX.Core
|
|||
case WC6.SizeFull when ext == ".wc6full":
|
||||
case WC6.Size when ext == ".wc6":
|
||||
return new WC6(data);
|
||||
case WR7.Size when ext == ".wr7":
|
||||
return new WR7(data);
|
||||
|
||||
case PGF.Size when ext == ".pgf":
|
||||
return new PGF(data);
|
||||
|
@ -69,6 +71,7 @@ namespace PKHeX.Core
|
|||
if (BitConverter.ToUInt32(data, 0x4C) / 10000 < 2000)
|
||||
return new WC7(data);
|
||||
return new WC6(data);
|
||||
case WR7.Size: return new WR7(data);
|
||||
|
||||
case PGF.Size: return new PGF(data);
|
||||
case PGT.Size: return new PGT(data);
|
||||
|
|
|
@ -13,14 +13,14 @@ namespace PKHeX.Core
|
|||
private const int RecordMax = 10; // 0xE90 > (0x140 * 0xA = 0xC80), not sure what final 0x210 bytes are used for
|
||||
private const int FlagCountMax = 0x1C00; // (7168) end of the block?
|
||||
|
||||
private int FlagStart => Offset + (RecordMax * WR7.SIZE);
|
||||
private int FlagStart => Offset + (RecordMax * WR7.Size);
|
||||
|
||||
private int GetRecordOffset(int index)
|
||||
{
|
||||
if (index >= RecordMax)
|
||||
throw new ArgumentException(nameof(index));
|
||||
|
||||
return Offset + (index * WR7.SIZE);
|
||||
return Offset + (index * WR7.Size);
|
||||
}
|
||||
|
||||
private int GetFlagOffset(int flag)
|
||||
|
@ -33,8 +33,8 @@ namespace PKHeX.Core
|
|||
public WR7 GetRecord(int index)
|
||||
{
|
||||
int ofs = GetRecordOffset(index);
|
||||
byte[] data = new byte[WR7.SIZE];
|
||||
Array.Copy(Data, ofs, data, 0, WR7.SIZE);
|
||||
byte[] data = new byte[WR7.Size];
|
||||
Array.Copy(Data, ofs, data, 0, WR7.Size);
|
||||
return new WR7(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public class WR7 : MysteryGift
|
||||
{
|
||||
public const int SIZE = 0x140;
|
||||
public const int Size = 0x140;
|
||||
|
||||
public WR7(byte[] data) => Data = data;
|
||||
|
||||
|
@ -88,7 +88,6 @@ namespace PKHeX.Core
|
|||
|
||||
// Mystery Gift implementation
|
||||
public override int Format => 7;
|
||||
public override PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria) => throw new Exception("Non-convertible format.");
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs) => false;
|
||||
protected override bool IsMatchDeferred(PKM pkm) => false;
|
||||
public override int Location { get; set; }
|
||||
|
@ -116,5 +115,21 @@ namespace PKHeX.Core
|
|||
GiftType = WR7GiftType.Pokemon;
|
||||
}
|
||||
}
|
||||
|
||||
public override PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria)
|
||||
{
|
||||
if (!IsPokémon)
|
||||
return null;
|
||||
|
||||
var pk = new PB7();
|
||||
SAV.ApplyToPKM(pk);
|
||||
if (!GameVersion.GG.Contains((GameVersion) SAV.Game))
|
||||
pk.Version = (int) GameVersion.GP;
|
||||
|
||||
pk.Species = Species;
|
||||
pk.Met_Level = pk.CurrentLevel = Level;
|
||||
|
||||
return pk; // can't really do much more
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue