Allow box name editing on gen2

This commit is contained in:
Kurt 2017-12-27 15:52:29 -08:00
parent 1e388fb85a
commit 61b65198f2
4 changed files with 15 additions and 7 deletions

View file

@ -235,6 +235,7 @@ namespace PKHeX.Core
public override int BoxSlotCount => Japanese ? 30 : 20;
public override bool HasParty => true;
public override bool HasNamableBoxes => true;
// Checksums
private ushort GetChecksum()
@ -338,7 +339,8 @@ namespace PKHeX.Core
}
public int TextSpeed
{
get => Options & 0x7; set
get => Options & 0x7;
set
{
var new_speed = value;
if (new_speed > 7)
@ -398,7 +400,7 @@ namespace PKHeX.Core
p.Items[i] = p.Items[ofs++];
}
while (ofs < p.Items.Length)
p.Items[ofs++] = new InventoryItem { Count = 0, Index = 0 };
p.Items[ofs++] = new InventoryItem();
p.SetPouchG1(ref Data);
}
}
@ -449,7 +451,9 @@ namespace PKHeX.Core
}
public override void SetBoxName(int box, string value)
{
// Don't allow for custom box names
int len = Korean ? 17 : 9;
var data = SetString(value, len, len, 0x50);
SetData(data, Offsets.BoxNames + box * len);
}
public override PKM GetPKM(byte[] data)

View file

@ -110,6 +110,7 @@ namespace PKHeX.Core
public bool HasDaycare => Daycare > -1;
public virtual bool HasPokeDex => PokeDex > -1;
public virtual bool HasBoxWallpapers => GetBoxWallpaperOffset(0) > -1;
public virtual bool HasNamableBoxes => HasBoxWallpapers;
public virtual bool HasSUBE => SUBE > -1 && !ORAS;
public virtual bool HasGeolocation => false;
public bool HasPokeBlock => ORAS && !ORASDEMO;

View file

@ -989,7 +989,7 @@ namespace PKHeX.WinForms.Controls
B_OpenPokeBeans.Enabled = sav.Generation == 7;
B_CellsStickers.Enabled = sav.Generation == 7;
B_OUTPasserby.Enabled = sav.HasPSS;
B_OpenBoxLayout.Enabled = sav.HasBoxWallpapers;
B_OpenBoxLayout.Enabled = sav.HasNamableBoxes;
B_OpenWondercards.Enabled = sav.HasWondercards;
B_OpenSuperTraining.Enabled = sav.HasSuperTrain;
B_OpenHallofFame.Enabled = sav.HasHoF;

View file

@ -15,15 +15,18 @@ namespace PKHeX.WinForms
InitializeComponent();
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
editing = true;
// Repopulate Wallpaper names
if (!LoadWallpaperNames())
if (!SAV.HasBoxWallpapers)
CB_BG.Visible = PAN_BG.Visible = false;
else if (!LoadWallpaperNames()) // Repopulate Wallpaper names
WinFormsUtil.Error("Box layout is not supported for this game.", "Please close the window.");
LoadBoxNames();
LoadFlags();
LoadUnlockedCount();
LB_BoxSelect.SelectedIndex = box;
editing = false;
}
private bool LoadWallpaperNames()