Added friend.dat editor

This commit is contained in:
Mega-Mew 2017-10-04 10:43:10 +02:00
parent 9d806f0a36
commit 6a4223c145
8 changed files with 1062 additions and 24 deletions

View File

@ -28,8 +28,8 @@ internal static void fixChecksums(ref byte[] d)
case 0x17BE10: // exhibition
applyCHK(ref d, 0x0, 0x17BE0C);
break;
case 0x29600: // friend#
applyCHK(ref d, 0x0, 0x295FC);
case 0x29608: // friend#
applyCHK(ref d, 0x0, 0x29604);
break;
case 0x25F90: // mydsgn1
applyCHK(ref d, 0x0, 0x25F8C);

View File

@ -144,6 +144,7 @@
</Compile>
<None Include="Resources\VillageData\encyclo.bin" />
<None Include="Resources\VillageData\exi_empty_data.bin" />
<None Include="Resources\VillageData\friend_empty_data.bin" />
<None Include="Resources\VillageData\Museum.bin" />
<None Include="Resources\VillageData\type.bin" />
<None Include="Resources\VillageData\VillagerBin\acnl_v_000.bin" />

View File

@ -7125,6 +7125,16 @@ public class Resources {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Byte[].
/// </summary>
public static byte[] friend_empty_data {
get {
object obj = ResourceManager.GetObject("friend_empty_data", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>

View File

@ -3676,4 +3676,7 @@
<data name="exi_empty_data" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VillageData\exi_empty_data.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="friend_empty_data" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VillageData\friend_empty_data.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -31,13 +31,92 @@ private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Friend));
this.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.L_Disclaimer = new System.Windows.Forms.Label();
this.friendList = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.NUD_RegYear = new System.Windows.Forms.NumericUpDown();
this.CB_RegMonth = new System.Windows.Forms.ComboBox();
this.NUD_RegDay = new System.Windows.Forms.NumericUpDown();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.CB_BirthMonth = new System.Windows.Forms.ComboBox();
this.NUD_BirthDay = new System.Windows.Forms.NumericUpDown();
this.B_ReplaceTCP = new System.Windows.Forms.Button();
this.TB_Comment = new System.Windows.Forms.TextBox();
this.PB_PlayerPict = new System.Windows.Forms.PictureBox();
this.L_Gender = new System.Windows.Forms.Label();
this.CB_Gender = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.L_Name = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.TB_Town = new System.Windows.Forms.TextBox();
this.TB_Name = new System.Windows.Forms.TextBox();
this.B_Del = new System.Windows.Forms.Button();
this.B_Import = new System.Windows.Forms.Button();
this.B_Export = new System.Windows.Forms.Button();
this.B_SavePlayer = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.PB_Badge21 = new System.Windows.Forms.PictureBox();
this.PB_Badge23 = new System.Windows.Forms.PictureBox();
this.PB_Badge22 = new System.Windows.Forms.PictureBox();
this.PB_Badge20 = new System.Windows.Forms.PictureBox();
this.PB_Badge19 = new System.Windows.Forms.PictureBox();
this.PB_Badge16 = new System.Windows.Forms.PictureBox();
this.PB_Badge18 = new System.Windows.Forms.PictureBox();
this.PB_Badge17 = new System.Windows.Forms.PictureBox();
this.PB_Badge13 = new System.Windows.Forms.PictureBox();
this.PB_Badge15 = new System.Windows.Forms.PictureBox();
this.PB_Badge14 = new System.Windows.Forms.PictureBox();
this.PB_Badge12 = new System.Windows.Forms.PictureBox();
this.PB_Badge11 = new System.Windows.Forms.PictureBox();
this.PB_Badge08 = new System.Windows.Forms.PictureBox();
this.PB_Badge10 = new System.Windows.Forms.PictureBox();
this.PB_Badge09 = new System.Windows.Forms.PictureBox();
this.PB_Badge05 = new System.Windows.Forms.PictureBox();
this.PB_Badge07 = new System.Windows.Forms.PictureBox();
this.PB_Badge06 = new System.Windows.Forms.PictureBox();
this.PB_Badge04 = new System.Windows.Forms.PictureBox();
this.PB_Badge03 = new System.Windows.Forms.PictureBox();
this.PB_Badge00 = new System.Windows.Forms.PictureBox();
this.PB_Badge02 = new System.Windows.Forms.PictureBox();
this.PB_Badge01 = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
this.groupBox9.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_RegYear)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_RegDay)).BeginInit();
this.groupBox10.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthDay)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_PlayerPict)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge23)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge22)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge20)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge19)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge16)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge18)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge17)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge13)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge15)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge14)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge12)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge11)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge08)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge10)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge09)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge05)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge07)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge06)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge04)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge03)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge00)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge02)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge01)).BeginInit();
this.SuspendLayout();
//
// 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(136, 227);
this.B_Cancel.Location = new System.Drawing.Point(524, 284);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(65, 23);
this.B_Cancel.TabIndex = 5;
@ -48,7 +127,7 @@ private void InitializeComponent()
// 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(207, 227);
this.B_Save.Location = new System.Drawing.Point(595, 284);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(65, 23);
this.B_Save.TabIndex = 4;
@ -56,22 +135,513 @@ private void InitializeComponent()
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// L_Disclaimer
// friendList
//
this.L_Disclaimer.AutoSize = true;
this.L_Disclaimer.ForeColor = System.Drawing.Color.Red;
this.L_Disclaimer.Location = new System.Drawing.Point(61, 125);
this.L_Disclaimer.Name = "L_Disclaimer";
this.L_Disclaimer.Size = new System.Drawing.Size(162, 13);
this.L_Disclaimer.TabIndex = 7;
this.L_Disclaimer.Text = "This Editor does not do anything.";
this.friendList.FormattingEnabled = true;
this.friendList.Location = new System.Drawing.Point(6, 3);
this.friendList.Name = "friendList";
this.friendList.Size = new System.Drawing.Size(120, 316);
this.friendList.TabIndex = 6;
this.friendList.SelectedIndexChanged += new System.EventHandler(this.friendList_SelectedIndexChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.groupBox9);
this.groupBox1.Controls.Add(this.groupBox10);
this.groupBox1.Controls.Add(this.B_ReplaceTCP);
this.groupBox1.Controls.Add(this.TB_Comment);
this.groupBox1.Controls.Add(this.PB_PlayerPict);
this.groupBox1.Controls.Add(this.L_Gender);
this.groupBox1.Controls.Add(this.CB_Gender);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.L_Name);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.TB_Town);
this.groupBox1.Controls.Add(this.TB_Name);
this.groupBox1.Location = new System.Drawing.Point(132, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(384, 277);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Player Data";
//
// groupBox9
//
this.groupBox9.Controls.Add(this.NUD_RegYear);
this.groupBox9.Controls.Add(this.CB_RegMonth);
this.groupBox9.Controls.Add(this.NUD_RegDay);
this.groupBox9.Location = new System.Drawing.Point(194, 218);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(184, 53);
this.groupBox9.TabIndex = 82;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "Registration";
//
// NUD_RegYear
//
this.NUD_RegYear.Location = new System.Drawing.Point(130, 19);
this.NUD_RegYear.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.NUD_RegYear.Name = "NUD_RegYear";
this.NUD_RegYear.Size = new System.Drawing.Size(51, 20);
this.NUD_RegYear.TabIndex = 84;
//
// CB_RegMonth
//
this.CB_RegMonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_RegMonth.FormattingEnabled = true;
this.CB_RegMonth.Items.AddRange(new object[] {
"-",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"});
this.CB_RegMonth.Location = new System.Drawing.Point(45, 18);
this.CB_RegMonth.Name = "CB_RegMonth";
this.CB_RegMonth.Size = new System.Drawing.Size(79, 21);
this.CB_RegMonth.TabIndex = 83;
//
// NUD_RegDay
//
this.NUD_RegDay.Location = new System.Drawing.Point(6, 19);
this.NUD_RegDay.Name = "NUD_RegDay";
this.NUD_RegDay.Size = new System.Drawing.Size(33, 20);
this.NUD_RegDay.TabIndex = 82;
this.NUD_RegDay.Value = new decimal(new int[] {
31,
0,
0,
0});
//
// groupBox10
//
this.groupBox10.Controls.Add(this.CB_BirthMonth);
this.groupBox10.Controls.Add(this.NUD_BirthDay);
this.groupBox10.Location = new System.Drawing.Point(237, 172);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(141, 44);
this.groupBox10.TabIndex = 81;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "Birthday";
//
// CB_BirthMonth
//
this.CB_BirthMonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_BirthMonth.FormattingEnabled = true;
this.CB_BirthMonth.Items.AddRange(new object[] {
"-",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"});
this.CB_BirthMonth.Location = new System.Drawing.Point(45, 19);
this.CB_BirthMonth.Name = "CB_BirthMonth";
this.CB_BirthMonth.Size = new System.Drawing.Size(79, 21);
this.CB_BirthMonth.TabIndex = 81;
//
// NUD_BirthDay
//
this.NUD_BirthDay.Location = new System.Drawing.Point(6, 20);
this.NUD_BirthDay.Maximum = new decimal(new int[] {
31,
0,
0,
0});
this.NUD_BirthDay.Name = "NUD_BirthDay";
this.NUD_BirthDay.Size = new System.Drawing.Size(33, 20);
this.NUD_BirthDay.TabIndex = 80;
this.NUD_BirthDay.Value = new decimal(new int[] {
31,
0,
0,
0});
//
// B_ReplaceTCP
//
this.B_ReplaceTCP.Location = new System.Drawing.Point(6, 202);
this.B_ReplaceTCP.Name = "B_ReplaceTCP";
this.B_ReplaceTCP.Size = new System.Drawing.Size(109, 19);
this.B_ReplaceTCP.TabIndex = 118;
this.B_ReplaceTCP.Text = "New TPC";
this.B_ReplaceTCP.UseVisualStyleBackColor = true;
this.B_ReplaceTCP.Click += new System.EventHandler(this.B_ReplaceTCP_Click);
//
// TB_Comment
//
this.TB_Comment.Location = new System.Drawing.Point(6, 224);
this.TB_Comment.MaxLength = 32;
this.TB_Comment.Multiline = true;
this.TB_Comment.Name = "TB_Comment";
this.TB_Comment.Size = new System.Drawing.Size(183, 47);
this.TB_Comment.TabIndex = 79;
//
// PB_PlayerPict
//
this.PB_PlayerPict.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.PB_PlayerPict.Location = new System.Drawing.Point(6, 23);
this.PB_PlayerPict.Name = "PB_PlayerPict";
this.PB_PlayerPict.Size = new System.Drawing.Size(109, 176);
this.PB_PlayerPict.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PB_PlayerPict.TabIndex = 117;
this.PB_PlayerPict.TabStop = false;
//
// L_Gender
//
this.L_Gender.Location = new System.Drawing.Point(221, 68);
this.L_Gender.Name = "L_Gender";
this.L_Gender.Size = new System.Drawing.Size(58, 13);
this.L_Gender.TabIndex = 116;
this.L_Gender.Text = "Gender:";
this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CB_Gender
//
this.CB_Gender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Gender.FormattingEnabled = true;
this.CB_Gender.Items.AddRange(new object[] {
"Male",
"Female"});
this.CB_Gender.Location = new System.Drawing.Point(285, 64);
this.CB_Gender.Name = "CB_Gender";
this.CB_Gender.Size = new System.Drawing.Size(93, 21);
this.CB_Gender.TabIndex = 115;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(242, 42);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(37, 13);
this.label1.TabIndex = 114;
this.label1.Text = "Town:";
//
// L_Name
//
this.L_Name.Location = new System.Drawing.Point(224, 15);
this.L_Name.Name = "L_Name";
this.L_Name.Size = new System.Drawing.Size(55, 13);
this.L_Name.TabIndex = 113;
this.L_Name.Text = "Player Name:";
this.L_Name.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(389, 12);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 13);
this.label2.TabIndex = 112;
//
// TB_Town
//
this.TB_Town.Location = new System.Drawing.Point(285, 38);
this.TB_Town.Name = "TB_Town";
this.TB_Town.Size = new System.Drawing.Size(93, 20);
this.TB_Town.TabIndex = 111;
//
// TB_Name
//
this.TB_Name.Location = new System.Drawing.Point(285, 12);
this.TB_Name.Name = "TB_Name";
this.TB_Name.Size = new System.Drawing.Size(93, 20);
this.TB_Name.TabIndex = 110;
//
// B_Del
//
this.B_Del.Location = new System.Drawing.Point(286, 286);
this.B_Del.Name = "B_Del";
this.B_Del.Size = new System.Drawing.Size(78, 23);
this.B_Del.TabIndex = 15;
this.B_Del.Text = "Delete Player";
this.B_Del.UseVisualStyleBackColor = true;
this.B_Del.Click += new System.EventHandler(this.B_Del_Click);
//
// B_Import
//
this.B_Import.Location = new System.Drawing.Point(208, 286);
this.B_Import.Name = "B_Import";
this.B_Import.Size = new System.Drawing.Size(77, 23);
this.B_Import.TabIndex = 14;
this.B_Import.Text = "Import Player";
this.B_Import.UseVisualStyleBackColor = true;
this.B_Import.Click += new System.EventHandler(this.B_Import_Click);
//
// B_Export
//
this.B_Export.Location = new System.Drawing.Point(130, 286);
this.B_Export.Name = "B_Export";
this.B_Export.Size = new System.Drawing.Size(77, 23);
this.B_Export.TabIndex = 13;
this.B_Export.Text = "Export Player";
this.B_Export.UseVisualStyleBackColor = true;
this.B_Export.Click += new System.EventHandler(this.B_Export_Click);
//
// B_SavePlayer
//
this.B_SavePlayer.Location = new System.Drawing.Point(403, 286);
this.B_SavePlayer.Name = "B_SavePlayer";
this.B_SavePlayer.Size = new System.Drawing.Size(75, 23);
this.B_SavePlayer.TabIndex = 16;
this.B_SavePlayer.Text = "Save Player";
this.B_SavePlayer.UseVisualStyleBackColor = true;
this.B_SavePlayer.Click += new System.EventHandler(this.B_SavePlayer_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.PB_Badge21);
this.groupBox2.Controls.Add(this.PB_Badge23);
this.groupBox2.Controls.Add(this.PB_Badge22);
this.groupBox2.Controls.Add(this.PB_Badge20);
this.groupBox2.Controls.Add(this.PB_Badge19);
this.groupBox2.Controls.Add(this.PB_Badge16);
this.groupBox2.Controls.Add(this.PB_Badge18);
this.groupBox2.Controls.Add(this.PB_Badge17);
this.groupBox2.Controls.Add(this.PB_Badge13);
this.groupBox2.Controls.Add(this.PB_Badge15);
this.groupBox2.Controls.Add(this.PB_Badge14);
this.groupBox2.Controls.Add(this.PB_Badge12);
this.groupBox2.Controls.Add(this.PB_Badge11);
this.groupBox2.Controls.Add(this.PB_Badge08);
this.groupBox2.Controls.Add(this.PB_Badge10);
this.groupBox2.Controls.Add(this.PB_Badge09);
this.groupBox2.Controls.Add(this.PB_Badge05);
this.groupBox2.Controls.Add(this.PB_Badge07);
this.groupBox2.Controls.Add(this.PB_Badge06);
this.groupBox2.Controls.Add(this.PB_Badge04);
this.groupBox2.Controls.Add(this.PB_Badge03);
this.groupBox2.Controls.Add(this.PB_Badge00);
this.groupBox2.Controls.Add(this.PB_Badge02);
this.groupBox2.Controls.Add(this.PB_Badge01);
this.groupBox2.Location = new System.Drawing.Point(527, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(133, 275);
this.groupBox2.TabIndex = 17;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Badges";
//
// PB_Badge21
//
this.PB_Badge21.Location = new System.Drawing.Point(82, 173);
this.PB_Badge21.Name = "PB_Badge21";
this.PB_Badge21.Size = new System.Drawing.Size(28, 28);
this.PB_Badge21.TabIndex = 122;
this.PB_Badge21.TabStop = false;
//
// PB_Badge23
//
this.PB_Badge23.Location = new System.Drawing.Point(82, 231);
this.PB_Badge23.Name = "PB_Badge23";
this.PB_Badge23.Size = new System.Drawing.Size(28, 28);
this.PB_Badge23.TabIndex = 124;
this.PB_Badge23.TabStop = false;
//
// PB_Badge22
//
this.PB_Badge22.Location = new System.Drawing.Point(82, 202);
this.PB_Badge22.Name = "PB_Badge22";
this.PB_Badge22.Size = new System.Drawing.Size(28, 28);
this.PB_Badge22.TabIndex = 123;
this.PB_Badge22.TabStop = false;
//
// PB_Badge20
//
this.PB_Badge20.Location = new System.Drawing.Point(82, 144);
this.PB_Badge20.Name = "PB_Badge20";
this.PB_Badge20.Size = new System.Drawing.Size(28, 28);
this.PB_Badge20.TabIndex = 121;
this.PB_Badge20.TabStop = false;
//
// PB_Badge19
//
this.PB_Badge19.Location = new System.Drawing.Point(82, 114);
this.PB_Badge19.Name = "PB_Badge19";
this.PB_Badge19.Size = new System.Drawing.Size(28, 28);
this.PB_Badge19.TabIndex = 120;
this.PB_Badge19.TabStop = false;
//
// PB_Badge16
//
this.PB_Badge16.Location = new System.Drawing.Point(82, 27);
this.PB_Badge16.Name = "PB_Badge16";
this.PB_Badge16.Size = new System.Drawing.Size(28, 28);
this.PB_Badge16.TabIndex = 117;
this.PB_Badge16.TabStop = false;
//
// PB_Badge18
//
this.PB_Badge18.Location = new System.Drawing.Point(82, 85);
this.PB_Badge18.Name = "PB_Badge18";
this.PB_Badge18.Size = new System.Drawing.Size(28, 28);
this.PB_Badge18.TabIndex = 119;
this.PB_Badge18.TabStop = false;
//
// PB_Badge17
//
this.PB_Badge17.Location = new System.Drawing.Point(82, 56);
this.PB_Badge17.Name = "PB_Badge17";
this.PB_Badge17.Size = new System.Drawing.Size(28, 28);
this.PB_Badge17.TabIndex = 118;
this.PB_Badge17.TabStop = false;
//
// PB_Badge13
//
this.PB_Badge13.Location = new System.Drawing.Point(51, 173);
this.PB_Badge13.Name = "PB_Badge13";
this.PB_Badge13.Size = new System.Drawing.Size(28, 28);
this.PB_Badge13.TabIndex = 114;
this.PB_Badge13.TabStop = false;
//
// PB_Badge15
//
this.PB_Badge15.Location = new System.Drawing.Point(51, 231);
this.PB_Badge15.Name = "PB_Badge15";
this.PB_Badge15.Size = new System.Drawing.Size(28, 28);
this.PB_Badge15.TabIndex = 116;
this.PB_Badge15.TabStop = false;
//
// PB_Badge14
//
this.PB_Badge14.Location = new System.Drawing.Point(51, 202);
this.PB_Badge14.Name = "PB_Badge14";
this.PB_Badge14.Size = new System.Drawing.Size(28, 28);
this.PB_Badge14.TabIndex = 115;
this.PB_Badge14.TabStop = false;
//
// PB_Badge12
//
this.PB_Badge12.Location = new System.Drawing.Point(51, 144);
this.PB_Badge12.Name = "PB_Badge12";
this.PB_Badge12.Size = new System.Drawing.Size(28, 28);
this.PB_Badge12.TabIndex = 113;
this.PB_Badge12.TabStop = false;
//
// PB_Badge11
//
this.PB_Badge11.Location = new System.Drawing.Point(51, 114);
this.PB_Badge11.Name = "PB_Badge11";
this.PB_Badge11.Size = new System.Drawing.Size(28, 28);
this.PB_Badge11.TabIndex = 112;
this.PB_Badge11.TabStop = false;
//
// PB_Badge08
//
this.PB_Badge08.Location = new System.Drawing.Point(51, 27);
this.PB_Badge08.Name = "PB_Badge08";
this.PB_Badge08.Size = new System.Drawing.Size(28, 28);
this.PB_Badge08.TabIndex = 109;
this.PB_Badge08.TabStop = false;
//
// PB_Badge10
//
this.PB_Badge10.Location = new System.Drawing.Point(51, 85);
this.PB_Badge10.Name = "PB_Badge10";
this.PB_Badge10.Size = new System.Drawing.Size(28, 28);
this.PB_Badge10.TabIndex = 111;
this.PB_Badge10.TabStop = false;
//
// PB_Badge09
//
this.PB_Badge09.Location = new System.Drawing.Point(51, 56);
this.PB_Badge09.Name = "PB_Badge09";
this.PB_Badge09.Size = new System.Drawing.Size(28, 28);
this.PB_Badge09.TabIndex = 110;
this.PB_Badge09.TabStop = false;
//
// PB_Badge05
//
this.PB_Badge05.Location = new System.Drawing.Point(20, 173);
this.PB_Badge05.Name = "PB_Badge05";
this.PB_Badge05.Size = new System.Drawing.Size(28, 28);
this.PB_Badge05.TabIndex = 106;
this.PB_Badge05.TabStop = false;
//
// PB_Badge07
//
this.PB_Badge07.Location = new System.Drawing.Point(20, 231);
this.PB_Badge07.Name = "PB_Badge07";
this.PB_Badge07.Size = new System.Drawing.Size(28, 28);
this.PB_Badge07.TabIndex = 108;
this.PB_Badge07.TabStop = false;
//
// PB_Badge06
//
this.PB_Badge06.Location = new System.Drawing.Point(20, 202);
this.PB_Badge06.Name = "PB_Badge06";
this.PB_Badge06.Size = new System.Drawing.Size(28, 28);
this.PB_Badge06.TabIndex = 107;
this.PB_Badge06.TabStop = false;
//
// PB_Badge04
//
this.PB_Badge04.Location = new System.Drawing.Point(20, 144);
this.PB_Badge04.Name = "PB_Badge04";
this.PB_Badge04.Size = new System.Drawing.Size(28, 28);
this.PB_Badge04.TabIndex = 105;
this.PB_Badge04.TabStop = false;
//
// PB_Badge03
//
this.PB_Badge03.Location = new System.Drawing.Point(20, 114);
this.PB_Badge03.Name = "PB_Badge03";
this.PB_Badge03.Size = new System.Drawing.Size(28, 28);
this.PB_Badge03.TabIndex = 104;
this.PB_Badge03.TabStop = false;
//
// PB_Badge00
//
this.PB_Badge00.Location = new System.Drawing.Point(20, 27);
this.PB_Badge00.Name = "PB_Badge00";
this.PB_Badge00.Size = new System.Drawing.Size(28, 28);
this.PB_Badge00.TabIndex = 101;
this.PB_Badge00.TabStop = false;
//
// PB_Badge02
//
this.PB_Badge02.Location = new System.Drawing.Point(20, 85);
this.PB_Badge02.Name = "PB_Badge02";
this.PB_Badge02.Size = new System.Drawing.Size(28, 28);
this.PB_Badge02.TabIndex = 103;
this.PB_Badge02.TabStop = false;
//
// PB_Badge01
//
this.PB_Badge01.Location = new System.Drawing.Point(20, 56);
this.PB_Badge01.Name = "PB_Badge01";
this.PB_Badge01.Size = new System.Drawing.Size(28, 28);
this.PB_Badge01.TabIndex = 102;
this.PB_Badge01.TabStop = false;
//
// Friend
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.L_Disclaimer);
this.ClientSize = new System.Drawing.Size(672, 319);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.B_SavePlayer);
this.Controls.Add(this.B_Del);
this.Controls.Add(this.B_Import);
this.Controls.Add(this.B_Export);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.friendList);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -80,8 +650,40 @@ private void InitializeComponent()
this.Name = "Friend";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Friend Editor";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox9.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_RegYear)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_RegDay)).EndInit();
this.groupBox10.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthDay)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_PlayerPict)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_Badge21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge23)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge22)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge20)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge19)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge16)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge18)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge17)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge13)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge15)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge14)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge12)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge11)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge08)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge10)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge09)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge05)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge07)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge06)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge04)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge03)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge00)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge02)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Badge01)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -89,6 +691,53 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.Label L_Disclaimer;
private System.Windows.Forms.ListBox friendList;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button B_Del;
private System.Windows.Forms.Button B_Import;
private System.Windows.Forms.Button B_Export;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label L_Name;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox TB_Town;
private System.Windows.Forms.TextBox TB_Name;
private System.Windows.Forms.Label L_Gender;
private System.Windows.Forms.ComboBox CB_Gender;
private System.Windows.Forms.Button B_ReplaceTCP;
private System.Windows.Forms.PictureBox PB_PlayerPict;
private System.Windows.Forms.GroupBox groupBox9;
private System.Windows.Forms.NumericUpDown NUD_RegYear;
private System.Windows.Forms.ComboBox CB_RegMonth;
private System.Windows.Forms.NumericUpDown NUD_RegDay;
private System.Windows.Forms.GroupBox groupBox10;
private System.Windows.Forms.ComboBox CB_BirthMonth;
private System.Windows.Forms.NumericUpDown NUD_BirthDay;
private System.Windows.Forms.TextBox TB_Comment;
private System.Windows.Forms.Button B_SavePlayer;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.PictureBox PB_Badge04;
private System.Windows.Forms.PictureBox PB_Badge03;
private System.Windows.Forms.PictureBox PB_Badge00;
private System.Windows.Forms.PictureBox PB_Badge02;
private System.Windows.Forms.PictureBox PB_Badge01;
private System.Windows.Forms.PictureBox PB_Badge05;
private System.Windows.Forms.PictureBox PB_Badge07;
private System.Windows.Forms.PictureBox PB_Badge06;
private System.Windows.Forms.PictureBox PB_Badge21;
private System.Windows.Forms.PictureBox PB_Badge23;
private System.Windows.Forms.PictureBox PB_Badge22;
private System.Windows.Forms.PictureBox PB_Badge20;
private System.Windows.Forms.PictureBox PB_Badge19;
private System.Windows.Forms.PictureBox PB_Badge16;
private System.Windows.Forms.PictureBox PB_Badge18;
private System.Windows.Forms.PictureBox PB_Badge17;
private System.Windows.Forms.PictureBox PB_Badge13;
private System.Windows.Forms.PictureBox PB_Badge15;
private System.Windows.Forms.PictureBox PB_Badge14;
private System.Windows.Forms.PictureBox PB_Badge12;
private System.Windows.Forms.PictureBox PB_Badge11;
private System.Windows.Forms.PictureBox PB_Badge08;
private System.Windows.Forms.PictureBox PB_Badge10;
private System.Windows.Forms.PictureBox PB_Badge09;
}
}

View File

@ -1,18 +1,88 @@
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NLSE
{
public partial class Friend : Form
{
Image[] BadgePCH = { Properties.Resources.empty, Properties.Resources.PCH_1, Properties.Resources.PCH_2, Properties.Resources.PCH_3 };
Image[] BadgeFLT = { Properties.Resources.empty, Properties.Resources.FLT_1, Properties.Resources.FLT_2, Properties.Resources.FLT_3 };
Image[] BadgePLG = { Properties.Resources.empty, Properties.Resources.PLG_1, Properties.Resources.PLG_2, Properties.Resources.PLG_3 };
Image[] BadgePSO = { Properties.Resources.empty, Properties.Resources.PSO_1, Properties.Resources.PSO_2, Properties.Resources.PSO_3 };
Image[] BadgeINS = { Properties.Resources.empty, Properties.Resources.INS_1, Properties.Resources.INS_2, Properties.Resources.INS_3 };
Image[] BadgePLP = { Properties.Resources.empty, Properties.Resources.PLP_1, Properties.Resources.PLP_2, Properties.Resources.PLP_3 };
Image[] BadgeBLO = { Properties.Resources.empty, Properties.Resources.BLO_1, Properties.Resources.BLO_2, Properties.Resources.BLO_3 };
Image[] BadgeTRN = { Properties.Resources.empty, Properties.Resources.TRN_1, Properties.Resources.TRN_2, Properties.Resources.TRN_3 };
Image[] BadgeHRT = { Properties.Resources.empty, Properties.Resources.HRT_1, Properties.Resources.HRT_2, Properties.Resources.HRT_3 };
Image[] BadgeARB = { Properties.Resources.empty, Properties.Resources.ARB_1, Properties.Resources.ARB_2, Properties.Resources.ARB_3 };
Image[] BadgeCLO = { Properties.Resources.empty, Properties.Resources.CLO_1, Properties.Resources.CLO_2, Properties.Resources.CLO_3 };
Image[] BadgeISL = { Properties.Resources.empty, Properties.Resources.ISL_1, Properties.Resources.ISL_2, Properties.Resources.ISL_3 };
Image[] BadgeSTP = { Properties.Resources.empty, Properties.Resources.STP_1, Properties.Resources.STP_2, Properties.Resources.STP_3 };
Image[] BadgeMVH = { Properties.Resources.empty, Properties.Resources.MVH_1, Properties.Resources.MVH_2, Properties.Resources.MVH_3 };
Image[] BadgeCDY = { Properties.Resources.empty, Properties.Resources.CDY_1, Properties.Resources.CDY_2, Properties.Resources.CDY_3 };
Image[] BadgeRNV = { Properties.Resources.empty, Properties.Resources.RNV_1, Properties.Resources.RNV_2, Properties.Resources.RNV_3 };
Image[] BadgeLTR = { Properties.Resources.empty, Properties.Resources.LTR_1, Properties.Resources.LTR_2, Properties.Resources.LTR_3 };
Image[] BadgeCTL = { Properties.Resources.empty, Properties.Resources.CTL_1, Properties.Resources.CTL_2, Properties.Resources.CTL_3 };
Image[] BadgeKKG = { Properties.Resources.empty, Properties.Resources.KKG_1, Properties.Resources.KKG_2, Properties.Resources.KKG_3 };
Image[] BadgeCRN = { Properties.Resources.empty, Properties.Resources.CRN_1, Properties.Resources.CRN_2, Properties.Resources.CRN_3 };
Image[] BadgeNVT = { Properties.Resources.empty, Properties.Resources.NVT_1, Properties.Resources.NVT_2, Properties.Resources.NVT_3 };
Image[] BadgeMSN = { Properties.Resources.empty, Properties.Resources.MSN_1, Properties.Resources.MSN_2, Properties.Resources.MSN_3 };
Image[] BadgeFLR = { Properties.Resources.empty, Properties.Resources.FLR_1, Properties.Resources.FLR_2, Properties.Resources.FLR_3 };
Image[] BadgeVST = { Properties.Resources.empty, Properties.Resources.VST_1, Properties.Resources.VST_2, Properties.Resources.VST_3 };
private PlayerData[] PlayersData;
public string path;
public Friend()
{
InitializeComponent();
Save = new FriendData(Main.SaveData);
// Load
loadData();
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "friend#.dat|*.dat" +
"|All Files|*.*";
if (ofd.ShowDialog() != DialogResult.OK)
{
Close();
return; // no file loaded
}
else
{
InitializeComponent();
path = ofd.FileName;
long length = new FileInfo(path).Length;
if (length != 0x29608)
{
MessageBox.Show("Not a valid friend#.dat file !");
Close();
}
else
{
Main.SaveData = File.ReadAllBytes(path);
Save = new FriendData(Main.SaveData);
loadData();
}
}
}
private void BlockControl()
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
B_SavePlayer.Enabled = false;
B_Del.Enabled = false;
B_Export.Enabled = false;
}
private void UnblockControl()
{
groupBox1.Enabled = true;
groupBox2.Enabled = true;
B_SavePlayer.Enabled = true;
B_Del.Enabled = true;
B_Export.Enabled = true;
}
private void B_Save_Click(object sender, EventArgs e)
{
saveData();
@ -37,15 +107,313 @@ public byte[] Write()
return Data;
}
}
class PlayerData
{
public byte[] Data;
public int PlayerSID;
public string PlayerName;
public string Comment;
public int TownSID;
public string TownName;
public byte[] Badges;
public int Gender;
public int BirthdayDay;
public int BirthdayMonth;
public int RegDay;
public int RegMonth;
public uint RegYear;
public int DCPart1;
public int DCPart2;
public int DCPart3;
public int DCPart4;
public Image JPEG;
public PlayerData(byte[] data)
{
Data = data;
PlayerSID = BitConverter.ToUInt16(data, 0x1424);
PlayerName = Encoding.Unicode.GetString(Data.Skip(0x1426).Take(0x12).ToArray()).Trim('\0');
TownSID = BitConverter.ToUInt16(data, 0x143A);
TownName = Encoding.Unicode.GetString(Data.Skip(0x143C).Take(0x12).ToArray()).Trim('\0');
Comment = Encoding.Unicode.GetString(Data.Skip(0x1470).Take(0x40).ToArray());
Badges = Data.Skip(0x1452).Take(24).ToArray();
Gender = Data[0x1438];
BirthdayMonth = Data[0x146A];
BirthdayDay = Data[0x146B];
RegDay = Data[0x146F];
RegMonth = Data[0x146E];
RegYear = BitConverter.ToUInt16(data, 0x146C);
DCPart1 = BitConverter.ToUInt16(data, 0x0);
DCPart2 = BitConverter.ToUInt16(data, 0x0);
DCPart3 = Data[0x0];
DCPart4 = Data[0x0];
try { JPEG = Image.FromStream(new MemoryStream(Data.Skip(0x8).Take(0x1400).ToArray())); }
catch { JPEG = null; }
}
public byte[] Write()
{
Array.Copy(Encoding.Unicode.GetBytes(PlayerName.PadRight(9, '\0')), 0, Data, 0x1426, 0x12);
Array.Copy(Encoding.Unicode.GetBytes(TownName.PadRight(9, '\0')), 0, Data, 0x143C, 0x12);
Array.Copy(Encoding.Unicode.GetBytes(Comment.PadRight(32, '\0')), 0, Data, 0x1470, 0x40);
Data[0x1438] = (byte)Gender;
Data[0x146A] = (byte)BirthdayMonth;
Data[0x146B] = (byte)BirthdayDay;
Data[0x146F] = (byte)RegDay;
Data[0x146E] = (byte)RegMonth;
Array.Copy(BitConverter.GetBytes(RegYear), 0, Data, 0x146C, 2);
return Data;
}
}
private void loadData()
{
Save = new FriendData(Main.SaveData);
PlayersData = new PlayerData[20];
for (int i = 0; i < PlayersData.Length; i++)
PlayersData[i] = new PlayerData(Save.Data.Skip(0x4 + i * 0x14B0).Take(0x14B0).ToArray());
PopulateList();
}
private void saveData()
{
int i = friendList.SelectedIndex;
savePlayer(i);
for (int g = 0; g < PlayersData.Length; g++)
Array.Copy(PlayersData[g].Write(), 0, Save.Data, 0x4 + g * 0x14B0, 0x14B0);
Main.SaveData = Save.Write();
Verification.fixChecksums(ref Main.SaveData);
File.WriteAllBytes(path, Main.SaveData);
}
private void PopulateList()
{
friendList.Items.Clear();
for (int j = 0; j < PlayersData.Length; j++)
{
if (PlayersData[j].PlayerSID == 0 && PlayersData[j].TownSID == 0)
{
int slot = j + 1;
string empty = "Slot " + slot.ToString() + ": empty";
friendList.Items.Add(empty);
}
else
{
friendList.Items.Add(PlayersData[j].PlayerName);
}
friendList.SelectedIndex = 0;
}
}
//
private void friendList_SelectedIndexChanged(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
loadPlayer(i);
}
private void loadBadge()
{
int i = friendList.SelectedIndex;
PB_Badge00.Image = BadgePCH[PlayersData[i].Badges[0]];
PB_Badge01.Image = BadgeFLT[PlayersData[i].Badges[1]];
PB_Badge02.Image = BadgePLG[PlayersData[i].Badges[2]];
PB_Badge03.Image = BadgePSO[PlayersData[i].Badges[3]];
PB_Badge04.Image = BadgeINS[PlayersData[i].Badges[4]];
PB_Badge05.Image = BadgePLP[PlayersData[i].Badges[5]];
PB_Badge06.Image = BadgeBLO[PlayersData[i].Badges[6]];
PB_Badge07.Image = BadgeTRN[PlayersData[i].Badges[7]];
PB_Badge08.Image = BadgeVST[PlayersData[i].Badges[22]];
PB_Badge09.Image = BadgeARB[PlayersData[i].Badges[9]];
PB_Badge10.Image = BadgeCLO[PlayersData[i].Badges[10]];
PB_Badge11.Image = BadgeNVT[PlayersData[i].Badges[11]];
PB_Badge12.Image = BadgeISL[PlayersData[i].Badges[12]];
PB_Badge13.Image = BadgeSTP[PlayersData[i].Badges[13]];
PB_Badge14.Image = BadgeMVH[PlayersData[i].Badges[14]];
PB_Badge15.Image = BadgeCDY[PlayersData[i].Badges[15]];
PB_Badge16.Image = BadgeLTR[PlayersData[i].Badges[16]];
PB_Badge17.Image = BadgeRNV[PlayersData[i].Badges[17]];
PB_Badge18.Image = BadgeCTL[PlayersData[i].Badges[18]];
PB_Badge19.Image = BadgeKKG[PlayersData[i].Badges[19]];
PB_Badge20.Image = BadgeMSN[PlayersData[i].Badges[20]];
PB_Badge21.Image = BadgeCRN[PlayersData[i].Badges[21]];
PB_Badge22.Image = BadgeHRT[PlayersData[i].Badges[8]];
PB_Badge23.Image = BadgeFLR[PlayersData[i].Badges[23]];
}
private void loadPlayer(int i)
{
if (PlayersData[i].PlayerSID == 0 && PlayersData[i].TownSID == 0)
{
BlockControl();
}
else
UnblockControl();
TB_Name.Text = PlayersData[i].PlayerName;
TB_Town.Text = PlayersData[i].TownName;
TB_Comment.Text = PlayersData[i].Comment;
CB_Gender.SelectedIndex = PlayersData[i].Gender;
NUD_RegDay.Value = PlayersData[i].RegDay;
CB_RegMonth.SelectedIndex = PlayersData[i].RegMonth;
NUD_RegYear.Value = PlayersData[i].RegYear;
NUD_BirthDay.Value = PlayersData[i].BirthdayDay;
CB_BirthMonth.SelectedIndex = PlayersData[i].BirthdayMonth;
PB_PlayerPict.Image = PlayersData[i].JPEG;
loadBadge();
}
private void savePlayer(int i)
{
PlayersData[i].PlayerName = TB_Name.Text;
PlayersData[i].TownName = TB_Town.Text;
PlayersData[i].Comment = TB_Comment.Text;
PlayersData[i].Gender = (byte)CB_Gender.SelectedIndex;
PlayersData[i].BirthdayDay = (byte)NUD_BirthDay.Value;
PlayersData[i].BirthdayMonth = (byte)CB_BirthMonth.SelectedIndex;
PlayersData[i].RegDay = (byte)NUD_RegDay.Value;
PlayersData[i].RegMonth = (byte)CB_RegMonth.SelectedIndex;
PlayersData[i].RegYear = (uint)NUD_RegYear.Value;
}
private void B_SavePlayer_Click(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
savePlayer(i);
for (int g = 0; g < PlayersData.Length; g++)
Array.Copy(PlayersData[g].Write(), 0, Save.Data, 0x4 + g * 0x14B0, 0x14B0);
PopulateList();
friendList.SelectedIndex = i;
}
private void B_Export_Click(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = TB_Name.Text + " friend Data.bin";
if (sfd.ShowDialog() != DialogResult.OK)
return; // not saved
byte[] Data = (PlayersData[i].Data.Take(0x14B0).ToArray());
File.WriteAllBytes(sfd.FileName, Data);
}
private void B_Import_Click(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() != DialogResult.OK)
return; // no file loaded
string path = ofd.FileName;
long length = new FileInfo(path).Length;
if (length != 0x14B0) // Check file size
{
MessageBox.Show("Invalid file.");
return;
}
byte[] Data = File.ReadAllBytes(path);
Array.Copy(Data, 0, Save.Data, (0x4 + i * 0x14B0), 0x14B0);
PlayersData = new PlayerData[20];
for (int j = 0; j < PlayersData.Length; j++)
PlayersData[j] = new PlayerData(Save.Data.Skip(0x4 + j * 0x14B0).Take(0x14B0).ToArray());
PopulateList();
friendList.SelectedIndex = i;
}
private void B_Del_Click(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
DialogResult dialogResult = MessageBox.Show("Do you really want to remove " + TB_Name.Text + " ?", "Delete Player", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
byte[] Empty = Properties.Resources.friend_empty_data;
Array.Copy(Empty, 0, Save.Data, (0x4 + i * 0x14B0), 0x14B0);
PlayersData = new PlayerData[20];
for (int j = 0; j < PlayersData.Length; j++)
PlayersData[j] = new PlayerData(Save.Data.Skip(0x4 + j * 0x14B0).Take(0x14B0).ToArray());
PopulateList();
friendList.SelectedIndex = i;
}
else if (dialogResult == DialogResult.No)
{
return;
}
}
private void B_ReplaceTCP_Click(object sender, EventArgs e)
{
int i = friendList.SelectedIndex;
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "JPEG Picture|*.jpg;*.jpeg";
if (ofd.ShowDialog() != DialogResult.OK)
return; // no file loaded
string path = ofd.FileName;
long length = new FileInfo(path).Length;
if (length > 0x1400)
{
MessageBox.Show("Your TCP Picture is too big !\nMax: 4kb (0x1400)");
return;
}
byte[] CheckHeader = File.ReadAllBytes(path).Skip(0).Take(2).ToArray();
if (BitConverter.ToUInt16(CheckHeader, 0x0) != 0xD8FF)
{
MessageBox.Show("The picture must be a JPEG !");
return;
}
Image img = Image.FromFile(path);
if (img.Height > 104 && img.Width > 64)
{
MessageBox.Show("The dimensions of the picture must be 64x104.");
return;
}
if (img.Height != 104 && img.Width != 64)
{
MessageBox.Show("The dimensions of the picture are ok, but the maximum here is 64x104.\nThe dimensions of your picture are: " + img.Width + "x" + img.Height + "");
}
byte[] CorrectFile = File.ReadAllBytes(path);
Array.Copy(CorrectFile, 0, Save.Data, 0xC + (i * 0x14B0), length);
PlayersData = new PlayerData[20];
for (int j = 0; j < PlayersData.Length; j++)
PlayersData[j] = new PlayerData(Save.Data.Skip(0x4 + j * 0x14B0).Take(0x14B0).ToArray());
PopulateList();
friendList.SelectedIndex = i;
PB_PlayerPict.Image = img;
Util.Alert("Succesfully injected the new picture.");
}
}
}

View File

@ -2807,7 +2807,14 @@ private void exhibitiondatEditorToolStripMenuItem_Click(object sender, EventArgs
private void frienddatEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
new Friend().ShowDialog();
try
{
new Friend().ShowDialog();
}
catch
{
}
}
private void dreamFixerToolStripMenuItem_Click(object sender, EventArgs e)