Add controls of G7Stamp,BallThrow

Some function has already included in SAV7, but no controls?
Add function about BallThrow Flags.
This commit is contained in:
pokecal 2017-03-27 03:56:06 +09:00
parent 6a0d824b31
commit dce4b839b1
3 changed files with 199 additions and 4 deletions

View file

@ -180,6 +180,13 @@ namespace PKHeX.WinForms
this.CB_Vivillon = new System.Windows.Forms.ComboBox();
this.L_DaysFromRefreshed = new System.Windows.Forms.Label();
this.NUD_DaysFromRefreshed = new System.Windows.Forms.NumericUpDown();
this.L_BallThrowType = new System.Windows.Forms.Label();
this.CB_BallThrowType = new System.Windows.Forms.ComboBox();
this.CB_BallThrowTypeListMode = new System.Windows.Forms.ComboBox();
this.LB_BallThrowTypeUnlocked = new System.Windows.Forms.ListBox();
this.LB_BallThrowTypeLearned = new System.Windows.Forms.ListBox();
this.L_Stamps = new System.Windows.Forms.Label();
this.LB_Stamps = new System.Windows.Forms.ListBox();
this.TC_Editor.SuspendLayout();
this.Tab_Overview.SuspendLayout();
this.GB_Stats.SuspendLayout();
@ -1593,6 +1600,13 @@ namespace PKHeX.WinForms
//
// Tab_Misc
//
this.Tab_Misc.Controls.Add(this.L_BallThrowType);
this.Tab_Misc.Controls.Add(this.CB_BallThrowType);
this.Tab_Misc.Controls.Add(this.CB_BallThrowTypeListMode);
this.Tab_Misc.Controls.Add(this.LB_BallThrowTypeUnlocked);
this.Tab_Misc.Controls.Add(this.LB_BallThrowTypeLearned);
this.Tab_Misc.Controls.Add(this.L_Stamps);
this.Tab_Misc.Controls.Add(this.LB_Stamps);
this.Tab_Misc.Controls.Add(this.L_DaysFromRefreshed);
this.Tab_Misc.Controls.Add(this.NUD_DaysFromRefreshed);
this.Tab_Misc.Controls.Add(this.L_PlazaName);
@ -1783,7 +1797,7 @@ namespace PKHeX.WinForms
// TB_PlazaName
//
this.TB_PlazaName.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TB_PlazaName.Location = new System.Drawing.Point(217, 139);
this.TB_PlazaName.Location = new System.Drawing.Point(217, 150);
this.TB_PlazaName.MaxLength = 20;
this.TB_PlazaName.Name = "TB_PlazaName";
this.TB_PlazaName.Size = new System.Drawing.Size(159, 20);
@ -1793,7 +1807,7 @@ namespace PKHeX.WinForms
// L_PlazaName
//
this.L_PlazaName.AutoSize = true;
this.L_PlazaName.Location = new System.Drawing.Point(214, 119);
this.L_PlazaName.Location = new System.Drawing.Point(214, 130);
this.L_PlazaName.Name = "L_PlazaName";
this.L_PlazaName.Size = new System.Drawing.Size(106, 13);
this.L_PlazaName.TabIndex = 62;
@ -1844,6 +1858,79 @@ namespace PKHeX.WinForms
0,
0});
//
// L_BallThrowType
//
this.L_BallThrowType.Location = new System.Drawing.Point(144, 50);
this.L_BallThrowType.Name = "L_BallThrowType";
this.L_BallThrowType.Size = new System.Drawing.Size(117, 20);
this.L_BallThrowType.TabIndex = 65;
this.L_BallThrowType.Text = "Ball Throw Type:";
this.L_BallThrowType.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CB_BallThrowType
//
this.CB_BallThrowType.FormattingEnabled = true;
this.CB_BallThrowType.Location = new System.Drawing.Point(267, 51);
this.CB_BallThrowType.Name = "CB_BallThrowType";
this.CB_BallThrowType.Size = new System.Drawing.Size(109, 21);
this.CB_BallThrowType.TabIndex = 66;
//
// CB_BallThrowTypeListMode
//
this.CB_BallThrowTypeListMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_BallThrowTypeListMode.FormattingEnabled = true;
this.CB_BallThrowTypeListMode.Items.AddRange(new object[] {
"unlocked list",
"learned list"});
this.CB_BallThrowTypeListMode.Location = new System.Drawing.Point(154, 76);
this.CB_BallThrowTypeListMode.Name = "CB_BallThrowTypeListMode";
this.CB_BallThrowTypeListMode.Size = new System.Drawing.Size(107, 21);
this.CB_BallThrowTypeListMode.TabIndex = 67;
this.CB_BallThrowTypeListMode.SelectedIndexChanged += new System.EventHandler(this.CB_BattleStyleListMode_SelectedIndexChanged);
//
// LB_BallThrowTypeUnlocked
//
this.LB_BallThrowTypeUnlocked.FormattingEnabled = true;
this.LB_BallThrowTypeUnlocked.ItemHeight = 12;
this.LB_BallThrowTypeUnlocked.Location = new System.Drawing.Point(267, 74);
this.LB_BallThrowTypeUnlocked.Name = "LB_BallThrowTypeUnlocked";
this.LB_BallThrowTypeUnlocked.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.LB_BallThrowTypeUnlocked.Size = new System.Drawing.Size(109, 52);
this.LB_BallThrowTypeUnlocked.TabIndex = 68;
this.LB_BallThrowTypeUnlocked.SelectedIndexChanged += new System.EventHandler(this.LB_BallThrowTypeUnlocked_SelectedIndexChanged);
//
// LB_BallThrowTypeLearned
//
this.LB_BallThrowTypeLearned.FormattingEnabled = true;
this.LB_BallThrowTypeLearned.ItemHeight = 12;
this.LB_BallThrowTypeLearned.Location = new System.Drawing.Point(267, 74);
this.LB_BallThrowTypeLearned.Name = "LB_BallThrowTypeLearned";
this.LB_BallThrowTypeLearned.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.LB_BallThrowTypeLearned.Size = new System.Drawing.Size(109, 52);
this.LB_BallThrowTypeLearned.TabIndex = 69;
this.LB_BallThrowTypeLearned.Visible = false;
this.LB_BallThrowTypeLearned.SelectedIndexChanged += new System.EventHandler(this.LB_BallThrowTypeLearned_SelectedIndexChanged);
//
// L_Stamps
//
this.L_Stamps.AutoSize = true;
this.L_Stamps.Location = new System.Drawing.Point(214, 174);
this.L_Stamps.Name = "L_Stamps";
this.L_Stamps.Size = new System.Drawing.Size(45, 13);
this.L_Stamps.TabIndex = 70;
this.L_Stamps.Text = "Stamps:";
this.L_Stamps.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LB_Stamps
//
this.LB_Stamps.FormattingEnabled = true;
this.LB_Stamps.ItemHeight = 12;
this.LB_Stamps.Location = new System.Drawing.Point(217, 194);
this.LB_Stamps.Name = "LB_Stamps";
this.LB_Stamps.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.LB_Stamps.Size = new System.Drawing.Size(159, 52);
this.LB_Stamps.TabIndex = 71;
//
// SAV_Trainer7
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2054,5 +2141,12 @@ namespace PKHeX.WinForms
private System.Windows.Forms.ComboBox CB_Vivillon;
private System.Windows.Forms.NumericUpDown NUD_DaysFromRefreshed;
private System.Windows.Forms.Label L_DaysFromRefreshed;
private System.Windows.Forms.Label L_BallThrowType;
private System.Windows.Forms.ComboBox CB_BallThrowType;
private System.Windows.Forms.ComboBox CB_BallThrowTypeListMode;
private System.Windows.Forms.ListBox LB_BallThrowTypeUnlocked;
private System.Windows.Forms.ListBox LB_BallThrowTypeLearned;
private System.Windows.Forms.Label L_Stamps;
private System.Windows.Forms.ListBox LB_Stamps;
}
}

View file

@ -102,6 +102,19 @@ namespace PKHeX.WinForms
CB_Vivillon.DisplayMember = "Text";
CB_Vivillon.ValueMember = "Value";
CB_Vivillon.DataSource = PKX.getFormList(666, GameInfo.Strings.types, GameInfo.Strings.forms, Main.gendersymbols).ToList();
string[] BattleStyles = new string[8] { "Normal", "Elegant", "Girlish", "Reverent", "Smug", "Left-handed", "Passionate", "Idol" };
for (int i = 0; i < BattleStyles.Length; i++)
{
CB_BallThrowType.Items.Add(BattleStyles[i]);
LB_BallThrowTypeUnlocked.Items.Add(BattleStyles[i]);
LB_BallThrowTypeLearned.Items.Add(BattleStyles[i]);
}
string[] TrainerStampTitle = new string[15] { "01:Official Pokemon Trainer", "02:Melemele Trial Completion", "03:Akala Trial Completion", "04:Ula'ula Trial Completion", "05:Poni Trial Completion", "06:Island Challenge Completion", "07:Melemele Pokedex Completion", "08:Akala Pokedex Completion", "09:Ula'ula Pokedex Completion", "10:Poni Pokedex Completion", "11:Alola Pokedex Completion", "12:50 Consecutive Single Battle Wins", "13:50 Consecutive Double Battle Wins", "14:50 Consecutive Multi Battle Wins", "15:Poke Finder Pro" };
for (int i = 0; i < TrainerStampTitle.Length; i++)
LB_Stamps.Items.Add(TrainerStampTitle[i]);
}
private void getTextBoxes()
{
@ -191,6 +204,27 @@ namespace PKHeX.WinForms
CB_Vivillon.SelectedIndex = (SAV.Vivillon < CB_Vivillon.Items.Count) ? SAV.Vivillon : -1;
NUD_DaysFromRefreshed.Value = Math.Min(NUD_DaysFromRefreshed.Maximum, SAV.DaysFromRefreshed);
if (SAV.BallThrowType >= 0 && SAV.BallThrowType < CB_BallThrowType.Items.Count)
CB_BallThrowType.SelectedIndex = SAV.BallThrowType;
byte bttu = SAV.BallThrowTypeUnlocked;
LB_BallThrowTypeUnlocked.SetSelected(0, true);
LB_BallThrowTypeUnlocked.SetSelected(1, true);
for (int i = 2; i < LB_BallThrowTypeUnlocked.Items.Count; i++)
LB_BallThrowTypeUnlocked.SetSelected(i, (bttu & (1 << i)) != 0);
byte bttl = SAV.BallThrowTypeLearned;
LB_BallThrowTypeLearned.SetSelected(0, true);
for (int i = 1; i < LB_BallThrowTypeLearned.Items.Count; i++)
LB_BallThrowTypeLearned.SetSelected(i, (bttl & (1 << i)) != 0);
CB_BallThrowTypeListMode.SelectedIndex = 0;
uint stampBits = SAV.Stamps;
for (int i = 0; i < LB_Stamps.Items.Count; i++)
LB_Stamps.SetSelected(i, (stampBits & (1 << i)) != 0);
}
private void save()
{
@ -278,6 +312,28 @@ namespace PKHeX.WinForms
if (CB_Vivillon.SelectedIndex >= 0) SAV.Vivillon = CB_Vivillon.SelectedIndex;
SAV.DaysFromRefreshed = (byte)NUD_DaysFromRefreshed.Value;
SAV.BallThrowType = CB_BallThrowType.SelectedIndex;
byte bttu = 0;
for(int i = 0; i < LB_BallThrowTypeUnlocked.Items.Count; i++)
{
if (LB_BallThrowTypeUnlocked.GetSelected(i))
bttu += (byte)(1 << i);
}
SAV.BallThrowTypeUnlocked = bttu;
byte bttl = 0;
for(int i = 0; i < LB_BallThrowTypeLearned.Items.Count; i++)
{
if (LB_BallThrowTypeLearned.GetSelected(i))
bttl += (byte)(1 << i);
}
SAV.BallThrowTypeLearned = bttl;
uint stampBits = 0;
for(int i = 0; i < LB_Stamps.Items.Count; i++)
{
if (LB_Stamps.GetSelected(i))
stampBits += (uint)(1 << i);
}
SAV.Stamps = stampBits;
}
private void clickOT(object sender, MouseEventArgs e)
@ -437,6 +493,37 @@ namespace PKHeX.WinForms
return tip;
}
private void CB_BattleStyleListMode_SelectedIndexChanged(object sender, EventArgs e)
{
if (CB_BallThrowTypeListMode.SelectedIndex == 0)
{
LB_BallThrowTypeUnlocked.Visible = true;
LB_BallThrowTypeLearned.Visible = false;
}
else
{
LB_BallThrowTypeUnlocked.Visible = false;
LB_BallThrowTypeLearned.Visible = true;
}
}
private void LB_BallThrowTypeLearned_SelectedIndexChanged(object sender, EventArgs e)
{
if (Loading) return;
if (!LB_BallThrowTypeLearned.GetSelected(0))
LB_BallThrowTypeLearned.SetSelected(0, true);
}
private void LB_BallThrowTypeUnlocked_SelectedIndexChanged(object sender, EventArgs e)
{
if (Loading) return;
for (int i = 0; i < 2; i++)
{
if (!LB_BallThrowTypeUnlocked.GetSelected(i))
LB_BallThrowTypeUnlocked.SetSelected(i, true);
}
}
private void B_GenTID_Click(object sender, EventArgs e)
{
var tuple = SaveUtil.getTIDSID(Util.ToUInt32(MT_G7TID.Text), ModifierKeys == Keys.Control);

View file

@ -432,8 +432,8 @@ namespace PKHeX.Core
}
public int BallThrowType
{
get { return Data[0x7A]; }
set { Data[0x7A] = (byte)(value > 8 ? 0 : value); }
get { return Data[TrainerCard + 0x7A]; }
set { Data[TrainerCard + 0x7A] = (byte)(value > 8 ? 0 : value); }
}
public int M
{
@ -1282,6 +1282,20 @@ namespace PKHeX.Core
return Blocks.Aggregate("", (current, b) => current +
$"{b.ID:00}: {b.Offset:X5}-{b.Offset + b.Length:X5}, {b.Length:X5}{Environment.NewLine}");
}
public byte BallThrowTypeUnlocked
{
get { return (byte)(((Data[0x23F5] & 0x0F) << 4) | ((Data[0x23F4] & 0xC0) >> 4)); }
set
{
Data[0x23F4] = (byte)((Data[0x23F4] & 0x3F) | ((value & 0x0C) << 4));
Data[0x23F5] = (byte)((Data[0x23F5] & 0xF0) | ((value & 0xF0) >> 4));
}
}
public byte BallThrowTypeLearned
{
get { return (byte)((Data[0x2583] & 0x7F) << 1); }
set { Data[0x2583] = (byte)((Data[0x2583] & 0x80) | ((value & 0xFE) >> 1)); }
}
public override bool RequiresMemeCrypto => true;
}