2022-11-25 01:42:17 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2023-01-22 04:02:33 +00:00
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-20 17:36:28 +00:00
|
|
|
/// Generation 9 <see cref="SaveFile"/> object for <see cref="GameVersion.SV"/> games.
|
2022-11-25 01:42:17 +00:00
|
|
|
/// </summary>
|
|
|
|
public sealed class SAV9SV : SaveFile, ISaveBlock9Main, ISCBlockArray, ISaveFileRevision
|
|
|
|
{
|
|
|
|
protected internal override string ShortSummary => $"{OT} ({Version}) - {LastSaved.DisplayValue}";
|
|
|
|
public override string Extension => string.Empty;
|
|
|
|
|
|
|
|
public SAV9SV(byte[] data) : this(SwishCrypto.Decrypt(data)) { }
|
|
|
|
|
2023-12-04 04:13:20 +00:00
|
|
|
private SAV9SV(IReadOnlyList<SCBlock> blocks) : base([])
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
|
|
|
AllBlocks = blocks;
|
|
|
|
Blocks = new SaveBlockAccessor9SV(this);
|
2023-12-18 01:06:39 +00:00
|
|
|
SaveRevision = Blocks.HasBlock(SaveBlockAccessor9SV.KBlueberryPoints) ? 2 : RaidKitakami.Data.Length != 0 ? 1 : 0;
|
2022-11-25 01:42:17 +00:00
|
|
|
Initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
public SAV9SV()
|
|
|
|
{
|
|
|
|
AllBlocks = Meta9.GetBlankDataSV();
|
|
|
|
Blocks = new SaveBlockAccessor9SV(this);
|
2023-12-18 00:41:15 +00:00
|
|
|
SaveRevision = Meta9.BlankRevision;
|
2022-11-25 01:42:17 +00:00
|
|
|
Initialize();
|
|
|
|
ClearBoxes();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void CopyChangesFrom(SaveFile sav)
|
|
|
|
{
|
|
|
|
// Absorb changes from all blocks
|
|
|
|
var z = (SAV9SV)sav;
|
|
|
|
var mine = AllBlocks;
|
|
|
|
var newB = z.AllBlocks;
|
|
|
|
for (int i = 0; i < mine.Count; i++)
|
|
|
|
mine[i].CopyFrom(newB[i]);
|
|
|
|
State.Edited = true;
|
|
|
|
}
|
|
|
|
|
2023-09-16 06:36:21 +00:00
|
|
|
public int SaveRevision { get; }
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
public string SaveRevisionString => SaveRevision switch
|
|
|
|
{
|
|
|
|
0 => "-Base", // Vanilla
|
2023-09-16 06:36:21 +00:00
|
|
|
1 => "-TM", // Teal Mask
|
|
|
|
2 => "-ID", // Indigo Disk
|
2022-11-25 01:42:17 +00:00
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(SaveRevision)),
|
|
|
|
};
|
|
|
|
|
|
|
|
public override bool ChecksumsValid => true;
|
|
|
|
public override string ChecksumInfo => string.Empty;
|
|
|
|
protected override void SetChecksums() { } // None!
|
|
|
|
protected override byte[] GetFinalData() => SwishCrypto.Encrypt(AllBlocks);
|
|
|
|
|
2023-01-22 04:02:33 +00:00
|
|
|
public override PersonalTable9SV Personal => PersonalTable.SV;
|
2023-03-26 00:55:55 +00:00
|
|
|
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_SV;
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
#region Blocks
|
|
|
|
public SCBlockAccessor Accessor => Blocks;
|
|
|
|
public SaveBlockAccessor9SV Blocks { get; }
|
|
|
|
public IReadOnlyList<SCBlock> AllBlocks { get; }
|
|
|
|
public T GetValue<T>(uint key) where T : struct => Blocks.GetBlockValueSafe<T>(key);
|
|
|
|
public void SetValue<T>(uint key, T value) where T : struct => Blocks.SetBlockValueSafe(key, value);
|
|
|
|
public Box8 BoxInfo => Blocks.BoxInfo;
|
|
|
|
public Party9 PartyInfo => Blocks.PartyInfo;
|
|
|
|
public MyItem9 Items => Blocks.Items;
|
|
|
|
public MyStatus9 MyStatus => Blocks.MyStatus;
|
|
|
|
public Zukan9 Zukan => Blocks.Zukan;
|
|
|
|
public BoxLayout9 BoxLayout => Blocks.BoxLayout;
|
|
|
|
public PlayTime9 Played => Blocks.Played;
|
|
|
|
public ConfigSave9 Config => Blocks.Config;
|
|
|
|
public TeamIndexes9 TeamIndexes => Blocks.TeamIndexes;
|
|
|
|
public Epoch1970Value LastSaved => Blocks.LastSaved;
|
|
|
|
public PlayerFashion9 PlayerFashion => Blocks.PlayerFashion;
|
|
|
|
public PlayerAppearance9 PlayerAppearance => Blocks.PlayerAppearance;
|
2023-09-18 02:49:26 +00:00
|
|
|
public RaidSpawnList9 RaidPaldea => Blocks.RaidPaldea;
|
|
|
|
public RaidSpawnList9 RaidKitakami => Blocks.RaidKitakami;
|
2023-12-18 00:41:15 +00:00
|
|
|
public RaidSpawnList9 RaidBlueberry => Blocks.RaidBlueberry;
|
2022-12-03 03:20:43 +00:00
|
|
|
public RaidSevenStar9 RaidSevenStar => Blocks.RaidSevenStar;
|
2023-03-30 03:44:04 +00:00
|
|
|
public Epoch1900Value EnrollmentDate => Blocks.EnrollmentDate;
|
2023-12-18 00:41:15 +00:00
|
|
|
public BlueberryQuestRecord9 BlueberryQuestRecord => Blocks.BlueberryQuestRecord;
|
2024-01-16 02:50:17 +00:00
|
|
|
public BlueberryClubRoom9 BlueberryClubRoom => Blocks.BlueberryClubRoom;
|
2022-11-25 01:42:17 +00:00
|
|
|
#endregion
|
|
|
|
|
2023-01-22 04:02:33 +00:00
|
|
|
protected override SAV9SV CloneInternal()
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
|
|
|
var blockCopy = new SCBlock[AllBlocks.Count];
|
|
|
|
for (int i = 0; i < AllBlocks.Count; i++)
|
|
|
|
blockCopy[i] = AllBlocks[i].Clone();
|
2023-01-22 04:02:33 +00:00
|
|
|
return new(blockCopy);
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
2023-09-16 06:36:21 +00:00
|
|
|
private ushort m_spec, m_item, m_move, m_abil;
|
2022-11-25 01:42:17 +00:00
|
|
|
public override int MaxBallID => Legal.MaxBallID_9;
|
2023-06-04 01:19:16 +00:00
|
|
|
public override int MaxGameID => Legal.MaxGameID_HOME;
|
2023-09-16 06:36:21 +00:00
|
|
|
public override ushort MaxMoveID => m_move;
|
|
|
|
public override ushort MaxSpeciesID => m_spec;
|
|
|
|
public override int MaxItemID => m_item;
|
|
|
|
public override int MaxAbilityID => m_abil;
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
private void Initialize()
|
|
|
|
{
|
|
|
|
Box = 0;
|
|
|
|
Party = 0;
|
|
|
|
PokeDex = 0;
|
|
|
|
TeamIndexes.LoadBattleTeams();
|
2023-09-16 06:36:21 +00:00
|
|
|
|
|
|
|
int rev = SaveRevision;
|
|
|
|
if (rev == 0)
|
|
|
|
{
|
|
|
|
m_move = Legal.MaxMoveID_9_T0;
|
|
|
|
m_spec = Legal.MaxSpeciesID_9_T0;
|
|
|
|
m_item = Legal.MaxItemID_9_T0;
|
|
|
|
m_abil = Legal.MaxAbilityID_9_T0;
|
|
|
|
}
|
|
|
|
else if (rev == 1)
|
|
|
|
{
|
|
|
|
m_move = Legal.MaxMoveID_9_T1;
|
|
|
|
m_spec = Legal.MaxSpeciesID_9_T1;
|
|
|
|
m_item = Legal.MaxItemID_9_T1;
|
|
|
|
m_abil = Legal.MaxAbilityID_9_T1;
|
|
|
|
}
|
2023-12-18 00:41:15 +00:00
|
|
|
else if (rev == 2)
|
|
|
|
{
|
|
|
|
m_move = Legal.MaxMoveID_9_T2;
|
|
|
|
m_spec = Legal.MaxSpeciesID_9_T2;
|
|
|
|
m_item = Legal.MaxItemID_9_T2;
|
|
|
|
m_abil = Legal.MaxAbilityID_9_T2;
|
|
|
|
}
|
2023-09-16 06:36:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(SaveRevision));
|
|
|
|
}
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override IReadOnlyList<string> PKMExtensions => Array.FindAll(PKM.Extensions, f =>
|
|
|
|
{
|
|
|
|
int gen = f[^1] - 0x30;
|
|
|
|
return gen == 9;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Configuration
|
|
|
|
protected override int SIZE_STORED => PokeCrypto.SIZE_9STORED;
|
|
|
|
protected override int SIZE_PARTY => PokeCrypto.SIZE_9PARTY;
|
|
|
|
public override int SIZE_BOXSLOT => PokeCrypto.SIZE_9PARTY;
|
2023-01-22 04:02:33 +00:00
|
|
|
public override PK9 BlankPKM => new();
|
2022-11-25 01:42:17 +00:00
|
|
|
public override Type PKMType => typeof(PK9);
|
|
|
|
|
|
|
|
public override int BoxCount => BoxLayout9.BoxCount;
|
2023-09-28 05:15:59 +00:00
|
|
|
public override int MaxEV => EffortValues.Max252;
|
2022-11-25 01:42:17 +00:00
|
|
|
public override int Generation => 9;
|
|
|
|
public override EntityContext Context => EntityContext.Gen9;
|
|
|
|
public override int MaxStringLengthOT => 12;
|
|
|
|
public override int MaxStringLengthNickname => 12;
|
2023-01-22 04:02:33 +00:00
|
|
|
protected override PK9 GetPKM(byte[] data) => new(data);
|
2022-11-25 01:42:17 +00:00
|
|
|
protected override byte[] DecryptPKM(byte[] data) => PokeCrypto.DecryptArray9(data);
|
|
|
|
|
|
|
|
public override GameVersion Version => Game switch
|
|
|
|
{
|
|
|
|
(int)GameVersion.SL => GameVersion.SL,
|
|
|
|
(int)GameVersion.VL => GameVersion.VL,
|
|
|
|
_ => GameVersion.Invalid,
|
|
|
|
};
|
|
|
|
|
|
|
|
public override string GetString(ReadOnlySpan<byte> data) => StringConverter8.GetString(data);
|
|
|
|
public override int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, StringConverterOption option)
|
|
|
|
=> StringConverter8.SetString(destBuffer, value, maxLength, option);
|
|
|
|
|
|
|
|
// Player Information
|
2023-01-22 04:02:33 +00:00
|
|
|
public override uint ID32 { get => MyStatus.ID32; set => MyStatus.ID32 = value; }
|
|
|
|
public override ushort TID16 { get => MyStatus.TID16; set => MyStatus.TID16 = value; }
|
|
|
|
public override ushort SID16 { get => MyStatus.SID16; set => MyStatus.SID16 = value; }
|
2022-11-25 01:42:17 +00:00
|
|
|
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 Language { get => MyStatus.Language; set => MyStatus.Language = value; }
|
|
|
|
public override string OT { get => MyStatus.OT; set => MyStatus.OT = value; }
|
|
|
|
public override uint Money { get => (uint)Blocks.GetBlockValue(SaveBlockAccessor9SV.KMoney); set => Blocks.SetBlockValue(SaveBlockAccessor9SV.KMoney, value); }
|
|
|
|
public uint LeaguePoints { get => (uint)Blocks.GetBlockValue(SaveBlockAccessor9SV.KLeaguePoints); set => Blocks.SetBlockValue(SaveBlockAccessor9SV.KLeaguePoints, value); }
|
2023-12-18 00:41:15 +00:00
|
|
|
public uint BlueberryPoints { get => (uint)Blocks.GetBlockValue(SaveBlockAccessor9SV.KBlueberryPoints); set => Blocks.SetBlockValueSafe(SaveBlockAccessor9SV.KBlueberryPoints, value); }
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
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; }
|
|
|
|
|
|
|
|
// Inventory
|
|
|
|
public override IReadOnlyList<InventoryPouch> Inventory { get => Items.Inventory; set => Items.Inventory = value; }
|
|
|
|
|
|
|
|
// Storage
|
|
|
|
public override int GetPartyOffset(int slot) => Party + (SIZE_PARTY * slot);
|
|
|
|
public override int GetBoxOffset(int box) => Box + (SIZE_PARTY * box * 30);
|
|
|
|
public override string GetBoxName(int box) => BoxLayout[box];
|
2023-01-22 04:02:33 +00:00
|
|
|
public override void SetBoxName(int box, ReadOnlySpan<char> value) => BoxLayout.SetBoxName(box, value);
|
2022-11-25 01:42:17 +00:00
|
|
|
public override byte[] GetDataForBox(PKM pk) => pk.EncryptedPartyData;
|
|
|
|
|
|
|
|
protected override void SetPKM(PKM pk, bool isParty = false)
|
|
|
|
{
|
|
|
|
PK9 pk9 = (PK9)pk;
|
|
|
|
// Apply to this Save File
|
2023-09-11 04:17:47 +00:00
|
|
|
var now = EncounterDate.GetDateSwitch();
|
|
|
|
pk9.Trade(this, now.Day, now.Month, now.Year);
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
if (FormArgumentUtil.IsFormArgumentTypeDatePair(pk9.Species, pk9.Form))
|
|
|
|
{
|
|
|
|
pk9.FormArgumentElapsed = pk9.FormArgumentMaximum = 0;
|
|
|
|
pk9.FormArgumentRemain = (byte)GetFormArgument(pk9);
|
|
|
|
}
|
|
|
|
|
|
|
|
pk9.RefreshChecksum();
|
|
|
|
AddCountAcquired(pk9);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static uint GetFormArgument(PKM pk)
|
|
|
|
{
|
|
|
|
if (pk.Form == 0)
|
|
|
|
return 0;
|
|
|
|
return pk.Species switch
|
|
|
|
{
|
|
|
|
(int)Species.Furfrou => 5u, // Furfrou
|
2023-08-20 07:31:54 +00:00
|
|
|
// Hoopa no longer sets Form Argument for Unbound form. Let it set 0.
|
2022-11-25 01:42:17 +00:00
|
|
|
_ => 0u,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private void AddCountAcquired(PKM pk)
|
|
|
|
{
|
|
|
|
if (pk.WasEgg)
|
|
|
|
{
|
|
|
|
//Records.AddRecord(00);
|
|
|
|
}
|
|
|
|
else // capture, assume wild
|
|
|
|
{
|
|
|
|
//Records.AddRecord(01); // wild capture
|
|
|
|
//Records.AddRecord(06); // total captured
|
|
|
|
//Records.AddRecord(16); // wild encountered
|
|
|
|
//Records.AddRecord(23); // total battled
|
|
|
|
}
|
|
|
|
if (pk.CurrentHandler == 1)
|
|
|
|
{
|
|
|
|
//Records.AddRecord(17, 2); // trade * 2 -- these games count 1 trade as 2 for some reason.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void SetDex(PKM pk) => Zukan.SetDex(pk);
|
|
|
|
public override bool GetCaught(ushort species) => Zukan.GetCaught(species);
|
|
|
|
public override bool GetSeen(ushort species) => Zukan.GetSeen(species);
|
|
|
|
|
|
|
|
public override int PartyCount
|
|
|
|
{
|
|
|
|
get => PartyInfo.PartyCount;
|
|
|
|
protected set => PartyInfo.PartyCount = value;
|
|
|
|
}
|
|
|
|
|
2023-03-26 06:14:50 +00:00
|
|
|
protected override Span<byte> BoxBuffer => BoxInfo.Data;
|
|
|
|
protected override Span<byte> PartyBuffer => PartyInfo.Data;
|
2023-01-22 04:02:33 +00:00
|
|
|
public override PK9 GetDecryptedPKM(byte[] data) => GetPKM(DecryptPKM(data));
|
2023-03-26 06:14:50 +00:00
|
|
|
public override PK9 GetBoxSlot(int offset) => GetDecryptedPKM(BoxInfo.Data.AsSpan(offset, SIZE_PARTY).ToArray()); // party format in boxes!
|
2022-11-25 01:42:17 +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);
|
|
|
|
//public int RecordCount => Record9.RecordCount;
|
|
|
|
|
|
|
|
public override StorageSlotSource GetSlotFlags(int index)
|
|
|
|
{
|
|
|
|
int team = Array.IndexOf(TeamIndexes.TeamSlots, index);
|
|
|
|
if (team < 0)
|
|
|
|
return StorageSlotSource.None;
|
|
|
|
|
|
|
|
team /= 6;
|
|
|
|
var result = (StorageSlotSource)((int)StorageSlotSource.BattleTeam1 << team);
|
|
|
|
if (TeamIndexes.GetIsTeamLocked(team))
|
|
|
|
result |= StorageSlotSource.Locked;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override int CurrentBox { get => BoxLayout.CurrentBox; set => BoxLayout.CurrentBox = value; }
|
|
|
|
public override int BoxesUnlocked { get => (byte)Blocks.GetBlockValue(SaveBlockAccessor9SV.KBoxesUnlocked); set => Blocks.SetBlockValue(SaveBlockAccessor9SV.KBoxesUnlocked, (byte)value); }
|
|
|
|
public override bool HasBoxWallpapers => true;
|
|
|
|
public override bool HasNamableBoxes => true;
|
|
|
|
public Span<byte> Coordinates => Blocks.GetBlock(SaveBlockAccessor9SV.KCoordinates).Data;
|
|
|
|
public float X { get => ReadSingleLittleEndian(Coordinates); set => WriteSingleLittleEndian(Coordinates, value); }
|
|
|
|
public float Y { get => ReadSingleLittleEndian(Coordinates[4..]); set => WriteSingleLittleEndian(Coordinates[4..], value); }
|
|
|
|
public float Z { get => ReadSingleLittleEndian(Coordinates[8..]); set => WriteSingleLittleEndian(Coordinates[8..], value); }
|
2023-11-05 20:24:08 +00:00
|
|
|
public Span<byte> PlayerRotation => Blocks.GetBlock(SaveBlockAccessor9SV.KPlayerRotation).Data;
|
|
|
|
public float RX { get => ReadSingleLittleEndian(PlayerRotation); set => WriteSingleLittleEndian(PlayerRotation, value); }
|
|
|
|
public float RY { get => ReadSingleLittleEndian(PlayerRotation[4..]); set => WriteSingleLittleEndian(PlayerRotation[4..], value); }
|
|
|
|
public float RZ { get => ReadSingleLittleEndian(PlayerRotation[8..]); set => WriteSingleLittleEndian(PlayerRotation[8..], value); }
|
|
|
|
public float RW { get => ReadSingleLittleEndian(PlayerRotation[12..]); set => WriteSingleLittleEndian(PlayerRotation[12..], value); }
|
2022-11-25 01:42:17 +00:00
|
|
|
|
|
|
|
public void SetCoordinates(float x, float y, float z)
|
|
|
|
{
|
|
|
|
// Only set coordinates if epsilon is different enough
|
|
|
|
const float epsilon = 0.0001f;
|
|
|
|
if (Math.Abs(X - x) < epsilon && Math.Abs(Y - y) < epsilon && Math.Abs(Z - z) < epsilon)
|
|
|
|
return;
|
|
|
|
X = x;
|
|
|
|
Y = y;
|
|
|
|
Z = z;
|
|
|
|
}
|
|
|
|
|
2023-11-05 20:24:08 +00:00
|
|
|
public void SetPlayerRotation(float rx, float ry, float rz, float rw)
|
|
|
|
{
|
|
|
|
// Only set coordinates if epsilon is different enough
|
|
|
|
const float epsilon = 0.0001f;
|
|
|
|
if (Math.Abs(RX - rx) < epsilon && Math.Abs(RY - ry) < epsilon && Math.Abs(RZ - rz) < epsilon && Math.Abs(RW - rw) < epsilon)
|
|
|
|
return;
|
|
|
|
RX = rx;
|
|
|
|
RY = ry;
|
|
|
|
RZ = rz;
|
|
|
|
RW = rw;
|
|
|
|
}
|
|
|
|
|
2022-11-25 01:42:17 +00:00
|
|
|
public override int GetBoxWallpaper(int box)
|
|
|
|
{
|
|
|
|
if ((uint)box >= BoxCount)
|
|
|
|
return box;
|
|
|
|
var b = Blocks.GetBlock(SaveBlockAccessor9SV.KBoxWallpapers);
|
|
|
|
return b.Data[box];
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void SetBoxWallpaper(int box, int value)
|
|
|
|
{
|
|
|
|
if ((uint)box >= BoxCount)
|
|
|
|
return;
|
|
|
|
var b = Blocks.GetBlock(SaveBlockAccessor9SV.KBoxWallpapers);
|
|
|
|
b.Data[box] = (byte)value;
|
|
|
|
}
|
2022-11-25 05:58:47 +00:00
|
|
|
|
2022-12-06 05:05:16 +00:00
|
|
|
public byte BoxLegendWallpaperFlag
|
|
|
|
{
|
|
|
|
get => Blocks.GetBlock(SaveBlockAccessor9SV.KBoxWallpapers).Data[BoxLayout9.BoxCount];
|
|
|
|
set => Blocks.GetBlock(SaveBlockAccessor9SV.KBoxWallpapers).Data[BoxLayout9.BoxCount] = value;
|
|
|
|
}
|
|
|
|
|
2024-01-16 02:50:17 +00:00
|
|
|
public ThrowStyle9 ThrowStyle {
|
|
|
|
get {
|
|
|
|
if(Blocks.TryGetBlock(SaveBlockAccessor9SV.KThrowStyle, out var throwStyleBlock))
|
|
|
|
return (ThrowStyle9)throwStyleBlock.Data[0];
|
|
|
|
return ThrowStyle9.OriginalStyle;
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (Blocks.TryGetBlock(SaveBlockAccessor9SV.KThrowStyle, out var throwStyleBlock))
|
|
|
|
throwStyleBlock.ChangeData([(byte)value]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-25 05:58:47 +00:00
|
|
|
public void CollectAllStakes()
|
|
|
|
{
|
|
|
|
for (int i = 14; i <= 17; i++)
|
|
|
|
{
|
|
|
|
for (int f = 1; f <= 8; f++)
|
|
|
|
{
|
2023-01-22 04:02:33 +00:00
|
|
|
var flag = $"FEVT_SUB_{i:000}_KUI_{f:00}_RELEASE";
|
2022-11-25 05:58:47 +00:00
|
|
|
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
|
|
|
var block = Accessor.GetBlock(hash);
|
|
|
|
block.ChangeBooleanType(SCTypeCode.Bool2);
|
|
|
|
}
|
|
|
|
}
|
2022-11-25 13:21:10 +00:00
|
|
|
|
2023-12-04 04:13:20 +00:00
|
|
|
string[] blocks =
|
|
|
|
[
|
2022-11-25 13:21:10 +00:00
|
|
|
"WEVT_SUB_014_EVENT_STATE_UTHUWA",
|
|
|
|
"WEVT_SUB_015_EVENT_STATE_TSURUGI",
|
|
|
|
"WEVT_SUB_016_EVENT_STATE_MOKKAN",
|
|
|
|
"WEVT_SUB_017_EVENT_STATE_MAGATAMA",
|
2023-12-04 04:13:20 +00:00
|
|
|
];
|
2022-11-25 13:21:10 +00:00
|
|
|
|
|
|
|
foreach (var block in blocks)
|
|
|
|
Accessor.GetBlock(block).SetValue(1); // lift seals from each shrine
|
2023-03-28 22:25:56 +00:00
|
|
|
|
|
|
|
// remove chains from each shrine
|
|
|
|
Accessor.GetBlock(SaveBlockAccessor9SV.KStakesRemovedTingLu).SetValue((ulong)10);
|
|
|
|
Accessor.GetBlock(SaveBlockAccessor9SV.KStakesRemovedChienPao).SetValue((ulong)10);
|
|
|
|
Accessor.GetBlock(SaveBlockAccessor9SV.KStakesRemovedWoChien).SetValue((ulong)10);
|
|
|
|
Accessor.GetBlock(SaveBlockAccessor9SV.KStakesRemovedChiYu).SetValue((ulong)10);
|
2022-11-25 13:21:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void UnlockAllTMRecipes()
|
|
|
|
{
|
2023-09-23 15:08:25 +00:00
|
|
|
for (int i = 1; i <= 229; i++)
|
2022-11-25 13:21:10 +00:00
|
|
|
{
|
2023-01-22 04:02:33 +00:00
|
|
|
var flag = $"FSYS_UI_WAZA_MACHINE_RELEASE_{i:000}";
|
2022-11-25 13:21:10 +00:00
|
|
|
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
2023-09-23 22:50:11 +00:00
|
|
|
if (Accessor.TryGetBlock(hash, out var block))
|
|
|
|
block.ChangeBooleanType(SCTypeCode.Bool2);
|
2022-11-25 13:21:10 +00:00
|
|
|
}
|
2022-11-25 05:58:47 +00:00
|
|
|
}
|
2023-12-18 00:41:15 +00:00
|
|
|
|
|
|
|
public void ActivateSnacksworthLegendaries()
|
|
|
|
{
|
|
|
|
for (int i = 13; i <= 37; i++)
|
|
|
|
{
|
|
|
|
var flag = $"WEVT_S2_SUB_{i:000}_STATE";
|
|
|
|
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
|
|
|
if (Accessor.TryGetBlock(hash, out var block))
|
|
|
|
block.SetValue(1); // appeared, not captured
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UnlockAllCoaches()
|
|
|
|
{
|
|
|
|
string[] blocks =
|
|
|
|
[
|
|
|
|
"FSYS_CLUB_HUD_COACH_BOTAN",
|
|
|
|
"FSYS_CLUB_HUD_COACH_CHAMP_HAGANE",
|
|
|
|
"FSYS_CLUB_HUD_COACH_CHAMP_JIMEN",
|
|
|
|
"FSYS_CLUB_HUD_COACH_CHAMP_TOP",
|
|
|
|
"FSYS_CLUB_HUD_COACH_FRIEND",
|
|
|
|
"FSYS_CLUB_HUD_COACH_RIVAL",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_ART",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_ATHLETIC",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_BIOLOGY",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_HEAD",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_HEALTH",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_HISTORY",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_HOME",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_LANGUAGE",
|
|
|
|
"FSYS_CLUB_HUD_COACH_TEACHER_MATH",
|
|
|
|
];
|
|
|
|
|
2023-12-18 01:26:38 +00:00
|
|
|
// extra safety
|
2023-12-18 00:41:15 +00:00
|
|
|
foreach (var block in blocks)
|
2023-12-18 01:26:38 +00:00
|
|
|
{
|
|
|
|
var hash = (uint)FnvHash.HashFnv1a_64(block);
|
|
|
|
if (Accessor.TryGetBlock(hash, out var flag))
|
|
|
|
flag.ChangeBooleanType(SCTypeCode.Bool2);
|
|
|
|
}
|
2023-12-18 00:41:15 +00:00
|
|
|
}
|
2024-01-16 02:50:17 +00:00
|
|
|
|
|
|
|
public void UnlockAllThrowStyles()
|
|
|
|
{
|
|
|
|
// Unlock Styles
|
|
|
|
for (int i = 1; i <= 3; i++)
|
|
|
|
{
|
|
|
|
var flag = $"FSYS_CLUB_ROOM_BALL_THROW_FORM_0{i}";
|
|
|
|
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
|
|
|
if (Accessor.TryGetBlock(hash, out var block))
|
|
|
|
block.ChangeBooleanType(SCTypeCode.Bool2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update Support Board
|
2024-01-16 03:29:39 +00:00
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub1SmugElegantPurchased = true;
|
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub1SmugElegantUnread = false;
|
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub2TwirlingNinjaPurchased = true;
|
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub2TwirlingNinjaUnread = false;
|
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub3ChampionPurchased = true;
|
|
|
|
BlueberryClubRoom.SupportBoard.BaseballClub3ChampionUnread = false;
|
2024-01-16 02:50:17 +00:00
|
|
|
}
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|