Add country/region editor to Geonet editor (#4286)

Adds individual country/region-level editing to the Geonet/Unity Tower editors
This commit is contained in:
abcboy101 2024-06-01 18:56:20 -04:00 committed by GitHub
parent acd2d49cdc
commit 5014b0c891
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 853 additions and 305 deletions

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = Die Attacken ID liegt außerhalb des gültigen Bereichs:
MsgIndexMoveGame = Die Attacke ist in diesem Spiel nicht erhältlich:
MsgIndexAbilityRange = Die Fähigkeiten ID liegt außerhalb des gültigen Bereichs:
MsgIndexAbilityGame = Die Fähigkeit ist in diesem Spiel nicht erhältlich:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = Die entschlüsselten Daten enthalten kein gültiges PKM/Wunderkarte.
MsgQRDecodeSize = QR Daten Größe: {0} bytes
MsgQRDeprecated = QR Codes sind veraltet zugunsten von anderen Methoden.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = Move Index beyond range:
MsgIndexMoveGame = Game can't obtain move:
MsgIndexAbilityRange = Ability Index beyond range:
MsgIndexAbilityGame = Game can't obtain ability:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = Decoded data not a valid PKM/Gift.
MsgQRDecodeSize = QR Data Size: {0} bytes
MsgQRDeprecated = QR codes are deprecated in favor of other methods.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = Índice de movimientos fuera de rango:
MsgIndexMoveGame = No se puede obtener el movimiento en el juego:
MsgIndexAbilityRange = Índice de habilidades fuera de rango:
MsgIndexAbilityGame = No se puede obtener la habilidad en el juego:
MsgGeonetPointNone = Ningún
MsgGeonetPointBlue = Azul
MsgGeonetPointYellow = Amarillo
MsgGeonetPointRed = Rojo
MsgQRDecodeFail = Los datos decodificados no son PKM/Regalo válidos.
MsgQRDecodeSize = Tamaño de los datos de QR: {0} bytes
MsgQRDeprecated = Los códigos QR están obsoletos en favor de otros métodos.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = Index de capacité hors de portée :
MsgIndexMoveGame = Ce jeu ne peut avoir pas avoir accès à cette capacité :
MsgIndexAbilityRange = Index de Talent hors de portée :
MsgIndexAbilityGame = Index de Talent hors de portée :
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = Les données décodées ne correspondent à rien de valide.
MsgQRDecodeSize = Taille des données QR : {0} octets.
MsgQRDeprecated = Les QR Codes sont dépréciés en faveur d'autres méthodes.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = Indice mossa oltre il limite:
MsgIndexMoveGame = Impossibile ottenere la mossa nel gioco:
MsgIndexAbilityRange = Indice abilità oltre il limite:
MsgIndexAbilityGame = Impossibile ottenere l'abilità nel gioco:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = I dati decodificati non corrispondono ad un Pokémon o ad un Dono valido.
MsgQRDecodeSize = Dimensione dati QR: {0} byte
MsgQRDeprecated = I codci QR sono deprecati in favore di altri metodi.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = 技IDが範囲を超えています:
MsgIndexMoveGame = このゲームではこの技は習得できません:
MsgIndexAbilityRange = 特性IDが範囲を超えています:
MsgIndexAbilityGame = このゲームではこの特性になれません:
MsgGeonetPointNone = ない
MsgGeonetPointBlue = 青
MsgGeonetPointYellow = 黄
MsgGeonetPointRed = 赤
MsgQRDecodeFail = デコードしたデータは有効なPKMまたはギフトデータではありません。
MsgQRDecodeSize = QRコードデータサイズ: {0} バイト
MsgQRDeprecated = QRコードは非推奨となり、他の方法が優先されます。

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = 기술 인덱스가 범위를 벗어남:
MsgIndexMoveGame = 게임에서 얻을 수 없는 기술:
MsgIndexAbilityRange = 특성 인덱스가 범위를 벗어남:
MsgIndexAbilityGame = 특성 인덱스가 범위를 벗어남:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = 해독한 데이터가 사용 가능한 포켓몬/소포가 아닙니다.
MsgQRDecodeSize = QR 데이터 크기: {0} 바이트
MsgQRDeprecated = QR 코드는 다른 방법들이 나옴에 따라 더이상 사용되지 않습니다.

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = 招式的编号超过范围:
MsgIndexMoveGame = 当前游戏不能获得招式:
MsgIndexAbilityRange = 特性的编号超过范围:
MsgIndexAbilityGame = 当前游戏不能获得特性:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = 解码后的数据不是一个有效的宝可梦或神秘礼物
MsgQRDecodeSize = QR 数据大小: {0} 字节
MsgQRDeprecated = QR 码已因其他方式而被弃用。

View file

@ -162,6 +162,10 @@ MsgIndexMoveRange = 招式之編號超過範圍:
MsgIndexMoveGame = 當前遊戲不能獲得招式:
MsgIndexAbilityRange = 特性之編號超過範圍:
MsgIndexAbilityGame = 當前遊戲不能獲得特性:
MsgGeonetPointNone = None
MsgGeonetPointBlue = Blue
MsgGeonetPointYellow = Yellow
MsgGeonetPointRed = Red
MsgQRDecodeFail = 解碼後之資料並非一個有效的寶可夢或神秘禮物
MsgQRDecodeSize = QR 數據大小: {0} 位元組
MsgQRDeprecated = QR 碼經已因其他方式而被棄用。

View file

@ -29,6 +29,6 @@ public enum Backdrop4 : byte
public static class BackdropInfo
{
public const int Count = (int)Backdrop4.Unset;
public const Backdrop4 MaxLegal = Backdrop4.Theater;
public const Backdrop4 MaxLegal = Backdrop4.Sky;
public static bool IsUnset(this Backdrop4 backdrop) => (uint)backdrop >= (uint)Backdrop4.Unset;
}

View file

@ -2,17 +2,28 @@ using System;
namespace PKHeX.Core;
public sealed class Geonet4
public sealed class Geonet4 : IGeonet
{
private readonly SAV4 SAV;
/* Lets the globe be panned outside Japan and zoomed out in Japanese games. Has no effect in non-Japanese games.
* Set once you register a location outside of Japan, even if it's just your own location in a non-Japanese game. */
public bool GlobalFlag { get; set; }
private readonly byte[] Data;
private readonly int Offset;
private const int CountryCount = 233;
public Geonet4(SAV4 sav)
{
SAV = sav;
Offset = SAV.Geonet + 3;
GlobalFlag = SAV.GeonetGlobalFlag;
Data = SAV.General.Slice(Offset, CountryCount * 16).ToArray();
}
public void Save()
{
SAV.GeonetGlobalFlag = GlobalFlag;
SAV.SetData(SAV.General.Slice(Offset, CountryCount * 16), Data);
}
public const int CountryCount = 233;
private const int Japan = 103;
private static ReadOnlySpan<byte> LegalCountries =>
[
@ -29,57 +40,44 @@ public sealed class Geonet4
public static byte GetSubregionCount(byte country) => country switch
{
009 => 24,
012 => 7,
028 => 27,
036 => 13,
043 => 31,
070 => 6,
071 => 22,
077 => 16,
094 => 35,
101 => 20,
103 => 50,
156 => 20,
166 => 16,
172 => 7,
193 => 17,
199 => 24,
219 => 12,
220 => 51,
009 => 24, // Argentina
012 => 7, // Australia
028 => 27, // Brazil
036 => 13, // Canada
043 => 31, // China
070 => 6, // Finland
071 => 22, // France
077 => 16, // Germany
094 => 35, // India
101 => 20, // Italy
103 => 50, // Japan
156 => 20, // Norway
166 => 16, // Poland
172 => 7, // Russian Federation
193 => 17, // Spain
199 => 24, // Sweden
219 => 12, // United Kingdom
220 => 51, // United States of America
_ => 0,
};
public enum Point
public bool GlobalFlag { get => SAV.GeonetGlobalFlag; set => SAV.GeonetGlobalFlag = value; }
public GeonetPoint GetCountrySubregion(byte country, byte subregion)
{
None = 0, // never communicated with
Blue = 1, // first communicated with today
Yellow = 2, // already communicated with
Red = 3, // own registered location
int index = ((country - 1) * 16) + (subregion / 4);
int shift = 2 * (subregion % 4);
return (GeonetPoint)(((Data[index] & 0b11 << shift) >> shift));
}
public Geonet4(SAV4 sav)
{
SAV = sav;
Offset = SAV.Geonet + 3;
GlobalFlag = SAV.GeonetGlobalFlag;
Data = SAV.General.Slice(Offset, CountryCount * 16).ToArray();
}
public void Save()
{
SAV.GeonetGlobalFlag = GlobalFlag;
SAV.SetData(SAV.General.Slice(Offset, CountryCount * 16), Data);
}
public void SetCountrySubregion(byte country, byte subregion, Point point)
public void SetCountrySubregion(byte country, byte subregion, GeonetPoint point)
{
int index = ((country - 1) * 16) + (subregion / 4);
int shift = 2 * (subregion % 4);
Data[index] = (byte)((Data[index] & ~(0b11 << shift)) | ((int)point << shift));
}
private void SetAllSubregions(byte country, Point type)
private void SetAllSubregions(byte country, GeonetPoint type)
{
var subregionCount = GetSubregionCount(country);
if (subregionCount == 0)
@ -95,33 +93,33 @@ public sealed class Geonet4
public void SetAll()
{
for (byte country = 1; country <= CountryCount; country++)
SetAllSubregions(country, Point.Yellow);
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
SetAllSubregions(country, GeonetPoint.Yellow);
SetSAVCountry();
GlobalFlag = true;
}
public void SetAllLegal()
{
foreach (var country in LegalCountries)
SetAllSubregions(country, Point.Yellow);
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
SetAllSubregions(country, GeonetPoint.Yellow);
SetSAVCountry();
GlobalFlag = true;
}
public void ClearAll()
{
for (byte country = 1; country <= CountryCount; country++)
SetAllSubregions(country, Point.None);
SetAllSubregions(country, GeonetPoint.None);
SetSAVCountry();
GlobalFlag = (SAV.Country > 0 && SAV.Country != Japan);
}
public void SetSAVCountry()
{
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
GlobalFlag = (SAV.Country > 0 && SAV.Country != 103);
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, GeonetPoint.Red);
}
}

View file

@ -2,9 +2,15 @@ using System;
namespace PKHeX.Core;
public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SAV, raw)
public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SAV, raw), IGeonet
{
private const int CountryCount = 232;
private const int UnityTowerOffset = 0x320;
private const int GeonetGlobalFlagOffset = 0x344;
private const int UnityTowerFlagOffset = 0x345;
private const int GeonetOffset = 0x348;
public const int CountryCount = 232;
private const int Japan = 105;
private static ReadOnlySpan<byte> LegalCountries =>
[
@ -21,58 +27,69 @@ public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SA
public static byte GetSubregionCount(byte country) => country switch
{
009 => 24,
012 => 8,
028 => 27,
036 => 13,
043 => 33,
072 => 6,
073 => 22,
079 => 16,
095 => 35,
102 => 20,
105 => 50,
155 => 22,
166 => 16,
174 => 8,
195 => 17,
200 => 22,
218 => 12,
220 => 51,
009 => 24, // Argentina
012 => 8, // Australia
028 => 27, // Brazil
036 => 13, // Canada
043 => 33, // China
072 => 6, // Finland
073 => 22, // France
079 => 16, // Germany
095 => 35, // India
102 => 20, // Italy
105 => 50, // Japan
155 => 22, // Norway
166 => 16, // Poland
174 => 8, // Russian Federation
195 => 17, // Spain
200 => 22, // Sweden
218 => 12, // United Kingdom
220 => 51, // United States of America
_ => 0,
};
public enum Point
{
None = 0, // never communicated with
Blue = 1, // first communicated with today
Yellow = 2, // already communicated with
Red = 3, // own registered location
}
private const int UnityTowerOffset = 0x320;
private const int GeonetGlobalFlagOffset = 0x344;
private const int UnityTowerFlagOffset = 0x345;
private const int GeonetOffset = 0x348;
public bool GlobalFlag { get => Data[GeonetGlobalFlagOffset] != 0; set => Data[GeonetGlobalFlagOffset] = (byte)(value ? 1 : 0); }
public bool UnityTowerFlag { get => Data[UnityTowerFlagOffset] != 0; set => Data[UnityTowerFlagOffset] = (byte)(value ? 1 : 0); }
public void SetCountrySubregion(byte country, byte subregion, Point point)
public GeonetPoint GetCountrySubregion(byte country, byte subregion)
{
int index = GeonetOffset + ((country - 1) * 16) + (subregion / 4);
int shift = 2 * (subregion % 4);
return (GeonetPoint)(((Data[index] & 0b11 << shift) >> shift));
}
public void SetCountrySubregion(byte country, byte subregion, GeonetPoint point)
{
int index = GeonetOffset + ((country - 1) * 16) + (subregion / 4);
int shift = 2 * (subregion % 4);
Data[index] = (byte)((Data[index] & ~(0b11 << shift)) | ((int)point << shift));
}
public void SetUnityTowerFloor(byte country, bool unlocked)
/// <summary>
/// Gets whether the floor is unlocked for the specified country.
/// </summary>
/// <param name="country">Country index</param>
/// <returns>Floor status.</returns>
public bool GetUnityTowerFloor(byte country)
{
int index = UnityTowerOffset + (country / 8);
int shift = country % 8;
Data[index] = (byte)((Data[index] & ~(0b1 << shift)) | (unlocked ? 0b1 : 0b0) << shift);
return ((Data[index] & 0b1 << shift) >> shift) != 0b0;
}
private void SetAllSubregions(byte country, Point type, bool floor)
/// <summary>
/// Sets whether the floor is unlocked for the specified country.
/// </summary>
/// <param name="country">Country index</param>
/// <param name="isUnlocked">Floor status</param>
public void SetUnityTowerFloor(byte country, bool isUnlocked)
{
int index = UnityTowerOffset + (country / 8);
int shift = country % 8;
Data[index] = (byte)((Data[index] & ~(0b1 << shift)) | (isUnlocked ? 0b1 : 0b0) << shift);
}
private void SetAllSubregions(byte country, GeonetPoint type, bool floor)
{
SetUnityTowerFloor(country, floor);
@ -90,11 +107,9 @@ public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SA
public void SetAll()
{
for (byte country = 1; country <= CountryCount; country++)
SetAllSubregions(country, Point.Yellow, true);
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
SetAllSubregions(country, GeonetPoint.Yellow, true);
SetSAVCountry();
GlobalFlag = true;
UnityTowerFlag = true;
}
@ -102,11 +117,9 @@ public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SA
public void SetAllLegal()
{
foreach (var country in LegalCountries)
SetAllSubregions(country, Point.Yellow, true);
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
SetAllSubregions(country, GeonetPoint.Yellow, true);
SetSAVCountry();
GlobalFlag = true;
UnityTowerFlag = true;
}
@ -114,12 +127,16 @@ public sealed class UnityTower5(SAV5 SAV, Memory<byte> raw) : SaveBlock<SAV5>(SA
public void ClearAll()
{
for (byte country = 1; country <= CountryCount; country++)
SetAllSubregions(country, Point.None, false);
SetAllSubregions(country, GeonetPoint.None, false);
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, Point.Red);
GlobalFlag = (SAV.Country > 0 && SAV.Country != 103);
SetSAVCountry();
GlobalFlag = (SAV.Country > 0 && SAV.Country != Japan);
UnityTowerFlag = false;
}
public void SetSAVCountry()
{
if (SAV.Country > 0)
SetCountrySubregion((byte)SAV.Country, (byte)SAV.Region, GeonetPoint.Red);
}
}

View file

@ -0,0 +1,78 @@
namespace PKHeX.Core;
/// <summary>
/// Generation 4/5 Geonet
/// </summary>
public interface IGeonet
{
/// <summary>
/// Gets the number of subregions for the specified country.
/// </summary>
/// <param name="country">Country index</param>
/// <returns>Number of subregions.</returns>
static abstract byte GetSubregionCount(byte country);
/// <summary>
/// Lets the globe be panned outside Japan and zoomed out in Japanese games. Has no effect in non-Japanese games.
/// Set once you register a location outside of Japan, even if it's just your own location in a non-Japanese game.
/// </summary>
bool GlobalFlag { get; set; }
/// <summary>
/// Gets the point status for the specified country and subregion.
/// </summary>
/// <param name="country">Country index</param>
/// <param name="subregion">Subregion index</param>
/// <returns>Point status.</returns>
GeonetPoint GetCountrySubregion(byte country, byte subregion);
/// <summary>
/// Sets the point status for the specified country and subregion.
/// </summary>
/// <param name="country">Country index</param>
/// <param name="subregion">Subregion index</param>
void SetCountrySubregion(byte country, byte subregion, GeonetPoint point);
/// <summary>
/// Sets all Geonet locations.
/// </summary>
void SetAll();
/// <summary>
/// Sets all legal Geonet locations.
/// </summary>
void SetAllLegal();
/// <summary>
/// Clear all Geonet locations.
/// </summary>
void ClearAll();
/// <summary>
/// Sets the point status for the registered Geonet location as the player's location.
/// </summary>
void SetSAVCountry();
}
public enum GeonetPoint
{
/// <summary>
/// Location that has never been communicated with.
/// </summary>
None = 0,
/// <summary>
/// Location that was first communicated with today.
/// </summary>
Blue = 1,
/// <summary>
/// Location that has already been communicated with.
/// </summary>
Yellow = 2,
/// <summary>
/// The player's own registered location.
/// </summary>
Red = 3,
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using static PKHeX.Core.MessageStrings;
using static PKHeX.Core.GeonetPoint;
namespace PKHeX.Core;
@ -15,6 +17,14 @@ public static partial class Util
return list;
}
public static List<ComboItem> GetGeonetPointList() =>
[
new (MsgGeonetPointNone, (int)None),
new (MsgGeonetPointBlue, (int)Blue),
new (MsgGeonetPointYellow, (int)Yellow),
new (MsgGeonetPointRed, (int)Red),
];
private static List<ComboItem> GetCBListFromCSV(ReadOnlySpan<string> inputCSV, int index)
{
var arr = new List<ComboItem>(inputCSV.Length);

View file

@ -211,6 +211,11 @@ public static class MessageStrings
public static string MsgIndexAbilityRange { get; set; } = "Ability Index beyond range:";
public static string MsgIndexAbilityGame { get; set; } = "Ability Index beyond range:";
public static string MsgGeonetPointNone { get; set; } = "None";
public static string MsgGeonetPointBlue { get; set; } = "Blue";
public static string MsgGeonetPointYellow { get; set; } = "Yellow";
public static string MsgGeonetPointRed { get; set; } = "Red";
#endregion
#region QR Codes

View file

@ -861,19 +861,19 @@ SAV_Misc3.TAB_Ferry=Ferry
SAV_Misc3.TAB_Joyful=Joyful
SAV_Misc3.TAB_Main=기본
SAV_Misc3.Tab_Records=Records
SAV_Misc4.B_AllAccessoriesIllegal=Give All (Illegal)
SAV_Misc4.B_AllAccessoriesLegal=Give All (Legal)
SAV_Misc4.B_AllBackdropsIllegal=Give All (Illegal)
SAV_Misc4.B_AllBackdropsLegal=Give All (Legal)
SAV_Misc4.B_AllAccessoriesIllegal=Give All Accessories (Illegal)
SAV_Misc4.B_AllAccessoriesLegal=Give All Accessories (Legal)
SAV_Misc4.B_AllBackdropsIllegal=Give All Backdrops (Illegal)
SAV_Misc4.B_AllBackdropsLegal=Give All Backdrops (Legal)
SAV_Misc4.B_AllFlyDest=모두 선택
SAV_Misc4.B_AllPoketch=모두 주기
SAV_Misc4.B_AllSealsIllegal=Give All Seals (Illegal)
SAV_Misc4.B_AllSealsLegal=Give All Seals (Legal)
SAV_Misc4.B_AllWalkerCourses=Check All
SAV_Misc4.B_Cancel=취소
SAV_Misc4.B_ClearAccessories=Clear All
SAV_Misc4.B_ClearBackdrops=Clear All
SAV_Misc4.B_ClearSeals=Clear All Seals
SAV_Misc4.B_ClearAccessories=Delete All Accessories
SAV_Misc4.B_ClearBackdrops=Delete All Backdrops
SAV_Misc4.B_ClearSeals=Delete All Seals
SAV_Misc4.B_DeleteAll=모두 삭제
SAV_Misc4.B_GiveAll=모두 주기
SAV_Misc4.B_GiveAllNoTrainers=Give All Non-Trainers

View file

@ -28,104 +28,178 @@ namespace PKHeX.WinForms
/// </summary>
private void InitializeComponent()
{
this.B_Save = new System.Windows.Forms.Button();
this.B_Cancel = new System.Windows.Forms.Button();
this.B_SetAllLocations = new System.Windows.Forms.Button();
this.B_SetAllLegalLocations = new System.Windows.Forms.Button();
this.B_ClearLocations = new System.Windows.Forms.Button();
this.CHK_GlobalFlag = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
B_Save = new System.Windows.Forms.Button();
B_Cancel = new System.Windows.Forms.Button();
B_SetAllLocations = new System.Windows.Forms.Button();
B_SetAllLegalLocations = new System.Windows.Forms.Button();
B_ClearLocations = new System.Windows.Forms.Button();
CHK_GlobalFlag = new System.Windows.Forms.CheckBox();
DGV_Geonet = new System.Windows.Forms.DataGridView();
Item_CountryIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Country = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_RegionIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Region = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Point = new System.Windows.Forms.DataGridViewComboBoxColumn();
((System.ComponentModel.ISupportInitialize)DGV_Geonet).BeginInit();
SuspendLayout();
//
// B_Save
//
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Save.Location = new System.Drawing.Point(195, 137);
this.B_Save.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(88, 27);
this.B_Save.TabIndex = 26;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
B_Save.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
B_Save.Location = new System.Drawing.Point(435, 381);
B_Save.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_Save.Name = "B_Save";
B_Save.Size = new System.Drawing.Size(88, 27);
B_Save.TabIndex = 6;
B_Save.Text = "Save";
B_Save.UseVisualStyleBackColor = true;
B_Save.Click += B_Save_Click;
//
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Cancel.Location = new System.Drawing.Point(101, 137);
this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(88, 27);
this.B_Cancel.TabIndex = 25;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
B_Cancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
B_Cancel.Location = new System.Drawing.Point(341, 381);
B_Cancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_Cancel.Name = "B_Cancel";
B_Cancel.Size = new System.Drawing.Size(88, 27);
B_Cancel.TabIndex = 5;
B_Cancel.Text = "Cancel";
B_Cancel.UseVisualStyleBackColor = true;
B_Cancel.Click += B_Cancel_Click;
//
// B_SetAllLocations
//
this.B_SetAllLocations.Location = new System.Drawing.Point(13, 12);
this.B_SetAllLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_SetAllLocations.Name = "B_SetAllLocations";
this.B_SetAllLocations.Size = new System.Drawing.Size(264, 27);
this.B_SetAllLocations.TabIndex = 27;
this.B_SetAllLocations.Text = "Set All Locations";
this.B_SetAllLocations.UseVisualStyleBackColor = true;
this.B_SetAllLocations.Click += new System.EventHandler(this.B_SetAllLocations_Click);
B_SetAllLocations.Location = new System.Drawing.Point(13, 12);
B_SetAllLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_SetAllLocations.Name = "B_SetAllLocations";
B_SetAllLocations.Size = new System.Drawing.Size(160, 27);
B_SetAllLocations.TabIndex = 0;
B_SetAllLocations.Text = "Set All Locations";
B_SetAllLocations.UseVisualStyleBackColor = true;
B_SetAllLocations.Click += B_SetAllLocations_Click;
//
// B_SetAllLegalLocations
//
this.B_SetAllLegalLocations.Location = new System.Drawing.Point(13, 45);
this.B_SetAllLegalLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_SetAllLegalLocations.Name = "B_SetAllLegalLocations";
this.B_SetAllLegalLocations.Size = new System.Drawing.Size(264, 27);
this.B_SetAllLegalLocations.TabIndex = 28;
this.B_SetAllLegalLocations.Text = "Set All Legal Locations";
this.B_SetAllLegalLocations.UseVisualStyleBackColor = true;
this.B_SetAllLegalLocations.Click += new System.EventHandler(this.B_SetAllLegalLocations_Click);
B_SetAllLegalLocations.Location = new System.Drawing.Point(185, 12);
B_SetAllLegalLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_SetAllLegalLocations.Name = "B_SetAllLegalLocations";
B_SetAllLegalLocations.Size = new System.Drawing.Size(160, 27);
B_SetAllLegalLocations.TabIndex = 1;
B_SetAllLegalLocations.Text = "Set All Legal Locations";
B_SetAllLegalLocations.UseVisualStyleBackColor = true;
B_SetAllLegalLocations.Click += B_SetAllLegalLocations_Click;
//
// B_ClearLocations
//
this.B_ClearLocations.Location = new System.Drawing.Point(13, 78);
this.B_ClearLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_ClearLocations.Name = "B_ClearLocations";
this.B_ClearLocations.Size = new System.Drawing.Size(264, 27);
this.B_ClearLocations.TabIndex = 29;
this.B_ClearLocations.Text = "Clear Locations";
this.B_ClearLocations.UseVisualStyleBackColor = true;
this.B_ClearLocations.Click += new System.EventHandler(this.B_ClearLocations_Click);
B_ClearLocations.Location = new System.Drawing.Point(357, 12);
B_ClearLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_ClearLocations.Name = "B_ClearLocations";
B_ClearLocations.Size = new System.Drawing.Size(160, 27);
B_ClearLocations.TabIndex = 2;
B_ClearLocations.Text = "Clear Locations";
B_ClearLocations.UseVisualStyleBackColor = true;
B_ClearLocations.Click += B_ClearLocations_Click;
//
// CHK_GlobalFlag
//
this.CHK_GlobalFlag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.CHK_GlobalFlag.AutoSize = true;
this.CHK_GlobalFlag.Location = new System.Drawing.Point(13, 111);
this.CHK_GlobalFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.CHK_GlobalFlag.Name = "CHK_GlobalFlag";
this.CHK_GlobalFlag.Size = new System.Drawing.Size(131, 19);
this.CHK_GlobalFlag.TabIndex = 45;
this.CHK_GlobalFlag.Text = "Whole Globe Visible";
this.CHK_GlobalFlag.UseVisualStyleBackColor = true;
CHK_GlobalFlag.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
CHK_GlobalFlag.AutoSize = true;
CHK_GlobalFlag.Location = new System.Drawing.Point(13, 355);
CHK_GlobalFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
CHK_GlobalFlag.Name = "CHK_GlobalFlag";
CHK_GlobalFlag.Size = new System.Drawing.Size(131, 19);
CHK_GlobalFlag.TabIndex = 4;
CHK_GlobalFlag.Text = "Whole Globe Visible";
CHK_GlobalFlag.UseVisualStyleBackColor = true;
//
// DGV_Geonet
//
DGV_Geonet.AllowUserToAddRows = false;
DGV_Geonet.AllowUserToDeleteRows = false;
DGV_Geonet.AllowUserToResizeColumns = false;
DGV_Geonet.AllowUserToResizeRows = false;
DGV_Geonet.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
DGV_Geonet.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_Geonet.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_Geonet.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DGV_Geonet.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { Item_CountryIndex, Item_Country, Item_RegionIndex, Item_Region, Item_Point });
DGV_Geonet.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
DGV_Geonet.Location = new System.Drawing.Point(13, 45);
DGV_Geonet.MultiSelect = false;
DGV_Geonet.Name = "DGV_Geonet";
DGV_Geonet.RowHeadersVisible = false;
DGV_Geonet.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_Geonet.Size = new System.Drawing.Size(505, 304);
DGV_Geonet.StandardTab = true;
DGV_Geonet.TabIndex = 3;
//
// Item_CountryIndex
//
Item_CountryIndex.HeaderText = "CountryIndex";
Item_CountryIndex.Name = "Item_CountryIndex";
Item_CountryIndex.ReadOnly = true;
Item_CountryIndex.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
Item_CountryIndex.Visible = false;
//
// Item_Country
//
Item_Country.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
Item_Country.FillWeight = 150F;
Item_Country.HeaderText = "Country";
Item_Country.MinimumWidth = 50;
Item_Country.Name = "Item_Country";
Item_Country.ReadOnly = true;
Item_Country.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Item_RegionIndex
//
Item_RegionIndex.HeaderText = "RegionIndex";
Item_RegionIndex.Name = "Item_RegionIndex";
Item_RegionIndex.ReadOnly = true;
Item_RegionIndex.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
Item_RegionIndex.Visible = false;
//
// Item_Region
//
Item_Region.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
Item_Region.FillWeight = 150F;
Item_Region.HeaderText = "Region";
Item_Region.MinimumWidth = 50;
Item_Region.Name = "Item_Region";
Item_Region.ReadOnly = true;
Item_Region.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Item_Point
//
Item_Point.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
Item_Point.FillWeight = 50F;
Item_Point.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
Item_Point.HeaderText = "Point";
Item_Point.MinimumWidth = 50;
Item_Point.Name = "Item_Point";
Item_Point.Resizable = System.Windows.Forms.DataGridViewTriState.True;
Item_Point.Width = 50;
//
// SAV_Geonet4
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(290, 173);
this.Controls.Add(this.CHK_GlobalFlag);
this.Controls.Add(this.B_ClearLocations);
this.Controls.Add(this.B_SetAllLegalLocations);
this.Controls.Add(this.B_SetAllLocations);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimumSize = new System.Drawing.Size(306, 196);
this.Name = "SAV_Geonet4";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Geonet Editor";
this.Load += new System.EventHandler(this.SAV_Geonet4_Load);
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
ClientSize = new System.Drawing.Size(530, 417);
Controls.Add(DGV_Geonet);
Controls.Add(CHK_GlobalFlag);
Controls.Add(B_ClearLocations);
Controls.Add(B_SetAllLegalLocations);
Controls.Add(B_SetAllLocations);
Controls.Add(B_Cancel);
Controls.Add(B_Save);
Icon = Properties.Resources.Icon;
Margin = new System.Windows.Forms.Padding(2);
MaximizeBox = false;
Name = "SAV_Geonet4";
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
Text = "Geonet Editor";
((System.ComponentModel.ISupportInitialize)DGV_Geonet).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -135,5 +209,11 @@ namespace PKHeX.WinForms
private System.Windows.Forms.Button B_SetAllLegalLocations;
private System.Windows.Forms.Button B_ClearLocations;
private System.Windows.Forms.CheckBox CHK_GlobalFlag;
private System.Windows.Forms.DataGridView DGV_Geonet;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_Country;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_Region;
private System.Windows.Forms.DataGridViewComboBoxColumn Item_Point;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_CountryIndex;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_RegionIndex;
}
}

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using PKHeX.Core;
@ -10,6 +11,10 @@ public partial class SAV_Geonet4 : Form
private readonly SAV4 SAV;
private readonly Geonet4 Geonet;
private readonly List<ComboItem> countryList;
private readonly List<ComboItem> subregionListDefault;
private readonly List<ComboItem> pointList;
public SAV_Geonet4(SAV4 sav)
{
InitializeComponent();
@ -17,38 +22,94 @@ public partial class SAV_Geonet4 : Form
SAV = (SAV4)(Origin = sav).Clone();
Geonet = new Geonet4(SAV);
countryList = Util.GetCountryRegionList("gen4_countries", Main.CurrentLanguage);
subregionListDefault = Util.GetCountryRegionList("gen4_sr_default", Main.CurrentLanguage);
pointList = Util.GetGeonetPointList();
InitializeDGVGeonet();
CHK_GlobalFlag.Checked = Geonet.GlobalFlag;
}
private void InitializeDGVGeonet()
{
DGV_Geonet.Rows.Clear();
Item_Point.InitializeBinding();
Item_Point.DataSource = pointList;
for (int i = 1; i <= Geonet4.CountryCount; i++)
{
var country = countryList[i].Value;
var countryName = countryList[i].Text;
var subregionCount = Geonet4.GetSubregionCount((byte)country);
var subregionList = (subregionCount == 0) ? subregionListDefault : Util.GetCountryRegionList($"gen4_sr_{country:000}", Main.CurrentLanguage);
if (subregionCount == 0)
{
var subregion = subregionList[0].Value;
var subregionName = subregionList[0].Text;
AddCountrySubregionRowDGV(country, subregion, countryName, subregionName);
}
for (int j = 1; j <= subregionCount; j++)
{
var subregion = subregionList[j].Value;
var subregionName = subregionList[j].Text;
AddCountrySubregionRowDGV(country, subregion, countryName, subregionName);
}
}
}
private void AddCountrySubregionRowDGV(int country, int subregion, string countryName, string subregionName)
{
var point = Geonet.GetCountrySubregion((byte)country, (byte)subregion);
var row = DGV_Geonet.Rows[DGV_Geonet.Rows.Add()];
row.Cells[0].Value = country;
row.Cells[1].Value = countryName;
row.Cells[2].Value = subregion;
row.Cells[3].Value = subregionName;
row.Cells[4].Value = (int)point;
}
private void B_Save_Click(object sender, EventArgs e)
{
Geonet.ClearAll();
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
{
var row = DGV_Geonet.Rows[i];
var country = (int)row.Cells[0].Value;
var subregion = (int)row.Cells[2].Value;
var point = (GeonetPoint)row.Cells[4].Value;
if (country > 0)
Geonet.SetCountrySubregion((byte)country, (byte)subregion, point);
}
Geonet.SetSAVCountry();
Geonet.Save();
Geonet.GlobalFlag = CHK_GlobalFlag.Checked;
Origin.CopyChangesFrom(SAV);
Close();
}
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void SAV_Geonet4_Load(object sender, EventArgs e)
{
CHK_GlobalFlag.Checked = Geonet.GlobalFlag;
}
private void B_SetAllLocations_Click(object sender, EventArgs e)
{
Geonet.SetAll();
InitializeDGVGeonet();
CHK_GlobalFlag.Checked = Geonet.GlobalFlag;
}
private void B_SetAllLegalLocations_Click(object sender, EventArgs e)
{
Geonet.SetAllLegal();
InitializeDGVGeonet();
CHK_GlobalFlag.Checked = Geonet.GlobalFlag;
}
private void B_ClearLocations_Click(object sender, EventArgs e)
{
Geonet.ClearAll();
InitializeDGVGeonet();
CHK_GlobalFlag.Checked = Geonet.GlobalFlag;
}
}

View file

@ -1142,11 +1142,12 @@ namespace PKHeX.WinForms
//
// B_ClearSeals
//
B_ClearSeals.Anchor = System.Windows.Forms.AnchorStyles.Left;
B_ClearSeals.Location = new System.Drawing.Point(42, 68);
B_ClearSeals.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_ClearSeals.Name = "B_ClearSeals";
B_ClearSeals.Size = new System.Drawing.Size(140, 43);
B_ClearSeals.TabIndex = 20;
B_ClearSeals.TabIndex = 0;
B_ClearSeals.Text = "Clear All Seals";
B_ClearSeals.UseVisualStyleBackColor = true;
B_ClearSeals.Click += B_ClearSeals_Click;
@ -1157,6 +1158,7 @@ namespace PKHeX.WinForms
DGV_Seals.AllowUserToDeleteRows = false;
DGV_Seals.AllowUserToResizeColumns = false;
DGV_Seals.AllowUserToResizeRows = false;
DGV_Seals.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
DGV_Seals.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_Seals.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_Seals.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@ -1168,27 +1170,29 @@ namespace PKHeX.WinForms
DGV_Seals.RowHeadersVisible = false;
DGV_Seals.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_Seals.Size = new System.Drawing.Size(209, 266);
DGV_Seals.TabIndex = 2;
DGV_Seals.StandardTab = true;
DGV_Seals.TabIndex = 3;
//
// B_AllSealsIllegal
//
B_AllSealsIllegal.Anchor = System.Windows.Forms.AnchorStyles.Left;
B_AllSealsIllegal.Location = new System.Drawing.Point(42, 166);
B_AllSealsIllegal.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_AllSealsIllegal.Name = "B_AllSealsIllegal";
B_AllSealsIllegal.Size = new System.Drawing.Size(140, 43);
B_AllSealsIllegal.TabIndex = 1;
B_AllSealsIllegal.TabIndex = 2;
B_AllSealsIllegal.Text = "Give All Seals (Illegal)";
B_AllSealsIllegal.UseVisualStyleBackColor = true;
B_AllSealsIllegal.Click += OnBAllSealsLegalOnClick;
//
// B_AllSealsLegal
//
B_AllSealsLegal.Anchor = System.Windows.Forms.AnchorStyles.Right;
B_AllSealsLegal.Anchor = System.Windows.Forms.AnchorStyles.Left;
B_AllSealsLegal.Location = new System.Drawing.Point(42, 117);
B_AllSealsLegal.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_AllSealsLegal.Name = "B_AllSealsLegal";
B_AllSealsLegal.Size = new System.Drawing.Size(140, 43);
B_AllSealsLegal.TabIndex = 0;
B_AllSealsLegal.TabIndex = 1;
B_AllSealsLegal.Text = "Give All Seals (Legal)";
B_AllSealsLegal.UseVisualStyleBackColor = true;
B_AllSealsLegal.Click += OnBAllSealsLegalOnClick;
@ -1216,7 +1220,7 @@ namespace PKHeX.WinForms
B_ClearBackdrops.Location = new System.Drawing.Point(221, 7);
B_ClearBackdrops.Name = "B_ClearBackdrops";
B_ClearBackdrops.Size = new System.Drawing.Size(209, 29);
B_ClearBackdrops.TabIndex = 16;
B_ClearBackdrops.TabIndex = 5;
B_ClearBackdrops.Text = "Clear All Backdrops";
B_ClearBackdrops.UseVisualStyleBackColor = true;
B_ClearBackdrops.Click += B_ClearBackdrops_Click;
@ -1226,7 +1230,7 @@ namespace PKHeX.WinForms
B_ClearAccessories.Location = new System.Drawing.Point(6, 7);
B_ClearAccessories.Name = "B_ClearAccessories";
B_ClearAccessories.Size = new System.Drawing.Size(209, 29);
B_ClearAccessories.TabIndex = 15;
B_ClearAccessories.TabIndex = 1;
B_ClearAccessories.Text = "Clear All Accessories";
B_ClearAccessories.UseVisualStyleBackColor = true;
B_ClearAccessories.Click += B_ClearAccessories_Click;
@ -1236,7 +1240,7 @@ namespace PKHeX.WinForms
B_AllBackdropsIllegal.Location = new System.Drawing.Point(221, 73);
B_AllBackdropsIllegal.Name = "B_AllBackdropsIllegal";
B_AllBackdropsIllegal.Size = new System.Drawing.Size(209, 29);
B_AllBackdropsIllegal.TabIndex = 13;
B_AllBackdropsIllegal.TabIndex = 7;
B_AllBackdropsIllegal.Text = "Give All Backdrops (Illegal)";
B_AllBackdropsIllegal.UseVisualStyleBackColor = true;
B_AllBackdropsIllegal.Click += OnBAllBackdropsLegalOnClick;
@ -1246,7 +1250,7 @@ namespace PKHeX.WinForms
B_AllBackdropsLegal.Location = new System.Drawing.Point(221, 40);
B_AllBackdropsLegal.Name = "B_AllBackdropsLegal";
B_AllBackdropsLegal.Size = new System.Drawing.Size(209, 29);
B_AllBackdropsLegal.TabIndex = 12;
B_AllBackdropsLegal.TabIndex = 6;
B_AllBackdropsLegal.Text = "Give All Backdrops (Legal)";
B_AllBackdropsLegal.UseVisualStyleBackColor = true;
B_AllBackdropsLegal.Click += OnBAllBackdropsLegalOnClick;
@ -1256,7 +1260,7 @@ namespace PKHeX.WinForms
B_AllAccessoriesIllegal.Location = new System.Drawing.Point(6, 73);
B_AllAccessoriesIllegal.Name = "B_AllAccessoriesIllegal";
B_AllAccessoriesIllegal.Size = new System.Drawing.Size(209, 29);
B_AllAccessoriesIllegal.TabIndex = 10;
B_AllAccessoriesIllegal.TabIndex = 3;
B_AllAccessoriesIllegal.Text = "Give All Accessories (Illegal)";
B_AllAccessoriesIllegal.UseVisualStyleBackColor = true;
B_AllAccessoriesIllegal.Click += OnBAllAccessoriesLegalOnClick;
@ -1266,7 +1270,7 @@ namespace PKHeX.WinForms
B_AllAccessoriesLegal.Location = new System.Drawing.Point(6, 40);
B_AllAccessoriesLegal.Name = "B_AllAccessoriesLegal";
B_AllAccessoriesLegal.Size = new System.Drawing.Size(209, 29);
B_AllAccessoriesLegal.TabIndex = 9;
B_AllAccessoriesLegal.TabIndex = 2;
B_AllAccessoriesLegal.Text = "Give All Accessories (Legal)";
B_AllAccessoriesLegal.UseVisualStyleBackColor = true;
B_AllAccessoriesLegal.Click += OnBAllAccessoriesLegalOnClick;
@ -1277,6 +1281,7 @@ namespace PKHeX.WinForms
DGV_Backdrops.AllowUserToDeleteRows = false;
DGV_Backdrops.AllowUserToResizeColumns = false;
DGV_Backdrops.AllowUserToResizeRows = false;
DGV_Backdrops.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
DGV_Backdrops.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_Backdrops.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_Backdrops.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@ -1288,7 +1293,8 @@ namespace PKHeX.WinForms
DGV_Backdrops.RowHeadersVisible = false;
DGV_Backdrops.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_Backdrops.Size = new System.Drawing.Size(209, 164);
DGV_Backdrops.TabIndex = 14;
DGV_Backdrops.StandardTab = true;
DGV_Backdrops.TabIndex = 8;
//
// DGV_Accessories
//
@ -1296,6 +1302,7 @@ namespace PKHeX.WinForms
DGV_Accessories.AllowUserToDeleteRows = false;
DGV_Accessories.AllowUserToResizeColumns = false;
DGV_Accessories.AllowUserToResizeRows = false;
DGV_Accessories.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
DGV_Accessories.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_Accessories.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_Accessories.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@ -1307,7 +1314,8 @@ namespace PKHeX.WinForms
DGV_Accessories.RowHeadersVisible = false;
DGV_Accessories.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_Accessories.Size = new System.Drawing.Size(209, 164);
DGV_Accessories.TabIndex = 11;
DGV_Accessories.StandardTab = true;
DGV_Accessories.TabIndex = 4;
//
// Tab_Poffins
//

View file

@ -28,118 +28,267 @@ namespace PKHeX.WinForms
/// </summary>
private void InitializeComponent()
{
this.B_Save = new System.Windows.Forms.Button();
this.B_Cancel = new System.Windows.Forms.Button();
this.B_SetAllLocations = new System.Windows.Forms.Button();
this.B_SetAllLegalLocations = new System.Windows.Forms.Button();
this.B_ClearLocations = new System.Windows.Forms.Button();
this.CHK_GlobalFlag = new System.Windows.Forms.CheckBox();
this.CHK_UnityTowerFlag = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
B_Save = new System.Windows.Forms.Button();
B_Cancel = new System.Windows.Forms.Button();
B_SetAllLocations = new System.Windows.Forms.Button();
B_SetAllLegalLocations = new System.Windows.Forms.Button();
B_ClearLocations = new System.Windows.Forms.Button();
CHK_GlobalFlag = new System.Windows.Forms.CheckBox();
CHK_UnityTowerFlag = new System.Windows.Forms.CheckBox();
splitContainer1 = new System.Windows.Forms.SplitContainer();
DGV_Geonet = new System.Windows.Forms.DataGridView();
DGV_UnityTower = new System.Windows.Forms.DataGridView();
Item_CountryIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Country = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_RegionIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Region = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_Point = new System.Windows.Forms.DataGridViewComboBoxColumn();
Item_Floor = new System.Windows.Forms.DataGridViewCheckBoxColumn();
Item_UnityTowerIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
Item_UnityTower = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
splitContainer1.Panel2.SuspendLayout();
splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DGV_Geonet).BeginInit();
((System.ComponentModel.ISupportInitialize)DGV_UnityTower).BeginInit();
SuspendLayout();
//
// B_Save
//
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Save.Location = new System.Drawing.Point(195, 137);
this.B_Save.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(88, 27);
this.B_Save.TabIndex = 26;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
B_Save.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
B_Save.Location = new System.Drawing.Point(435, 381);
B_Save.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_Save.Name = "B_Save";
B_Save.Size = new System.Drawing.Size(88, 27);
B_Save.TabIndex = 7;
B_Save.Text = "Save";
B_Save.UseVisualStyleBackColor = true;
B_Save.Click += B_Save_Click;
//
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Cancel.Location = new System.Drawing.Point(101, 137);
this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(88, 27);
this.B_Cancel.TabIndex = 25;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
B_Cancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
B_Cancel.Location = new System.Drawing.Point(341, 381);
B_Cancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_Cancel.Name = "B_Cancel";
B_Cancel.Size = new System.Drawing.Size(88, 27);
B_Cancel.TabIndex = 6;
B_Cancel.Text = "Cancel";
B_Cancel.UseVisualStyleBackColor = true;
B_Cancel.Click += B_Cancel_Click;
//
// B_SetAllLocations
//
this.B_SetAllLocations.Location = new System.Drawing.Point(13, 12);
this.B_SetAllLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_SetAllLocations.Name = "B_SetAllLocations";
this.B_SetAllLocations.Size = new System.Drawing.Size(264, 27);
this.B_SetAllLocations.TabIndex = 27;
this.B_SetAllLocations.Text = "Set All Locations";
this.B_SetAllLocations.UseVisualStyleBackColor = true;
this.B_SetAllLocations.Click += new System.EventHandler(this.B_SetAllLocations_Click);
B_SetAllLocations.Location = new System.Drawing.Point(13, 12);
B_SetAllLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_SetAllLocations.Name = "B_SetAllLocations";
B_SetAllLocations.Size = new System.Drawing.Size(160, 27);
B_SetAllLocations.TabIndex = 0;
B_SetAllLocations.Text = "Set All Locations";
B_SetAllLocations.UseVisualStyleBackColor = true;
B_SetAllLocations.Click += B_SetAllLocations_Click;
//
// B_SetAllLegalLocations
//
this.B_SetAllLegalLocations.Location = new System.Drawing.Point(13, 45);
this.B_SetAllLegalLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_SetAllLegalLocations.Name = "B_SetAllLegalLocations";
this.B_SetAllLegalLocations.Size = new System.Drawing.Size(264, 27);
this.B_SetAllLegalLocations.TabIndex = 28;
this.B_SetAllLegalLocations.Text = "Set All Legal Locations";
this.B_SetAllLegalLocations.UseVisualStyleBackColor = true;
this.B_SetAllLegalLocations.Click += new System.EventHandler(this.B_SetAllLegalLocations_Click);
B_SetAllLegalLocations.Location = new System.Drawing.Point(185, 12);
B_SetAllLegalLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_SetAllLegalLocations.Name = "B_SetAllLegalLocations";
B_SetAllLegalLocations.Size = new System.Drawing.Size(160, 27);
B_SetAllLegalLocations.TabIndex = 1;
B_SetAllLegalLocations.Text = "Set All Legal Locations";
B_SetAllLegalLocations.UseVisualStyleBackColor = true;
B_SetAllLegalLocations.Click += B_SetAllLegalLocations_Click;
//
// B_ClearLocations
//
this.B_ClearLocations.Location = new System.Drawing.Point(13, 78);
this.B_ClearLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.B_ClearLocations.Name = "B_ClearLocations";
this.B_ClearLocations.Size = new System.Drawing.Size(264, 27);
this.B_ClearLocations.TabIndex = 29;
this.B_ClearLocations.Text = "Clear Locations";
this.B_ClearLocations.UseVisualStyleBackColor = true;
this.B_ClearLocations.Click += new System.EventHandler(this.B_ClearLocations_Click);
B_ClearLocations.Location = new System.Drawing.Point(357, 12);
B_ClearLocations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
B_ClearLocations.Name = "B_ClearLocations";
B_ClearLocations.Size = new System.Drawing.Size(160, 27);
B_ClearLocations.TabIndex = 2;
B_ClearLocations.Text = "Clear Locations";
B_ClearLocations.UseVisualStyleBackColor = true;
B_ClearLocations.Click += B_ClearLocations_Click;
//
// CHK_GlobalFlag
//
this.CHK_GlobalFlag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.CHK_GlobalFlag.AutoSize = true;
this.CHK_GlobalFlag.Location = new System.Drawing.Point(13, 111);
this.CHK_GlobalFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.CHK_GlobalFlag.Name = "CHK_GlobalFlag";
this.CHK_GlobalFlag.Size = new System.Drawing.Size(131, 19);
this.CHK_GlobalFlag.TabIndex = 45;
this.CHK_GlobalFlag.Text = "Whole Globe Visible";
this.CHK_GlobalFlag.UseVisualStyleBackColor = true;
CHK_GlobalFlag.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
CHK_GlobalFlag.AutoSize = true;
CHK_GlobalFlag.Location = new System.Drawing.Point(13, 355);
CHK_GlobalFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
CHK_GlobalFlag.Name = "CHK_GlobalFlag";
CHK_GlobalFlag.Size = new System.Drawing.Size(131, 19);
CHK_GlobalFlag.TabIndex = 4;
CHK_GlobalFlag.Text = "Whole Globe Visible";
CHK_GlobalFlag.UseVisualStyleBackColor = true;
//
// CHK_UnityTowerFlag
//
this.CHK_UnityTowerFlag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.CHK_UnityTowerFlag.AutoSize = true;
this.CHK_UnityTowerFlag.Location = new System.Drawing.Point(144, 111);
this.CHK_UnityTowerFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.CHK_UnityTowerFlag.Name = "CHK_UnityTowerFlag";
this.CHK_UnityTowerFlag.Size = new System.Drawing.Size(141, 19);
this.CHK_UnityTowerFlag.TabIndex = 46;
this.CHK_UnityTowerFlag.Text = "Unity Tower Unlocked";
this.CHK_UnityTowerFlag.UseVisualStyleBackColor = true;
CHK_UnityTowerFlag.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
CHK_UnityTowerFlag.AutoSize = true;
CHK_UnityTowerFlag.Location = new System.Drawing.Point(144, 355);
CHK_UnityTowerFlag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
CHK_UnityTowerFlag.Name = "CHK_UnityTowerFlag";
CHK_UnityTowerFlag.Size = new System.Drawing.Size(141, 19);
CHK_UnityTowerFlag.TabIndex = 5;
CHK_UnityTowerFlag.Text = "Unity Tower Unlocked";
CHK_UnityTowerFlag.UseVisualStyleBackColor = true;
//
// splitContainer1
//
splitContainer1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
splitContainer1.Location = new System.Drawing.Point(13, 45);
splitContainer1.Margin = new System.Windows.Forms.Padding(0);
splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
splitContainer1.Panel1.Controls.Add(DGV_Geonet);
//
// splitContainer1.Panel2
//
splitContainer1.Panel2.Controls.Add(DGV_UnityTower);
splitContainer1.Size = new System.Drawing.Size(505, 304);
splitContainer1.SplitterDistance = 336;
splitContainer1.TabIndex = 3;
//
// DGV_Geonet
//
DGV_Geonet.AllowUserToAddRows = false;
DGV_Geonet.AllowUserToDeleteRows = false;
DGV_Geonet.AllowUserToResizeColumns = false;
DGV_Geonet.AllowUserToResizeRows = false;
DGV_Geonet.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_Geonet.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_Geonet.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DGV_Geonet.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { Item_CountryIndex, Item_Country, Item_RegionIndex, Item_Region, Item_Point });
DGV_Geonet.Dock = System.Windows.Forms.DockStyle.Fill;
DGV_Geonet.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
DGV_Geonet.Location = new System.Drawing.Point(0, 0);
DGV_Geonet.MultiSelect = false;
DGV_Geonet.Name = "DGV_Geonet";
DGV_Geonet.RowHeadersVisible = false;
DGV_Geonet.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_Geonet.Size = new System.Drawing.Size(336, 304);
DGV_Geonet.StandardTab = true;
DGV_Geonet.TabIndex = 0;
//
// DGV_UnityTower
//
DGV_UnityTower.AllowUserToAddRows = false;
DGV_UnityTower.AllowUserToDeleteRows = false;
DGV_UnityTower.AllowUserToResizeColumns = false;
DGV_UnityTower.AllowUserToResizeRows = false;
DGV_UnityTower.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
DGV_UnityTower.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
DGV_UnityTower.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DGV_UnityTower.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { Item_Floor, Item_UnityTowerIndex, Item_UnityTower });
DGV_UnityTower.Dock = System.Windows.Forms.DockStyle.Fill;
DGV_UnityTower.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
DGV_UnityTower.Location = new System.Drawing.Point(0, 0);
DGV_UnityTower.MultiSelect = false;
DGV_UnityTower.Name = "DGV_UnityTower";
DGV_UnityTower.RowHeadersVisible = false;
DGV_UnityTower.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
DGV_UnityTower.Size = new System.Drawing.Size(165, 304);
DGV_UnityTower.StandardTab = true;
DGV_UnityTower.TabIndex = 0;
//
// Item_CountryIndex
//
Item_CountryIndex.HeaderText = "CountryIndex";
Item_CountryIndex.Name = "Item_CountryIndex";
Item_CountryIndex.ReadOnly = true;
Item_CountryIndex.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
Item_CountryIndex.Visible = false;
//
// Item_Country
//
Item_Country.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
Item_Country.FillWeight = 150F;
Item_Country.HeaderText = "Country";
Item_Country.MinimumWidth = 50;
Item_Country.Name = "Item_Country";
Item_Country.ReadOnly = true;
Item_Country.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Item_RegionIndex
//
Item_RegionIndex.HeaderText = "RegionIndex";
Item_RegionIndex.Name = "Item_RegionIndex";
Item_RegionIndex.ReadOnly = true;
Item_RegionIndex.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
Item_RegionIndex.Visible = false;
//
// Item_Region
//
Item_Region.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
Item_Region.FillWeight = 150F;
Item_Region.HeaderText = "Region";
Item_Region.MinimumWidth = 50;
Item_Region.Name = "Item_Region";
Item_Region.ReadOnly = true;
Item_Region.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Item_Point
//
Item_Point.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
Item_Point.FillWeight = 50F;
Item_Point.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
Item_Point.HeaderText = "Point";
Item_Point.MinimumWidth = 50;
Item_Point.Name = "Item_Point";
Item_Point.Width = 50;
//
// Item_Floor
//
Item_Floor.HeaderText = "Floor";
Item_Floor.Name = "Item_Floor";
Item_Floor.Width = 50;
//
// Item_UnityTowerIndex
//
Item_UnityTowerIndex.HeaderText = "CountryIndex";
Item_UnityTowerIndex.Name = "Item_UnityTowerIndex";
Item_UnityTowerIndex.ReadOnly = true;
Item_UnityTowerIndex.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
Item_UnityTowerIndex.Visible = false;
//
// Item_UnityTower
//
Item_UnityTower.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
Item_UnityTower.HeaderText = "Country";
Item_UnityTower.Name = "Item_UnityTower";
Item_UnityTower.ReadOnly = true;
Item_UnityTower.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// SAV_UnityTower
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(290, 173);
this.Controls.Add(this.CHK_UnityTowerFlag);
this.Controls.Add(this.CHK_GlobalFlag);
this.Controls.Add(this.B_ClearLocations);
this.Controls.Add(this.B_SetAllLegalLocations);
this.Controls.Add(this.B_SetAllLocations);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimumSize = new System.Drawing.Size(306, 212);
this.Name = "SAV_UnityTower";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Unity Tower Editor";
this.Load += new System.EventHandler(this.SAV_UnityTower_Load);
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
ClientSize = new System.Drawing.Size(530, 417);
Controls.Add(CHK_UnityTowerFlag);
Controls.Add(CHK_GlobalFlag);
Controls.Add(B_ClearLocations);
Controls.Add(B_SetAllLegalLocations);
Controls.Add(B_SetAllLocations);
Controls.Add(B_Cancel);
Controls.Add(B_Save);
Controls.Add(splitContainer1);
Icon = Properties.Resources.Icon;
Margin = new System.Windows.Forms.Padding(2);
MaximizeBox = false;
Name = "SAV_UnityTower";
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
Text = "Unity Tower Editor";
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DGV_Geonet).EndInit();
((System.ComponentModel.ISupportInitialize)DGV_UnityTower).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -150,5 +299,16 @@ namespace PKHeX.WinForms
private System.Windows.Forms.Button B_ClearLocations;
private System.Windows.Forms.CheckBox CHK_GlobalFlag;
private System.Windows.Forms.CheckBox CHK_UnityTowerFlag;
private System.Windows.Forms.DataGridView DGV_Geonet;
private System.Windows.Forms.DataGridViewComboBoxColumn Item_Point;
private System.Windows.Forms.DataGridView DGV_UnityTower;
private System.Windows.Forms.DataGridViewCheckBoxColumn Item_Floor;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_CountryIndex;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_RegionIndex;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_UnityTowerIndex;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_Country;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_Region;
private System.Windows.Forms.DataGridViewTextBoxColumn Item_UnityTower;
}
}

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using PKHeX.Core;
@ -10,6 +11,10 @@ public partial class SAV_UnityTower : Form
private readonly SAV5 SAV;
private readonly UnityTower5 UnityTower;
private readonly List<ComboItem> countryList;
private readonly List<ComboItem> subregionListDefault;
private readonly List<ComboItem> pointList;
public SAV_UnityTower(SAV5 sav)
{
InitializeComponent();
@ -17,10 +22,93 @@ public partial class SAV_UnityTower : Form
SAV = (SAV5)(Origin = sav).Clone();
UnityTower = SAV.UnityTower;
countryList = Util.GetCountryRegionList("gen5_countries", Main.CurrentLanguage);
subregionListDefault = Util.GetCountryRegionList("gen5_sr_default", Main.CurrentLanguage);
pointList = Util.GetGeonetPointList();
InitializeDGVGeonet();
InitializeDGVUnityTower();
CHK_GlobalFlag.Checked = UnityTower.GlobalFlag;
CHK_UnityTowerFlag.Checked = UnityTower.UnityTowerFlag;
}
private void InitializeDGVGeonet()
{
DGV_Geonet.Rows.Clear();
Item_Point.InitializeBinding();
Item_Point.DataSource = pointList;
for (int i = 1; i <= UnityTower5.CountryCount; i++)
{
var country = countryList[i].Value;
var countryName = countryList[i].Text;
var subregionCount = UnityTower5.GetSubregionCount((byte)country);
var subregionList = (subregionCount == 0) ? subregionListDefault : Util.GetCountryRegionList($"gen5_sr_{country:000}", Main.CurrentLanguage);
if (subregionCount == 0)
{
var subregion = subregionList[0].Value;
var subregionName = subregionList[0].Text;
AddCountrySubregionRowDGV(country, subregion, countryName, subregionName);
}
for (int j = 1; j <= subregionCount; j++)
{
var subregion = subregionList[j].Value;
var subregionName = subregionList[j].Text;
AddCountrySubregionRowDGV(country, subregion, countryName, subregionName);
}
}
}
private void AddCountrySubregionRowDGV(int country, int subregion, string countryName, string subregionName)
{
var point = UnityTower.GetCountrySubregion((byte)country, (byte)subregion);
var row = DGV_Geonet.Rows[DGV_Geonet.Rows.Add()];
row.Cells[0].Value = country;
row.Cells[1].Value = countryName;
row.Cells[2].Value = subregion;
row.Cells[3].Value = subregionName;
row.Cells[4].Value = (int)point;
}
private void InitializeDGVUnityTower()
{
DGV_UnityTower.Rows.Clear();
DGV_UnityTower.Rows.Add(UnityTower5.CountryCount);
for (int i = 0; i < UnityTower5.CountryCount; i++)
{
var row = DGV_UnityTower.Rows[i];
var country = countryList[i + 1].Value;
var countryName = countryList[i + 1].Text;
((DataGridViewCheckBoxCell)row.Cells[0]).Value = UnityTower.GetUnityTowerFloor((byte)country);
row.Cells[1].Value = country;
row.Cells[2].Value = countryName;
}
}
private void B_Save_Click(object sender, EventArgs e)
{
UnityTower.ClearAll();
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
{
var row = DGV_Geonet.Rows[i];
var country = (int)row.Cells[0].Value;
var subregion = (int)row.Cells[2].Value;
var point = (GeonetPoint)row.Cells[4].Value;
if (country > 0)
UnityTower.SetCountrySubregion((byte)country, (byte)subregion, point);
}
for (int i = 0; i < DGV_UnityTower.Rows.Count; i++)
{
var row = DGV_UnityTower.Rows[i];
var unlocked = (bool)row.Cells[0].Value;
var country = (int)row.Cells[1].Value;
UnityTower.SetUnityTowerFloor((byte)country, unlocked);
}
UnityTower.SetSAVCountry();
UnityTower.GlobalFlag = CHK_GlobalFlag.Checked;
UnityTower.UnityTowerFlag = CHK_UnityTowerFlag.Checked;
Origin.CopyChangesFrom(SAV);
@ -29,15 +117,11 @@ public partial class SAV_UnityTower : Form
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void SAV_UnityTower_Load(object sender, EventArgs e)
{
CHK_GlobalFlag.Checked = UnityTower.GlobalFlag;
CHK_UnityTowerFlag.Checked = UnityTower.UnityTowerFlag;
}
private void B_SetAllLocations_Click(object sender, EventArgs e)
{
UnityTower.SetAll();
InitializeDGVGeonet();
InitializeDGVUnityTower();
CHK_GlobalFlag.Checked = UnityTower.GlobalFlag;
CHK_UnityTowerFlag.Checked = UnityTower.UnityTowerFlag;
}
@ -45,6 +129,8 @@ public partial class SAV_UnityTower : Form
private void B_SetAllLegalLocations_Click(object sender, EventArgs e)
{
UnityTower.SetAllLegal();
InitializeDGVGeonet();
InitializeDGVUnityTower();
CHK_GlobalFlag.Checked = UnityTower.GlobalFlag;
CHK_UnityTowerFlag.Checked = UnityTower.UnityTowerFlag;
}
@ -52,6 +138,8 @@ public partial class SAV_UnityTower : Form
private void B_ClearLocations_Click(object sender, EventArgs e)
{
UnityTower.ClearAll();
InitializeDGVGeonet();
InitializeDGVUnityTower();
CHK_GlobalFlag.Checked = UnityTower.GlobalFlag;
CHK_UnityTowerFlag.Checked = UnityTower.UnityTowerFlag;
}

View file

@ -186,6 +186,13 @@ public static class WinFormsUtil
control.ValueMember = nameof(ComboItem.Value);
}
/// <inheritdoc cref="InitializeBinding(ListControl)"/>
public static void InitializeBinding(this DataGridViewComboBoxColumn control)
{
control.DisplayMember = nameof(ComboItem.Text);
control.ValueMember = nameof(ComboItem.Value);
}
public static void SetValueClamped(this NumericUpDown nud, int value) => nud.Value = Math.Min(nud.Maximum, Math.Max(nud.Minimum, value));
public static void SetValueClamped(this NumericUpDown nud, uint value) => nud.Value = Math.Min(nud.Maximum, Math.Max(nud.Minimum, value));