mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
update FestaPlazaEditor
I think the form contains almost all controls that needed.
This commit is contained in:
parent
4bbe586981
commit
c3716440e6
|
|
@ -86,10 +86,18 @@ private void InitializeComponent()
|
|||
this.NUD_MyMessageMeet = new System.Windows.Forms.NumericUpDown();
|
||||
this.TC_Editor = new System.Windows.Forms.TabControl();
|
||||
this.Tab_Overview = new System.Windows.Forms.TabPage();
|
||||
this.L_PlazaName = new System.Windows.Forms.Label();
|
||||
this.TB_PlazaName = new System.Windows.Forms.TextBox();
|
||||
this.L_RankFC = new System.Windows.Forms.Label();
|
||||
this.Tab_Unlock = new System.Windows.Forms.TabPage();
|
||||
this.Tab_Facility = new System.Windows.Forms.TabPage();
|
||||
this.Tab_BattleAgency = new System.Windows.Forms.TabPage();
|
||||
this.NUD_Trainer3 = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_Trainer2 = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_Trainer1 = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_DefeatMon = new System.Windows.Forms.Label();
|
||||
this.NUD_DefeatMon = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_Note = new System.Windows.Forms.Label();
|
||||
this.L_Defeated = new System.Windows.Forms.Label();
|
||||
this.NUD_Defeated = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_Grade = new System.Windows.Forms.NumericUpDown();
|
||||
|
|
@ -103,7 +111,6 @@ private void InitializeComponent()
|
|||
this.GB_Others = new System.Windows.Forms.GroupBox();
|
||||
this.ppkx3 = new System.Windows.Forms.PictureBox();
|
||||
this.ppkx2 = new System.Windows.Forms.PictureBox();
|
||||
this.L_Note = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_FC_Current)).BeginInit();
|
||||
this.GB_FC.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_FC_Used)).BeginInit();
|
||||
|
|
@ -125,6 +132,10 @@ private void InitializeComponent()
|
|||
this.Tab_Unlock.SuspendLayout();
|
||||
this.Tab_Facility.SuspendLayout();
|
||||
this.Tab_BattleAgency.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer3)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_DefeatMon)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Defeated)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Grade)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ppkx1)).BeginInit();
|
||||
|
|
@ -805,6 +816,8 @@ private void InitializeComponent()
|
|||
//
|
||||
// Tab_Overview
|
||||
//
|
||||
this.Tab_Overview.Controls.Add(this.L_PlazaName);
|
||||
this.Tab_Overview.Controls.Add(this.TB_PlazaName);
|
||||
this.Tab_Overview.Controls.Add(this.L_RankFC);
|
||||
this.Tab_Overview.Controls.Add(this.GB_FC);
|
||||
this.Tab_Overview.Controls.Add(this.GB_MyMessage);
|
||||
|
|
@ -819,6 +832,26 @@ private void InitializeComponent()
|
|||
this.Tab_Overview.Text = "Overview";
|
||||
this.Tab_Overview.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// L_PlazaName
|
||||
//
|
||||
this.L_PlazaName.AutoSize = true;
|
||||
this.L_PlazaName.Location = new System.Drawing.Point(9, 142);
|
||||
this.L_PlazaName.Name = "L_PlazaName";
|
||||
this.L_PlazaName.Size = new System.Drawing.Size(112, 12);
|
||||
this.L_PlazaName.TabIndex = 64;
|
||||
this.L_PlazaName.Text = "Festival Plaza Name:";
|
||||
this.L_PlazaName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// 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(12, 160);
|
||||
this.TB_PlazaName.MaxLength = 20;
|
||||
this.TB_PlazaName.Name = "TB_PlazaName";
|
||||
this.TB_PlazaName.Size = new System.Drawing.Size(159, 20);
|
||||
this.TB_PlazaName.TabIndex = 63;
|
||||
this.TB_PlazaName.Text = "WWWWWWWWWWWWWWWWWWWW";
|
||||
//
|
||||
// L_RankFC
|
||||
//
|
||||
this.L_RankFC.Location = new System.Drawing.Point(117, 111);
|
||||
|
|
@ -873,6 +906,11 @@ private void InitializeComponent()
|
|||
//
|
||||
// Tab_BattleAgency
|
||||
//
|
||||
this.Tab_BattleAgency.Controls.Add(this.NUD_Trainer3);
|
||||
this.Tab_BattleAgency.Controls.Add(this.NUD_Trainer2);
|
||||
this.Tab_BattleAgency.Controls.Add(this.NUD_Trainer1);
|
||||
this.Tab_BattleAgency.Controls.Add(this.L_DefeatMon);
|
||||
this.Tab_BattleAgency.Controls.Add(this.NUD_DefeatMon);
|
||||
this.Tab_BattleAgency.Controls.Add(this.L_Note);
|
||||
this.Tab_BattleAgency.Controls.Add(this.L_Defeated);
|
||||
this.Tab_BattleAgency.Controls.Add(this.NUD_Defeated);
|
||||
|
|
@ -890,13 +928,99 @@ private void InitializeComponent()
|
|||
this.Tab_BattleAgency.Text = "BattleAgency";
|
||||
this.Tab_BattleAgency.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// NUD_Trainer3
|
||||
//
|
||||
this.NUD_Trainer3.Location = new System.Drawing.Point(391, 93);
|
||||
this.NUD_Trainer3.Maximum = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Trainer3.Name = "NUD_Trainer3";
|
||||
this.NUD_Trainer3.Size = new System.Drawing.Size(43, 19);
|
||||
this.NUD_Trainer3.TabIndex = 18;
|
||||
this.NUD_Trainer3.Value = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NUD_Trainer2
|
||||
//
|
||||
this.NUD_Trainer2.Location = new System.Drawing.Point(342, 93);
|
||||
this.NUD_Trainer2.Maximum = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Trainer2.Name = "NUD_Trainer2";
|
||||
this.NUD_Trainer2.Size = new System.Drawing.Size(43, 19);
|
||||
this.NUD_Trainer2.TabIndex = 17;
|
||||
this.NUD_Trainer2.Value = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NUD_Trainer1
|
||||
//
|
||||
this.NUD_Trainer1.Location = new System.Drawing.Point(293, 93);
|
||||
this.NUD_Trainer1.Maximum = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Trainer1.Name = "NUD_Trainer1";
|
||||
this.NUD_Trainer1.Size = new System.Drawing.Size(43, 19);
|
||||
this.NUD_Trainer1.TabIndex = 16;
|
||||
this.NUD_Trainer1.Value = new decimal(new int[] {
|
||||
210,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// L_DefeatMon
|
||||
//
|
||||
this.L_DefeatMon.Location = new System.Drawing.Point(179, 64);
|
||||
this.L_DefeatMon.Name = "L_DefeatMon";
|
||||
this.L_DefeatMon.Size = new System.Drawing.Size(195, 18);
|
||||
this.L_DefeatMon.TabIndex = 15;
|
||||
this.L_DefeatMon.Text = "Today\'s Defeated Pokemon Count:";
|
||||
this.L_DefeatMon.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_DefeatMon
|
||||
//
|
||||
this.NUD_DefeatMon.Location = new System.Drawing.Point(380, 65);
|
||||
this.NUD_DefeatMon.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_DefeatMon.Name = "NUD_DefeatMon";
|
||||
this.NUD_DefeatMon.Size = new System.Drawing.Size(54, 19);
|
||||
this.NUD_DefeatMon.TabIndex = 14;
|
||||
this.NUD_DefeatMon.Value = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// L_Note
|
||||
//
|
||||
this.L_Note.Location = new System.Drawing.Point(159, 92);
|
||||
this.L_Note.Name = "L_Note";
|
||||
this.L_Note.Size = new System.Drawing.Size(128, 36);
|
||||
this.L_Note.TabIndex = 13;
|
||||
this.L_Note.Text = "Upcoming 3 Trainers:\r\n(210: unset) ";
|
||||
this.L_Note.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// L_Defeated
|
||||
//
|
||||
this.L_Defeated.Location = new System.Drawing.Point(203, 36);
|
||||
this.L_Defeated.Location = new System.Drawing.Point(165, 36);
|
||||
this.L_Defeated.Name = "L_Defeated";
|
||||
this.L_Defeated.Size = new System.Drawing.Size(184, 18);
|
||||
this.L_Defeated.Size = new System.Drawing.Size(222, 18);
|
||||
this.L_Defeated.TabIndex = 12;
|
||||
this.L_Defeated.Text = "Current Defeated Trainer Count:";
|
||||
this.L_Defeated.Text = "Defeated Trainer Count for Next Grade:";
|
||||
this.L_Defeated.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Defeated
|
||||
|
|
@ -988,7 +1112,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// B_ImportParty
|
||||
//
|
||||
this.B_ImportParty.Location = new System.Drawing.Point(76, 92);
|
||||
this.B_ImportParty.Location = new System.Drawing.Point(76, 134);
|
||||
this.B_ImportParty.Name = "B_ImportParty";
|
||||
this.B_ImportParty.Size = new System.Drawing.Size(122, 23);
|
||||
this.B_ImportParty.TabIndex = 7;
|
||||
|
|
@ -1029,16 +1153,6 @@ private void InitializeComponent()
|
|||
this.ppkx2.TabIndex = 4;
|
||||
this.ppkx2.TabStop = false;
|
||||
//
|
||||
// L_Note
|
||||
//
|
||||
this.L_Note.Location = new System.Drawing.Point(162, 147);
|
||||
this.L_Note.Name = "L_Note";
|
||||
this.L_Note.Size = new System.Drawing.Size(275, 36);
|
||||
this.L_Note.TabIndex = 13;
|
||||
this.L_Note.Text = "NOTE: If you edit the Grade from <50 to 50,\r\n it is recommended that the Defeated" +
|
||||
" Count = 0";
|
||||
this.L_Note.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// SAV_FestivalPlaza
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
|
@ -1072,11 +1186,16 @@ private void InitializeComponent()
|
|||
((System.ComponentModel.ISupportInitialize)(this.NUD_MyMessageMeet)).EndInit();
|
||||
this.TC_Editor.ResumeLayout(false);
|
||||
this.Tab_Overview.ResumeLayout(false);
|
||||
this.Tab_Overview.PerformLayout();
|
||||
this.Tab_Unlock.ResumeLayout(false);
|
||||
this.Tab_Facility.ResumeLayout(false);
|
||||
this.Tab_Facility.PerformLayout();
|
||||
this.Tab_BattleAgency.ResumeLayout(false);
|
||||
this.Tab_BattleAgency.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer3)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Trainer1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_DefeatMon)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Defeated)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Grade)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ppkx1)).EndInit();
|
||||
|
|
@ -1165,5 +1284,12 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label L_Defeated;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Defeated;
|
||||
private System.Windows.Forms.Label L_Note;
|
||||
private System.Windows.Forms.Label L_DefeatMon;
|
||||
private System.Windows.Forms.NumericUpDown NUD_DefeatMon;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Trainer3;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Trainer2;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Trainer1;
|
||||
private System.Windows.Forms.Label L_PlazaName;
|
||||
private System.Windows.Forms.TextBox TB_PlazaName;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ public SAV_FestivalPlaza(SaveFile sav)
|
|||
if (SAV.USUM)
|
||||
{
|
||||
PBs = new[] { ppkx1, ppkx2, ppkx3 };
|
||||
NUD_Trainers = new[] { NUD_Trainer1, NUD_Trainer2, NUD_Trainer3 };
|
||||
LoadBattleAgency();
|
||||
}
|
||||
else
|
||||
|
|
@ -127,9 +128,9 @@ public SAV_FestivalPlaza(SaveFile sav)
|
|||
|
||||
NUD_Rank.Value = SAV.FestaRank;
|
||||
LoadRankLabel(SAV.FestaRank);
|
||||
NUDs = new[] { NUD_MyMessageMeet, NUD_MyMessagePart, NUD_MyMessageMoved, NUD_MyMessageDissapointed };
|
||||
for (int i = 0; i < NUDs.Length; i++)
|
||||
NUDs[i].Value = SAV.GetFestaMessage(i);
|
||||
NUD_Messages = new[] { NUD_MyMessageMeet, NUD_MyMessagePart, NUD_MyMessageMoved, NUD_MyMessageDissapointed };
|
||||
for (int i = 0; i < NUD_Messages.Length; i++)
|
||||
NUD_Messages[i].Value = SAV.GetFestaMessage(i);
|
||||
|
||||
LB_FacilityIndex.SelectedIndex = 0;
|
||||
CB_FacilityMessage.SelectedIndex = 0;
|
||||
|
|
@ -240,7 +241,7 @@ private void LoadBattleAgency()
|
|||
LoadPictureBox();
|
||||
B_ImportParty.Visible = SAV.HasParty;
|
||||
CHK_Choosed.Checked = SAV.GetFlag(0x6C55E, 1);
|
||||
CHK_TrainerInvited.Checked = BitConverter.ToUInt16(SAV.GetData(0x6C3EE, 2), 0) == 0x7FFF && BitConverter.ToUInt16(SAV.GetData(0x6C526, 2), 0) == 0x7FFF;
|
||||
CHK_TrainerInvited.Checked = IsTrainerInvited();
|
||||
ushort valus = BitConverter.ToUInt16(SAV.GetData(0x6C55C, 2), 0);
|
||||
int grade = valus >> 6 & 0x3F;
|
||||
NUD_Grade.Value = grade;
|
||||
|
|
@ -248,24 +249,42 @@ private void LoadBattleAgency()
|
|||
int defeated = valus >> 12;
|
||||
NUD_Defeated.Value = defeated > max ? max : defeated;
|
||||
NUD_Defeated.Maximum = max;
|
||||
NUD_DefeatMon.Value = BitConverter.ToUInt16(SAV.GetData(0x6C558, 2), 0);
|
||||
for (int i = 0, j, m; i < NUD_Trainers.Length; i++)
|
||||
{
|
||||
j = GetSavData16(0x6C56C + 0x14 * i);
|
||||
m = (int)NUD_Trainers[i].Maximum;
|
||||
NUD_Trainers[i].Value = j < 0 || j > m ? m : j;
|
||||
}
|
||||
TB_PlazaName.Text = SAV.FestivalPlazaName;
|
||||
}
|
||||
private void LoadPictureBox()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
PBs[i].Image = p[i].Sprite(SAV, -1, -1, flagIllegal: true);
|
||||
}
|
||||
private readonly NumericUpDown[] NUD_Trainers = new NumericUpDown[3];
|
||||
private ushort GetSavData16(int Offset) => BitConverter.ToUInt16(SAV.GetData(Offset, 2), 0);
|
||||
private readonly ushort InvitedValue = 0x7DFF;
|
||||
private readonly PKM[] p = new PKM[3];
|
||||
private readonly PictureBox[] PBs = new PictureBox[3];
|
||||
private bool IsTrainerInvited() => (GetSavData16(0x6C3EE) & InvitedValue) == InvitedValue && (GetSavData16(0x6C526) & InvitedValue) == InvitedValue;
|
||||
private void SaveBattleAgency()
|
||||
{
|
||||
SAV.SetFlag(0x6C55E, 1, CHK_Choosed.Checked);
|
||||
byte[] TrainerInvited = BitConverter.GetBytes((ushort)(CHK_TrainerInvited.Checked ? 0x7FFF : 0));
|
||||
SAV.SetData(TrainerInvited, 0x6C3EE);
|
||||
SAV.SetData(TrainerInvited, 0x6C526);
|
||||
if (IsTrainerInvited() ^ CHK_TrainerInvited.Checked)
|
||||
{
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)(CHK_TrainerInvited.Checked ? GetSavData16(0x6C3EE) | InvitedValue : 0)), 0x6C3EE);
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)(CHK_TrainerInvited.Checked ? GetSavData16(0x6C526) | InvitedValue : 0)), 0x6C526);
|
||||
}
|
||||
SAV.SetData(p[0].EncryptedBoxData, 0x6C200);
|
||||
SAV.SetData(p[1].EncryptedPartyData, 0x6C2E8);
|
||||
SAV.SetData(p[2].EncryptedPartyData, 0x6C420);
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)(((int)NUD_Defeated.Value & 0xF) << 12 | ((int)NUD_Grade.Value & 0x3F) << 6)), 0x6C55C);
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)(((int)NUD_Defeated.Value & 0xF) << 12 | ((int)NUD_Grade.Value & 0x3F) << 6 | SAV.Data[0x6C55C] & 0x3F)), 0x6C55C);
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)NUD_DefeatMon.Value), 0x6C558);
|
||||
for (int i = 0; i < NUD_Trainers.Length; i++)
|
||||
SAV.SetData(BitConverter.GetBytes((ushort)NUD_Trainers[i].Value), 0x6C56C + 0x14 * i);
|
||||
SAV.FestivalPlazaName = TB_PlazaName.Text;
|
||||
}
|
||||
private void NUD_FC_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -469,11 +488,11 @@ private void NUD_Rank_ValueChanged(object sender, EventArgs e)
|
|||
SAV.FestaRank = (ushort)rank;
|
||||
LoadRankLabel(rank);
|
||||
}
|
||||
private readonly NumericUpDown[] NUDs;
|
||||
private readonly NumericUpDown[] NUD_Messages;
|
||||
private void NUD_MyMessage_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (editing) return;
|
||||
int mmIndex = Array.IndexOf(NUDs, (NumericUpDown)sender);
|
||||
int mmIndex = Array.IndexOf(NUD_Messages, (NumericUpDown)sender);
|
||||
if (mmIndex < 0) return;
|
||||
SAV.SetFestaMessage(mmIndex, (ushort)((NumericUpDown)sender).Value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user