Add gs event flags

https://projectpokemon.org/home/forums/topic/49717-pkhex-flag-editing/?tab=comments#comment-240804

via pret repo; looks like 2000 event flags, and 0x100 event
consts/work-vals (byte)
add more rebattle toggles
This commit is contained in:
Kurt 2019-03-05 23:06:05 -08:00
parent a4bf6335a9
commit 61bf82e2bd
11 changed files with 101 additions and 56 deletions

View file

@ -697,6 +697,9 @@
<None Remove="Resources\text\script\flags_c_en.txt" /> <None Remove="Resources\text\script\flags_c_en.txt" />
<None Remove="Resources\text\script\flags_c_ja.txt" /> <None Remove="Resources\text\script\flags_c_ja.txt" />
<None Remove="Resources\text\script\flags_c_zh.txt" /> <None Remove="Resources\text\script\flags_c_zh.txt" />
<None Remove="Resources\text\script\flags_gs_en.txt" />
<None Remove="Resources\text\script\flags_gs_ja.txt" />
<None Remove="Resources\text\script\flags_gs_zh.txt" />
<None Remove="Resources\text\zh\lang_zh.txt" /> <None Remove="Resources\text\zh\lang_zh.txt" />
<None Remove="Resources\text\zh\LegalityCheckStrings_zh.txt" /> <None Remove="Resources\text\zh\LegalityCheckStrings_zh.txt" />
<None Remove="Resources\text\zh\MessageStrings_zh.txt" /> <None Remove="Resources\text\zh\MessageStrings_zh.txt" />
@ -1432,6 +1435,9 @@
<EmbeddedResource Include="Resources\text\script\flags_c_en.txt" /> <EmbeddedResource Include="Resources\text\script\flags_c_en.txt" />
<EmbeddedResource Include="Resources\text\script\flags_c_ja.txt" /> <EmbeddedResource Include="Resources\text\script\flags_c_ja.txt" />
<EmbeddedResource Include="Resources\text\script\flags_c_zh.txt" /> <EmbeddedResource Include="Resources\text\script\flags_c_zh.txt" />
<EmbeddedResource Include="Resources\text\script\flags_gs_en.txt" />
<EmbeddedResource Include="Resources\text\script\flags_gs_ja.txt" />
<EmbeddedResource Include="Resources\text\script\flags_gs_zh.txt" />
<EmbeddedResource Include="Resources\text\zh\lang_zh.txt" /> <EmbeddedResource Include="Resources\text\zh\lang_zh.txt" />
<EmbeddedResource Include="Resources\text\zh\LegalityCheckStrings_zh.txt" /> <EmbeddedResource Include="Resources\text\zh\LegalityCheckStrings_zh.txt" />
<EmbeddedResource Include="Resources\text\zh\MessageStrings_zh.txt" /> <EmbeddedResource Include="Resources\text\zh\MessageStrings_zh.txt" />

View file

@ -1,6 +1,11 @@
0042 Captured Sudowoodo
0079 Received Eevee
0190 Kurt can check GS Ball 0190 Kurt can check GS Ball
0191 Kurt ready to return GS Ball (combine with above Flag) 0191 Kurt ready to return GS Ball (combine with above Flag)
0192 GS Ball can be inserted into Ilex Forest Shrine 0192 GS Ball can be inserted into Ilex Forest Shrine
0791 Captured Ho-oh
0792 Captured Lugia
0830 Received Odd Egg 0830 Received Odd Egg
0832 Received GS Ball 0832 Received GS Ball
1872 Captured Snorlax
1873 Captured Red Gyarados 1873 Captured Red Gyarados

View file

@ -1,6 +1,11 @@
0042 Captured Sudowoodo
0079 Received Eevee
0190 GSボールイベント (ガンテツ確認中) 0190 GSボールイベント (ガンテツ確認中)
0191 GSボールイベント (ガンテツから受け取れる / 上のフラグと組み合わせて使用) 0191 GSボールイベント (ガンテツから受け取れる / 上のフラグと組み合わせて使用)
0192 GSボールが置ける (ウバメのもりのほこら) 0192 GSボールが置ける (ウバメのもりのほこら)
0791 Captured Ho-oh
0792 Captured Lugia
0830 なぞのタマゴ 受け取り済み 0830 なぞのタマゴ 受け取り済み
0832 GSボール 受け取り済み 0832 GSボール 受け取り済み
1872 Captured Snorlax
1873 Captured Red Gyarados 1873 Captured Red Gyarados

View file

@ -1,6 +1,11 @@
0042 Captured Sudowoodo
0079 Received Eevee
0190 钢铁能检查GS球 0190 钢铁能检查GS球
0191 钢铁能归还GS球 (与上述旗标绑定) 0191 钢铁能归还GS球 (与上述旗标绑定)
0192 GS球能放入桐树林祠堂 0192 GS球能放入桐树林祠堂
0830 已接收 奇异的蛋 0830 已接收 奇异的蛋
0832 已接收 GS球 0832 已接收 GS球
0791 Captured Ho-oh
0792 Captured Lugia
1872 Captured Snorlax
1873 Captured Red Gyarados 1873 Captured Red Gyarados

View file

@ -0,0 +1,6 @@
0190 Kurt can check GS Ball
0191 Kurt ready to return GS Ball (combine with above Flag)
0192 GS Ball can be inserted into Ilex Forest Shrine
0830 Received Odd Egg
0832 Received GS Ball
1873 Captured Red Gyarados

View file

@ -0,0 +1,6 @@
0042 Captured Sudowoodo
0079 Received Eevee
0791 Captured Ho-oh
0792 Captured Lugia
1872 Captured Snorlax
1873 Captured Red Gyarados

View file

@ -0,0 +1,6 @@
0042 Captured Sudowoodo
0079 Received Eevee
0791 Captured Ho-oh
0792 Captured Lugia
1872 Captured Snorlax
1873 Captured Red Gyarados

View file

@ -125,6 +125,7 @@ namespace PKHeX.Core
// Enable Pokedex editing // Enable Pokedex editing
PokeDex = 0; PokeDex = 0;
EventFlag = Offsets.EventFlag; EventFlag = Offsets.EventFlag;
EventConst = Offsets.EventConst;
if (!Exportable) if (!Exportable)
ClearBoxes(); ClearBoxes();
@ -256,9 +257,8 @@ namespace PKHeX.Core
public override bool IsPKMPresent(int offset) => PKX.IsPKMPresentGB(Data, offset); public override bool IsPKMPresent(int offset) => PKX.IsPKMPresentGB(Data, offset);
// not correct, but whole contains. Data[EventFlag+0x22F]=Data[0x1A2F] means repel count. protected override int EventConstMax => 0x100;
protected override int EventFlagMax => Version == GameVersion.C ? 0x230 << 3 : base.EventFlagMax; protected override int EventFlagMax => 2000;
protected override int EventConstMax => Version == GameVersion.C ? 0 : base.EventConstMax;
public override int BoxCount => Japanese ? 9 : 14; public override int BoxCount => Japanese ? 9 : 14;
public override int MaxEV => 65535; public override int MaxEV => 65535;
@ -626,6 +626,32 @@ namespace PKHeX.Core
return GetFlag(Offsets.PokedexCaught + ofs, bit & 7); return GetFlag(Offsets.PokedexCaught + ofs, bit & 7);
} }
/// <summary>All Event Constant values for the save file</summary>
/// <remarks>These are all bytes</remarks>
public override ushort[] EventConsts
{
get
{
if (EventConstMax <= 0)
return Array.Empty<ushort>();
ushort[] Constants = new ushort[EventConstMax];
for (int i = 0; i < Constants.Length; i++)
Constants[i] = Data[EventConst + i];
return Constants;
}
set
{
if (EventConstMax <= 0)
return;
if (value.Length != EventConstMax)
return;
for (int i = 0; i < value.Length; i++)
Data[EventConst + i] = Math.Min(byte.MaxValue, (byte)value[i]);
}
}
// Misc // Misc
public ushort ResetKey => GetResetKey(); public ushort ResetKey => GetResetKey();

View file

@ -283,11 +283,11 @@ namespace PKHeX.Core
} }
/// <summary> All Event Constant values for the savegame </summary> /// <summary> All Event Constant values for the savegame </summary>
public ushort[] EventConsts public virtual ushort[] EventConsts
{ {
get get
{ {
if (EventConstMax < 0) if (EventConstMax <= 0)
return Array.Empty<ushort>(); return Array.Empty<ushort>();
ushort[] Constants = new ushort[EventConstMax]; ushort[] Constants = new ushort[EventConstMax];
@ -297,7 +297,7 @@ namespace PKHeX.Core
} }
set set
{ {
if (EventConstMax < 0) if (EventConstMax <= 0)
return; return;
if (value.Length != EventConstMax) if (value.Length != EventConstMax)
return; return;

View file

@ -14,6 +14,7 @@
else else
LoadOffsetsInternational(sav.Version); LoadOffsetsInternational(sav.Version);
Daycare = PokedexSeen + 0x1F + 28 + 1; // right after first unown seen Daycare = PokedexSeen + 0x1F + 28 + 1; // right after first unown seen
EventConst = EventFlag - 0x100;
} }
public int Options { get; } public int Options { get; }
@ -34,7 +35,8 @@
public int Gender { get; private set; } = -1; public int Gender { get; private set; } = -1;
public int AccumulatedChecksumEnd { get; private set; } = -1; public int AccumulatedChecksumEnd { get; private set; } = -1;
public int OverallChecksumPosition { get; private set; } = -1; public int OverallChecksumPosition { get; private set; } = -1;
public int EventFlag { get; private set; } = int.MinValue; public int EventFlag { get; private set; }= -1;
public int EventConst { get; }
public int Daycare { get; } public int Daycare { get; }
public int PouchTMHM { get; private set; } = -1; public int PouchTMHM { get; private set; } = -1;
@ -70,6 +72,8 @@
PouchKey = 0x2449; PouchKey = 0x2449;
PouchBall = 0x2464; PouchBall = 0x2464;
PouchPC = 0x247E; PouchPC = 0x247E;
EventFlag = CurrentBoxIndex - 0x105;
break; break;
case GameVersion.C: case GameVersion.C:
TimePlayed = 0x2052; TimePlayed = 0x2052;
@ -126,6 +130,8 @@
PouchKey = 0x242A; PouchKey = 0x242A;
PouchBall = 0x2445; PouchBall = 0x2445;
PouchPC = 0x245F; PouchPC = 0x245F;
EventFlag = CurrentBoxIndex - 0x105;
break; break;
case GameVersion.C: case GameVersion.C:
Money = 0x23BE; Money = 0x23BE;
@ -179,6 +185,8 @@
PouchKey = 0x2441; PouchKey = 0x2441;
PouchBall = 0x245C; PouchBall = 0x245C;
PouchPC = 0x2476; PouchPC = 0x2476;
EventFlag = CurrentBoxIndex - 0x105;
} }
} }
} }

View file

@ -106,59 +106,31 @@ namespace PKHeX.WinForms
private string[] GetStringList(string type) private string[] GetStringList(string type)
{ {
switch (SAV.Version) gamePrefix = GetResourceSuffix(SAV.Version);
return GameInfo.GetStrings(gamePrefix, GameInfo.CurrentLanguage, type);
}
private static string GetResourceSuffix(GameVersion ver)
{
switch (ver)
{ {
case GameVersion.X: case GameVersion.X: case GameVersion.Y: return "xy";
case GameVersion.Y: case GameVersion.OR: case GameVersion.AS: return "oras";
gamePrefix = "xy"; case GameVersion.SN: case GameVersion.MN: return "sm";
break; case GameVersion.US: case GameVersion.UM: return "usum";
case GameVersion.OR: case GameVersion.DP: return "dp";
case GameVersion.AS: case GameVersion.Pt: return "pt";
gamePrefix = "oras"; case GameVersion.HGSS: return "hgss";
break; case GameVersion.BW: return "bw";
case GameVersion.SN: case GameVersion.B2W2: return "b2w2";
case GameVersion.MN: case GameVersion.R: case GameVersion.S: case GameVersion.RS: return "rs";
gamePrefix = "sm"; case GameVersion.E: return "e";
break; case GameVersion.FR: case GameVersion.LG: case GameVersion.FRLG: return "frlg";
case GameVersion.US: case GameVersion.C: return "c";
case GameVersion.UM: case GameVersion.GD: case GameVersion.SV: case GameVersion.GS: return "gs";
gamePrefix = "usum";
break;
case GameVersion.DP:
gamePrefix = "dp";
break;
case GameVersion.Pt:
gamePrefix = "pt";
break;
case GameVersion.HGSS:
gamePrefix = "hgss";
break;
case GameVersion.BW:
gamePrefix = "bw";
break;
case GameVersion.B2W2:
gamePrefix = "b2w2";
break;
case GameVersion.R:
case GameVersion.S:
case GameVersion.RS:
gamePrefix = "rs";
break;
case GameVersion.E:
gamePrefix = "e";
break;
case GameVersion.FR:
case GameVersion.LG:
case GameVersion.FRLG:
gamePrefix = "frlg";
break;
case GameVersion.C:
gamePrefix = "c";
break;
default: default:
throw new ArgumentException(nameof(GameVersion)); throw new ArgumentException(nameof(GameVersion));
} }
return GameInfo.GetStrings(gamePrefix, GameInfo.CurrentLanguage, type);
} }
private void AddFlagList(string[] list) private void AddFlagList(string[] list)