diff --git a/Source/GrasscutterTools/Forms/FormDropEditor.cs b/Source/GrasscutterTools/Forms/FormDropEditor.cs index a51bc1e..8435a28 100644 --- a/Source/GrasscutterTools/Forms/FormDropEditor.cs +++ b/Source/GrasscutterTools/Forms/FormDropEditor.cs @@ -193,7 +193,7 @@ namespace GrasscutterTools.Forms private IEnumerable SelectedMonsterIds() { foreach (string item in ListMonsters.SelectedItems) - yield return int.Parse(item.Substring(0, item.IndexOf(':')).Trim()); + yield return ItemMap.ToId(item); } /// @@ -378,7 +378,7 @@ namespace GrasscutterTools.Forms var dropData = new DropData(); var item = TxtItem.Text; - dropData.ItemId = int.Parse(item.Substring(0, item.IndexOf(':')).Trim()); + dropData.ItemId = ItemMap.ToId(item); //if (int.TryParse(item.Substring(0, item.IndexOf(':')).Trim(), out int itemId)) //{ // dropData.ItemId = itemId; diff --git a/Source/GrasscutterTools/Forms/FormGachaBannerEditor.cs b/Source/GrasscutterTools/Forms/FormGachaBannerEditor.cs index fca8c68..ecd8b1f 100644 --- a/Source/GrasscutterTools/Forms/FormGachaBannerEditor.cs +++ b/Source/GrasscutterTools/Forms/FormGachaBannerEditor.cs @@ -189,7 +189,7 @@ namespace GrasscutterTools.Forms else { var item = list.Items[i] as string; - var id = int.Parse(item.Substring(0, item.IndexOf(':'))); + var id = ItemMap.ToId(item); list.SetItemChecked(i, Array.IndexOf(checkedIds, id) != -1); } } @@ -217,7 +217,7 @@ namespace GrasscutterTools.Forms { StringBuilder builder = new StringBuilder(); foreach (string item in list.CheckedItems) - builder.Append(item.Substring(0, item.IndexOf(':'))) + builder.Append(ItemMap.ToId(item)) .Append(", "); txt.Text = builder.ToString(0, builder.Length - 2); } diff --git a/Source/GrasscutterTools/Forms/FormMain.Designer.cs b/Source/GrasscutterTools/Forms/FormMain.Designer.cs index 2f3f253..1545c43 100644 --- a/Source/GrasscutterTools/Forms/FormMain.Designer.cs +++ b/Source/GrasscutterTools/Forms/FormMain.Designer.cs @@ -235,32 +235,34 @@ namespace GrasscutterTools.Forms this.LblDefaultUid = new System.Windows.Forms.Label(); this.TCMain = new System.Windows.Forms.TabControl(); this.TPMail = new System.Windows.Forms.TabPage(); - this.LblMailSenderLabel = new System.Windows.Forms.Label(); - this.TxtMailSender = new System.Windows.Forms.TextBox(); - this.LblMailTitleLabel = new System.Windows.Forms.Label(); - this.TxtMailTitle = new System.Windows.Forms.TextBox(); - this.LblMailContentLabel = new System.Windows.Forms.Label(); - this.TxtMailContent = new System.Windows.Forms.TextBox(); - this.LblMailRecipientLabel = new System.Windows.Forms.Label(); - this.RbMailSendToAll = new System.Windows.Forms.RadioButton(); - this.RbMailSendToPlayer = new System.Windows.Forms.RadioButton(); - this.NUDMailRecipient = new System.Windows.Forms.NumericUpDown(); - this.LblMailItemsLabel = new System.Windows.Forms.Label(); - this.ListMailItems = new System.Windows.Forms.ListBox(); - this.button1 = new System.Windows.Forms.Button(); - this.ListMailSelectableItems = new System.Windows.Forms.ListBox(); - this.TxtMailSelectableItemFilter = new System.Windows.Forms.TextBox(); - this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP(); - this.label1 = new System.Windows.Forms.Label(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); - this.label2 = new System.Windows.Forms.Label(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.TxtMailSelectableItemFilter = new System.Windows.Forms.TextBox(); + this.NUDMailItemLevel = new System.Windows.Forms.NumericUpDown(); + this.ListMailSelectableItems = new System.Windows.Forms.ListBox(); + this.LblMailItemLevel = new System.Windows.Forms.Label(); + this.LblMailItemCount = new System.Windows.Forms.Label(); + this.NUDMailItemCount = new System.Windows.Forms.NumericUpDown(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.BtnClearMail = new System.Windows.Forms.Button(); + this.BtnRemoveMail = new System.Windows.Forms.Button(); this.ListMailList = new System.Windows.Forms.ListBox(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); + this.BtnSendMail = new System.Windows.Forms.Button(); + this.ListMailItems = new System.Windows.Forms.ListBox(); + this.LblMailItemsLabel = new System.Windows.Forms.Label(); + this.NUDMailRecipient = new System.Windows.Forms.NumericUpDown(); + this.RbMailSendToPlayer = new System.Windows.Forms.RadioButton(); + this.RbMailSendToAll = new System.Windows.Forms.RadioButton(); + this.LblMailRecipientLabel = new System.Windows.Forms.Label(); + this.TxtMailContent = new System.Windows.Forms.TextBox(); + this.LblMailContentLabel = new System.Windows.Forms.Label(); + this.TxtMailTitle = new System.Windows.Forms.TextBox(); + this.LblMailTitleLabel = new System.Windows.Forms.Label(); + this.TxtMailSender = new System.Windows.Forms.TextBox(); + this.LblMailSenderLabel = new System.Windows.Forms.Label(); + this.BtnAddMailItem = new System.Windows.Forms.Button(); + this.BtnDeleteMailItem = new System.Windows.Forms.Button(); + this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP(); this.GrpCommand.SuspendLayout(); this.TPRemoteCall.SuspendLayout(); this.GrpServerStatus.SuspendLayout(); @@ -320,12 +322,12 @@ namespace GrasscutterTools.Forms ((System.ComponentModel.ISupportInitialize)(this.NUDUid)).BeginInit(); this.TCMain.SuspendLayout(); this.TPMail.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUDMailRecipient)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailItemLevel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailItemCount)).BeginInit(); this.tabPage2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailRecipient)).BeginInit(); this.SuspendLayout(); // // TxtCommand @@ -2115,8 +2117,10 @@ namespace GrasscutterTools.Forms // // TPMail // + this.TPMail.Controls.Add(this.BtnAddMailItem); + this.TPMail.Controls.Add(this.BtnDeleteMailItem); this.TPMail.Controls.Add(this.tabControl1); - this.TPMail.Controls.Add(this.button1); + this.TPMail.Controls.Add(this.BtnSendMail); this.TPMail.Controls.Add(this.ListMailItems); this.TPMail.Controls.Add(this.LblMailItemsLabel); this.TPMail.Controls.Add(this.NUDMailRecipient); @@ -2133,146 +2137,6 @@ namespace GrasscutterTools.Forms this.TPMail.Name = "TPMail"; this.TPMail.UseVisualStyleBackColor = true; // - // LblMailSenderLabel - // - resources.ApplyResources(this.LblMailSenderLabel, "LblMailSenderLabel"); - this.LblMailSenderLabel.Name = "LblMailSenderLabel"; - // - // TxtMailSender - // - resources.ApplyResources(this.TxtMailSender, "TxtMailSender"); - this.TxtMailSender.Name = "TxtMailSender"; - // - // LblMailTitleLabel - // - resources.ApplyResources(this.LblMailTitleLabel, "LblMailTitleLabel"); - this.LblMailTitleLabel.Name = "LblMailTitleLabel"; - // - // TxtMailTitle - // - resources.ApplyResources(this.TxtMailTitle, "TxtMailTitle"); - this.TxtMailTitle.Name = "TxtMailTitle"; - // - // LblMailContentLabel - // - resources.ApplyResources(this.LblMailContentLabel, "LblMailContentLabel"); - this.LblMailContentLabel.Name = "LblMailContentLabel"; - // - // TxtMailContent - // - resources.ApplyResources(this.TxtMailContent, "TxtMailContent"); - this.TxtMailContent.Name = "TxtMailContent"; - // - // LblMailRecipientLabel - // - resources.ApplyResources(this.LblMailRecipientLabel, "LblMailRecipientLabel"); - this.LblMailRecipientLabel.Name = "LblMailRecipientLabel"; - // - // RbMailSendToAll - // - resources.ApplyResources(this.RbMailSendToAll, "RbMailSendToAll"); - this.RbMailSendToAll.Name = "RbMailSendToAll"; - this.RbMailSendToAll.TabStop = true; - this.RbMailSendToAll.UseVisualStyleBackColor = true; - // - // RbMailSendToPlayer - // - resources.ApplyResources(this.RbMailSendToPlayer, "RbMailSendToPlayer"); - this.RbMailSendToPlayer.Name = "RbMailSendToPlayer"; - this.RbMailSendToPlayer.TabStop = true; - this.RbMailSendToPlayer.UseVisualStyleBackColor = true; - // - // NUDMailRecipient - // - resources.ApplyResources(this.NUDMailRecipient, "NUDMailRecipient"); - this.NUDMailRecipient.Name = "NUDMailRecipient"; - // - // LblMailItemsLabel - // - resources.ApplyResources(this.LblMailItemsLabel, "LblMailItemsLabel"); - this.LblMailItemsLabel.Name = "LblMailItemsLabel"; - // - // ListMailItems - // - resources.ApplyResources(this.ListMailItems, "ListMailItems"); - this.ListMailItems.FormattingEnabled = true; - this.ListMailItems.Name = "ListMailItems"; - // - // button1 - // - resources.ApplyResources(this.button1, "button1"); - this.button1.Name = "button1"; - this.button1.UseVisualStyleBackColor = true; - // - // ListMailSelectableItems - // - resources.ApplyResources(this.ListMailSelectableItems, "ListMailSelectableItems"); - this.ListMailSelectableItems.FormattingEnabled = true; - this.ListMailSelectableItems.Name = "ListMailSelectableItems"; - // - // TxtMailSelectableItemFilter - // - resources.ApplyResources(this.TxtMailSelectableItemFilter, "TxtMailSelectableItemFilter"); - this.TxtMailSelectableItemFilter.Name = "TxtMailSelectableItemFilter"; - // - // TxtBanReason - // - this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - resources.ApplyResources(this.TxtBanReason, "TxtBanReason"); - this.TxtBanReason.Maximum = 0F; - this.TxtBanReason.Minimum = 0F; - this.TxtBanReason.Name = "TxtBanReason"; - // - // label1 - // - resources.ApplyResources(this.label1, "label1"); - this.label1.Name = "label1"; - // - // numericUpDown1 - // - resources.ApplyResources(this.numericUpDown1, "numericUpDown1"); - this.numericUpDown1.Maximum = new decimal(new int[] { - 1000000, - 0, - 0, - 0}); - this.numericUpDown1.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // label2 - // - resources.ApplyResources(this.label2, "label2"); - this.label2.Name = "label2"; - // - // numericUpDown2 - // - resources.ApplyResources(this.numericUpDown2, "numericUpDown2"); - this.numericUpDown2.Maximum = new decimal(new int[] { - 90, - 0, - 0, - 0}); - this.numericUpDown2.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // // tabControl1 // resources.ApplyResources(this.tabControl1, "tabControl1"); @@ -2284,41 +2148,200 @@ namespace GrasscutterTools.Forms // tabPage1 // this.tabPage1.Controls.Add(this.TxtMailSelectableItemFilter); - this.tabPage1.Controls.Add(this.numericUpDown2); + this.tabPage1.Controls.Add(this.NUDMailItemLevel); this.tabPage1.Controls.Add(this.ListMailSelectableItems); - this.tabPage1.Controls.Add(this.label2); - this.tabPage1.Controls.Add(this.label1); - this.tabPage1.Controls.Add(this.numericUpDown1); + this.tabPage1.Controls.Add(this.LblMailItemLevel); + this.tabPage1.Controls.Add(this.LblMailItemCount); + this.tabPage1.Controls.Add(this.NUDMailItemCount); resources.ApplyResources(this.tabPage1, "tabPage1"); this.tabPage1.Name = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; // + // TxtMailSelectableItemFilter + // + resources.ApplyResources(this.TxtMailSelectableItemFilter, "TxtMailSelectableItemFilter"); + this.TxtMailSelectableItemFilter.Name = "TxtMailSelectableItemFilter"; + this.TxtMailSelectableItemFilter.TextChanged += new System.EventHandler(this.TxtMailSelectableItemFilter_TextChanged); + // + // NUDMailItemLevel + // + resources.ApplyResources(this.NUDMailItemLevel, "NUDMailItemLevel"); + this.NUDMailItemLevel.Maximum = new decimal(new int[] { + 90, + 0, + 0, + 0}); + this.NUDMailItemLevel.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUDMailItemLevel.Name = "NUDMailItemLevel"; + this.NUDMailItemLevel.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // ListMailSelectableItems + // + resources.ApplyResources(this.ListMailSelectableItems, "ListMailSelectableItems"); + this.ListMailSelectableItems.FormattingEnabled = true; + this.ListMailSelectableItems.Name = "ListMailSelectableItems"; + // + // LblMailItemLevel + // + resources.ApplyResources(this.LblMailItemLevel, "LblMailItemLevel"); + this.LblMailItemLevel.Name = "LblMailItemLevel"; + // + // LblMailItemCount + // + resources.ApplyResources(this.LblMailItemCount, "LblMailItemCount"); + this.LblMailItemCount.Name = "LblMailItemCount"; + // + // NUDMailItemCount + // + resources.ApplyResources(this.NUDMailItemCount, "NUDMailItemCount"); + this.NUDMailItemCount.Maximum = new decimal(new int[] { + 1000000, + 0, + 0, + 0}); + this.NUDMailItemCount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUDMailItemCount.Name = "NUDMailItemCount"; + this.NUDMailItemCount.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // // tabPage2 // - this.tabPage2.Controls.Add(this.button3); - this.tabPage2.Controls.Add(this.button2); + this.tabPage2.Controls.Add(this.BtnClearMail); + this.tabPage2.Controls.Add(this.BtnRemoveMail); this.tabPage2.Controls.Add(this.ListMailList); resources.ApplyResources(this.tabPage2, "tabPage2"); this.tabPage2.Name = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // + // BtnClearMail + // + resources.ApplyResources(this.BtnClearMail, "BtnClearMail"); + this.BtnClearMail.Name = "BtnClearMail"; + this.BtnClearMail.UseVisualStyleBackColor = true; + this.BtnClearMail.Click += new System.EventHandler(this.BtnClearMail_Click); + // + // BtnRemoveMail + // + resources.ApplyResources(this.BtnRemoveMail, "BtnRemoveMail"); + this.BtnRemoveMail.Name = "BtnRemoveMail"; + this.BtnRemoveMail.UseVisualStyleBackColor = true; + this.BtnRemoveMail.Click += new System.EventHandler(this.BtnRemoveMail_Click); + // // ListMailList // resources.ApplyResources(this.ListMailList, "ListMailList"); this.ListMailList.FormattingEnabled = true; this.ListMailList.Name = "ListMailList"; + this.ListMailList.SelectedIndexChanged += new System.EventHandler(this.ListMailList_SelectedIndexChanged); // - // button2 + // BtnSendMail // - resources.ApplyResources(this.button2, "button2"); - this.button2.Name = "button2"; - this.button2.UseVisualStyleBackColor = true; + resources.ApplyResources(this.BtnSendMail, "BtnSendMail"); + this.BtnSendMail.Name = "BtnSendMail"; + this.BtnSendMail.UseVisualStyleBackColor = true; + this.BtnSendMail.Click += new System.EventHandler(this.BtnSendMail_Click); // - // button3 + // ListMailItems // - resources.ApplyResources(this.button3, "button3"); - this.button3.Name = "button3"; - this.button3.UseVisualStyleBackColor = true; + resources.ApplyResources(this.ListMailItems, "ListMailItems"); + this.ListMailItems.FormattingEnabled = true; + this.ListMailItems.Name = "ListMailItems"; + // + // LblMailItemsLabel + // + resources.ApplyResources(this.LblMailItemsLabel, "LblMailItemsLabel"); + this.LblMailItemsLabel.Name = "LblMailItemsLabel"; + // + // NUDMailRecipient + // + resources.ApplyResources(this.NUDMailRecipient, "NUDMailRecipient"); + this.NUDMailRecipient.Name = "NUDMailRecipient"; + // + // RbMailSendToPlayer + // + resources.ApplyResources(this.RbMailSendToPlayer, "RbMailSendToPlayer"); + this.RbMailSendToPlayer.Name = "RbMailSendToPlayer"; + this.RbMailSendToPlayer.UseVisualStyleBackColor = true; + // + // RbMailSendToAll + // + resources.ApplyResources(this.RbMailSendToAll, "RbMailSendToAll"); + this.RbMailSendToAll.Checked = true; + this.RbMailSendToAll.Name = "RbMailSendToAll"; + this.RbMailSendToAll.TabStop = true; + this.RbMailSendToAll.UseVisualStyleBackColor = true; + // + // LblMailRecipientLabel + // + resources.ApplyResources(this.LblMailRecipientLabel, "LblMailRecipientLabel"); + this.LblMailRecipientLabel.Name = "LblMailRecipientLabel"; + // + // TxtMailContent + // + resources.ApplyResources(this.TxtMailContent, "TxtMailContent"); + this.TxtMailContent.Name = "TxtMailContent"; + // + // LblMailContentLabel + // + resources.ApplyResources(this.LblMailContentLabel, "LblMailContentLabel"); + this.LblMailContentLabel.Name = "LblMailContentLabel"; + // + // TxtMailTitle + // + resources.ApplyResources(this.TxtMailTitle, "TxtMailTitle"); + this.TxtMailTitle.Name = "TxtMailTitle"; + // + // LblMailTitleLabel + // + resources.ApplyResources(this.LblMailTitleLabel, "LblMailTitleLabel"); + this.LblMailTitleLabel.Name = "LblMailTitleLabel"; + // + // TxtMailSender + // + resources.ApplyResources(this.TxtMailSender, "TxtMailSender"); + this.TxtMailSender.Name = "TxtMailSender"; + // + // LblMailSenderLabel + // + resources.ApplyResources(this.LblMailSenderLabel, "LblMailSenderLabel"); + this.LblMailSenderLabel.Name = "LblMailSenderLabel"; + // + // BtnAddMailItem + // + resources.ApplyResources(this.BtnAddMailItem, "BtnAddMailItem"); + this.BtnAddMailItem.Name = "BtnAddMailItem"; + this.BtnAddMailItem.UseVisualStyleBackColor = true; + this.BtnAddMailItem.Click += new System.EventHandler(this.BtnAddMailItem_Click); + // + // BtnDeleteMailItem + // + resources.ApplyResources(this.BtnDeleteMailItem, "BtnDeleteMailItem"); + this.BtnDeleteMailItem.Name = "BtnDeleteMailItem"; + this.BtnDeleteMailItem.UseVisualStyleBackColor = true; + this.BtnDeleteMailItem.Click += new System.EventHandler(this.BtnDeleteMailItem_Click); + // + // TxtBanReason + // + this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + resources.ApplyResources(this.TxtBanReason, "TxtBanReason"); + this.TxtBanReason.Maximum = 0F; + this.TxtBanReason.Minimum = 0F; + this.TxtBanReason.Name = "TxtBanReason"; // // FormMain // @@ -2416,13 +2439,13 @@ namespace GrasscutterTools.Forms this.TCMain.ResumeLayout(false); this.TPMail.ResumeLayout(false); this.TPMail.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUDMailRecipient)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailItemLevel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailItemCount)).EndInit(); this.tabPage2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUDMailRecipient)).EndInit(); this.ResumeLayout(false); } @@ -2648,18 +2671,20 @@ namespace GrasscutterTools.Forms private System.Windows.Forms.RadioButton RbMailSendToPlayer; private System.Windows.Forms.RadioButton RbMailSendToAll; private System.Windows.Forms.Label LblMailRecipientLabel; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button BtnSendMail; private System.Windows.Forms.TextBox TxtMailSelectableItemFilter; private System.Windows.Forms.ListBox ListMailSelectableItems; - private System.Windows.Forms.NumericUpDown numericUpDown2; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.NumericUpDown numericUpDown1; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown NUDMailItemLevel; + private System.Windows.Forms.Label LblMailItemLevel; + private System.Windows.Forms.NumericUpDown NUDMailItemCount; + private System.Windows.Forms.Label LblMailItemCount; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.ListBox ListMailList; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button BtnClearMail; + private System.Windows.Forms.Button BtnRemoveMail; + private System.Windows.Forms.Button BtnAddMailItem; + private System.Windows.Forms.Button BtnDeleteMailItem; } } diff --git a/Source/GrasscutterTools/Forms/FormMain.cs b/Source/GrasscutterTools/Forms/FormMain.cs index 13d3559..2eea869 100644 --- a/Source/GrasscutterTools/Forms/FormMain.cs +++ b/Source/GrasscutterTools/Forms/FormMain.cs @@ -29,6 +29,7 @@ using System.Windows.Forms; using GrasscutterTools.DispatchServer; using GrasscutterTools.Game; +using GrasscutterTools.Game.Mail; using GrasscutterTools.GOOD; using GrasscutterTools.OpenCommand; using GrasscutterTools.Properties; @@ -78,6 +79,7 @@ namespace GrasscutterTools.Forms InitStatList(); InitPermList(); InitQuestList(); + InitMailPage(); ChangeTPArtifact(); } @@ -122,6 +124,9 @@ namespace GrasscutterTools.Forms // 初始化开放命令 InitOpenCommand(); + + // 初始化邮件列表 + InitMailList(); } catch (Exception ex) { @@ -136,11 +141,15 @@ namespace GrasscutterTools.Forms { try { - Settings.Default.AutoCopy = ChkAutoCopy.Checked; + Settings.Default.AutoCopy = ChkAutoCopy.Checked; + + // 保存自定义命令 SaveCustomCommands(); - SaveGiveItemRecord(); - SaveSpawnRecord(); + + // 保存开放命令设置 SaveOpenCommand(); + + // 保存默认设置 Settings.Default.Save(); } catch (Exception ex) @@ -688,15 +697,15 @@ namespace GrasscutterTools.Forms else { var t = CmbMainAttribution.SelectedItem as string; - var mainAttr = t.Substring(0, t.IndexOf(':')).Trim(); + var mainAttr = ItemMap.ToId(t); var subAttrs = ""; if (ListSubAttributionChecked.Items.Count > 0) { - var subAttrDir = new Dictionary(ListSubAttributionChecked.Items.Count); + var subAttrDir = new Dictionary(ListSubAttributionChecked.Items.Count); foreach (string item in ListSubAttributionChecked.Items) { - var subId = item.Substring(0, item.IndexOf(':')).Trim(); + var subId = ItemMap.ToId(item); var times = int.Parse(item.Substring(item.LastIndexOf('x') + 1)); if (subAttrDir.ContainsKey(subId)) subAttrDir[subId] += times; @@ -791,7 +800,7 @@ namespace GrasscutterTools.Forms var name = ListWeapons.SelectedItem as string; if (!string.IsNullOrEmpty(name)) { - var id = name.Substring(0, name.IndexOf(':')).Trim(); + var id = ItemMap.ToId(name); if (Check(CommandVersion.V1_2_2)) SetCommand("/give", $"{id} x{NUDWeaponAmout.Value} lv{NUDWeaponLevel.Value} r{NUDWeaponRefinement.Value}"); else @@ -837,7 +846,7 @@ namespace GrasscutterTools.Forms var name = ListGameItems.SelectedItem as string; if (!string.IsNullOrEmpty(name)) { - var id = name.Substring(0, name.IndexOf(':')).Trim(); + var id = ItemMap.ToId(name); if (ChkDrop.Checked) { @@ -927,6 +936,7 @@ namespace GrasscutterTools.Forms var cmd = new GameCommand($"{ListGameItems.SelectedItem} x{NUDGameItemAmout.Value}", TxtCommand.Text); GiveItemCommands.Add(cmd); ListGiveItemLogs.Items.Add(cmd.Name); + SaveGiveItemRecord(); } } @@ -939,6 +949,7 @@ namespace GrasscutterTools.Forms { GiveItemCommands.RemoveAt(ListGiveItemLogs.SelectedIndex); ListGiveItemLogs.Items.RemoveAt(ListGiveItemLogs.SelectedIndex); + SaveGiveItemRecord(); } } @@ -951,6 +962,7 @@ namespace GrasscutterTools.Forms { GiveItemCommands.Clear(); ListGiveItemLogs.Items.Clear(); + SaveGiveItemRecord(); } } @@ -1093,7 +1105,7 @@ namespace GrasscutterTools.Forms var selectedItem = ListEntity.SelectedItem as string; if (!string.IsNullOrEmpty(selectedItem)) { - var id = selectedItem.Substring(0, selectedItem.IndexOf(':')).Trim(); + var id = ItemMap.ToId(selectedItem); if (Check(CommandVersion.V1_3_1)) SetCommand("/spawn", $"{id} x{NUDEntityAmout.Value} lv{NUDEntityLevel.Value}" + (ChkInfiniteHP.Checked ? " hp0" : "")); else @@ -1181,6 +1193,7 @@ namespace GrasscutterTools.Forms var cmd = new GameCommand($"{ListEntity.SelectedItem} Lv{NUDEntityLevel.Value} x{NUDEntityAmout.Value}", TxtCommand.Text); SpawnCommands.Add(cmd); ListSpawnLogs.Items.Add(cmd.Name); + SaveSpawnRecord(); } } @@ -1193,6 +1206,7 @@ namespace GrasscutterTools.Forms { SpawnCommands.RemoveAt(ListSpawnLogs.SelectedIndex); ListSpawnLogs.Items.RemoveAt(ListSpawnLogs.SelectedIndex); + SaveSpawnRecord(); } } @@ -1205,6 +1219,7 @@ namespace GrasscutterTools.Forms { SpawnCommands.Clear(); ListSpawnLogs.Items.Clear(); + SaveSpawnRecord(); } } @@ -1248,7 +1263,7 @@ namespace GrasscutterTools.Forms // 可以直接弃用 scene 命令 var name = ListScenes.SelectedItem as string; - var id = name.Substring(0, name.IndexOf(':')).Trim(); + var id = ItemMap.ToId(name); if (Check(CommandVersion.V1_2_2)) { SetCommand("/scene", id.ToString()); @@ -1420,6 +1435,227 @@ namespace GrasscutterTools.Forms #endregion - 管理 Management - + #region - 邮件 Mail - + + /// + /// 初始化邮件页面 + /// + private void InitMailPage() + { + TxtMailSender.Text = Settings.Default.DefaultMailSender; + LoadMailSelectableItems(); + } + + /// + /// 点击发送邮件时触发 + /// + private void BtnSendMail_Click(object sender, EventArgs e) + { + var mail = new Mail + { + Title = TxtMailTitle.Text.Trim(), + Sender = TxtMailSender.Text.Trim(), + Content = TxtMailContent.Text.Trim(), + Recipient = RbMailSendToAll.Checked ? 0 : (int)NUDMailRecipient.Value, + ItemList = new List(MailItems), + SendTime = DateTime.Now, + }; + + if (mail.Title == "" || mail.Sender == "" || mail.Content == "") + { + MessageBox.Show("输入不能为空!", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + var cmd = $"/sendMail {(mail.SendToAll ? "all" : mail.Recipient.ToString())} |" + + $"/sendMail {mail.Title} |" + + $"/sendMail {mail.Content} |" + + $"/sendMail {mail.Sender} |"; + foreach (var item in mail.ItemList) + cmd += $"/sendMail {item.ItemId} {item.ItemCount} {item.ItemLevel} |"; + cmd += "/sendMail finish"; + + SetCommand(cmd); + AddMailToList(mail); + } + + /// + /// 展示邮件 + /// + /// + private void ShowMail(Mail mail) + { + TxtMailTitle.Text = mail.Title; + TxtMailSender.Text = mail.Sender; + TxtMailContent.Text = mail.Content; + NUDMailRecipient.Value = mail.Recipient; + RbMailSendToAll.Checked = mail.SendToAll; + RbMailSendToPlayer.Checked = !mail.SendToAll; + ShowMailItems(mail.ItemList); + } + + + #region -- 邮件附件列表 Mail items -- + + /// + /// 当前邮件附件列表 + /// + private readonly List MailItems = new List(); + + /// + /// 展示邮件附件列表 + /// + /// + private void ShowMailItems(List items) + { + MailItems.Clear(); + MailItems.AddRange(items); + ListMailItems.BeginUpdate(); + ListMailItems.Items.Clear(); + ListMailItems.Items.AddRange(items.Select(it => it.ToString()).ToArray()); + ListMailItems.EndUpdate(); + } + + /// + /// 点击添加邮件附件项时触发 + /// + private void BtnAddMailItem_Click(object sender, EventArgs e) + { + if (ListMailSelectableItems.SelectedIndex == -1) + return; + var item = ListMailSelectableItems.SelectedItem as string; + var itemId = ItemMap.ToId(item); + var mailItem = new MailItem + { + ItemId = itemId, + ItemCount = (int)NUDMailItemCount.Value, + ItemLevel = (int)NUDMailItemLevel.Value, + }; + MailItems.Add(mailItem); + ListMailItems.Items.Add(mailItem.ToString()); + } + + /// + /// 点击删除邮件附件项时触发 + /// + private void BtnDeleteMailItem_Click(object sender, EventArgs e) + { + if (ListMailItems.SelectedIndex == -1) return; + + MailItems.RemoveAt(ListMailItems.SelectedIndex); + ListMailItems.Items.RemoveAt(ListMailItems.SelectedIndex); + } + + #endregion + + #region -- 邮件附件可选列表 Mail item selectable list -- + + /// + /// 加载附件可选项列表 + /// + private void LoadMailSelectableItems() + { + ListMailSelectableItems.Items.Clear(); + ListMailSelectableItems.Items.AddRange(GameData.Items.Lines); + } + + /// + /// 邮件页面物品列表过滤器文本改变时触发 + /// + private void TxtMailSelectableItemFilter_TextChanged(object sender, EventArgs e) + { + UIUtil.ListBoxFilter(ListMailSelectableItems, GameData.Items.Lines, TxtMailSelectableItemFilter.Text); + } + + #endregion + + #region -- 邮件列表 Mail list -- + + /// + /// 获取物品记录文件路径 + /// + private readonly string MailListPath = Path.Combine(Application.LocalUserAppDataPath, "MailList.json"); + + /// + /// 邮件列表 + /// + private List MailList = new List(); + + /// + /// 初始化邮件列表 + /// + private void InitMailList() + { + if (File.Exists(MailListPath)) + { + MailList = JsonConvert.DeserializeObject>(File.ReadAllText(MailListPath)); + ListMailList.Items.AddRange(MailList.Select(it => it.ToString()).ToArray()); + } + else + { + MailList = new List(); + } + } + + /// + /// 保存邮件列表 + /// + private void SaveMailList() + { + File.WriteAllText(MailListPath, JsonConvert.SerializeObject(MailList)); + } + + /// + /// 添加邮件到列表 + /// + /// 邮件 + private void AddMailToList(Mail mail) + { + MailList.Add(mail); + ListMailList.Items.Add(mail.ToString()); + SaveMailList(); + } + + /// + /// 邮件列表选中项改变时发生 + /// + private void ListMailList_SelectedIndexChanged(object sender, EventArgs e) + { + if (ListMailList.SelectedIndex == -1) return; + // 显示选中邮件 + var mail = MailList[ListMailList.SelectedIndex]; + ShowMail(mail); + } + + /// + /// 点击删除邮件按钮时触发 + /// + private void BtnRemoveMail_Click(object sender, EventArgs e) + { + if (ListMailList.SelectedIndex == -1) return; + MailList.RemoveAt(ListMailList.SelectedIndex); + ListMailList.Items.RemoveAt(ListMailList.SelectedIndex); + SaveMailList(); + } + + /// + /// 点击清空邮件列表按钮时触发 + /// + private void BtnClearMail_Click(object sender, EventArgs e) + { + if (MailList.Count == 0) return; + if (MessageBox.Show(Resources.AskConfirmDeletion, Resources.Tips, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + ListMailList.Items.Clear(); + MailList.Clear(); + SaveMailList(); + } + } + + #endregion + + #endregion + #region - 关于 About - /// @@ -1988,7 +2224,11 @@ namespace GrasscutterTools.Forms if (GOODData.Avatars.TryGetValue(character.Name, out var character_id)) { if (Check(CommandVersion.V1_4_1)) - commands_list.Add($"/give {character_id} lv{character.Level} c{character.Constellation} sl{character.Talents}"); + { + // 取最高级的技能等级 + var skillLevel = Math.Max(Math.Max(character.Talents.Auto, character.Talents.Skill), character.Talents.Burst); + commands_list.Add($"/give {character_id} lv{character.Level} c{character.Constellation} sl{skillLevel}"); + } else commands_list.Add($"/give {character_id} lv{character.Level} c{character.Constellation}"); } @@ -2140,7 +2380,7 @@ namespace GrasscutterTools.Forms if (ListQuest.SelectedIndex == -1) return; var item = ListQuest.SelectedItem as string; - var id = item.Substring(0, item.IndexOf(':')).Trim(); + var id = ItemMap.ToId(item); SetCommand("/quest", $"{(sender as Button).Tag} {id}"); } diff --git a/Source/GrasscutterTools/Forms/FormMain.resx b/Source/GrasscutterTools/Forms/FormMain.resx index 7ff0460..cbeca43 100644 --- a/Source/GrasscutterTools/Forms/FormMain.resx +++ b/Source/GrasscutterTools/Forms/FormMain.resx @@ -8193,9 +8193,246 @@ Top, Bottom, Left, Right + + NoControl + + + 329, 121 + + + 75, 23 + + + 8 + + + + 添加 + + + BtnAddMailItem + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TPMail + + + 0 + + + NoControl + + + 329, 150 + + + 75, 23 + + + 9 + + + - 删除 + + + BtnDeleteMailItem + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TPMail + + + 1 + Top, Bottom, Left, Right + + Top, Left, Right + + + 0, 0 + + + 228, 23 + + + 12 + + + TxtMailSelectableItemFilter + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 0 + + + Bottom, Left + + + 175, 179 + + + 50, 23 + + + 15 + + + NUDMailItemLevel + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 1 + + + Top, Bottom, Left, Right + + + 17 + + + 0, 26 + + + 0, 0, 0, 0 + + + 228, 140 + + + 13 + + + ListMailSelectableItems + + + System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 2 + + + Bottom, Left + + + True + + + NoControl + + + 127, 181 + + + 44, 17 + + + 17 + + + 等级: + + + LblMailItemLevel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 3 + + + Bottom, Left + + + True + + + NoControl + + + 1, 181 + + + 44, 17 + + + 15 + + + 数量: + + + LblMailItemCount + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 4 + + + Bottom, Left + + + 51, 179 + + + 60, 23 + + + 14 + + + NUDMailItemCount + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 5 + + + 4, 26 + + + 3, 3, 3, 3 + + + 228, 204 + + + 0 + + + 物品列表 + tabPage1 @@ -8208,6 +8445,105 @@ 0 + + NoControl + + + 87, 177 + + + 75, 23 + + + 18 + + + × 清空 + + + BtnClearMail + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 0 + + + NoControl + + + 6, 178 + + + 75, 23 + + + 17 + + + - 删除 + + + BtnRemoveMail + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 1 + + + Top, Bottom, Left, Right + + + 17 + + + 0, 0 + + + 0, 0, 0, 0 + + + 228, 174 + + + 0 + + + ListMailList + + + System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 2 + + + 4, 26 + + + 3, 3, 3, 3 + + + 228, 204 + + + 1 + + + 邮件列表 + tabPage2 @@ -8227,7 +8563,7 @@ 236, 234 - 19 + 11 tabControl1 @@ -8239,37 +8575,37 @@ TPMail - 0 + 2 - + Bottom, Left - + NoControl - + 329, 219 - + 75, 23 - - 12 + + 10 - + 发送 - - button1 + + BtnSendMail - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TPMail - - 1 + + 3 Top, Bottom, Left @@ -8284,7 +8620,7 @@ 250, 123 - 11 + 7 ListMailItems @@ -8296,7 +8632,7 @@ TPMail - 2 + 4 True @@ -8326,7 +8662,7 @@ TPMail - 3 + 5 202, 35 @@ -8335,7 +8671,7 @@ 121, 23 - 9 + 4 NUDMailRecipient @@ -8347,7 +8683,7 @@ TPMail - 4 + 6 True @@ -8362,7 +8698,7 @@ 50, 21 - 8 + 3 玩家 @@ -8377,7 +8713,7 @@ TPMail - 5 + 7 True @@ -8392,7 +8728,7 @@ 62, 21 - 7 + 2 所有人 @@ -8407,7 +8743,7 @@ TPMail - 6 + 8 True @@ -8437,7 +8773,7 @@ TPMail - 7 + 9 73, 93 @@ -8446,7 +8782,7 @@ 250, 23 - 5 + 6 TxtMailContent @@ -8458,7 +8794,7 @@ TPMail - 8 + 10 True @@ -8488,7 +8824,7 @@ TPMail - 9 + 11 73, 64 @@ -8497,7 +8833,7 @@ 250, 23 - 3 + 5 TxtMailTitle @@ -8509,7 +8845,7 @@ TPMail - 10 + 12 True @@ -8539,7 +8875,7 @@ TPMail - 11 + 13 73, 6 @@ -8560,7 +8896,7 @@ TPMail - 12 + 14 True @@ -8590,7 +8926,7 @@ TPMail - 13 + 15 4, 26 @@ -8643,60 +8979,6 @@ 0 - - Top, Bottom, Left, Right - - - 17 - - - 0, 26 - - - 0, 0, 0, 0 - - - 228, 140 - - - 13 - - - ListMailSelectableItems - - - System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 2 - - - Top, Left, Right - - - 0, 0 - - - 228, 23 - - - 14 - - - TxtMailSelectableItemFilter - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 0 - 250, 22 @@ -8721,354 +9003,6 @@ 3 - - Bottom, Left - - - True - - - 1, 177 - - - 44, 17 - - - 15 - - - 数量: - - - label1 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 4 - - - Bottom, Left - - - 51, 175 - - - 60, 23 - - - 16 - - - numericUpDown1 - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 5 - - - Bottom, Left - - - True - - - 127, 177 - - - 44, 17 - - - 17 - - - 等级: - - - label2 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 3 - - - Bottom, Left - - - 175, 175 - - - 50, 23 - - - 18 - - - numericUpDown2 - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 1 - - - TxtMailSelectableItemFilter - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 0 - - - numericUpDown2 - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 1 - - - ListMailSelectableItems - - - System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 2 - - - label2 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 3 - - - label1 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 4 - - - numericUpDown1 - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 5 - - - 4, 26 - - - 3, 3, 3, 3 - - - 228, 204 - - - 0 - - - 物品列表 - - - tabPage1 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 0 - - - button3 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 0 - - - button2 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 1 - - - ListMailList - - - System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 2 - - - 4, 26 - - - 3, 3, 3, 3 - - - 228, 204 - - - 1 - - - 邮件列表 - - - tabPage2 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 1 - - - Top, Bottom, Left, Right - - - 17 - - - 0, 0 - - - 0, 0, 0, 0 - - - 228, 174 - - - 0 - - - ListMailList - - - System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 2 - - - 6, 178 - - - 75, 23 - - - 1 - - - - 删除 - - - button2 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 1 - - - 87, 177 - - - 75, 23 - - - 2 - - - × 清空 - - - button3 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage2 - - - 0 - True @@ -9081,6 +9015,9 @@ Microsoft YaHei UI, 9pt + + NoControl + 3, 4, 3, 4 diff --git a/Source/GrasscutterTools/Game/ItemMap.cs b/Source/GrasscutterTools/Game/ItemMap.cs index 5a1ad8c..c67aebd 100644 --- a/Source/GrasscutterTools/Game/ItemMap.cs +++ b/Source/GrasscutterTools/Game/ItemMap.cs @@ -69,5 +69,7 @@ namespace GrasscutterTools.Game public string[] Names { get; } public string[] Lines { get; } + + public static int ToId(string line) => int.Parse(line.Substring(0, line.IndexOf(':')).Trim()); } } \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Mail/Mail.cs b/Source/GrasscutterTools/Game/Mail/Mail.cs index 74403ef..ed1708d 100644 --- a/Source/GrasscutterTools/Game/Mail/Mail.cs +++ b/Source/GrasscutterTools/Game/Mail/Mail.cs @@ -45,5 +45,13 @@ namespace GrasscutterTools.Game.Mail /// 发送时间 /// public DateTime SendTime { get; set; } + + public override string ToString() + { + if (SendToAll) + return $"ToAll: [{Title}] {Content} | {SendTime}"; + else + return $"To[{Recipient}]: [{Title}] {Content} | {SendTime}"; + } } } diff --git a/Source/GrasscutterTools/Game/Mail/MailItem.cs b/Source/GrasscutterTools/Game/Mail/MailItem.cs index c61e8fd..f43a775 100644 --- a/Source/GrasscutterTools/Game/Mail/MailItem.cs +++ b/Source/GrasscutterTools/Game/Mail/MailItem.cs @@ -22,7 +22,12 @@ public override string ToString() { - return $"{ItemId}:{GameData.Items[ItemId]} x{ItemCount} lv{ItemLevel}"; + if (ItemLevel > 1) + return $"{ItemId}:{GameData.Items[ItemId]} x{ItemCount} lv{ItemLevel}"; + else if (ItemCount > 1) + return $"{ItemId}:{GameData.Items[ItemId]} x{ItemCount}"; + else + return $"{ItemId}:{GameData.Items[ItemId]}"; } } }