mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 21:38:40 +00:00
Add bdsp poffin editor
The RAM is pretty dirty for unallocated poffins; slots that have never been filled will have junk with whatever the unallocated pointer was looking at. An empty poffin slot is just marked as FF, ignores the stats for that slot. Not sure on the naming, but Matt had a single Level 60 poffin -> must be Mild? Thus, all the names are -1 from the textfile array...
This commit is contained in:
parent
b34977d498
commit
be3af9fba9
14 changed files with 728 additions and 3 deletions
|
@ -0,0 +1,31 @@
|
|||
|
||||
scharfer Knursp
|
||||
scharf-herber Knursp
|
||||
scharf-süßer Knursp
|
||||
scharf-bitterer Knursp
|
||||
scharf-saurer Knursp
|
||||
herb-scharfer Knursp
|
||||
herber Knursp
|
||||
herb-süßer Knursp
|
||||
herb-bitterer Knursp
|
||||
herb-saurer Knursp
|
||||
süß-scharfer Knursp
|
||||
süß-herber Knursp
|
||||
süßer Knursp
|
||||
süß-bitterer Knursp
|
||||
süß-saurer Knursp
|
||||
bitter-scharfer Knursp
|
||||
bitter-herber Knursp
|
||||
bitter-süßer Knursp
|
||||
bitterer Knursp
|
||||
bitter-saurer Knursp
|
||||
sauer-scharfer Knursp
|
||||
sauer-herber Knursp
|
||||
sauer-süßer Knursp
|
||||
sauer-bitterer Knursp
|
||||
saurer Knursp
|
||||
reichhaltiger Knursp
|
||||
opulenter Knursp
|
||||
schlechter Knursp
|
||||
exquisiter Knursp
|
||||
sehr exquisiter Knursp
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Spicy Poffin
|
||||
Spicy-Dry Poffin
|
||||
Spicy-Sweet Poffin
|
||||
Spicy-Bitter Poffin
|
||||
Spicy-Sour Poffin
|
||||
Dry-Spicy Poffin
|
||||
Dry Poffin
|
||||
Dry-Sweet Poffin
|
||||
Dry-Bitter Poffin
|
||||
Dry-Sour Poffin
|
||||
Sweet-Spicy Poffin
|
||||
Sweet-Dry Poffin
|
||||
Sweet Poffin
|
||||
Sweet-Bitter Poffin
|
||||
Sweet-Sour Poffin
|
||||
Bitter-Spicy Poffin
|
||||
Bitter-Dry Poffin
|
||||
Bitter-Sweet Poffin
|
||||
Bitter Poffin
|
||||
Bitter-Sour Poffin
|
||||
Sour-Spicy Poffin
|
||||
Sour-Dry Poffin
|
||||
Sour-Sweet Poffin
|
||||
Sour-Bitter Poffin
|
||||
Sour Poffin
|
||||
Rich Poffin
|
||||
Overripe Poffin
|
||||
Foul Poffin
|
||||
Mild Poffin
|
||||
Super Mild Poffin
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Pokocho Picante
|
||||
Pokocho Picanseco
|
||||
Pokocho Picandulce
|
||||
Pokocho Picanamargo
|
||||
Pokocho Picanácido
|
||||
Pokocho Secopicante
|
||||
Pokocho Seco
|
||||
Pokocho Secodulce
|
||||
Pokocho Secoamargo
|
||||
Pokocho Secoácido
|
||||
Pokocho Dulcepicante
|
||||
Pokocho Dulceseco
|
||||
Pokocho Dulce
|
||||
Pokocho Dulceamargo
|
||||
Pokocho Dulceácido
|
||||
Pokocho Amarpicante
|
||||
Pokocho Amarseco
|
||||
Pokocho Amardulce
|
||||
Pokocho Amargo
|
||||
Pokocho Amarácido
|
||||
Pokocho Acidopicante
|
||||
Pokocho Acidoseco
|
||||
Pokocho Acidodulce
|
||||
Pokocho Acidoamargo
|
||||
Pokocho Ácido
|
||||
Pokocho Sustancioso
|
||||
Pokocho Pastoso
|
||||
Pokocho Chungo
|
||||
Pokocho Suave
|
||||
Pokocho Supersuave
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Poffin Épicé
|
||||
Poffin Épicé Âpre
|
||||
Poffin Épicé Sucré
|
||||
Poffin Épicé Amer
|
||||
Poffin Épicé Acide
|
||||
Poffin Âpre Épicé
|
||||
Poffin Âpre
|
||||
Poffin Âpre Sucré
|
||||
Poffin Âpre Amer
|
||||
Poffin Âpre Acide
|
||||
Poffin Sucré Épicé
|
||||
Poffin Sucré Âpre
|
||||
Poffin Sucré
|
||||
Poffin Sucré Amer
|
||||
Poffin Sucré Acide
|
||||
Poffin Amer Épicé
|
||||
Poffin Amer Âpre
|
||||
Poffin Amer Sucré
|
||||
Poffin Amer
|
||||
Poffin Amer Acide
|
||||
Poffin Acide Épicé
|
||||
Poffin Acide Âpre
|
||||
Poffin Acide Sucré
|
||||
Poffin Acide Amer
|
||||
Poffin Acide
|
||||
Poffin Nourrissant
|
||||
Poffin Écœurant
|
||||
Poffin Infect
|
||||
Poffin Doux
|
||||
Super Poffin Doux
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Poffin pepato
|
||||
Poffin pepato agro
|
||||
Poffin pepato dolce
|
||||
Poffin pepato amaro
|
||||
Poffin pepato aspro
|
||||
Poffin agro pepato
|
||||
Poffin agro
|
||||
Poffin agro dolce
|
||||
Poffin agro amaro
|
||||
Poffin agro aspro
|
||||
Poffin dolce pepato
|
||||
Poffin dolce agro
|
||||
Poffin dolce
|
||||
Poffin dolce amaro
|
||||
Poffin dolce aspro
|
||||
Poffin amaro pepato
|
||||
Poffin amaro agro
|
||||
Poffin amaro dolce
|
||||
Poffin amaro
|
||||
Poffin amaro aspro
|
||||
Poffin aspro pepato
|
||||
Poffin aspro agro
|
||||
Poffin aspro dolce
|
||||
Poffin aspro amaro
|
||||
Poffin aspro
|
||||
Poffin ricco
|
||||
Poffin pesante
|
||||
Poffin cattivo
|
||||
Poffin equilibrato
|
||||
Poffin superequilibrato
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
からいポフィン
|
||||
からしぶポフィン
|
||||
からあまポフィン
|
||||
からにがポフィン
|
||||
からすっぱポフィン
|
||||
しぶからポフィン
|
||||
しぶいポフィン
|
||||
しぶあまポフィン
|
||||
しぶにがポフィン
|
||||
しぶすっぱポフィン
|
||||
あまからポフィン
|
||||
あましぶポフィン
|
||||
あまいポフィン
|
||||
あまにがポフィン
|
||||
あまずっぱポフィン
|
||||
にがからポフィン
|
||||
にがしぶポフィン
|
||||
にがあまポフィン
|
||||
にがいポフィン
|
||||
にがすっぱポフィン
|
||||
すっぱからポフィン
|
||||
すっぱしぶポフィン
|
||||
すっぱあまポフィン
|
||||
すっぱにがポフィン
|
||||
すっぱいポフィン
|
||||
こってりポフィン
|
||||
くどいポフィン
|
||||
まずいポフィン
|
||||
まろやかポフィン
|
||||
ちょうまろやかポフィン
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
매운 포핀
|
||||
맵고 떫은 포핀
|
||||
매콤달콤 포핀
|
||||
맵고 쓴 포핀
|
||||
매콤새콤 포핀
|
||||
떫고 매운 포핀
|
||||
떫은 포핀
|
||||
떫고 단 포핀
|
||||
떫고 쓴 포핀
|
||||
떫고 신 포핀
|
||||
달콤매콤 포핀
|
||||
달고 떫은 포핀
|
||||
달콤한 포핀
|
||||
달고 쓴 포핀
|
||||
달콤새콤 포핀
|
||||
쓰고 매운 포핀
|
||||
쓰고 떫은 포핀
|
||||
쓰고 단 포핀
|
||||
쓴 포핀
|
||||
쓰고 신 포핀
|
||||
새콤매콤 포핀
|
||||
시고 떫은 포핀
|
||||
새콤달콤 포핀
|
||||
시고 쓴 포핀
|
||||
신 포핀
|
||||
진한 맛 포핀
|
||||
느끼한 포핀
|
||||
맛없는 포핀
|
||||
순한 맛 포핀
|
||||
정말 순한 맛 포핀
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
辣味宝芬
|
||||
辣涩宝芬
|
||||
辣甜宝芬
|
||||
辣苦宝芬
|
||||
辣酸宝芬
|
||||
涩辣宝芬
|
||||
涩味宝芬
|
||||
涩甜宝芬
|
||||
涩苦宝芬
|
||||
涩酸宝芬
|
||||
甜辣宝芬
|
||||
甜涩宝芬
|
||||
甜味宝芬
|
||||
甜苦宝芬
|
||||
甜酸宝芬
|
||||
苦辣宝芬
|
||||
苦涩宝芬
|
||||
苦甜宝芬
|
||||
苦味宝芬
|
||||
苦酸宝芬
|
||||
酸辣宝芬
|
||||
酸涩宝芬
|
||||
酸甜宝芬
|
||||
酸苦宝芬
|
||||
酸味宝芬
|
||||
浓厚宝芬
|
||||
腻口宝芬
|
||||
难吃宝芬
|
||||
香醇宝芬
|
||||
超香醇宝芬
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
辣味寶芬
|
||||
辣澀寶芬
|
||||
辣甜寶芬
|
||||
辣苦寶芬
|
||||
辣酸寶芬
|
||||
澀辣寶芬
|
||||
澀味寶芬
|
||||
澀甜寶芬
|
||||
澀苦寶芬
|
||||
澀酸寶芬
|
||||
甜辣寶芬
|
||||
甜澀寶芬
|
||||
甜味寶芬
|
||||
甜苦寶芬
|
||||
甜酸寶芬
|
||||
苦辣寶芬
|
||||
苦澀寶芬
|
||||
苦甜寶芬
|
||||
苦味寶芬
|
||||
苦酸寶芬
|
||||
酸辣寶芬
|
||||
酸澀寶芬
|
||||
酸甜寶芬
|
||||
酸苦寶芬
|
||||
酸味寶芬
|
||||
濃厚寶芬
|
||||
膩口寶芬
|
||||
難吃寶芬
|
||||
香醇寶芬
|
||||
超香醇寶芬
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -17,9 +19,67 @@ namespace PKHeX.Core
|
|||
// int CookingCount;
|
||||
|
||||
// 0x640 bytes of data is for poffins
|
||||
public const int COUNT_POFFIN = 50; // 100?
|
||||
public const int SIZE_POFFIN = 0x20;
|
||||
public const int COUNT_POFFIN = 100;
|
||||
|
||||
private int GetPoffinOffset(int index)
|
||||
{
|
||||
if ((uint)index >= COUNT_POFFIN)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
return Offset + (index * Poffin8b.SIZE);
|
||||
}
|
||||
|
||||
public Poffin8b GetPoffin(int index) => new(Data, GetPoffinOffset(index));
|
||||
public void SetPoffin(int index, Poffin8b poffin) => poffin.CopyTo(Data, GetPoffinOffset(index));
|
||||
public int CookingCount { get => BitConverter.ToInt32(Data, Offset + 0x640); set => BitConverter.GetBytes(value).CopyTo(Data, Offset + 0x640); }
|
||||
|
||||
public Poffin8b[] GetPoffins()
|
||||
{
|
||||
var result = new Poffin8b[COUNT_POFFIN];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = GetPoffin(i);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void SetPoffins(IReadOnlyCollection<Poffin8b> value)
|
||||
{
|
||||
if (value.Count != COUNT_POFFIN)
|
||||
throw new ArgumentOutOfRangeException(nameof(value.Count));
|
||||
var ordered = value.OrderBy(z => z.IsNull).ThenBy(z => z.IsNew);
|
||||
int ctr = 0;
|
||||
foreach (var p in ordered)
|
||||
SetPoffin(ctr++, p);
|
||||
}
|
||||
|
||||
public int CountPoffins() => GetPoffins().Count(z => z.IsNull);
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public sealed class Poffin8b
|
||||
{
|
||||
public const int SIZE = 0x10;
|
||||
|
||||
private readonly byte[] Data = new byte[SIZE];
|
||||
|
||||
public Poffin8b(byte[] data, int offset)
|
||||
{
|
||||
data.AsSpan(offset, SIZE).CopyTo(Data);
|
||||
}
|
||||
|
||||
public void Clear() => Data.AsSpan().Clear();
|
||||
public void CopyTo(byte[] data, int offset) => Data.CopyTo(data, offset);
|
||||
public void ToNull() => MstID = 0xFF;
|
||||
public bool IsNull => MstID == 0xFF;
|
||||
|
||||
public byte MstID { get => Data[0x00]; set => Data[0x00] = value; }
|
||||
public byte Level { get => Data[0x01]; set => Data[0x01] = value; }
|
||||
public byte Taste { get => Data[0x02]; set => Data[0x02] = value; } // Smoothness/feel of the Poffin => +sheen
|
||||
|
||||
public bool IsNew { get => BitConverter.ToUInt32(Data, 0x04) == 1; set => BitConverter.GetBytes(value ? 1u : 0u).CopyTo(Data, 0x04); }
|
||||
|
||||
public byte FlavorSpicy { get => Data[0x08]; set => Data[0x08] = value; }
|
||||
public byte FlavorDry { get => Data[0x09]; set => Data[0x09] = value; }
|
||||
public byte FlavorSweet { get => Data[0x0A]; set => Data[0x0A] = value; }
|
||||
public byte FlavorBitter { get => Data[0x0B]; set => Data[0x0B] = value; }
|
||||
public byte FlavorSour { get => Data[0x0C]; set => Data[0x0C] = value; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
this.TB_Secure1 = new System.Windows.Forms.TextBox();
|
||||
this.L_GameSync = new System.Windows.Forms.Label();
|
||||
this.TB_GameSync = new System.Windows.Forms.TextBox();
|
||||
this.B_Poffins = new System.Windows.Forms.Button();
|
||||
this.tabBoxMulti.SuspendLayout();
|
||||
this.Tab_Box.SuspendLayout();
|
||||
this.Tab_PartyBattle.SuspendLayout();
|
||||
|
@ -465,6 +466,7 @@
|
|||
this.FLP_SAVtools.Controls.Add(this.B_Blocks);
|
||||
this.FLP_SAVtools.Controls.Add(this.B_OtherSlots);
|
||||
this.FLP_SAVtools.Controls.Add(this.B_OpenSealStickers);
|
||||
this.FLP_SAVtools.Controls.Add(this.B_Poffins);
|
||||
this.FLP_SAVtools.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.FLP_SAVtools.Location = new System.Drawing.Point(3, 16);
|
||||
this.FLP_SAVtools.Name = "FLP_SAVtools";
|
||||
|
@ -876,6 +878,16 @@
|
|||
this.TB_GameSync.Text = "0000000000000000";
|
||||
this.TB_GameSync.Validated += new System.EventHandler(this.UpdateStringSeed);
|
||||
//
|
||||
// B_Poffins
|
||||
//
|
||||
this.B_Poffins.Location = new System.Drawing.Point(96, 235);
|
||||
this.B_Poffins.Name = "B_Poffins";
|
||||
this.B_Poffins.Size = new System.Drawing.Size(87, 23);
|
||||
this.B_Poffins.TabIndex = 6;
|
||||
this.B_Poffins.Text = "Poffins";
|
||||
this.B_Poffins.UseVisualStyleBackColor = true;
|
||||
this.B_Poffins.Click += new System.EventHandler(this.B_Poffins_Click);
|
||||
//
|
||||
// SAVEditor
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
|
@ -972,5 +984,6 @@
|
|||
private System.Windows.Forms.Button Menu_ExportBAK;
|
||||
private System.Windows.Forms.FlowLayoutPanel FLP_SAVToolsMisc;
|
||||
private System.Windows.Forms.Button B_OpenSealStickers;
|
||||
private System.Windows.Forms.Button B_Poffins;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1085,7 +1085,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
B_OpenHoneyTreeEditor.Visible = sav is SAV4Sinnoh;
|
||||
B_OpenUGSEditor.Visible = sav is SAV4Sinnoh or SAV8BS;
|
||||
B_OpenSealStickers.Visible = sav is SAV8BS;
|
||||
B_OpenSealStickers.Visible = B_Poffins.Visible = sav is SAV8BS;
|
||||
B_OpenApricorn.Visible = sav is SAV4HGSS;
|
||||
B_OpenRTCEditor.Visible = sav.Generation == 2 || sav is IGen3Hoenn;
|
||||
B_MailBox.Visible = sav is SAV2 or SAV3 or SAV4 or SAV5;
|
||||
|
@ -1200,6 +1200,14 @@ namespace PKHeX.WinForms.Controls
|
|||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void B_Poffins_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (SAV is not SAV8BS bs)
|
||||
return;
|
||||
using var form = new SAV_Poffin8b(bs);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void B_FestivalPlaza_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (SAV is not SAV7 s)
|
||||
|
|
132
PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Poffin8b.Designer.cs
generated
Normal file
132
PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Poffin8b.Designer.cs
generated
Normal file
|
@ -0,0 +1,132 @@
|
|||
namespace PKHeX.WinForms
|
||||
{
|
||||
partial class SAV_Poffin8b
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dgv = new System.Windows.Forms.DataGridView();
|
||||
this.B_Save = new System.Windows.Forms.Button();
|
||||
this.B_Cancel = new System.Windows.Forms.Button();
|
||||
this.B_All = new System.Windows.Forms.Button();
|
||||
this.B_None = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dgv
|
||||
//
|
||||
this.dgv.AllowUserToAddRows = false;
|
||||
this.dgv.AllowUserToDeleteRows = false;
|
||||
this.dgv.AllowUserToResizeColumns = false;
|
||||
this.dgv.AllowUserToResizeRows = false;
|
||||
this.dgv.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.dgv.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.dgv.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||
this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgv.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
|
||||
this.dgv.Location = new System.Drawing.Point(12, 43);
|
||||
this.dgv.MultiSelect = false;
|
||||
this.dgv.Name = "dgv";
|
||||
this.dgv.RowHeadersVisible = false;
|
||||
this.dgv.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
|
||||
this.dgv.ShowEditingIcon = false;
|
||||
this.dgv.Size = new System.Drawing.Size(568, 395);
|
||||
this.dgv.TabIndex = 11;
|
||||
//
|
||||
// B_Save
|
||||
//
|
||||
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Save.Location = new System.Drawing.Point(530, 444);
|
||||
this.B_Save.Name = "B_Save";
|
||||
this.B_Save.Size = new System.Drawing.Size(50, 23);
|
||||
this.B_Save.TabIndex = 12;
|
||||
this.B_Save.Text = "Save";
|
||||
this.B_Save.UseVisualStyleBackColor = true;
|
||||
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
|
||||
//
|
||||
// B_Cancel
|
||||
//
|
||||
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Cancel.Location = new System.Drawing.Point(474, 444);
|
||||
this.B_Cancel.Name = "B_Cancel";
|
||||
this.B_Cancel.Size = new System.Drawing.Size(50, 23);
|
||||
this.B_Cancel.TabIndex = 13;
|
||||
this.B_Cancel.Text = "Cancel";
|
||||
this.B_Cancel.UseVisualStyleBackColor = true;
|
||||
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
|
||||
//
|
||||
// B_All
|
||||
//
|
||||
this.B_All.Location = new System.Drawing.Point(12, 14);
|
||||
this.B_All.Name = "B_All";
|
||||
this.B_All.Size = new System.Drawing.Size(60, 23);
|
||||
this.B_All.TabIndex = 14;
|
||||
this.B_All.Text = "All";
|
||||
this.B_All.UseVisualStyleBackColor = true;
|
||||
this.B_All.Click += new System.EventHandler(this.B_All_Click);
|
||||
//
|
||||
// B_None
|
||||
//
|
||||
this.B_None.Location = new System.Drawing.Point(82, 14);
|
||||
this.B_None.Name = "B_None";
|
||||
this.B_None.Size = new System.Drawing.Size(60, 23);
|
||||
this.B_None.TabIndex = 16;
|
||||
this.B_None.Text = "None";
|
||||
this.B_None.UseVisualStyleBackColor = true;
|
||||
this.B_None.Click += new System.EventHandler(this.B_None_Click);
|
||||
//
|
||||
// SAV_Poffin8b
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(592, 481);
|
||||
this.Controls.Add(this.B_None);
|
||||
this.Controls.Add(this.B_All);
|
||||
this.Controls.Add(this.B_Cancel);
|
||||
this.Controls.Add(this.B_Save);
|
||||
this.Controls.Add(this.dgv);
|
||||
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SAV_Poffin8b";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Poffin Editor";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dgv;
|
||||
private System.Windows.Forms.Button B_Save;
|
||||
private System.Windows.Forms.Button B_Cancel;
|
||||
private System.Windows.Forms.Button B_All;
|
||||
private System.Windows.Forms.Button B_None;
|
||||
}
|
||||
}
|
233
PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Poffin8b.cs
Normal file
233
PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Poffin8b.cs
Normal file
|
@ -0,0 +1,233 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
|
||||
namespace PKHeX.WinForms
|
||||
{
|
||||
public partial class SAV_Poffin8b : Form
|
||||
{
|
||||
private readonly SAV8BS SAV;
|
||||
private readonly IReadOnlyList<Poffin8b> AllItems;
|
||||
|
||||
private readonly string[] ItemNames = Util.GetStringList("poffin8b", Main.CurrentLanguage);
|
||||
|
||||
public SAV_Poffin8b(SAV8BS sav)
|
||||
{
|
||||
InitializeComponent();
|
||||
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
||||
SAV = sav;
|
||||
|
||||
ItemNames[0] = GameInfo.Strings.Item[0];
|
||||
AllItems = SAV.Poffins.GetPoffins();
|
||||
Setup(PoffinSaveData8b.COUNT_POFFIN);
|
||||
LoadItems(AllItems);
|
||||
}
|
||||
|
||||
private void Setup(int rowCount)
|
||||
{
|
||||
dgv.Rows.Clear();
|
||||
dgv.Columns.Clear();
|
||||
|
||||
var cIndex = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "ID",
|
||||
DisplayIndex = 0,
|
||||
Width = 40,
|
||||
ReadOnly = true,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cType = new DataGridViewComboBoxColumn
|
||||
{
|
||||
HeaderText = "Type",
|
||||
DisplayIndex = 1,
|
||||
Width = 120,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
};
|
||||
|
||||
var cLevel = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Level",
|
||||
DisplayIndex = 2,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cTaste = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Taste",
|
||||
DisplayIndex = 3,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cNew = new DataGridViewCheckBoxColumn
|
||||
{
|
||||
HeaderText = "New",
|
||||
DisplayIndex = 4,
|
||||
Width = 35,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cF1 = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Spicy",
|
||||
DisplayIndex = 5,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cF2 = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Dry",
|
||||
DisplayIndex = 6,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cF3 = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Sweet",
|
||||
DisplayIndex = 7,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cF4 = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Bitter",
|
||||
DisplayIndex = 8,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
var cF5 = new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = "Sour",
|
||||
DisplayIndex = 9,
|
||||
Width = 50,
|
||||
SortMode = DataGridViewColumnSortMode.Automatic,
|
||||
};
|
||||
|
||||
cIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cType.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cLevel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cTaste.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
|
||||
cF1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cF2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cF3.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cF4.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
cF5.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
|
||||
dgv.Columns.Add(cIndex);
|
||||
dgv.Columns.Add(cType);
|
||||
dgv.Columns.Add(cLevel);
|
||||
dgv.Columns.Add(cTaste);
|
||||
dgv.Columns.Add(cNew);
|
||||
dgv.Columns.Add(cF1);
|
||||
dgv.Columns.Add(cF2);
|
||||
dgv.Columns.Add(cF3);
|
||||
dgv.Columns.Add(cF4);
|
||||
dgv.Columns.Add(cF5);
|
||||
|
||||
cType.Items.AddRange(ItemNames);
|
||||
|
||||
dgv.Rows.Add(rowCount);
|
||||
}
|
||||
|
||||
private void LoadItems(IReadOnlyList<Poffin8b> items)
|
||||
{
|
||||
for (var i = 0; i < items.Count; i++)
|
||||
{
|
||||
var item = items[i];
|
||||
var cells = dgv.Rows[i].Cells;
|
||||
cells[0].Value = i.ToString("000");
|
||||
cells[1].Value = GetPoffinName(item.MstID);
|
||||
cells[2].Value = item.Level.ToString();
|
||||
cells[3].Value = item.Taste.ToString();
|
||||
cells[4].Value = item.IsNew;
|
||||
cells[5].Value = item.FlavorSpicy.ToString();
|
||||
cells[6].Value = item.FlavorDry.ToString();
|
||||
cells[7].Value = item.FlavorSweet.ToString();
|
||||
cells[8].Value = item.FlavorBitter.ToString();
|
||||
cells[9].Value = item.FlavorSour.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPoffinName(byte itemMstId)
|
||||
{
|
||||
var index = (int)(byte)(itemMstId + 1);
|
||||
var strings = ItemNames;
|
||||
if ((uint)index >= strings.Length)
|
||||
index = 0;
|
||||
return ItemNames[index];
|
||||
}
|
||||
|
||||
private byte SetPoffinName(string value)
|
||||
{
|
||||
var index = Array.IndexOf(ItemNames, value);
|
||||
if (index != -1)
|
||||
return (byte)(index - 1);
|
||||
return unchecked((byte)-1);
|
||||
}
|
||||
|
||||
private void SaveItems(IReadOnlyList<Poffin8b> items)
|
||||
{
|
||||
for (int rowIndex = 0; rowIndex < dgv.Rows.Count; rowIndex++)
|
||||
{
|
||||
var cells = dgv.Rows[rowIndex].Cells;
|
||||
var index = int.Parse(cells[0].Value?.ToString() ?? "0");
|
||||
var item = items[index];
|
||||
|
||||
item.MstID = SetPoffinName(cells[1].Value?.ToString() ?? "");
|
||||
item.Level = Parse(cells[2]);
|
||||
item.Taste = Parse(cells[3]);
|
||||
item.IsNew = (bool)cells[4].Value;
|
||||
item.FlavorSpicy = Parse(cells[5]);
|
||||
item.FlavorDry = Parse(cells[6]);
|
||||
item.FlavorSweet = Parse(cells[7]);
|
||||
item.FlavorBitter = Parse(cells[8]);
|
||||
item.FlavorSour = Parse(cells[9]);
|
||||
|
||||
static byte Parse(DataGridViewCell c) => (byte)(byte.TryParse(c.Value.ToString(), out var p) ? p : 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_All_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var poffin in AllItems)
|
||||
{
|
||||
poffin.MstID = 0x1C;
|
||||
poffin.Level = 60;
|
||||
poffin.Taste = 0xFF;
|
||||
poffin.FlavorSpicy = poffin.FlavorBitter = poffin.FlavorDry = poffin.FlavorSour = poffin.FlavorSweet = 0xFF;
|
||||
}
|
||||
LoadItems(AllItems);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_None_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var poffin in AllItems)
|
||||
poffin.ToNull();
|
||||
LoadItems(AllItems);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveItems(AllItems);
|
||||
SAV.Poffins.SetPoffins(AllItems);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue