From 5117f3a5c96bc8c77c44d22d10c8280aedb34e63 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 11 Jun 2017 00:25:21 -0700 Subject: [PATCH] cap entry of Yellow pikachu friendship gen1 trainer editor, 0-255 https://projectpokemon.org/forums/forums/topic/40817-request-autoset-yellow-pikachu-friendship-to-255-if-user-inserts-number-higher-than-255/ --- .../SAV_SimpleTrainer.Designer.cs | 47 ++++++++++--------- .../Save Editors/SAV_SimpleTrainer.cs | 6 +++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.Designer.cs index 6774b226a6f..9e17f4e8fad 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_SimpleTrainer)); this.GB_Adventure = new System.Windows.Forms.GroupBox(); + this.L_PikaFriend = new System.Windows.Forms.Label(); + this.MT_PikaFriend = new System.Windows.Forms.MaskedTextBox(); this.L_Started = new System.Windows.Forms.Label(); this.CAL_AdventureStartDate = new System.Windows.Forms.DateTimePicker(); this.CAL_HoFDate = new System.Windows.Forms.DateTimePicker(); @@ -92,8 +94,6 @@ private void InitializeComponent() this.LBL_BattleStyle = new System.Windows.Forms.Label(); this.CB_BattleStyle = new System.Windows.Forms.ComboBox(); this.CHK_BattleEffects = new System.Windows.Forms.CheckBox(); - this.L_PikaFriend = new System.Windows.Forms.Label(); - this.MT_PikaFriend = new System.Windows.Forms.MaskedTextBox(); this.GB_Adventure.SuspendLayout(); this.GB_Map.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).BeginInit(); @@ -128,6 +128,28 @@ private void InitializeComponent() this.GB_Adventure.TabStop = false; this.GB_Adventure.Text = "Adventure Info"; // + // L_PikaFriend + // + this.L_PikaFriend.AutoSize = true; + this.L_PikaFriend.Location = new System.Drawing.Point(7, 44); + this.L_PikaFriend.Name = "L_PikaFriend"; + this.L_PikaFriend.Size = new System.Drawing.Size(100, 13); + this.L_PikaFriend.TabIndex = 73; + this.L_PikaFriend.Text = "Pikachu Friendship:"; + this.L_PikaFriend.Visible = false; + // + // MT_PikaFriend + // + this.MT_PikaFriend.Location = new System.Drawing.Point(111, 40); + this.MT_PikaFriend.Mask = "000"; + this.MT_PikaFriend.Name = "MT_PikaFriend"; + this.MT_PikaFriend.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.MT_PikaFriend.Size = new System.Drawing.Size(39, 20); + this.MT_PikaFriend.TabIndex = 72; + this.MT_PikaFriend.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.MT_PikaFriend.Visible = false; + this.MT_PikaFriend.TextChanged += new System.EventHandler(this.change255); + // // L_Started // this.L_Started.Location = new System.Drawing.Point(4, 51); @@ -796,27 +818,6 @@ private void InitializeComponent() this.CHK_BattleEffects.Text = "Use Battle Effects"; this.CHK_BattleEffects.UseVisualStyleBackColor = true; // - // L_PikaFriend - // - this.L_PikaFriend.AutoSize = true; - this.L_PikaFriend.Location = new System.Drawing.Point(7, 44); - this.L_PikaFriend.Name = "L_PikaFriend"; - this.L_PikaFriend.Size = new System.Drawing.Size(100, 13); - this.L_PikaFriend.TabIndex = 73; - this.L_PikaFriend.Text = "Pikachu Friendship:"; - this.L_PikaFriend.Visible = false; - // - // MT_PikaFriend - // - this.MT_PikaFriend.Location = new System.Drawing.Point(111, 40); - this.MT_PikaFriend.Mask = "000"; - this.MT_PikaFriend.Name = "MT_PikaFriend"; - this.MT_PikaFriend.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.MT_PikaFriend.Size = new System.Drawing.Size(39, 20); - this.MT_PikaFriend.TabIndex = 72; - this.MT_PikaFriend.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MT_PikaFriend.Visible = false; - // // SAV_SimpleTrainer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.cs index 0dd5bfb4f05..a46d4321c28 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimpleTrainer.cs @@ -162,6 +162,12 @@ private void changeFFFF(object sender, EventArgs e) if (box.Text == "") box.Text = "0"; if (Util.ToInt32(box.Text) > 65535) box.Text = "65535"; } + private void change255(object sender, EventArgs e) + { + MaskedTextBox box = sender as MaskedTextBox; + if (box.Text == "") box.Text = "0"; + if (Util.ToInt32(box.Text) > byte.MaxValue) box.Text = "255"; + } private void B_Save_Click(object sender, EventArgs e) {