Add chateau score, seaside cycle score

Update some other areas too
looks like this fixes the sube pkx fetch method for extraslots, yay.
This commit is contained in:
Kurt 2021-05-13 23:12:53 -07:00
parent d21c1fb135
commit 07584a8774
4 changed files with 113 additions and 6 deletions

View file

@ -30,7 +30,7 @@
/// Attempts to load a file using the plugin. /// Attempts to load a file using the plugin.
/// </summary> /// </summary>
/// <param name="filePath">Path to file to be loaded.</param> /// <param name="filePath">Path to file to be loaded.</param>
/// <returns></returns> /// <returns>True if the plugin has handled the file.</returns>
bool TryLoadFile(string filePath); bool TryLoadFile(string filePath);
/// <summary> /// <summary>

View file

@ -104,7 +104,7 @@ namespace PKHeX.Core
{ {
new SlotInfoMisc(sav.Data, 0, sav.GTS) {Type = StorageSlotType.GTS}, new SlotInfoMisc(sav.Data, 0, sav.GTS) {Type = StorageSlotType.GTS},
new SlotInfoMisc(sav.Data, 0, sav.Fused) {Type = StorageSlotType.Fused}, new SlotInfoMisc(sav.Data, 0, sav.Fused) {Type = StorageSlotType.Fused},
new SlotInfoMisc(sav.Data, 0, sav.SUBE.Offset + 0x90) {Type = StorageSlotType.Misc}, // Old Man new SlotInfoMisc(sav.Data, 0, sav.SUBE.Give) {Type = StorageSlotType.Misc}, // Old Man
new SlotInfoMisc(sav.Data, 0, sav.GetBattleBoxSlot(0)) {Type = StorageSlotType.BattleBox}, new SlotInfoMisc(sav.Data, 0, sav.GetBattleBoxSlot(0)) {Type = StorageSlotType.BattleBox},
new SlotInfoMisc(sav.Data, 1, sav.GetBattleBoxSlot(1)) {Type = StorageSlotType.BattleBox}, new SlotInfoMisc(sav.Data, 1, sav.GetBattleBoxSlot(1)) {Type = StorageSlotType.BattleBox},
@ -121,6 +121,7 @@ namespace PKHeX.Core
{ {
new SlotInfoMisc(sav.Data, 0, SAV6AO.GTS) {Type = StorageSlotType.GTS}, new SlotInfoMisc(sav.Data, 0, SAV6AO.GTS) {Type = StorageSlotType.GTS},
new SlotInfoMisc(sav.Data, 0, SAV6AO.Fused) {Type = StorageSlotType.Fused}, new SlotInfoMisc(sav.Data, 0, SAV6AO.Fused) {Type = StorageSlotType.Fused},
new SlotInfoMisc(sav.Data, 0, sav.SUBE.Give) {Type = StorageSlotType.Misc},
new SlotInfoMisc(sav.Data, 0, sav.GetBattleBoxSlot(0)) {Type = StorageSlotType.BattleBox}, new SlotInfoMisc(sav.Data, 0, sav.GetBattleBoxSlot(0)) {Type = StorageSlotType.BattleBox},
new SlotInfoMisc(sav.Data, 1, sav.GetBattleBoxSlot(1)) {Type = StorageSlotType.BattleBox}, new SlotInfoMisc(sav.Data, 1, sav.GetBattleBoxSlot(1)) {Type = StorageSlotType.BattleBox},

View file

@ -145,9 +145,15 @@ namespace PKHeX.Core
921, 922, 923, 924, 925, 926 921, 922, 923, 924, 925, 926
}); });
public static readonly Dictionary<int, int> ZCrystalDictionary = Pouch_ZCrystal_USUM public static readonly Dictionary<int, int> ZCrystalDictionary = GetDictionary(Pouch_ZCrystal_USUM, Pouch_ZCrystalHeld_USUM);
.Zip(Pouch_ZCrystalHeld_USUM, (k, v) => new KeyValuePair<int, int>(k, v))
.ToDictionary(x => x.Key, x => x.Value); private static Dictionary<int, int> GetDictionary(IReadOnlyList<ushort> key, IReadOnlyList<ushort> held)
{
var result = new Dictionary<int, int>(held.Count);
for (int i = 0; i < key.Count; i++)
result.Add(key[i], held[i]);
return result;
}
internal static readonly ushort[] HeldItems_SM = ArrayUtil.ConcatAll(Pouch_Items_SM, Pouch_Berries_SM, Pouch_Medicine_SM, Pouch_ZCrystalHeld_SM); internal static readonly ushort[] HeldItems_SM = ArrayUtil.ConcatAll(Pouch_Items_SM, Pouch_Berries_SM, Pouch_Medicine_SM, Pouch_ZCrystalHeld_SM);
internal static readonly ushort[] HeldItems_USUM = ArrayUtil.ConcatAll(Pouch_Items_SM, Pouch_Berries_SM, Pouch_Medicine_SM, Pouch_ZCrystalHeld_USUM, Pouch_Roto_USUM); internal static readonly ushort[] HeldItems_USUM = ArrayUtil.ConcatAll(Pouch_Items_SM, Pouch_Berries_SM, Pouch_Medicine_SM, Pouch_ZCrystalHeld_USUM, Pouch_Roto_USUM);

View file

@ -11,6 +11,16 @@ namespace PKHeX.Core
protected abstract int BadgeVictoryOffset { get; } protected abstract int BadgeVictoryOffset { get; }
/// <summary>
/// Absolute offset of the <see cref="PK6"/> that the player has given an NPC.
/// </summary>
public abstract int Give { get; }
/// <summary>
/// Absolute offset of the <see cref="PK6"/> that is unreferenced?
/// </summary>
public abstract int UnusedPKM { get; }
private int GetBadgeVictorySpeciesOffset(uint badge, uint slot) private int GetBadgeVictorySpeciesOffset(uint badge, uint slot)
{ {
if (badge >= 8) if (badge >= 8)
@ -37,12 +47,102 @@ namespace PKHeX.Core
public sealed class SubEventLog6XY : SubEventLog6 public sealed class SubEventLog6XY : SubEventLog6
{ {
public SubEventLog6XY(SAV6XY sav, int offset) : base(sav, offset) { } public SubEventLog6XY(SAV6XY sav, int offset) : base(sav, offset) { }
// Structure:
// 0x00
// u8[0x28] chateau data
private ushort ChateauValue
{
get => BitConverter.ToUInt16(Data, Offset);
set => BitConverter.GetBytes(value).CopyTo(Data, Offset);
}
public ushort ChateauRank
{
get => (ushort)(ChateauValue & 0xF);
set => ChateauValue = (ushort)((ChateauValue & ~0xFu) | (value & 0xFu));
}
public ushort ChateauPoints
{
get => (ushort)(ChateauValue >> 4);
set => ChateauValue = (ushort)((ushort)(value << 4) | (ChateauValue & 0xFu));
}
// other chateau data?
// u32 SUBE @ 0x28
// 0x2C
protected override int BadgeVictoryOffset => 0x2C; // thru 0x8B protected override int BadgeVictoryOffset => 0x2C; // thru 0x8B
// u16[6 * 8] trainer teams for gyms
// u32 SUBE @ 0x8C
// 0x90
// u8[0xE8] pkm?
public override int Give => 0x90 + Offset;
// u32 SUBE @ 0x178
// 0x17C
// u8[0xE8] pkm?
public override int UnusedPKM => 0x17C + Offset;
// u32 SUBE @ 0x264
// 0x268
// u8[0xA0] unused?
} }
public sealed class SubEventLog6AO : SubEventLog6 public sealed class SubEventLog6AO : SubEventLog6
{ {
public SubEventLog6AO(SAV6AO sav, int offset) : base(sav, offset) { } public SubEventLog6AO(SAV6AO sav, int offset) : base(sav, offset) { }
// Structure:
// 0x00
// u8[0x5A] trainer rematch flags
// u8[2] unused (alignment)
// u32 SUBE @ 0x5C
// 0x60
protected override int BadgeVictoryOffset => 0x60; // thru 0xBF protected override int BadgeVictoryOffset => 0x60; // thru 0xBF
// u16[6 * 8] trainer teams for gyms
// u32 SUBE @ 0xC0
// 0xC4
// u8[0xE8] pkm?
public override int Give => 0xC4 + Offset;
// u32 SUBE @ 0x1AC
// 0x1B0
// u8[0xE8] pkm?
public override int UnusedPKM => 0x1B0 + Offset;
// u32 SUBE @ 0x298
// 0x29C
// u16 SeasideCyclingRoadTimeMilliseconds 29C
public ushort SeasideCyclingRoadTimeMilliseconds
{
get => BitConverter.ToUInt16(Data, Offset + 0x29C);
set => BitConverter.GetBytes(value).CopyTo(Data, Offset + 0x29C);
}
// u16 SeasideCyclingRoadCollisions 29E
public ushort SeasideCyclingRoadCollisions
{
get => BitConverter.ToUInt16(Data, Offset + 0x29E);
set => BitConverter.GetBytes(value).CopyTo(Data, Offset + 0x29E);
}
// u16[7] 2A0
// u16[7] 2AE
// u16[17] 2BC
// u16[7] 2EA
// u16 2EC
// u16 2EE
// u16 2F0
// u16 2F2
// u32 SUBE @ 0x2F4
// 0x2F8
// u64[27]
// u8[16]
// u8[32] unused?
} }
} }