2014-06-28 21:22:05 +00:00
|
|
|
|
using System;
|
2015-03-11 01:44:51 +00:00
|
|
|
|
using System.Windows.Forms;
|
2017-01-08 07:54:09 +00:00
|
|
|
|
using PKHeX.Core;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.WinForms
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class MemoryAmie : Form
|
|
|
|
|
{
|
2018-07-14 23:32:06 +00:00
|
|
|
|
private readonly TextMarkup TextArgs;
|
2019-11-25 06:34:51 +00:00
|
|
|
|
private readonly MemoryStrings MemStrings;
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
public MemoryAmie(PKM pk)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2018-04-03 03:36:13 +00:00
|
|
|
|
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
|
|
|
|
pkm = pk;
|
2019-11-25 06:34:51 +00:00
|
|
|
|
MemStrings = new MemoryStrings(GameInfo.Strings, pkm.Format);
|
2019-02-07 07:28:02 +00:00
|
|
|
|
PrevCountries = new[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4 };
|
|
|
|
|
PrevRegions = new[] { CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, };
|
2015-09-24 05:44:15 +00:00
|
|
|
|
string[] arguments = L_Arguments.Text.Split(new[] {" ; "}, StringSplitOptions.None);
|
2014-06-28 22:24:45 +00:00
|
|
|
|
|
2018-07-14 23:32:06 +00:00
|
|
|
|
TextArgs = new TextMarkup(arguments);
|
2019-02-07 07:28:02 +00:00
|
|
|
|
foreach (ComboBox comboBox in PrevCountries)
|
2015-12-15 05:39:56 +00:00
|
|
|
|
{
|
2018-07-14 23:00:28 +00:00
|
|
|
|
comboBox.InitializeBinding();
|
2017-06-18 01:37:19 +00:00
|
|
|
|
Main.SetCountrySubRegion(comboBox, "countries");
|
2015-12-15 05:39:56 +00:00
|
|
|
|
}
|
2019-02-07 07:28:02 +00:00
|
|
|
|
foreach (var region in PrevRegions)
|
|
|
|
|
region.InitializeBinding();
|
2017-06-18 01:37:19 +00:00
|
|
|
|
GetLangStrings();
|
|
|
|
|
LoadFields();
|
2019-11-28 22:02:05 +00:00
|
|
|
|
|
|
|
|
|
if (!(pkm is IGeoTrack))
|
|
|
|
|
tabControl1.TabPages.Remove(Tab_Residence);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-20 04:22:43 +00:00
|
|
|
|
private bool init;
|
2019-02-07 07:28:02 +00:00
|
|
|
|
private readonly ComboBox[] PrevCountries;
|
|
|
|
|
private readonly ComboBox[] PrevRegions;
|
2017-05-23 04:55:05 +00:00
|
|
|
|
private readonly PKM pkm;
|
2016-03-27 02:40:02 +00:00
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
// Load/Save Actions
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void LoadFields()
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2014-12-13 07:13:58 +00:00
|
|
|
|
// Load the region/country values.
|
2018-07-14 17:34:34 +00:00
|
|
|
|
if (pkm is IGeoTrack g)
|
|
|
|
|
{
|
|
|
|
|
CB_Country0.SelectedValue = g.Geo1_Country;
|
|
|
|
|
CB_Country1.SelectedValue = g.Geo2_Country;
|
|
|
|
|
CB_Country2.SelectedValue = g.Geo3_Country;
|
|
|
|
|
CB_Country3.SelectedValue = g.Geo4_Country;
|
|
|
|
|
CB_Country4.SelectedValue = g.Geo5_Country;
|
|
|
|
|
CB_Region0.SelectedValue = g.Geo1_Region;
|
|
|
|
|
CB_Region1.SelectedValue = g.Geo2_Region;
|
|
|
|
|
CB_Region2.SelectedValue = g.Geo3_Region;
|
|
|
|
|
CB_Region3.SelectedValue = g.Geo4_Region;
|
|
|
|
|
CB_Region4.SelectedValue = g.Geo5_Region;
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2014-12-13 07:13:58 +00:00
|
|
|
|
// Load the Fullness, and Enjoyment
|
2016-10-20 01:19:01 +00:00
|
|
|
|
M_Fullness.Text = pkm.Fullness.ToString();
|
|
|
|
|
M_Enjoyment.Text = pkm.Enjoyment.ToString();
|
2014-10-10 02:59:57 +00:00
|
|
|
|
|
2020-08-01 00:25:14 +00:00
|
|
|
|
M_OT_Friendship.Text = pkm.OT_Friendship.ToString();
|
2016-10-20 01:19:01 +00:00
|
|
|
|
M_CT_Friendship.Text = pkm.HT_Friendship.ToString();
|
2020-08-02 18:06:30 +00:00
|
|
|
|
|
|
|
|
|
if (pkm is IAffection a)
|
|
|
|
|
{
|
|
|
|
|
M_OT_Affection.Text = a.OT_Affection.ToString();
|
|
|
|
|
M_CT_Affection.Text = a.HT_Affection.ToString();
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2020-08-01 00:25:14 +00:00
|
|
|
|
if (pkm is ITrainerMemories m)
|
|
|
|
|
{
|
|
|
|
|
// Load the OT Memories
|
|
|
|
|
CB_OTQual.SelectedIndex = Math.Max(0, m.OT_Intensity - 1);
|
|
|
|
|
CB_OTMemory.SelectedValue = m.OT_Memory;
|
|
|
|
|
CB_OTVar.SelectedValue = m.OT_TextVar;
|
|
|
|
|
CB_OTFeel.SelectedIndex = m.OT_Feeling;
|
|
|
|
|
|
|
|
|
|
// Load the HT Memories
|
|
|
|
|
CB_CTQual.SelectedIndex = Math.Max(0, m.HT_Intensity - 1);
|
|
|
|
|
CB_CTMemory.SelectedValue = m.HT_Memory;
|
|
|
|
|
CB_CTVar.SelectedValue = m.HT_TextVar;
|
|
|
|
|
CB_CTFeel.SelectedIndex = m.HT_Feeling;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
CB_Handler.Items.Clear();
|
2018-07-14 23:32:06 +00:00
|
|
|
|
CB_Handler.Items.Add($"{pkm.OT_Name} ({TextArgs.OT})"); // OTNAME : OT
|
2014-12-20 19:27:29 +00:00
|
|
|
|
|
2018-05-28 15:26:52 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(pkm.HT_Name))
|
|
|
|
|
CB_Handler.Items.Add(pkm.HT_Name);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
else
|
2016-10-20 01:19:01 +00:00
|
|
|
|
pkm.CurrentHandler = 0;
|
2014-12-20 19:27:29 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
tabControl1.SelectedIndex = CB_Handler.SelectedIndex = pkm.CurrentHandler;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2018-05-12 15:13:39 +00:00
|
|
|
|
GB_M_OT.Enabled = GB_M_CT.Enabled = GB_Residence.Enabled =
|
|
|
|
|
BTN_Save.Enabled = M_Fullness.Enabled = M_Enjoyment.Enabled =
|
2016-10-20 01:19:01 +00:00
|
|
|
|
L_Fullness.Enabled = L_Enjoyment.Enabled = !pkm.IsEgg;
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2016-10-20 01:19:01 +00:00
|
|
|
|
if (!pkm.IsEgg)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2015-03-11 01:44:51 +00:00
|
|
|
|
bool enable;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
if (pkm.GenNumber < 6)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2016-01-29 02:51:27 +00:00
|
|
|
|
// Previous Generation Mon
|
2018-07-14 23:32:06 +00:00
|
|
|
|
GB_M_OT.Text = $"{TextArgs.PastGen} {pkm.OT_Name}: {TextArgs.OT}"; // Past Gen OT : OTNAME
|
|
|
|
|
GB_M_CT.Text = $"{TextArgs.MemoriesWith} {pkm.HT_Name}"; // Memories with : HTNAME
|
2014-10-10 02:59:57 +00:00
|
|
|
|
enable = false;
|
2018-03-28 23:07:03 +00:00
|
|
|
|
// Reset to no memory -- don't reset affection as ORAS can raise it
|
2016-01-29 02:51:27 +00:00
|
|
|
|
CB_OTQual.SelectedIndex = CB_OTFeel.SelectedIndex = 0;
|
|
|
|
|
CB_OTVar.SelectedValue = CB_OTMemory.SelectedValue = 0;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-10-10 02:59:57 +00:00
|
|
|
|
enable = true;
|
2018-07-14 23:32:06 +00:00
|
|
|
|
GB_M_OT.Text = $"{TextArgs.MemoriesWith} {pkm.OT_Name} ({TextArgs.OT})"; // Memories with : OTNAME
|
|
|
|
|
GB_M_CT.Text = $"{TextArgs.MemoriesWith} {pkm.HT_Name}"; // Memories with : HTNAME
|
2018-05-13 02:07:32 +00:00
|
|
|
|
if (pkm.HT_Name.Length == 0)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2018-05-12 15:13:39 +00:00
|
|
|
|
CB_Country1.Enabled = CB_Country2.Enabled = CB_Country3.Enabled = CB_Country4.Enabled =
|
|
|
|
|
CB_Region1.Enabled = CB_Region2.Enabled = CB_Region3.Enabled = CB_Region4.Enabled =
|
2015-09-29 04:11:03 +00:00
|
|
|
|
GB_M_CT.Enabled = false;
|
2018-07-14 23:32:06 +00:00
|
|
|
|
GB_M_CT.Text = $"{TextArgs.NeverLeft} {TextArgs.OT} - {TextArgs.Disabled}"; // Never Left : OT : Disabled
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2018-07-29 23:39:15 +00:00
|
|
|
|
{
|
2018-07-14 23:32:06 +00:00
|
|
|
|
GB_M_CT.Text = $"{TextArgs.MemoriesWith} {pkm.HT_Name}";
|
2018-07-29 23:39:15 +00:00
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2018-03-28 23:07:03 +00:00
|
|
|
|
RTB_OT.Visible = CB_OTQual.Enabled = CB_OTMemory.Enabled = CB_OTFeel.Enabled = CB_OTVar.Enabled = enable;
|
|
|
|
|
M_OT_Affection.Enabled = true;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-12-27 02:35:10 +00:00
|
|
|
|
else
|
2018-07-29 23:39:15 +00:00
|
|
|
|
{
|
2018-09-02 02:55:08 +00:00
|
|
|
|
GB_M_OT.Text = GB_M_CT.Text = $"N/A: {GameInfo.Strings.EggName}";
|
2018-07-29 23:39:15 +00:00
|
|
|
|
}
|
2015-12-27 02:35:10 +00:00
|
|
|
|
|
2017-01-27 05:35:26 +00:00
|
|
|
|
init = true;
|
2015-02-07 20:21:54 +00:00
|
|
|
|
|
|
|
|
|
// Manually load the Memory Parse
|
2017-06-18 01:37:19 +00:00
|
|
|
|
RTB_CT.Text = GetMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, pkm.HT_Name);
|
|
|
|
|
RTB_OT.Text = GetMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, pkm.OT_Name);
|
2020-02-28 04:53:33 +00:00
|
|
|
|
|
|
|
|
|
// Affection no longer stored in gen8+, so only show in gen6/7.
|
|
|
|
|
L_OT_Affection.Visible = L_CT_Affection.Visible = M_OT_Affection.Visible = M_CT_Affection.Visible = pkm.Format <= 7;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void SaveFields()
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
// Save Region & Country Data
|
2018-07-14 17:34:34 +00:00
|
|
|
|
if (pkm is IGeoTrack g)
|
|
|
|
|
{
|
|
|
|
|
g.Geo1_Region = WinFormsUtil.GetIndex(CB_Region0);
|
|
|
|
|
g.Geo2_Region = WinFormsUtil.GetIndex(CB_Region1);
|
|
|
|
|
g.Geo3_Region = WinFormsUtil.GetIndex(CB_Region2);
|
|
|
|
|
g.Geo4_Region = WinFormsUtil.GetIndex(CB_Region3);
|
|
|
|
|
g.Geo5_Region = WinFormsUtil.GetIndex(CB_Region4);
|
|
|
|
|
g.Geo1_Country = WinFormsUtil.GetIndex(CB_Country0);
|
|
|
|
|
g.Geo2_Country = WinFormsUtil.GetIndex(CB_Country1);
|
|
|
|
|
g.Geo3_Country = WinFormsUtil.GetIndex(CB_Country2);
|
|
|
|
|
g.Geo4_Country = WinFormsUtil.GetIndex(CB_Country3);
|
|
|
|
|
g.Geo5_Country = WinFormsUtil.GetIndex(CB_Country4);
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
// Save 0-255 stats
|
2016-10-20 01:19:01 +00:00
|
|
|
|
pkm.HT_Friendship = Util.ToInt32(M_CT_Friendship.Text);
|
|
|
|
|
pkm.OT_Friendship = Util.ToInt32(M_OT_Friendship.Text);
|
2020-08-02 18:06:30 +00:00
|
|
|
|
|
|
|
|
|
if (pkm is IAffection a)
|
|
|
|
|
{
|
|
|
|
|
a.OT_Affection = Util.ToInt32(M_OT_Affection.Text);
|
|
|
|
|
a.HT_Affection = Util.ToInt32(M_CT_Affection.Text);
|
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
pkm.Fullness = (byte)Util.ToInt32(M_Fullness.Text);
|
|
|
|
|
pkm.Enjoyment = (byte)Util.ToInt32(M_Enjoyment.Text);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
// Save Memories
|
2020-08-01 00:25:14 +00:00
|
|
|
|
if (pkm is ITrainerMemories m)
|
|
|
|
|
{
|
|
|
|
|
m.OT_Memory = WinFormsUtil.GetIndex(CB_OTMemory);
|
|
|
|
|
m.OT_TextVar = CB_OTVar.Enabled ? WinFormsUtil.GetIndex(CB_OTVar) : 0;
|
|
|
|
|
m.OT_Intensity = CB_OTFeel.Enabled ? CB_OTQual.SelectedIndex + 1 : 0;
|
|
|
|
|
m.OT_Feeling = CB_OTFeel.Enabled ? CB_OTFeel.SelectedIndex : 0;
|
|
|
|
|
|
|
|
|
|
m.HT_Memory = WinFormsUtil.GetIndex(CB_CTMemory);
|
|
|
|
|
m.HT_TextVar = CB_CTVar.Enabled ? WinFormsUtil.GetIndex(CB_CTVar) : 0;
|
|
|
|
|
m.HT_Intensity = CB_CTFeel.Enabled ? CB_CTQual.SelectedIndex + 1 : 0;
|
|
|
|
|
m.HT_Feeling = CB_CTFeel.Enabled ? CB_CTFeel.SelectedIndex : 0;
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Event Actions
|
|
|
|
|
private void B_Save_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
SaveFields();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
Close();
|
2017-06-18 01:37:19 +00:00
|
|
|
|
}
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
2017-06-18 01:37:19 +00:00
|
|
|
|
}
|
2015-03-11 01:44:51 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void GetLangStrings()
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2019-11-25 06:34:51 +00:00
|
|
|
|
var strings = MemStrings;
|
2018-07-14 23:00:28 +00:00
|
|
|
|
CB_OTMemory.InitializeBinding();
|
|
|
|
|
CB_CTMemory.InitializeBinding();
|
2018-05-19 17:04:07 +00:00
|
|
|
|
CB_OTMemory.DataSource = new BindingSource(strings.Memory, null);
|
|
|
|
|
CB_CTMemory.DataSource = new BindingSource(strings.Memory, null);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
// Quality Chooser
|
2018-05-19 17:04:07 +00:00
|
|
|
|
foreach (var q in strings.GetMemoryQualities())
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2018-05-19 15:30:36 +00:00
|
|
|
|
CB_CTQual.Items.Add(q);
|
|
|
|
|
CB_OTQual.Items.Add(q);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Feeling Chooser
|
2019-12-09 02:56:37 +00:00
|
|
|
|
foreach (var q in strings.GetMemoryFeelings(pkm.Format))
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2018-05-19 15:30:36 +00:00
|
|
|
|
CB_CTFeel.Items.Add(q);
|
|
|
|
|
CB_OTFeel.Items.Add(q);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2018-05-19 17:04:07 +00:00
|
|
|
|
private void UpdateMemoryDisplay(object sender)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (sender == CB_CTMemory)
|
|
|
|
|
{
|
2019-12-08 07:36:39 +00:00
|
|
|
|
int memory = WinFormsUtil.GetIndex((ComboBox)sender);
|
|
|
|
|
var memIndex = Memories.GetMemoryArgType(memory, pkm.GenNumber);
|
|
|
|
|
var argvals = MemStrings.GetArgumentStrings(memIndex);
|
2018-07-14 23:00:28 +00:00
|
|
|
|
CB_CTVar.InitializeBinding();
|
2018-05-21 22:43:07 +00:00
|
|
|
|
CB_CTVar.DataSource = new BindingSource(argvals, null);
|
2019-12-08 07:36:39 +00:00
|
|
|
|
LCTV.Text = TextArgs.GetMemoryCategory(memIndex, pkm.GenNumber);
|
2018-05-19 17:04:07 +00:00
|
|
|
|
LCTV.Visible = CB_CTVar.Visible = CB_CTVar.Enabled = argvals.Count > 1;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-12-08 07:36:39 +00:00
|
|
|
|
int memory = WinFormsUtil.GetIndex((ComboBox)sender);
|
|
|
|
|
var memIndex = Memories.GetMemoryArgType(memory, pkm.Format);
|
|
|
|
|
var argvals = MemStrings.GetArgumentStrings(memIndex);
|
2018-07-14 23:00:28 +00:00
|
|
|
|
CB_OTVar.InitializeBinding();
|
2018-05-21 22:43:07 +00:00
|
|
|
|
CB_OTVar.DataSource = new BindingSource(argvals, null);
|
2019-12-08 07:36:39 +00:00
|
|
|
|
LOTV.Text = TextArgs.GetMemoryCategory(memIndex, pkm.Format);
|
2018-05-19 17:04:07 +00:00
|
|
|
|
LOTV.Visible = CB_OTVar.Visible = CB_OTVar.Enabled = argvals.Count > 1;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2017-09-08 00:46:18 +00:00
|
|
|
|
private string GetMemoryString(ComboBox m, Control arg, Control q, Control f, string tr)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
string result;
|
2017-09-08 00:46:18 +00:00
|
|
|
|
bool enabled;
|
2017-06-18 01:37:19 +00:00
|
|
|
|
int mem = WinFormsUtil.GetIndex(m);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
if (mem == 0)
|
2017-09-08 00:46:18 +00:00
|
|
|
|
{
|
2019-11-28 22:02:05 +00:00
|
|
|
|
string nn = pkm.Nickname;
|
2020-09-06 18:24:54 +00:00
|
|
|
|
result = string.Format(GameInfo.Strings.memories[38], nn);
|
2017-09-08 00:46:18 +00:00
|
|
|
|
enabled = false;
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2017-09-08 00:46:18 +00:00
|
|
|
|
string nn = pkm.Nickname;
|
|
|
|
|
string a = arg.Text;
|
2017-01-08 07:54:09 +00:00
|
|
|
|
result = string.Format(GameInfo.Strings.memories[mem + 38], nn, tr, a, f.Text, q.Text);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
enabled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-10 02:59:57 +00:00
|
|
|
|
// Show labels if the memory allows for them.
|
2014-06-28 21:22:05 +00:00
|
|
|
|
if (q == CB_CTQual)
|
|
|
|
|
L_CT_Quality.Visible = L_CT_Feeling.Visible = enabled;
|
|
|
|
|
else
|
|
|
|
|
L_OT_Quality.Visible = L_OT_Feeling.Visible = enabled;
|
|
|
|
|
|
2014-10-10 02:59:57 +00:00
|
|
|
|
// Show Quality and Feeling.
|
2014-06-28 21:22:05 +00:00
|
|
|
|
q.Visible = q.Enabled = f.Visible = f.Enabled = enabled;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void ChangeMemory(object sender, EventArgs e)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
ComboBox m = (ComboBox)sender;
|
2018-05-19 17:04:07 +00:00
|
|
|
|
if (m == CB_CTMemory || m == CB_OTMemory)
|
|
|
|
|
UpdateMemoryDisplay(m);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-02-07 20:21:54 +00:00
|
|
|
|
if (!init) return;
|
2017-06-18 01:37:19 +00:00
|
|
|
|
RTB_OT.Text = GetMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, pkm.OT_Name);
|
|
|
|
|
RTB_CT.Text = GetMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, pkm.HT_Name);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2017-09-08 00:46:18 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void ChangeCountryIndex(object sender, EventArgs e)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2019-02-07 07:28:02 +00:00
|
|
|
|
int index = Array.IndexOf(PrevCountries, sender);
|
2017-09-30 05:58:25 +00:00
|
|
|
|
int val;
|
|
|
|
|
if (sender is ComboBox c && (val = WinFormsUtil.GetIndex(c)) > 0)
|
2015-09-29 04:11:03 +00:00
|
|
|
|
{
|
2019-02-07 07:28:02 +00:00
|
|
|
|
Main.SetCountrySubRegion(PrevRegions[index], $"sr_{val:000}");
|
|
|
|
|
PrevRegions[index].Enabled = true;
|
2015-09-29 04:11:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-02-07 07:28:02 +00:00
|
|
|
|
PrevRegions[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
|
|
|
|
PrevRegions[index].Enabled = false;
|
|
|
|
|
PrevRegions[index].SelectedValue = 0;
|
2015-09-29 04:11:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-29 23:39:15 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void ChangeCountryText(object sender, EventArgs e)
|
2015-09-29 04:11:03 +00:00
|
|
|
|
{
|
2017-09-08 00:46:18 +00:00
|
|
|
|
if (!(sender is ComboBox cb) || !string.IsNullOrWhiteSpace(cb.Text))
|
|
|
|
|
return;
|
|
|
|
|
cb.SelectedValue = 0;
|
|
|
|
|
ChangeCountryIndex(sender, e);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void Update255_MTB(object sender, EventArgs e)
|
2014-08-15 22:28:15 +00:00
|
|
|
|
{
|
2018-05-19 15:30:36 +00:00
|
|
|
|
if (!(sender is MaskedTextBox tb)) return;
|
|
|
|
|
if (Util.ToInt32(tb.Text) > byte.MaxValue)
|
|
|
|
|
tb.Text = "255";
|
2014-08-15 22:28:15 +00:00
|
|
|
|
}
|
2014-12-13 06:58:34 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void ClickResetLocation(object sender, EventArgs e)
|
2014-12-13 06:58:34 +00:00
|
|
|
|
{
|
2015-09-29 04:11:03 +00:00
|
|
|
|
Label[] senderarr = { L_Geo0, L_Geo1, L_Geo2, L_Geo3, L_Geo4, };
|
2016-02-24 22:59:03 +00:00
|
|
|
|
int index = Array.IndexOf(senderarr, sender);
|
2019-02-07 07:28:02 +00:00
|
|
|
|
PrevCountries[index].SelectedValue = 0;
|
2014-12-13 06:58:34 +00:00
|
|
|
|
|
2019-02-07 07:28:02 +00:00
|
|
|
|
PrevRegions[index].InitializeBinding();
|
|
|
|
|
PrevRegions[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
|
|
|
|
PrevRegions[index].SelectedValue = 0;
|
2014-12-13 06:58:34 +00:00
|
|
|
|
}
|
2015-09-29 04:11:03 +00:00
|
|
|
|
|
2016-03-27 02:40:02 +00:00
|
|
|
|
private void B_ClearAll_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
2019-02-07 07:28:02 +00:00
|
|
|
|
PrevCountries[i].SelectedValue = 0;
|
2016-03-27 02:40:02 +00:00
|
|
|
|
}
|
2018-07-14 23:32:06 +00:00
|
|
|
|
|
2020-09-07 20:51:13 +00:00
|
|
|
|
private sealed class TextMarkup
|
2018-07-14 23:32:06 +00:00
|
|
|
|
{
|
|
|
|
|
public string Disabled { get; } = nameof(Disabled);
|
|
|
|
|
public string NeverLeft { get; } = "Never left";
|
|
|
|
|
public string OT { get; } = "OT";
|
|
|
|
|
public string PastGen { get; } = "Past Gen";
|
|
|
|
|
public string MemoriesWith { get; } = "Memories with";
|
|
|
|
|
|
|
|
|
|
private string Species { get; } = "Species:";
|
|
|
|
|
private string Area { get; } = "Area:";
|
|
|
|
|
private string Item { get; } = "Item:";
|
|
|
|
|
private string Move { get; } = "Move:";
|
|
|
|
|
private string Location { get; } = "Location:";
|
|
|
|
|
|
|
|
|
|
public TextMarkup(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Array.Resize(ref args, 10);
|
|
|
|
|
if (args[0] != null) Disabled = args[0];
|
|
|
|
|
if (args[1] != null) NeverLeft = args[1];
|
|
|
|
|
if (args[2] != null) OT = args[2];
|
|
|
|
|
if (args[3] != null) PastGen = args[3];
|
|
|
|
|
if (args[4] != null) MemoriesWith = args[4];
|
|
|
|
|
|
|
|
|
|
// Pokémon ; Area ; Item(s) ; Move ; Location
|
|
|
|
|
if (args[5] != null) Species = args[5] + ":";
|
|
|
|
|
if (args[6] != null) Area = args[6] + ":";
|
|
|
|
|
if (args[7] != null) Item = args[7] + ":";
|
|
|
|
|
if (args[8] != null) Move = args[8] + ":";
|
|
|
|
|
if (args[9] != null) Location = args[9] + ":";
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-08 07:36:39 +00:00
|
|
|
|
public string GetMemoryCategory(MemoryArgType type, int format)
|
2018-07-14 23:32:06 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return type switch
|
2018-07-14 23:32:06 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
MemoryArgType.GeneralLocation => Area,
|
2019-12-08 07:36:39 +00:00
|
|
|
|
MemoryArgType.SpecificLocation when format == 6 => Location,
|
2019-10-08 01:40:09 +00:00
|
|
|
|
MemoryArgType.Species => Species,
|
|
|
|
|
MemoryArgType.Move => Move,
|
|
|
|
|
MemoryArgType.Item => Item,
|
|
|
|
|
_ => string.Empty
|
|
|
|
|
};
|
2018-07-14 23:32:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-02-07 20:21:54 +00:00
|
|
|
|
}
|