diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index 0a72dac..7b237a3 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System.ComponentModel; +using System.Runtime.InteropServices; namespace pk3DS.Core.Structures { @@ -7,61 +8,95 @@ public struct Item { public Item(byte[] data) => this = data.ToStructure(); public byte[] Write() => this.ToBytes(); + private const string Battle = "Battle"; + private const string Field = "Field"; + private const string Mart = "Mart"; + private const string Heal = "Heal"; #region Structure - public ushort Price; - public byte HeldEffect; - public byte HeldArgument; - public byte NaturalGiftEffect; - public byte FlingEffect; - public byte FlingPower; - public byte NaturalGiftPower; - public byte NaturalGiftTypeFlags; - public byte KeyFlags; - public byte UseEffect; - public byte _0xB; // Battle Type - public byte _0xC; // 0 or 1 - public byte _0xD; // Classification (0-3 Battle, 4 Balls, 5 Mail) - public byte Consumable; - public byte SortIndex; - public BattleStatusFlags CureInflict; // Bitflags + private ushort Price; + [Category(Battle)] + public byte HeldEffect { get; set; } + public byte HeldArgument { get; set; } + public byte NaturalGiftEffect { get; set; } + public byte FlingEffect { get; set; } + public byte FlingPower { get; set; } + private byte NaturalGiftPower { get; set; } + public byte NaturalGiftTypeFlags { get; set; } + public byte KeyFlags { get; set; } + [Category(Field), Description("Routine # to call when used; 0=unusable.")] + public byte UseEffect { get; set; } + public byte _0xB { get; set; } // Battle Type + public byte _0xC { get; set; } // 0 or 1 + public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) + public byte Consumable { get; set; } + public byte SortIndex { get; set; } + public BattleStatusFlags CureInflict { get; set; } // Bitflags private byte Boost0; // Revive 1, Sacred Ash 3, Rare Candy 5, EvoStone 8, upper4 for BoostAtk private byte Boost1; // DEF, SPA private byte Boost2; // SPD, SPE private byte Boost3; // ACC, CRIT - public byte FunctionFlags0; - public byte FunctionFlags1; - public byte EVHP; - public byte EVATK; - public byte EVDEF; - public byte EVSPE; - public byte EVSPA; - public byte EVSPD; - public HealValue HealAmount; - public byte PPGain; - public byte Friendship1; - public byte Friendship2; - public byte Friendship3; + public byte FunctionFlags0 { get; set; } + public byte FunctionFlags1{ get; set; } + [Category(Field), Description("Adds EVs to the HP stat.")] + public byte EVHP { get; set; } + [Category(Field), Description("Adds EVs to the Attack stat.")] + public byte EVATK { get; set; } + [Category(Field), Description("Adds EVs to the Defense stat.")] + public byte EVDEF { get; set; } + [Category(Field), Description("Adds EVs to the Speed stat.")] + public byte EVSPE { get; set; } + [Category(Field), Description("Adds EVs to the Sp. Attack stat.")] + public byte EVSPA { get; set; } + [Category(Field), Description("Adds EVs to the Sp. Defense stat.")] + public byte EVSPD { get; set; } + [Category(Heal), Description("Determines the healing percent, or if a flat value is used."), RefreshProperties(RefreshProperties.All)] + public HealValue HealAmount { get; set; } + [Category(Field), Description("PP to be added to the move's current PP if used.")] + public byte PPGain { get; set; } + public byte Friendship1 { get; set; } + public byte Friendship2 { get; set; } + public byte Friendship3 { get; set; } public byte _0x23, _0x24; #endregion - // Exposing more info + [Category(Mart), RefreshProperties(RefreshProperties.All)] public int BuyPrice { get => Price * 10; set => Price = (ushort)(value / 10); } + [Category(Mart), ReadOnly(true)] public int SellPrice { get => Price * 5; set => Price = (ushort)(value / 5); } + + [Category(Battle)] public int NaturalGiftType { get => NaturalGiftTypeFlags & 0x1F; set => NaturalGiftTypeFlags = (byte)(NaturalGiftEffect & ~0x1F | value); } + [Category(Battle)] public int U8Flags { get => NaturalGiftTypeFlags >> 5; set => NaturalGiftTypeFlags = (byte)(NaturalGiftEffect & 0x1F | (value << 5)); } + [Category(Battle)] public int FieldEffect { get => Boost0 & 0xF; set => Boost0 = (byte)(Boost0 & ~0xF | (value & 0xF)); } + [Category(Battle)] public int BoostATK { get => Boost0 >> 4; set => Boost0 = (byte)(Boost0 & 0xF | (value << 4)); } + [Category(Battle)] public int BoostDEF { get => Boost1 & 0xF; set => Boost1 = (byte)(Boost1 & ~0xF | (value & 0xF)); } + [Category(Battle)] public int BoostSPA { get => Boost1 >> 4; set => Boost1 = (byte)(Boost1 & 0xF | (value << 4)); } + [Category(Battle)] public int BoostSPD { get => Boost2 & 0xF; set => Boost2 = (byte)(Boost2 & ~0xF | (value & 0xF)); } + [Category(Battle)] public int BoostSPE { get => Boost2 >> 4; set => Boost2 = (byte)(Boost2 & 0xF | (value << 4)); } + [Category(Battle)] public int BoostACC { get => Boost0 & 0xF; set => Boost0 = (byte)(Boost3 & ~0xF | (value & 0xF)); } + [Category(Battle)] public int BoostCRIT { get => (Boost3 >> 4) & 3; set => Boost3 = (byte)(Boost3 & ~0x30 | ((value & 3) << 4)); } + [Category(Battle)] public int BoostPP { get => (Boost3 >> 6) & 3; set => Boost3 = (byte)(Boost3 & 0x3F | ((value & 3) << 6)); } + + [Category(Heal), Description("Raw value of the Heal enum."), RefreshProperties(RefreshProperties.All)] + public int HealValue + { + get => (int) HealAmount; + set => HealAmount = (HealValue)value; + } } } diff --git a/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs b/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs index 09bfaea..1785e1d 100644 --- a/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs @@ -28,154 +28,82 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.CB_Item = new System.Windows.Forms.ComboBox(); - this.L_Item = new System.Windows.Forms.Label(); - this.RTB = new System.Windows.Forms.RichTextBox(); - this.MT_Price = new System.Windows.Forms.MaskedTextBox(); - this.NUD_UseEffect = new System.Windows.Forms.NumericUpDown(); - this.L_UseEffect = new System.Windows.Forms.Label(); - this.L_Buy = new System.Windows.Forms.Label(); - this.L_Feedback = new System.Windows.Forms.Label(); - this.L_Sell = new System.Windows.Forms.Label(); - this.MT_Sell = new System.Windows.Forms.MaskedTextBox(); + this.Grid = new System.Windows.Forms.PropertyGrid(); this.L_Index = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_UseEffect)).BeginInit(); + this.RTB = new System.Windows.Forms.RichTextBox(); + this.L_Item = new System.Windows.Forms.Label(); + this.CB_Item = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // - // CB_Item + // Grid // - this.CB_Item.DropDownWidth = 120; - this.CB_Item.FormattingEnabled = true; - this.CB_Item.Location = new System.Drawing.Point(71, 10); - this.CB_Item.Name = "CB_Item"; - this.CB_Item.Size = new System.Drawing.Size(129, 21); - this.CB_Item.TabIndex = 1; - this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry); - // - // L_Item - // - this.L_Item.AutoSize = true; - this.L_Item.Location = new System.Drawing.Point(33, 13); - this.L_Item.Name = "L_Item"; - this.L_Item.Size = new System.Drawing.Size(30, 13); - this.L_Item.TabIndex = 2; - this.L_Item.Text = "Item:"; - this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // RTB - // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.Grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.RTB.Location = new System.Drawing.Point(12, 124); - this.RTB.Name = "RTB"; - this.RTB.ReadOnly = true; - this.RTB.Size = new System.Drawing.Size(316, 51); - this.RTB.TabIndex = 38; - this.RTB.Text = ""; - // - // MT_Price - // - this.MT_Price.Location = new System.Drawing.Point(163, 37); - this.MT_Price.Mask = "00000"; - this.MT_Price.Name = "MT_Price"; - this.MT_Price.Size = new System.Drawing.Size(37, 20); - this.MT_Price.TabIndex = 39; - this.MT_Price.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MT_Price.TextChanged += new System.EventHandler(this.changePrice); - // - // NUD_UseEffect - // - this.NUD_UseEffect.Location = new System.Drawing.Point(165, 82); - this.NUD_UseEffect.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_UseEffect.Name = "NUD_UseEffect"; - this.NUD_UseEffect.Size = new System.Drawing.Size(35, 20); - this.NUD_UseEffect.TabIndex = 40; - // - // L_UseEffect - // - this.L_UseEffect.AutoSize = true; - this.L_UseEffect.Location = new System.Drawing.Point(97, 84); - this.L_UseEffect.Name = "L_UseEffect"; - this.L_UseEffect.Size = new System.Drawing.Size(60, 13); - this.L_UseEffect.TabIndex = 41; - this.L_UseEffect.Text = "Use Effect:"; - // - // L_Buy - // - this.L_Buy.AutoSize = true; - this.L_Buy.Location = new System.Drawing.Point(75, 40); - this.L_Buy.Name = "L_Buy"; - this.L_Buy.Size = new System.Drawing.Size(82, 13); - this.L_Buy.TabIndex = 42; - this.L_Buy.Text = "Purchase Price:"; - // - // L_Feedback - // - this.L_Feedback.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.L_Feedback.AutoSize = true; - this.L_Feedback.Location = new System.Drawing.Point(32, 108); - this.L_Feedback.Name = "L_Feedback"; - this.L_Feedback.Size = new System.Drawing.Size(274, 13); - this.L_Feedback.TabIndex = 43; - this.L_Feedback.Text = "Please give feedback on what is actually needed to edit."; - // - // L_Sell - // - this.L_Sell.AutoSize = true; - this.L_Sell.Location = new System.Drawing.Point(103, 61); - this.L_Sell.Name = "L_Sell"; - this.L_Sell.Size = new System.Drawing.Size(54, 13); - this.L_Sell.TabIndex = 44; - this.L_Sell.Text = "Sell Price:"; - // - // MT_Sell - // - this.MT_Sell.Enabled = false; - this.MT_Sell.Location = new System.Drawing.Point(163, 58); - this.MT_Sell.Mask = "00000"; - this.MT_Sell.Name = "MT_Sell"; - this.MT_Sell.Size = new System.Drawing.Size(37, 20); - this.MT_Sell.TabIndex = 45; - this.MT_Sell.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.Grid.LineColor = System.Drawing.SystemColors.ControlDark; + this.Grid.Location = new System.Drawing.Point(12, 94); + this.Grid.Name = "Grid"; + this.Grid.Size = new System.Drawing.Size(316, 280); + this.Grid.TabIndex = 52; // // L_Index // this.L_Index.AutoSize = true; - this.L_Index.Location = new System.Drawing.Point(206, 13); + this.L_Index.Location = new System.Drawing.Point(221, 14); this.L_Index.Name = "L_Index"; this.L_Index.Size = new System.Drawing.Size(39, 13); - this.L_Index.TabIndex = 46; + this.L_Index.TabIndex = 51; this.L_Index.Text = "Index: "; // + // RTB + // + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.RTB.Location = new System.Drawing.Point(11, 37); + this.RTB.Name = "RTB"; + this.RTB.ReadOnly = true; + this.RTB.Size = new System.Drawing.Size(316, 51); + this.RTB.TabIndex = 50; + this.RTB.Text = ""; + // + // L_Item + // + this.L_Item.Location = new System.Drawing.Point(12, 10); + this.L_Item.Name = "L_Item"; + this.L_Item.Size = new System.Drawing.Size(51, 21); + this.L_Item.TabIndex = 49; + this.L_Item.Text = "Item:"; + this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Item + // + this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Item.DropDownWidth = 120; + this.CB_Item.FormattingEnabled = true; + this.CB_Item.Location = new System.Drawing.Point(71, 10); + this.CB_Item.Name = "CB_Item"; + this.CB_Item.Size = new System.Drawing.Size(144, 21); + this.CB_Item.TabIndex = 48; + this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + // // ItemEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(339, 182); + this.ClientSize = new System.Drawing.Size(339, 381); + this.Controls.Add(this.Grid); this.Controls.Add(this.L_Index); - this.Controls.Add(this.MT_Sell); - this.Controls.Add(this.L_Sell); - this.Controls.Add(this.L_Feedback); - this.Controls.Add(this.L_Buy); - this.Controls.Add(this.L_UseEffect); - this.Controls.Add(this.NUD_UseEffect); - this.Controls.Add(this.MT_Price); this.Controls.Add(this.RTB); this.Controls.Add(this.L_Item); this.Controls.Add(this.CB_Item); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(355, 420); - this.MinimumSize = new System.Drawing.Size(355, 220); + this.MaximumSize = new System.Drawing.Size(355, 1000); + this.MinimumSize = new System.Drawing.Size(355, 420); this.Name = "ItemEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Item Editor"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); - ((System.ComponentModel.ISupportInitialize)(this.NUD_UseEffect)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -183,16 +111,10 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.ComboBox CB_Item; - private System.Windows.Forms.Label L_Item; - private System.Windows.Forms.RichTextBox RTB; - private System.Windows.Forms.MaskedTextBox MT_Price; - private System.Windows.Forms.NumericUpDown NUD_UseEffect; - private System.Windows.Forms.Label L_UseEffect; - private System.Windows.Forms.Label L_Buy; - private System.Windows.Forms.Label L_Feedback; - private System.Windows.Forms.Label L_Sell; - private System.Windows.Forms.MaskedTextBox MT_Sell; + private System.Windows.Forms.PropertyGrid Grid; private System.Windows.Forms.Label L_Index; + private System.Windows.Forms.RichTextBox RTB; + private System.Windows.Forms.Label L_Item; + private System.Windows.Forms.ComboBox CB_Item; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/ItemEditor6.cs b/pk3DS/Subforms/Gen6/ItemEditor6.cs index b06c371..cb67880 100644 --- a/pk3DS/Subforms/Gen6/ItemEditor6.cs +++ b/pk3DS/Subforms/Gen6/ItemEditor6.cs @@ -39,30 +39,20 @@ private void getEntry() { if (entry < 1) return; item = new Item(files[entry]); + Grid.SelectedObject = item; RTB.Text = itemflavor[entry].Replace("\\n", Environment.NewLine); - MT_Price.Text = item.BuyPrice.ToString(); - NUD_UseEffect.Value = item.UseEffect; } private void setEntry() { if (entry < 1) return; - - item.Price = (ushort)(WinFormsUtil.ToInt32(MT_Price)/10); - item.UseEffect = (byte)(int)NUD_UseEffect.Value; - - files[entry] = item.Write(); + files[entry] = ((Item)Grid.SelectedObject).Write(); } private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); } - private void changePrice(object sender, EventArgs e) - { - MT_Sell.Text = (Math.Min(WinFormsUtil.ToUInt32(MT_Price) / 10, 0x7FFF) * 10 / 2).ToString(); - } - private int getItemMapOffset() { if (Main.ExeFSPath == null) { WinFormsUtil.Alert("No exeFS code to load."); return -1; } diff --git a/pk3DS/Subforms/Gen7/ItemEditor7.Designer.cs b/pk3DS/Subforms/Gen7/ItemEditor7.Designer.cs index 5bfaf23..0bb756f 100644 --- a/pk3DS/Subforms/Gen7/ItemEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/ItemEditor7.Designer.cs @@ -31,33 +31,27 @@ private void InitializeComponent() this.CB_Item = new System.Windows.Forms.ComboBox(); this.L_Item = new System.Windows.Forms.Label(); this.RTB = new System.Windows.Forms.RichTextBox(); - this.MT_Price = new System.Windows.Forms.MaskedTextBox(); - this.NUD_UseEffect = new System.Windows.Forms.NumericUpDown(); - this.L_UseEffect = new System.Windows.Forms.Label(); - this.L_Buy = new System.Windows.Forms.Label(); - this.L_Feedback = new System.Windows.Forms.Label(); - this.L_Sell = new System.Windows.Forms.Label(); - this.MT_Sell = new System.Windows.Forms.MaskedTextBox(); this.L_Index = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_UseEffect)).BeginInit(); + this.Grid = new System.Windows.Forms.PropertyGrid(); this.SuspendLayout(); // // CB_Item // + this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item.DropDownWidth = 120; this.CB_Item.FormattingEnabled = true; this.CB_Item.Location = new System.Drawing.Point(71, 10); this.CB_Item.Name = "CB_Item"; - this.CB_Item.Size = new System.Drawing.Size(129, 21); + this.CB_Item.Size = new System.Drawing.Size(144, 21); this.CB_Item.TabIndex = 1; this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry); // // L_Item // - this.L_Item.AutoSize = true; - this.L_Item.Location = new System.Drawing.Point(33, 13); + this.L_Item.Location = new System.Drawing.Point(12, 10); this.L_Item.Name = "L_Item"; - this.L_Item.Size = new System.Drawing.Size(30, 13); + this.L_Item.Size = new System.Drawing.Size(51, 21); this.L_Item.TabIndex = 2; this.L_Item.Text = "Item:"; this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -66,116 +60,50 @@ private void InitializeComponent() // this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.RTB.Location = new System.Drawing.Point(12, 124); + this.RTB.Location = new System.Drawing.Point(11, 37); this.RTB.Name = "RTB"; this.RTB.ReadOnly = true; this.RTB.Size = new System.Drawing.Size(316, 51); this.RTB.TabIndex = 38; this.RTB.Text = ""; // - // MT_Price - // - this.MT_Price.Location = new System.Drawing.Point(163, 37); - this.MT_Price.Mask = "00000"; - this.MT_Price.Name = "MT_Price"; - this.MT_Price.Size = new System.Drawing.Size(37, 20); - this.MT_Price.TabIndex = 39; - this.MT_Price.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MT_Price.TextChanged += new System.EventHandler(this.changePrice); - // - // NUD_UseEffect - // - this.NUD_UseEffect.Location = new System.Drawing.Point(165, 82); - this.NUD_UseEffect.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_UseEffect.Name = "NUD_UseEffect"; - this.NUD_UseEffect.Size = new System.Drawing.Size(35, 20); - this.NUD_UseEffect.TabIndex = 40; - // - // L_UseEffect - // - this.L_UseEffect.AutoSize = true; - this.L_UseEffect.Location = new System.Drawing.Point(97, 84); - this.L_UseEffect.Name = "L_UseEffect"; - this.L_UseEffect.Size = new System.Drawing.Size(60, 13); - this.L_UseEffect.TabIndex = 41; - this.L_UseEffect.Text = "Use Effect:"; - // - // L_Buy - // - this.L_Buy.AutoSize = true; - this.L_Buy.Location = new System.Drawing.Point(75, 40); - this.L_Buy.Name = "L_Buy"; - this.L_Buy.Size = new System.Drawing.Size(82, 13); - this.L_Buy.TabIndex = 42; - this.L_Buy.Text = "Purchase Price:"; - // - // L_Feedback - // - this.L_Feedback.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.L_Feedback.AutoSize = true; - this.L_Feedback.Location = new System.Drawing.Point(32, 108); - this.L_Feedback.Name = "L_Feedback"; - this.L_Feedback.Size = new System.Drawing.Size(274, 13); - this.L_Feedback.TabIndex = 43; - this.L_Feedback.Text = "Please give feedback on what is actually needed to edit."; - // - // L_Sell - // - this.L_Sell.AutoSize = true; - this.L_Sell.Location = new System.Drawing.Point(103, 61); - this.L_Sell.Name = "L_Sell"; - this.L_Sell.Size = new System.Drawing.Size(54, 13); - this.L_Sell.TabIndex = 44; - this.L_Sell.Text = "Sell Price:"; - // - // MT_Sell - // - this.MT_Sell.Enabled = false; - this.MT_Sell.Location = new System.Drawing.Point(163, 58); - this.MT_Sell.Mask = "00000"; - this.MT_Sell.Name = "MT_Sell"; - this.MT_Sell.Size = new System.Drawing.Size(37, 20); - this.MT_Sell.TabIndex = 45; - this.MT_Sell.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // // L_Index // this.L_Index.AutoSize = true; - this.L_Index.Location = new System.Drawing.Point(206, 13); + this.L_Index.Location = new System.Drawing.Point(221, 14); this.L_Index.Name = "L_Index"; this.L_Index.Size = new System.Drawing.Size(39, 13); this.L_Index.TabIndex = 46; this.L_Index.Text = "Index: "; // + // Grid + // + this.Grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Grid.LineColor = System.Drawing.SystemColors.ControlDark; + this.Grid.Location = new System.Drawing.Point(12, 94); + this.Grid.Name = "Grid"; + this.Grid.Size = new System.Drawing.Size(316, 280); + this.Grid.TabIndex = 47; + // // ItemEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(339, 182); + this.ClientSize = new System.Drawing.Size(339, 381); + this.Controls.Add(this.Grid); this.Controls.Add(this.L_Index); - this.Controls.Add(this.MT_Sell); - this.Controls.Add(this.L_Sell); - this.Controls.Add(this.L_Feedback); - this.Controls.Add(this.L_Buy); - this.Controls.Add(this.L_UseEffect); - this.Controls.Add(this.NUD_UseEffect); - this.Controls.Add(this.MT_Price); this.Controls.Add(this.RTB); this.Controls.Add(this.L_Item); this.Controls.Add(this.CB_Item); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(355, 420); - this.MinimumSize = new System.Drawing.Size(355, 220); + this.MaximumSize = new System.Drawing.Size(355, 1000); + this.MinimumSize = new System.Drawing.Size(355, 420); this.Name = "ItemEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Item Editor"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); - ((System.ComponentModel.ISupportInitialize)(this.NUD_UseEffect)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -186,13 +114,7 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Item; private System.Windows.Forms.Label L_Item; private System.Windows.Forms.RichTextBox RTB; - private System.Windows.Forms.MaskedTextBox MT_Price; - private System.Windows.Forms.NumericUpDown NUD_UseEffect; - private System.Windows.Forms.Label L_UseEffect; - private System.Windows.Forms.Label L_Buy; - private System.Windows.Forms.Label L_Feedback; - private System.Windows.Forms.Label L_Sell; - private System.Windows.Forms.MaskedTextBox MT_Sell; private System.Windows.Forms.Label L_Index; + private System.Windows.Forms.PropertyGrid Grid; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/ItemEditor7.cs b/pk3DS/Subforms/Gen7/ItemEditor7.cs index f3afa5d..e5fd05d 100644 --- a/pk3DS/Subforms/Gen7/ItemEditor7.cs +++ b/pk3DS/Subforms/Gen7/ItemEditor7.cs @@ -33,38 +33,28 @@ private void changeEntry(object sender, EventArgs e) { setEntry(); entry = CB_Item.SelectedIndex; - L_Index.Text = "Index: " + entry.ToString("000"); + L_Index.Text = $"Index: {entry:000}"; getEntry(); } private void getEntry() { if (entry < 1) return; item = new Item(files[entry]); + Grid.SelectedObject = item; RTB.Text = itemflavor[entry].Replace("\\n", Environment.NewLine); - MT_Price.Text = item.BuyPrice.ToString(); - NUD_UseEffect.Value = item.UseEffect; } private void setEntry() { if (entry < 1) return; - - item.Price = (ushort)(WinFormsUtil.ToInt32(MT_Price)/10); - item.UseEffect = (byte)(int)NUD_UseEffect.Value; - - files[entry] = item.Write(); + files[entry] = ((Item)Grid.SelectedObject).Write(); } private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); } - private void changePrice(object sender, EventArgs e) - { - MT_Sell.Text = (Math.Min(WinFormsUtil.ToUInt32(MT_Price) / 10, 0x7FFF) * 10 / 2).ToString(); - } - - private readonly byte[] ItemIconTableSignature = + private static readonly byte[] ItemIconTableSignature = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -72,7 +62,7 @@ private void changePrice(object sender, EventArgs e) 0x00, 0x01, 0x01, 0x00 }; - private int getItemMapOffset() + private static int getItemMapOffset() { if (Main.ExeFSPath == null) { WinFormsUtil.Alert("No exeFS code to load."); return -1; } string[] exefsFiles = Directory.GetFiles(Main.ExeFSPath);