2016-10-20 01:19:01 +00:00
|
|
|
|
using System;
|
2017-07-02 02:43:51 +00:00
|
|
|
|
using System.Diagnostics;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2017-10-24 06:12:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generation 7 <see cref="SaveFile"/> object.
|
|
|
|
|
/// </summary>
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public abstract class SAV7 : SAV_BEEF, ITrainerStatRecord
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
|
|
|
|
// Save Data Attributes
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected override string BAKText => $"{OT} ({Version}) - {Played.LastSavedTime}";
|
2016-10-20 01:19:01 +00:00
|
|
|
|
public override string Filter => "Main SAV|*.*";
|
2019-02-08 05:40:20 +00:00
|
|
|
|
public override string Extension => string.Empty;
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-01-05 06:22:50 +00:00
|
|
|
|
public override string[] PKMExtensions => PKM.Extensions.Where(f =>
|
|
|
|
|
{
|
|
|
|
|
int gen = f.Last() - 0x30;
|
2019-02-10 04:33:37 +00:00
|
|
|
|
return gen <= 7 && f[1] != 'b'; // ignore PB7
|
2017-01-05 06:22:50 +00:00
|
|
|
|
}).ToArray();
|
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected SAV7(byte[] data, BlockInfo[] blocks, int biOffset) : base(data, blocks, biOffset)
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
Initialize();
|
|
|
|
|
ClearMemeCrypto();
|
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected SAV7(int size, BlockInfo[] blocks, int biOffset) : base(size, blocks, biOffset)
|
|
|
|
|
{
|
|
|
|
|
Initialize();
|
|
|
|
|
ClearBoxes();
|
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
private void Initialize()
|
|
|
|
|
{
|
|
|
|
|
GetSAVOffsets();
|
|
|
|
|
ReloadBattleTeams();
|
|
|
|
|
}
|
2016-11-08 16:43:57 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
private void ReloadBattleTeams()
|
|
|
|
|
{
|
2017-10-31 16:24:54 +00:00
|
|
|
|
var demo = !USUM && Data.Skip(PCLayout).Take(0x4C4).All(z => z == 0); // up to Battle Box values
|
2016-12-16 16:50:50 +00:00
|
|
|
|
if (demo || !Exportable)
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
BoxLayout.ClearBattleTeams();
|
2016-11-08 16:43:57 +00:00
|
|
|
|
}
|
2016-12-16 16:50:50 +00:00
|
|
|
|
else // Valid slot locking info present
|
2016-12-16 07:17:17 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
BoxLayout.LoadBattleTeams();
|
2016-12-16 07:17:17 +00:00
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
// Configuration
|
|
|
|
|
public override int SIZE_STORED => PKX.SIZE_6STORED;
|
2017-06-18 01:37:19 +00:00
|
|
|
|
protected override int SIZE_PARTY => PKX.SIZE_6PARTY;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
public override PKM BlankPKM => new PK7();
|
|
|
|
|
public override Type PKMType => typeof(PK7);
|
|
|
|
|
|
|
|
|
|
public override int BoxCount => 32;
|
|
|
|
|
public override int MaxEV => 252;
|
|
|
|
|
public override int Generation => 7;
|
2016-10-27 05:06:03 +00:00
|
|
|
|
protected override int GiftCountMax => 48;
|
|
|
|
|
protected override int GiftFlagMax => 0x100 * 8;
|
2017-11-13 05:28:34 +00:00
|
|
|
|
protected override int EventConstMax => 1000;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
public override int OTLength => 12;
|
|
|
|
|
public override int NickLength => 12;
|
|
|
|
|
|
2017-01-27 03:18:20 +00:00
|
|
|
|
public override int MaxBallID => Legal.MaxBallID_7; // 26
|
|
|
|
|
public override int MaxGameID => Legal.MaxGameID_7;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected override PKM GetPKM(byte[] data) => new PK7(data);
|
|
|
|
|
protected override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray(data);
|
2016-11-12 22:57:54 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
// Feature Overrides
|
|
|
|
|
|
|
|
|
|
// Blocks & Offsets
|
2017-11-08 23:07:04 +00:00
|
|
|
|
private const int MemeCryptoBlock = 36;
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
private void ClearMemeCrypto()
|
2017-11-04 22:04:21 +00:00
|
|
|
|
{
|
2017-11-14 03:34:50 +00:00
|
|
|
|
new byte[0x80].CopyTo(Data, Blocks[MemeCryptoBlock].Offset + 0x100);
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
protected override void SetChecksums()
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
BoxLayout.SaveBattleTeams();
|
2018-02-19 19:33:37 +00:00
|
|
|
|
Blocks.SetChecksums(Data);
|
2016-10-27 05:06:03 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected override byte[] GetFinalData()
|
2016-10-27 05:06:03 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
SetChecksums();
|
|
|
|
|
var result = MemeCrypto.Resign7(Data);
|
|
|
|
|
Debug.Assert(result != Data);
|
|
|
|
|
return result;
|
2016-10-27 05:06:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void GetSAVOffsets()
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2017-11-08 08:34:32 +00:00
|
|
|
|
/* 00 */ Bag = Blocks[00].Offset; // 0x00000 // [DE0] MyItem
|
|
|
|
|
/* 01 */ Trainer1 = Blocks[01].Offset; // 0x00E00 // [07C] Situation
|
|
|
|
|
/* 02 */ // = Blocks[02].Offset; // 0x01000 // [014] RandomGroup
|
|
|
|
|
/* 03 */ TrainerCard = Blocks[03].Offset; // 0x01200 // [0C0] MyStatus
|
|
|
|
|
/* 04 */ Party = Blocks[04].Offset; // 0x01400 // [61C] PokePartySave
|
|
|
|
|
/* 05 */ EventConst = Blocks[05].Offset; // 0x01C00 // [E00] EventWork
|
|
|
|
|
/* 06 */ PokeDex = Blocks[06].Offset; // 0x02A00 // [F78] ZukanData
|
|
|
|
|
/* 07 */ GTS = Blocks[07].Offset; // 0x03A00 // [228] GtsData
|
2018-05-12 15:41:23 +00:00
|
|
|
|
/* 08 */ Fused = Blocks[08].Offset; // 0x03E00 // [104] UnionPokemon
|
2017-11-08 08:34:32 +00:00
|
|
|
|
/* 09 */ Misc = Blocks[09].Offset; // 0x04000 // [200] Misc
|
|
|
|
|
/* 10 */ Trainer2 = Blocks[10].Offset; // 0x04200 // [020] FieldMenu
|
|
|
|
|
/* 11 */ ConfigSave = Blocks[11].Offset; // 0x04400 // [004] ConfigSave
|
|
|
|
|
/* 12 */ AdventureInfo = Blocks[12].Offset; // 0x04600 // [058] GameTime
|
|
|
|
|
/* 13 */ PCLayout = Blocks[13].Offset; // 0x04800 // [5E6] BOX
|
|
|
|
|
/* 14 */ Box = Blocks[14].Offset; // 0x04E00 // [36600] BoxPokemon
|
|
|
|
|
/* 15 */ Resort = Blocks[15].Offset; // 0x3B400 // [572C] ResortSave
|
|
|
|
|
/* 16 */ PlayTime = Blocks[16].Offset; // 0x40C00 // [008] PlayTime
|
|
|
|
|
/* 17 */ Overworld = Blocks[17].Offset; // 0x40E00 // [1080] FieldMoveModelSave
|
|
|
|
|
/* 18 */ Fashion = Blocks[18].Offset; // 0x42000 // [1A08] Fashion
|
|
|
|
|
/* 19 */ // = Blocks[19].Offset; // 0x43C00 // [6408] JoinFestaPersonalSave
|
|
|
|
|
/* 20 */ // = Blocks[20].Offset; // 0x4A200 // [6408] JoinFestaPersonalSave
|
|
|
|
|
/* 21 */ JoinFestaData = Blocks[21].Offset; // 0x50800 // [3998] JoinFestaDataSave
|
|
|
|
|
/* 22 */ // = Blocks[22].Offset; // 0x54200 // [100] BerrySpot
|
|
|
|
|
/* 23 */ // = Blocks[23].Offset; // 0x54400 // [100] FishingSpot
|
|
|
|
|
/* 24 */ // = Blocks[24].Offset; // 0x54600 // [10528] LiveMatchData
|
|
|
|
|
/* 25 */ // = Blocks[25].Offset; // 0x64C00 // [204] BattleSpotData
|
|
|
|
|
/* 26 */ PokeFinderSave = Blocks[26].Offset; // 0x65000 // [B60] PokeFinderSave
|
|
|
|
|
/* 27 */ WondercardFlags= Blocks[27].Offset; // 0x65C00 // [3F50] MysteryGiftSave
|
|
|
|
|
/* 28 */ Record = Blocks[28].Offset; // 0x69C00 // [358] Record
|
|
|
|
|
/* 29 */ // = Blocks[29].Offset; // 0x6A000 // [728] ValidationSave
|
|
|
|
|
/* 30 */ // = Blocks[30].Offset; // 0x6A800 // [200] GameSyncSave
|
|
|
|
|
/* 31 */ // = Blocks[31].Offset; // 0x6AA00 // [718] PokeDiarySave
|
|
|
|
|
/* 32 */ BattleTree = Blocks[32].Offset; // 0x6B200 // [1FC] BattleInstSave
|
|
|
|
|
/* 33 */ Daycare = Blocks[33].Offset; // 0x6B400 // [200] Sodateya
|
|
|
|
|
/* 34 */ // = Blocks[34].Offset; // 0x6B600 // [120] WeatherSave
|
|
|
|
|
/* 35 */ QRSaveData = Blocks[35].Offset; // 0x6B800 // [1C8] QRReaderSaveData
|
|
|
|
|
/* 36 */ // = Blocks[36].Offset; // 0x6BA00 // [200] TurtleSalmonSave
|
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
// USUM only
|
|
|
|
|
/* 37 */ // = Blocks[37].Offset; BattleFesSave
|
|
|
|
|
/* 38 */ // = Blocks[38].Offset; FinderStudioSave
|
|
|
|
|
|
2018-09-15 05:37:47 +00:00
|
|
|
|
EventFlag = EventConst + (EventConstMax * 2); // After Event Const (u16)*n
|
|
|
|
|
HoF = EventFlag + (EventFlagMax / 8); // After Event Flags (1b)*(1u8/8b)*n
|
2017-11-08 08:34:32 +00:00
|
|
|
|
|
2019-07-05 19:16:09 +00:00
|
|
|
|
PokeDexLanguageFlags = 0x550;
|
2017-11-08 08:34:32 +00:00
|
|
|
|
WondercardData = WondercardFlags + 0x100;
|
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
Played = new PlayTime6(this, PlayTime);
|
|
|
|
|
MysteryBlock = new MysteryBlock7(this, WondercardFlags);
|
|
|
|
|
PokeFinder = new PokeFinder7(this, PokeFinderSave);
|
|
|
|
|
Festa = new JoinFesta7(this, JoinFestaData);
|
|
|
|
|
DaycareBlock = new Daycare7(this, Daycare);
|
|
|
|
|
Situation = new Situation7(this, Overworld);
|
|
|
|
|
MyStatus = new MyStatus7(this, TrainerCard);
|
|
|
|
|
OverworldBlock = new FieldMoveModelSave7(this, Overworld);
|
|
|
|
|
Config = new ConfigSave7(this, ConfigSave);
|
|
|
|
|
GameTime = new GameTime7(this, AdventureInfo);
|
|
|
|
|
MiscBlock = new Misc7(this, Misc);
|
|
|
|
|
BoxLayout = new BoxLayout7(this, PCLayout);
|
|
|
|
|
BattleTreeBlock = new BattleTree7(this, BattleTree);
|
|
|
|
|
ResortSave = new ResortSave7(this, Resort);
|
|
|
|
|
FieldMenu = new FieldMenu7(this, Trainer2);
|
|
|
|
|
FashionBlock = new FashionBlock7(this, Fashion);
|
|
|
|
|
|
|
|
|
|
TeamSlots = BoxLayout.TeamSlots;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Private Only
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected int Bag { get; set; } = int.MinValue;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
private int AdventureInfo { get; set; } = int.MinValue;
|
|
|
|
|
private int Trainer2 { get; set; } = int.MinValue;
|
2019-01-26 03:58:00 +00:00
|
|
|
|
public int Misc { get; private set; } = int.MinValue;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
private int WondercardFlags { get; set; } = int.MinValue;
|
|
|
|
|
private int PlayTime { get; set; } = int.MinValue;
|
2016-11-17 04:57:15 +00:00
|
|
|
|
private int Overworld { get; set; } = int.MinValue;
|
2019-01-26 03:58:00 +00:00
|
|
|
|
public int JoinFestaData { get; private set; } = int.MinValue;
|
2016-11-29 07:02:25 +00:00
|
|
|
|
private int PokeFinderSave { get; set; } = int.MinValue;
|
2016-12-04 21:23:35 +00:00
|
|
|
|
private int BattleTree { get; set; } = int.MinValue;
|
2017-10-15 06:47:16 +00:00
|
|
|
|
private int ConfigSave { get; set; } = int.MinValue;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public int QRSaveData { get; set; } = int.MinValue;
|
|
|
|
|
|
|
|
|
|
protected MyItem Items { private get; set; }
|
|
|
|
|
protected MysteryBlock7 MysteryBlock { private get; set; }
|
|
|
|
|
public PokeFinder7 PokeFinder { get; private set; }
|
|
|
|
|
public JoinFesta7 Festa { get; private set; }
|
|
|
|
|
private Daycare7 DaycareBlock { get; set; }
|
|
|
|
|
protected Record6 Records { get; set; }
|
|
|
|
|
public PlayTime6 Played { get; set; }
|
|
|
|
|
public MyStatus7 MyStatus { get; private set; }
|
|
|
|
|
public FieldMoveModelSave7 OverworldBlock { get; private set; }
|
|
|
|
|
public Situation7 Situation { get; private set; }
|
|
|
|
|
public ConfigSave7 Config { get; private set; }
|
|
|
|
|
public GameTime7 GameTime { get; private set; }
|
|
|
|
|
public Misc7 MiscBlock { get; private set; }
|
|
|
|
|
public Zukan7 Zukan { get; protected set; }
|
|
|
|
|
private BoxLayout7 BoxLayout { get; set; }
|
|
|
|
|
public BattleTree7 BattleTreeBlock { get; private set; }
|
|
|
|
|
public ResortSave7 ResortSave { get; private set; }
|
|
|
|
|
public FieldMenu7 FieldMenu { get; private set; }
|
|
|
|
|
public FashionBlock7 FashionBlock { get; private set; }
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2016-10-23 19:45:27 +00:00
|
|
|
|
// Accessible as SAV7
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private int TrainerCard { get; set; } = 0x14000;
|
|
|
|
|
private int Resort { get; set; }
|
2019-07-05 19:16:09 +00:00
|
|
|
|
public int PokeDexLanguageFlags { get; private set; }
|
2016-11-23 04:28:20 +00:00
|
|
|
|
public int Fashion { get; set; } = int.MinValue;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected int Record { get; set; } = int.MinValue;
|
2016-10-23 19:45:27 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
public override GameVersion Version
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
switch (Game)
|
|
|
|
|
{
|
|
|
|
|
case 30: return GameVersion.SN;
|
2016-10-23 03:09:22 +00:00
|
|
|
|
case 31: return GameVersion.MN;
|
2017-11-08 08:34:32 +00:00
|
|
|
|
case 32: return GameVersion.US;
|
|
|
|
|
case 33: return GameVersion.UM;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
2018-03-12 01:07:48 +00:00
|
|
|
|
return GameVersion.Invalid;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public override string MiscSaveInfo() => string.Join(Environment.NewLine, Blocks.Select(b => b.Summary));
|
|
|
|
|
public override string GetString(byte[] data, int offset, int length) => StringConverter.GetString7(data, offset, length);
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public override byte[] SetString(string value, int maxLength, int PadToSize = 0, ushort PadWith = 0)
|
2016-12-21 14:45:22 +00:00
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
if (PadToSize == 0)
|
|
|
|
|
PadToSize = maxLength + 1;
|
|
|
|
|
return StringConverter.SetString7(value, maxLength, Language, PadToSize, PadWith);
|
2016-12-21 14:45:22 +00:00
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
// Player Information
|
|
|
|
|
public override int TID { get => MyStatus.TID; set => MyStatus.TID = value; }
|
|
|
|
|
public override int SID { get => MyStatus.SID; set => MyStatus.SID = value; }
|
|
|
|
|
public override int Game { get => MyStatus.Game; set => MyStatus.Game = value; }
|
|
|
|
|
public override int Gender { get => MyStatus.Gender; set => MyStatus.Gender = value; }
|
|
|
|
|
public override int GameSyncIDSize => MyStatus7.GameSyncIDSize; // 64 bits
|
|
|
|
|
public override string GameSyncID { get => MyStatus.GameSyncID; set => MyStatus.GameSyncID = value; }
|
|
|
|
|
public override int SubRegion { get => MyStatus.SubRegion; set => MyStatus.SubRegion = value; }
|
|
|
|
|
public override int Country { get => MyStatus.Country; set => MyStatus.Country = value; }
|
|
|
|
|
public override int ConsoleRegion { get => MyStatus.ConsoleRegion; set => MyStatus.ConsoleRegion = value; }
|
|
|
|
|
public override int Language { get => MyStatus.Language; set => MyStatus.Language = value; }
|
|
|
|
|
public override string OT { get => MyStatus.OT; set => MyStatus.OT = value; }
|
|
|
|
|
public override int MultiplayerSpriteID { get => MyStatus.MultiplayerSpriteID; set => MyStatus.MultiplayerSpriteID = value; }
|
|
|
|
|
public override uint Money { get => MiscBlock.Money; set => MiscBlock.Money = value; }
|
|
|
|
|
|
|
|
|
|
public override int PlayedHours { get => Played.PlayedHours; set => Played.PlayedHours = value; }
|
|
|
|
|
public override int PlayedMinutes { get => Played.PlayedMinutes; set => Played.PlayedMinutes = value; }
|
|
|
|
|
public override int PlayedSeconds { get => Played.PlayedSeconds; set => Played.PlayedSeconds = value; }
|
|
|
|
|
public override uint SecondsToStart { get => GameTime.SecondsToStart; set => GameTime.SecondsToStart = value; }
|
|
|
|
|
public override uint SecondsToFame { get => GameTime.SecondsToFame; set => GameTime.SecondsToFame = value; }
|
2016-11-11 12:13:23 +00:00
|
|
|
|
|
2016-12-30 08:30:54 +00:00
|
|
|
|
// Stat Records
|
2018-07-07 22:38:11 +00:00
|
|
|
|
public int RecordCount => 200;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public int GetRecord(int recordID) => Records.GetRecord(recordID);
|
|
|
|
|
public void SetRecord(int recordID, int value) => Records.SetRecord(recordID, value);
|
|
|
|
|
public int GetRecordMax(int recordID) => Records.GetRecordMax(recordID);
|
|
|
|
|
public int GetRecordOffset(int recordID) => Records.GetRecordOffset(recordID);
|
2016-11-29 07:02:25 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
// Inventory
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public override InventoryPouch[] Inventory { get => Items.Inventory; set => Items.Inventory = value; }
|
2016-11-15 05:40:31 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
// Storage
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public override int GetPartyOffset(int slot) => Party + (SIZE_PARTY * slot);
|
|
|
|
|
public override int GetBoxOffset(int box) => Box + (SIZE_STORED * box * 30);
|
|
|
|
|
protected override int GetBoxWallpaperOffset(int box) => BoxLayout.GetBoxWallpaperOffset(box);
|
|
|
|
|
public override int GetBoxWallpaper(int box) => BoxLayout.GetBoxWallpaper(box);
|
|
|
|
|
public override void SetBoxWallpaper(int box, int value) => BoxLayout.SetBoxWallpaper(box, value);
|
|
|
|
|
public override string GetBoxName(int box) => BoxLayout[box];
|
|
|
|
|
public override void SetBoxName(int box, string value) => BoxLayout[box] = value;
|
|
|
|
|
public override int CurrentBox { get => BoxLayout.CurrentBox; set => BoxLayout.CurrentBox = value; }
|
|
|
|
|
public override int BoxesUnlocked { get => BoxLayout.BoxesUnlocked; set => BoxLayout.BoxesUnlocked = value; }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
protected override void SetPKM(PKM pkm)
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2017-12-12 00:01:24 +00:00
|
|
|
|
PK7 pk7 = (PK7)pkm;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
// Apply to this Save File
|
|
|
|
|
int CT = pk7.CurrentHandler;
|
|
|
|
|
DateTime Date = DateTime.Now;
|
2019-03-31 05:05:28 +00:00
|
|
|
|
pk7.Trade(this, Date.Day, Date.Month, Date.Year);
|
2016-10-20 01:19:01 +00:00
|
|
|
|
if (CT != pk7.CurrentHandler) // Logic updated Friendship
|
|
|
|
|
{
|
|
|
|
|
// Copy over the Friendship Value only under certain circumstances
|
|
|
|
|
if (pk7.Moves.Contains(216)) // Return
|
|
|
|
|
pk7.CurrentFriendship = pk7.OppositeFriendship;
|
|
|
|
|
else if (pk7.Moves.Contains(218)) // Frustration
|
|
|
|
|
pkm.CurrentFriendship = pk7.OppositeFriendship;
|
|
|
|
|
}
|
|
|
|
|
pkm.RefreshChecksum();
|
2019-06-09 02:56:11 +00:00
|
|
|
|
AddCountAcquired(pkm);
|
2018-09-28 04:30:20 +00:00
|
|
|
|
}
|
2018-09-27 02:06:05 +00:00
|
|
|
|
|
2018-09-28 04:30:20 +00:00
|
|
|
|
private void AddCountAcquired(PKM pkm)
|
|
|
|
|
{
|
2019-06-09 02:56:11 +00:00
|
|
|
|
Records.AddRecord(pkm.WasEgg ? 008 : 006); // egg, capture
|
2018-09-27 02:06:05 +00:00
|
|
|
|
if (pkm.CurrentHandler == 1)
|
2019-06-09 02:56:11 +00:00
|
|
|
|
Records.AddRecord(011); // trade
|
2018-11-27 16:53:56 +00:00
|
|
|
|
if (!pkm.WasEgg)
|
2019-06-09 02:56:11 +00:00
|
|
|
|
Records.AddRecord(004); // wild encounters
|
2016-11-08 16:43:57 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
protected override void SetPartyValues(PKM pkm, bool isParty)
|
2017-06-07 05:13:12 +00:00
|
|
|
|
{
|
2018-03-26 02:05:49 +00:00
|
|
|
|
base.SetPartyValues(pkm, isParty);
|
2018-07-21 03:25:28 +00:00
|
|
|
|
((PK7)pkm).FormDuration = GetFormDuration(pkm, isParty);
|
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-07-21 03:25:28 +00:00
|
|
|
|
private static uint GetFormDuration(PKM pkm, bool isParty)
|
|
|
|
|
{
|
|
|
|
|
if (!isParty || pkm.AltForm == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
switch (pkm.Species)
|
|
|
|
|
{
|
|
|
|
|
case 676: return 5; // Furfrou
|
|
|
|
|
case 720: return 3; // Hoopa
|
|
|
|
|
default: return 0;
|
|
|
|
|
}
|
2017-06-07 05:13:12 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected override void SetDex(PKM pkm) => Zukan.SetDex(pkm);
|
|
|
|
|
public override bool GetCaught(int species) => Zukan.GetCaught(species);
|
|
|
|
|
public override bool GetSeen(int species) => Zukan.GetSeen(species);
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
public override int PartyCount
|
|
|
|
|
{
|
2018-09-15 05:37:47 +00:00
|
|
|
|
get => Data[Party + (6 * SIZE_PARTY)];
|
|
|
|
|
protected set => Data[Party + (6 * SIZE_PARTY)] = (byte)value;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-12-05 06:59:28 +00:00
|
|
|
|
public override StorageSlotFlag GetSlotFlags(int index)
|
|
|
|
|
{
|
|
|
|
|
int team = Array.IndexOf(TeamSlots, index);
|
|
|
|
|
if (team < 0)
|
|
|
|
|
return StorageSlotFlag.None;
|
2017-10-31 16:24:54 +00:00
|
|
|
|
|
2018-12-05 06:59:28 +00:00
|
|
|
|
team /= 6;
|
|
|
|
|
var val = (StorageSlotFlag)((int)StorageSlotFlag.BattleTeam1 << team);
|
2019-06-09 02:56:11 +00:00
|
|
|
|
if (BoxLayout.GetIsTeamLocked(team))
|
2018-12-05 06:59:28 +00:00
|
|
|
|
val |= StorageSlotFlag.Locked;
|
|
|
|
|
return val;
|
2017-10-31 16:24:54 +00:00
|
|
|
|
}
|
2016-10-29 18:32:21 +00:00
|
|
|
|
|
2017-11-13 05:28:34 +00:00
|
|
|
|
private int FusedCount => USUM ? 3 : 1;
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-11-13 05:28:34 +00:00
|
|
|
|
public int GetFusedSlotOffset(int slot)
|
|
|
|
|
{
|
|
|
|
|
if (Fused < 0 || slot < 0 || slot >= FusedCount)
|
|
|
|
|
return -1;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
return Fused + (PKX.SIZE_6PARTY * slot); // 0x104*slot
|
2017-11-13 05:28:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
public override int DaycareSeedSize => Daycare7.DaycareSeedSize; // 128 bits
|
|
|
|
|
public override int GetDaycareSlotOffset(int loc, int slot) => DaycareBlock.GetDaycareSlotOffset(slot);
|
|
|
|
|
public override bool? IsDaycareOccupied(int loc, int slot) => DaycareBlock.GetIsOccupied(slot);
|
|
|
|
|
public override string GetDaycareRNGSeed(int loc) => DaycareBlock.RNGSeed;
|
|
|
|
|
public override bool? IsDaycareHasEgg(int loc) => DaycareBlock.HasEgg;
|
|
|
|
|
public override void SetDaycareOccupied(int loc, int slot, bool occupied) => DaycareBlock.SetOccupied(slot, occupied);
|
|
|
|
|
public override void SetDaycareRNGSeed(int loc, string seed) => DaycareBlock.RNGSeed = seed;
|
|
|
|
|
public override void SetDaycareHasEgg(int loc, bool hasEgg) => DaycareBlock.HasEgg = hasEgg;
|
2016-10-23 19:45:27 +00:00
|
|
|
|
|
2019-06-09 02:56:11 +00:00
|
|
|
|
protected override bool[] MysteryGiftReceivedFlags { get => MysteryBlock.MysteryGiftReceivedFlags; set => MysteryBlock.MysteryGiftReceivedFlags = value; }
|
|
|
|
|
protected override MysteryGift[] MysteryGiftCards { get => MysteryBlock.MysteryGiftCards; set => MysteryBlock.MysteryGiftCards = value; }
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|