mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-03 03:57:04 -05:00
* Update to .NET 10 * Property fields * API signature updates * Extension method blocks * Completed dark mode support Outside of my control: - vertical tab control (pkm editor) - datetimepicker controls - lgpe event flags (no idea) - some control types having white-borders when they should really be gray Box background is 50% transparency to effectively darken the image. * Custom legality report popup * Event diff dialog, version select dialog * Add quick overwrite popup for export sav * Extension methods * Dark Mode: glow currently editing sprite * Add invalid encounter hint for trade evolutions * Extension properties * Append legality hint on hover card * Slot image loading: clear the screen-reader description if a slot is empty/invalid, rather than retain the previous description. Changing boxes would easily confuse users on this.
295 lines
10 KiB
C#
295 lines
10 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
|
|
namespace PKHeX.WinForms;
|
|
|
|
public partial class SAV_ZygardeCell : Form
|
|
{
|
|
private readonly SaveFile Origin;
|
|
private readonly SAV7 SAV;
|
|
|
|
public SAV_ZygardeCell(SAV7 sav)
|
|
{
|
|
InitializeComponent();
|
|
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
|
SAV = (SAV7)(Origin = sav).Clone();
|
|
var ew = sav.EventWork;
|
|
NUD_CellsTotal.Value = ew.ZygardeCellTotal;
|
|
NUD_CellsCollected.Value = ew.ZygardeCellCount;
|
|
|
|
var combo = (DataGridViewComboBoxColumn)dgv.Columns[2];
|
|
combo.Items.AddRange(states); // add only the Names
|
|
dgv.Columns[0].ValueType = typeof(int);
|
|
|
|
// Populate Grid
|
|
dgv.Rows.Add(ew.TotalZygardeCellCount);
|
|
var locations = SAV is SAV7SM ? locationsSM : locationsUSUM;
|
|
for (int i = 0; i < dgv.RowCount; i++)
|
|
{
|
|
var cell = ew.GetZygardeCell(i);
|
|
if (cell > 2)
|
|
throw new IndexOutOfRangeException("Unable to find cell index.");
|
|
|
|
var c = dgv.Rows[i].Cells;
|
|
c[0].Value = (i + 1);
|
|
c[1].Value = locations[i];
|
|
c[2].Value = states[cell];
|
|
}
|
|
}
|
|
|
|
private static readonly string[] states = ["None", "Available", "Received"];
|
|
|
|
private void B_Save_Click(object sender, EventArgs e)
|
|
{
|
|
var ew = SAV.EventWork;
|
|
for (int i = 0; i < dgv.RowCount; i++)
|
|
{
|
|
string str = (string)dgv.Rows[i].Cells[2].Value!;
|
|
int val = states.IndexOf(str);
|
|
if (val < 0)
|
|
throw new IndexOutOfRangeException("Unable to find cell index.");
|
|
|
|
ew.SetZygardeCell(i, (ushort)val);
|
|
}
|
|
|
|
ew.ZygardeCellTotal = (ushort)NUD_CellsTotal.Value;
|
|
ew.ZygardeCellCount = (ushort)NUD_CellsCollected.Value;
|
|
if (SAV is SAV7USUM)
|
|
SAV.SetRecord(72, (int)NUD_CellsCollected.Value);
|
|
|
|
Origin.CopyChangesFrom(SAV);
|
|
Close();
|
|
}
|
|
|
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void B_GiveAll_Click(object sender, EventArgs e)
|
|
{
|
|
int added = 0;
|
|
for (int i = 0; i < dgv.RowCount; i++)
|
|
{
|
|
var state = dgv.Rows[i].Cells[2];
|
|
if (states.IndexOf((string)state.Value!) != 2) // Not Collected
|
|
added++;
|
|
state.Value = states[2];
|
|
}
|
|
|
|
NUD_CellsCollected.Value += added;
|
|
if (SAV is not SAV7USUM)
|
|
NUD_CellsTotal.Value += added;
|
|
|
|
System.Media.SystemSounds.Asterisk.Play();
|
|
}
|
|
|
|
#region locations -- lazy
|
|
|
|
private static readonly string[] locationsSM =
|
|
[
|
|
"Verdant Cave - Trial Site",
|
|
"Ruins of Conflict - Outside",
|
|
"Route 1 (Day)",
|
|
"Route 3",
|
|
"Route 3 (Day)",
|
|
"Kala'e Bay",
|
|
"Hau'oli Cemetery",
|
|
"Route 2",
|
|
"Route 1 - Trainer School (Night)",
|
|
"Hau'oli City - Shopping District",
|
|
"Route 1 - Outskirts",
|
|
"Hau'oli City - Shopping District (Night)",
|
|
"Route 1",
|
|
"Iki Town (Night)",
|
|
"Route 4",
|
|
"Paniola Ranch (Night)",
|
|
"Paniola Ranch (Day)",
|
|
"Wela Volcano Park - Top",
|
|
"Lush Jungle - Cave",
|
|
"Route 7",
|
|
"Akala Outskirts",
|
|
"Royal Avenue (Day)",
|
|
"Royal Avenue (Night)",
|
|
"Konikoni City (Night)",
|
|
"Heahea City (Night)",
|
|
"Route 8",
|
|
"Route 8 (Day)",
|
|
"Route 5",
|
|
"Hano Beach (Day)",
|
|
"Heahea City",
|
|
"Diglett's Tunnel",
|
|
"Hano Beach",
|
|
"Malie Garden",
|
|
"Malie City - Community Center (Night)",
|
|
"Malie City (Day)",
|
|
"Malie City - Outer Cape (Day)",
|
|
"Route 11 (Night)",
|
|
"Route 12 (Day)",
|
|
"Route 12",
|
|
"Secluded Shore (Night)",
|
|
"Blush Mountain",
|
|
"Route 13",
|
|
"Haina Desert",
|
|
"Ruins of Abundance - Outside",
|
|
"Route 14",
|
|
"Route 14 (Night)",
|
|
"Tapu Village",
|
|
"Route 15",
|
|
"Aether House (Day)",
|
|
"Ula'ula Meadow - Boardwalk",
|
|
"Route 16 (Day)",
|
|
"Ula'ula Meadow - Grass",
|
|
"Route 17 - Building",
|
|
"Route 17 - Ledge",
|
|
"Po Town (Night)",
|
|
"Route 10 (Day)",
|
|
"Hokulani Observatory (Night)",
|
|
"Mount Lanakila - Mountainside",
|
|
"Mount Lanakila - High Mountainside",
|
|
"Secluded Shore (Day)",
|
|
"Route 13 (Night)",
|
|
"Po Town (Day)",
|
|
"Seafolk Village - Blue Food Boat",
|
|
"Seafolk Village - Unbuilt House",
|
|
"Poni Wilds (Day)",
|
|
"Poni Wilds (Night)",
|
|
"Poni Wilds",
|
|
"Ancient Poni Path - Near Well (Day)",
|
|
"Ancient Poni Path (Night)",
|
|
"Poni Breaker Coast (Day)",
|
|
"Ruins of Hope",
|
|
"Poni Grove - Mountain Corner",
|
|
"Poni Grove - Near a Bush",
|
|
"Poni Plains (Day)",
|
|
"Poni Plains (Night)",
|
|
"Poni Plains",
|
|
"Poni Meadow",
|
|
"Poni Coast (Night)",
|
|
"Poni Coast",
|
|
"Poni Gauntlet - On Bridge",
|
|
"Poni Gauntlet - Island w/ Trainer",
|
|
"Resolution Cave - 1F (Day)",
|
|
"Resolution Cave - B1F (Night)",
|
|
"Vast Poni Canyon - 3F",
|
|
"Vast Poni Canyon - 2F",
|
|
"Vast Poni Canyon - Top",
|
|
"Vast Poni Canyon - Inside",
|
|
"Ancient Poni Path - Brickwall (Day)",
|
|
"Poni Breaker Coast (Night)",
|
|
"Resolution Cave - B1F",
|
|
"Aether Foundation B2F - Right Hallway",
|
|
"Aether Foundation 1F - Outside - Right Side",
|
|
"Aether Foundation 1F - Outside (Day)",
|
|
"Aether Foundation 1F - Entrance (Night)",
|
|
"Aether Foundation 1F - Main Building",
|
|
];
|
|
|
|
private static readonly string[] locationsUSUM =
|
|
[
|
|
"Hau'oli City (Shopping) - Salon (Outside)",
|
|
"Hau'oli City (Shopping) - Malasada Shop (Outside)",
|
|
"Hau'oli City (Shopping) - Ilima's House (2F)",
|
|
"Malie City - Library (1F)",
|
|
"Hau'oli City (Marina) - Pier",
|
|
"Route 2 - Southeast House",
|
|
"Hau'oli City (Shopping) - Ilima's House (Outside)",
|
|
"Hau'oli City (Shopping) - City Hall",
|
|
"Heahea City - Hotel (3F)",
|
|
"Route 2 - Berry Fields House",
|
|
"Route 2 - Berry Fields House (Outside)",
|
|
"Royal Avenue - Northeast",
|
|
"Hau'oli City (Shopping) - Pokemon Center (Outside)",
|
|
"Royal Avenue - South",
|
|
"Hokulani Observatory - Room",
|
|
"Hokulani Observatory - Reception",
|
|
"Hau'oli City (Shopping) - City Hall (Outside)",
|
|
"Konikoni City - Olivia's Jewelry Shop (2F)",
|
|
"Heahea City - Surfboard (Outside)",
|
|
"Po Town - Southwest",
|
|
"Hano Resort Lobby - Southwest Water",
|
|
"Hau'oli City (Shopping) - Northwest of Police Station",
|
|
"Hau'oli City (Marina) - Ferry Terminal (Outside)",
|
|
"Route 2 - Southeast House (Outside)",
|
|
"Route 2 - Pokemon Center (Outside)",
|
|
"Heahea City - West",
|
|
"Heahea City - Hotel West (Outside)",
|
|
"Heahea City - Hotel East (Outside)",
|
|
"Heahea City - Research Lab East (Outside)",
|
|
"Heahea City - Research Lab South (Outside)",
|
|
"Heahea City - Game Freak",
|
|
"Hokulani Observatory - Dead End",
|
|
"Heahea City - Game Freak Building (3F)",
|
|
"Heahea City - Research Lab",
|
|
"Heahea City - Hotel (1F)",
|
|
"Battle Royal Dome - 2F",
|
|
"Paniola Town - West",
|
|
"Paniola Town - Kiawe's House (1F)",
|
|
"Paniola Town - Kiawe's House (2F)",
|
|
"Paniola Ranch - Northwest",
|
|
"Paniola Ranch - Southeast",
|
|
"Hano Beach",
|
|
"Hano Resort - South",
|
|
"Hano Resort - North",
|
|
"Konikoni City Lighthouse (Through Diglett's Tunnel)",
|
|
"Battle Royal Dome - 1F",
|
|
"Route 8 - Aether Base (Outside)",
|
|
"Route 8 - Fossil Restoration Center (Outside)",
|
|
"Konikoni City - West",
|
|
"Konikoni City - Restaurant (1F)",
|
|
"Iki Town - Southwest",
|
|
"Hau'oli City (Shopping) - Ilima's House Pool",
|
|
"Wela Volcano Park - Rocks Behind Sign",
|
|
"Route 5 - South of Pokemon Center",
|
|
"Hano Beach - Below Sandygast",
|
|
"Malie City (Outer Cape) - Recycling Plant (Outside)",
|
|
"Malie City - Ferry Terminal (Outside)",
|
|
"Malie City - Apparel Shop (Outside)",
|
|
"Malie City - Salon (Outside)",
|
|
"Route 16 - Aether Base (Outside)",
|
|
"Blush Mountain - Power Plant (Outside)",
|
|
"Malie City - Library (2F)",
|
|
"Malie Garden - Northeast",
|
|
"Malie City - CommunityCenter",
|
|
"Hokulani Observatory - Outside",
|
|
"Mount Hokulani",
|
|
"Blush Mountain - Power Plant",
|
|
"Route 13",
|
|
"Route 14 - Front of Abandoned Megamart",
|
|
"Route 14 - North",
|
|
"Route 15 - Islet Surfboard (Outside)",
|
|
"Route 17 - Police Station (Outside)",
|
|
"Route 17 - Police Station",
|
|
"Po Town - Pokemon Center (Outside)",
|
|
"Exeggutor Island - Under Rock",
|
|
"Po Town - Shady House East (Outside)",
|
|
"Po Town - Pokemon Center",
|
|
"Po Town - Shady House (1F)",
|
|
"Route 13 - Motel (Outside)",
|
|
"Po Town - Shady House 2F (Outside)",
|
|
"Route 17 - South of Po Town",
|
|
"Ula'ula Meadow",
|
|
"Po Town - Shady House West Rocks (Outside) 1",
|
|
"Po Town - Shady House West Rocks (Outside) 2",
|
|
"Po Town - Shady House West Rocks (Outside) 3",
|
|
"Seafolk Village - Southeast Whiscash (Mina's Ship) (Outside)",
|
|
"Seafolk Village - Southwest Huntail",
|
|
"Seafolk Village - Southwest Huntail (Outside)",
|
|
"Seafolk Village - Southeast Whiscash (Mina's Ship)",
|
|
"Seafolk Village - West Wailord (Restaurant)",
|
|
"Seafolk Village - East Steelix",
|
|
"Poni Wilds - Southeast",
|
|
"Ancient Poni Path - Hapu's House (Kitchen)",
|
|
"Seafolk Village - Northeast",
|
|
"Ancient Poni Path - Hapu's House (Bedroom)",
|
|
"Ancient Poni Path - Southwest",
|
|
"Ancient Poni Path - Hapu's House (Courtyard)",
|
|
"Ancient Poni Path - Hapu's House (Outside Behind Well)",
|
|
"Ancient Poni Path - Northeast",
|
|
"Battle Tree - Entrance",
|
|
];
|
|
|
|
#endregion
|
|
}
|