mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-28 18:05:23 -05:00
Add rival string editing for all remaining games
Block Editor for direct edits, no GUI Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
This commit is contained in:
@@ -255,6 +255,14 @@ public override int TID
|
||||
|
||||
public override int SID { get => 0; set { } }
|
||||
|
||||
public string Rival
|
||||
{
|
||||
get => GetString(Offsets.Rival, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, Offsets.Rival);
|
||||
}
|
||||
|
||||
public Span<byte> Rival_Trash { get => Data.AsSpan(Offsets.Rival, StringLength); set { if (value.Length == StringLength) value.CopyTo(Data.AsSpan(Offsets.Rival)); } }
|
||||
|
||||
public bool Yellow => Starter == 0x54; // Pikachu
|
||||
public int Starter => Data[Offsets.Starter];
|
||||
|
||||
|
||||
@@ -326,6 +326,18 @@ public Span<byte> OT_Trash
|
||||
set { if (value.Length == StringLength) value.CopyTo(Data.AsSpan(Offsets.Trainer1 + 2)); }
|
||||
}
|
||||
|
||||
public string Rival
|
||||
{
|
||||
get => GetString(Offsets.Rival, (Korean ? 2 : 1) * OTLength);
|
||||
set => SetString(value, (Korean ? 2 : 1) * OTLength).CopyTo(Data, Offsets.Rival);
|
||||
}
|
||||
|
||||
public Span<byte> Rival_Trash
|
||||
{
|
||||
get => Data.AsSpan(Offsets.Rival, StringLength);
|
||||
set { if (value.Length == StringLength) value.CopyTo(Data.AsSpan(Offsets.Rival)); }
|
||||
}
|
||||
|
||||
public override int Gender
|
||||
{
|
||||
get => Version == GameVersion.C ? Data[Offsets.Gender] : 0;
|
||||
|
||||
@@ -232,6 +232,9 @@ public override int PlayedSeconds
|
||||
public abstract int X { get; set; }
|
||||
public abstract int Y { get; set; }
|
||||
|
||||
public abstract string Rival { get; set; }
|
||||
public abstract Span<byte> Rival_Trash { get; set; }
|
||||
|
||||
public abstract int X2 { get; set; }
|
||||
public abstract int Y2 { get; set; }
|
||||
public abstract int Z { get; set; }
|
||||
|
||||
@@ -145,6 +145,19 @@ private void SetActiveGiftFlags(IReadOnlyList<MysteryGift> gifts)
|
||||
public override int M { get => BitConverter.ToUInt16(General, 0x1238); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x1238); }
|
||||
public override int X { get => BitConverter.ToUInt16(General, 0x1240); set => BitConverter.GetBytes((ushort)(X2 = value)).CopyTo(General, 0x1240); }
|
||||
public override int Y { get => BitConverter.ToUInt16(General, 0x1244); set => BitConverter.GetBytes((ushort)(Y2 = value)).CopyTo(General, 0x1244); }
|
||||
|
||||
public override string Rival
|
||||
{
|
||||
get => GetString(0x25A8, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, 0x25A8);
|
||||
}
|
||||
|
||||
public override Span<byte> Rival_Trash
|
||||
{
|
||||
get => Data.AsSpan(0x25A8, OTLength);
|
||||
set { if (value.Length == OTLength) value.CopyTo(Data.AsSpan(0x25A8)); }
|
||||
}
|
||||
|
||||
public override int X2 { get => BitConverter.ToUInt16(General, 0x25FA); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x25FA); }
|
||||
public override int Y2 { get => BitConverter.ToUInt16(General, 0x25FE); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x25FE); }
|
||||
public override int Z { get => BitConverter.ToUInt16(General, 0x2602); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x2602); }
|
||||
|
||||
@@ -154,6 +154,19 @@ public override IReadOnlyList<InventoryPouch> Inventory
|
||||
public override int M { get => BitConverter.ToUInt16(General, 0x1234); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x1234); }
|
||||
public override int X { get => BitConverter.ToUInt16(General, 0x123C); set => BitConverter.GetBytes((ushort)(X2 = value)).CopyTo(General, 0x123C); }
|
||||
public override int Y { get => BitConverter.ToUInt16(General, 0x1240); set => BitConverter.GetBytes((ushort)(Y2 = value)).CopyTo(General, 0x1240); }
|
||||
|
||||
public override string Rival
|
||||
{
|
||||
get => GetString(0x22D4, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, 0x22D4);
|
||||
}
|
||||
|
||||
public override Span<byte> Rival_Trash
|
||||
{
|
||||
get => Data.AsSpan(0x22D4, OTLength);
|
||||
set { if (value.Length == OTLength) value.CopyTo(Data.AsSpan(0x22D4)); }
|
||||
}
|
||||
|
||||
public override int X2 { get => BitConverter.ToUInt16(General, 0x236E); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x236E); }
|
||||
public override int Y2 { get => BitConverter.ToUInt16(General, 0x2372); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x2372); }
|
||||
public override int Z { get => BitConverter.ToUInt16(General, 0x2376); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x2376); }
|
||||
|
||||
@@ -111,6 +111,19 @@ public override IReadOnlyList<InventoryPouch> Inventory
|
||||
public override int M { get => BitConverter.ToUInt16(General, 0x1280); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x1280); }
|
||||
public override int X { get => BitConverter.ToUInt16(General, 0x1288); set => BitConverter.GetBytes((ushort)(X2 = value)).CopyTo(General, 0x1288); }
|
||||
public override int Y { get => BitConverter.ToUInt16(General, 0x128C); set => BitConverter.GetBytes((ushort)(Y2 = value)).CopyTo(General, 0x128C); }
|
||||
|
||||
public override string Rival
|
||||
{
|
||||
get => GetString(0x27E8, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, 0x27E8);
|
||||
}
|
||||
|
||||
public override Span<byte> Rival_Trash
|
||||
{
|
||||
get => Data.AsSpan(0x27E8, OTLength);
|
||||
set { if (value.Length == OTLength) value.CopyTo(Data.AsSpan(0x27E8)); }
|
||||
}
|
||||
|
||||
public override int X2 { get => BitConverter.ToUInt16(General, 0x287E); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x287E); }
|
||||
public override int Y2 { get => BitConverter.ToUInt16(General, 0x2882); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x2882); }
|
||||
public override int Z { get => BitConverter.ToUInt16(General, 0x2886); set => BitConverter.GetBytes((ushort)value).CopyTo(General, 0x2886); }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
@@ -56,5 +57,17 @@ private void Initialize()
|
||||
public PWTBlock5 PWT => Blocks.PWT;
|
||||
public override int Fused => 0x1FA00 + sizeof(uint);
|
||||
public override int GTS => 0x20400;
|
||||
|
||||
public string Rival
|
||||
{
|
||||
get => GetString(0x23BA4, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, 0x23BA4);
|
||||
}
|
||||
|
||||
public Span<byte> Rival_Trash
|
||||
{
|
||||
get => Data.AsSpan(0x23BA4, OTLength);
|
||||
set { if (value.Length == OTLength) value.CopyTo(Data.AsSpan(0x23BA4)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ private static SAV1Offsets GetINT() => new()
|
||||
DexSeen = 0x25B6,
|
||||
Items = 0x25C9,
|
||||
Money = 0x25F3,
|
||||
Rival = 0x25F6,
|
||||
Options = 0x2601,
|
||||
Badges = 0x2602,
|
||||
TID = 0x2605,
|
||||
@@ -36,6 +37,7 @@ private static SAV1Offsets GetJPN() => new()
|
||||
DexSeen = 0x25B1,
|
||||
Items = 0x25C4,
|
||||
Money = 0x25EE,
|
||||
Rival = 0x25F1,
|
||||
Options = 0x25F7,
|
||||
Badges = 0x25F8,
|
||||
TID = 0x25FB,
|
||||
@@ -60,6 +62,7 @@ private static SAV1Offsets GetJPN() => new()
|
||||
public int DexSeen { get; private init; }
|
||||
public int Items { get; private init; }
|
||||
public int Money { get; private init; }
|
||||
public int Rival { get; private init; }
|
||||
public int Options { get; private init; }
|
||||
public int Badges { get; private init; }
|
||||
public int TID { get; private init; }
|
||||
|
||||
@@ -23,6 +23,7 @@ public SAV2Offsets(SAV2 sav)
|
||||
|
||||
public int Options { get; }
|
||||
public int Trainer1 { get; }
|
||||
public int Rival { get; private set; }
|
||||
|
||||
public int DaylightSavings { get; private set; } = -1;
|
||||
public int TimePlayed { get; private set; } = -1;
|
||||
@@ -55,6 +56,7 @@ private void LoadOffsetsInternational(GameVersion version)
|
||||
{
|
||||
RTCFlags = 0x0C60;
|
||||
|
||||
Rival = 0x2021;
|
||||
DaylightSavings = 0x2042;
|
||||
OtherCurrentBox = 0x284C;
|
||||
switch (version)
|
||||
@@ -116,6 +118,7 @@ private void LoadOffsetsInternational(GameVersion version)
|
||||
|
||||
private void LoadOffsetsJapanese(GameVersion version)
|
||||
{
|
||||
Rival = 0x2017;
|
||||
DaylightSavings = 0x2029;
|
||||
TimePlayed = 0x2034;
|
||||
Palette = 0x204C;
|
||||
@@ -184,6 +187,7 @@ private void LoadOffsetsKorean()
|
||||
RTCFlags = 0x1060;
|
||||
|
||||
// No Crystal Version
|
||||
Rival = 0x2021;
|
||||
DaylightSavings = 0x2042;
|
||||
OtherCurrentBox = 0x284C;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user