From 5eb29262ea5049eb3cf11d4ab2974c2581345edd Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Sat, 28 Dec 2024 23:21:18 +0000 Subject: [PATCH 1/6] Server Forms Search Boxes Added the following Search Boxes to Forms: NPCInfoForm QuestInfoForm RecipeInfoForm GameShopForm MagicInfoForm --- Server.MirForms/Database/GameShop.cs | 58 + Server.MirForms/Database/GameShop.designer.cs | 20 +- .../Database/MagicInfoForm.Designer.cs | 1 + Server.MirForms/Database/MagicInfoForm.cs | 1128 +++++++++-------- Server.MirForms/Database/MagicInfoForm.resx | 54 +- .../Database/NPCInfoForm.Designer.cs | 26 +- Server.MirForms/Database/NPCInfoForm.cs | 124 +- Server.MirForms/Database/NPCInfoForm.resx | 4 +- .../Database/QuestInfoForm.Designer.cs | 757 +++++------ Server.MirForms/Database/QuestInfoForm.cs | 151 ++- Server.MirForms/Database/QuestInfoForm.resx | 54 +- .../Database/RecipeInfoForm.Designer.cs | 20 +- Server.MirForms/Database/RecipeInfoForm.cs | 59 +- 13 files changed, 1386 insertions(+), 1070 deletions(-) diff --git a/Server.MirForms/Database/GameShop.cs b/Server.MirForms/Database/GameShop.cs index 87fefb3b3..baf363399 100644 --- a/Server.MirForms/Database/GameShop.cs +++ b/Server.MirForms/Database/GameShop.cs @@ -6,6 +6,7 @@ public partial class GameShop : Form { private List SelectedItems; + private bool isGameShopSearchPlaceholderActive = true; public Envir Envir => SMain.EditEnvir; @@ -14,6 +15,12 @@ public GameShop() InitializeComponent(); LoadGameShopItems(); + + GameShopSearchBox_TextChanged(this, EventArgs.Empty); + + GameShopSearchBox.Text = "Search"; + GameShopSearchBox.ForeColor = Color.Gray; // Make the placeholder text look distinct + isGameShopSearchPlaceholderActive = true; } private void GameShop_Load(object sender, EventArgs e) @@ -471,5 +478,56 @@ private void ItemComboBox_SelectedIndexChanged(object sender, EventArgs e) int selectedIndex = GameShopListBox.SelectedIndex; GameShopListBox.Items[selectedIndex] = selectedGameShopItem; } + + #region Search Box + private void GameShopSearchBox_TextChanged(object sender, EventArgs e) + { + // Ignore filtering if placeholder is active or if the text is "Search" + if (isGameShopSearchPlaceholderActive || GameShopSearchBox.Text.Trim() == "Search") return; + + string searchText = GameShopSearchBox.Text.Trim().ToLower(); + + GameShopListBox.Items.Clear(); + + // If the search box is empty, display all game shop items + if (string.IsNullOrEmpty(searchText)) + { + foreach (var item in SMain.EditEnvir.GameShopList) + { + GameShopListBox.Items.Add(item); + } + return; + } + + // Filter game shop items that match the search text + foreach (var item in SMain.EditEnvir.GameShopList) + { + if (!string.IsNullOrEmpty(item.Info?.Name) && item.Info.Name.ToLower().Contains(searchText)) + { + GameShopListBox.Items.Add(item); + } + } + } + + private void GameShopSearchBox_Enter(object sender, EventArgs e) + { + if (isGameShopSearchPlaceholderActive) + { + GameShopSearchBox.Text = string.Empty; + GameShopSearchBox.ForeColor = Color.Black; // Reset to normal text color + isGameShopSearchPlaceholderActive = false; + } + } + + private void GameShopSearchBox_Leave(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(GameShopSearchBox.Text)) + { + GameShopSearchBox.Text = "Search"; + GameShopSearchBox.ForeColor = Color.Gray; // Set placeholder color + isGameShopSearchPlaceholderActive = true; + } + } + #endregion } } diff --git a/Server.MirForms/Database/GameShop.designer.cs b/Server.MirForms/Database/GameShop.designer.cs index 0734fe57b..a9b28f743 100644 --- a/Server.MirForms/Database/GameShop.designer.cs +++ b/Server.MirForms/Database/GameShop.designer.cs @@ -63,6 +63,7 @@ private void InitializeComponent() CategoryFilter_lb = new ComboBox(); ResetFilter_button = new Button(); Add_Button = new Button(); + GameShopSearchBox = new TextBox(); ItemDetails_gb.SuspendLayout(); groupBox3.SuspendLayout(); SuspendLayout(); @@ -71,12 +72,12 @@ private void InitializeComponent() // GameShopListBox.FormattingEnabled = true; GameShopListBox.ItemHeight = 15; - GameShopListBox.Location = new Point(14, 89); + GameShopListBox.Location = new Point(14, 119); GameShopListBox.Margin = new Padding(4, 3, 4, 3); GameShopListBox.Name = "GameShopListBox"; GameShopListBox.ScrollAlwaysVisible = true; GameShopListBox.SelectionMode = SelectionMode.MultiExtended; - GameShopListBox.Size = new Size(234, 379); + GameShopListBox.Size = new Size(234, 349); GameShopListBox.TabIndex = 11; GameShopListBox.SelectedIndexChanged += GameShopListBox_SelectedIndexChanged; // @@ -272,7 +273,7 @@ private void InitializeComponent() // TopItem_checkbox // TopItem_checkbox.AutoSize = true; - TopItem_checkbox.Location = new Point(34, 352); + TopItem_checkbox.Location = new Point(32, 352); TopItem_checkbox.Margin = new Padding(4, 3, 4, 3); TopItem_checkbox.Name = "TopItem_checkbox"; TopItem_checkbox.RightToLeft = RightToLeft.Yes; @@ -471,11 +472,22 @@ private void InitializeComponent() Add_Button.UseVisualStyleBackColor = true; Add_Button.Click += Add_Button_Click; // + // GameShopSearchBox + // + GameShopSearchBox.Location = new Point(14, 88); + GameShopSearchBox.Name = "GameShopSearchBox"; + GameShopSearchBox.Size = new Size(234, 23); + GameShopSearchBox.TabIndex = 114; + GameShopSearchBox.TextChanged += GameShopSearchBox_TextChanged; + GameShopSearchBox.Enter += GameShopSearchBox_Enter; + GameShopSearchBox.Leave += GameShopSearchBox_Leave; + // // GameShop // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(581, 503); + Controls.Add(GameShopSearchBox); Controls.Add(Add_Button); Controls.Add(ServerLog_button); Controls.Add(ResetFilter_button); @@ -496,6 +508,7 @@ private void InitializeComponent() groupBox3.ResumeLayout(false); groupBox3.PerformLayout(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -535,5 +548,6 @@ private void InitializeComponent() private Button Add_Button; private Label label7; private ComboBox ItemComboBox; + private TextBox GameShopSearchBox; } } \ No newline at end of file diff --git a/Server.MirForms/Database/MagicInfoForm.Designer.cs b/Server.MirForms/Database/MagicInfoForm.Designer.cs index 57a169b7e..9b0c02bea 100644 --- a/Server.MirForms/Database/MagicInfoForm.Designer.cs +++ b/Server.MirForms/Database/MagicInfoForm.Designer.cs @@ -58,5 +58,6 @@ partial class MagicInfoForm private System.Windows.Forms.TextBox textBoxName; private System.Windows.Forms.Label label23; private System.Windows.Forms.Label label24; + private TextBox MagicSearchBox; } } \ No newline at end of file diff --git a/Server.MirForms/Database/MagicInfoForm.cs b/Server.MirForms/Database/MagicInfoForm.cs index ee8e880e2..f74a59921 100644 --- a/Server.MirForms/Database/MagicInfoForm.cs +++ b/Server.MirForms/Database/MagicInfoForm.cs @@ -9,90 +9,94 @@ public partial class MagicInfoForm : Form public Envir Envir => SMain.EditEnvir; private MagicInfo _selectedMagicInfo; + private bool isMagicSearchPlaceholderActive = true; public MagicInfoForm() { InitializeComponent(); - for (int i = 0; i < Envir.MagicInfoList.Count; i++) - MagiclistBox.Items.Add(Envir.MagicInfoList[i]); + MagicSearchBox_TextChanged(this, EventArgs.Empty); UpdateMagicForm(); + + MagicSearchBox.Text = "Search"; + MagicSearchBox.ForeColor = Color.Gray; // Placeholder text color + isMagicSearchPlaceholderActive = true; } private void UpdateMagicForm(byte field = 0) { - _selectedMagicInfo = (MagicInfo)MagiclistBox.SelectedItem; - - lblBookValid.BackColor = SystemColors.Window; - - if (_selectedMagicInfo == null) - { - tabControl1.Enabled = false; - lblBookValid.Text = "Searching"; - lblSelected.Text = "Selected Skill: none"; - lblDamageExample.Text = ""; - lblDamageExplained.Text = ""; - txtSkillIcon.Text = "0"; - txtSkillLvl1Points.Text = "0"; - txtSkillLvl1Req.Text = "0"; - txtSkillLvl2Points.Text = "0"; - txtSkillLvl2Req.Text = "0"; - txtSkillLvl3Points.Text = "0"; - txtSkillLvl3Req.Text = "0"; - txtMPBase.Text = "0"; - txtMPIncrease.Text = "0"; - txtDelayBase.Text = "0"; - txtDelayReduction.Text = "0"; - txtDmgBaseMin.Text = "0"; - txtDmgBaseMax.Text = "0"; - txtDmgBonusMin.Text = "0"; - txtDmgBonusMax.Text = "0"; - } - else - { - tabControl1.Enabled = true; - lblSelected.Text = "Selected Skill: " + _selectedMagicInfo.ToString(); - lblDamageExample.Text = - $"Damage @ Skill level 0: {GetMinPower(0):000}-{GetMaxPower(0):000} ||| level 1: {GetMinPower(1):000}-{GetMaxPower(1):000} ||| level 2: {GetMinPower(2):000}-{GetMaxPower(2):000} ||| level 3: {GetMinPower(3):000}-{GetMaxPower(3):000}"; - lblDamageExplained.Text = - $"Damage: {{Random(minstat-maxstat) + [<(random({_selectedMagicInfo.MPowerBase}-{_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus})/4) X (skill level +1)> + random<{_selectedMagicInfo.PowerBase}-{_selectedMagicInfo.PowerBonus + _selectedMagicInfo.PowerBase}>]}} X {{{_selectedMagicInfo.MultiplierBase} + (skill level * {_selectedMagicInfo.MultiplierBonus})}}"; - txtSkillIcon.Text = _selectedMagicInfo.Icon.ToString(); - txtSkillLvl1Points.Text = _selectedMagicInfo.Need1.ToString(); - txtSkillLvl1Req.Text = _selectedMagicInfo.Level1.ToString(); - txtSkillLvl2Points.Text = _selectedMagicInfo.Need2.ToString(); - txtSkillLvl2Req.Text = _selectedMagicInfo.Level2.ToString(); - txtSkillLvl3Points.Text = _selectedMagicInfo.Need3.ToString(); - txtSkillLvl3Req.Text = _selectedMagicInfo.Level3.ToString(); - txtMPBase.Text = _selectedMagicInfo.BaseCost.ToString(); - txtMPIncrease.Text = _selectedMagicInfo.LevelCost.ToString(); - txtDelayBase.Text = _selectedMagicInfo.DelayBase.ToString(); - txtDelayReduction.Text = _selectedMagicInfo.DelayReduction.ToString(); - txtDmgBaseMin.Text = _selectedMagicInfo.PowerBase.ToString(); - txtDmgBaseMax.Text = (_selectedMagicInfo.PowerBase + _selectedMagicInfo.PowerBonus).ToString(); - txtDmgBonusMin.Text = _selectedMagicInfo.MPowerBase.ToString(); - txtDmgBonusMax.Text = (_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus).ToString(); - if (field != 1) + _selectedMagicInfo = (MagicInfo)MagiclistBox.SelectedItem; + + lblBookValid.BackColor = SystemColors.Window; + + if (_selectedMagicInfo == null) + { + tabControl1.Enabled = false; + lblBookValid.Text = "Searching"; + lblSelected.Text = "Selected Skill: none"; + lblDamageExample.Text = ""; + lblDamageExplained.Text = ""; + txtSkillIcon.Text = "0"; + txtSkillLvl1Points.Text = "0"; + txtSkillLvl1Req.Text = "0"; + txtSkillLvl2Points.Text = "0"; + txtSkillLvl2Req.Text = "0"; + txtSkillLvl3Points.Text = "0"; + txtSkillLvl3Req.Text = "0"; + txtMPBase.Text = "0"; + txtMPIncrease.Text = "0"; + txtDelayBase.Text = "0"; + txtDelayReduction.Text = "0"; + txtDmgBaseMin.Text = "0"; + txtDmgBaseMax.Text = "0"; + txtDmgBonusMin.Text = "0"; + txtDmgBonusMax.Text = "0"; + } + else + { + tabControl1.Enabled = true; + lblSelected.Text = "Selected Skill: " + _selectedMagicInfo.ToString(); + lblDamageExample.Text = + $"Damage @ Skill level 0: {GetMinPower(0):000}-{GetMaxPower(0):000} ||| level 1: {GetMinPower(1):000}-{GetMaxPower(1):000} ||| level 2: {GetMinPower(2):000}-{GetMaxPower(2):000} ||| level 3: {GetMinPower(3):000}-{GetMaxPower(3):000}"; + lblDamageExplained.Text = + $"Damage: {{Random(minstat-maxstat) + [<(random({_selectedMagicInfo.MPowerBase}-{_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus})/4) X (skill level +1)> + random<{_selectedMagicInfo.PowerBase}-{_selectedMagicInfo.PowerBonus + _selectedMagicInfo.PowerBase}>]}} X {{{_selectedMagicInfo.MultiplierBase} + (skill level * {_selectedMagicInfo.MultiplierBonus})}}"; + txtSkillIcon.Text = _selectedMagicInfo.Icon.ToString(); + txtSkillLvl1Points.Text = _selectedMagicInfo.Need1.ToString(); + txtSkillLvl1Req.Text = _selectedMagicInfo.Level1.ToString(); + txtSkillLvl2Points.Text = _selectedMagicInfo.Need2.ToString(); + txtSkillLvl2Req.Text = _selectedMagicInfo.Level2.ToString(); + txtSkillLvl3Points.Text = _selectedMagicInfo.Need3.ToString(); + txtSkillLvl3Req.Text = _selectedMagicInfo.Level3.ToString(); + txtMPBase.Text = _selectedMagicInfo.BaseCost.ToString(); + txtMPIncrease.Text = _selectedMagicInfo.LevelCost.ToString(); + txtDelayBase.Text = _selectedMagicInfo.DelayBase.ToString(); + txtDelayReduction.Text = _selectedMagicInfo.DelayReduction.ToString(); + txtDmgBaseMin.Text = _selectedMagicInfo.PowerBase.ToString(); + txtDmgBaseMax.Text = (_selectedMagicInfo.PowerBase + _selectedMagicInfo.PowerBonus).ToString(); + txtDmgBonusMin.Text = _selectedMagicInfo.MPowerBase.ToString(); + txtDmgBonusMax.Text = (_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus).ToString(); + if (field != 1) txtDmgMultBase.Text = _selectedMagicInfo.MultiplierBase.ToString(); - if (field != 2) - txtDmgMultBoost.Text = _selectedMagicInfo.MultiplierBonus.ToString(); - txtRange.Text = _selectedMagicInfo.Range.ToString(); - ItemInfo Book = Envir.GetBook((short)_selectedMagicInfo.Spell); - if (Book != null) - { - lblBookValid.Text = Book.Name; - } - else - { - lblBookValid.Text = "No book found"; - lblBookValid.BackColor = Color.Red; - } - this.textBoxName.Text = _selectedMagicInfo.Name; - } + if (field != 2) + txtDmgMultBoost.Text = _selectedMagicInfo.MultiplierBonus.ToString(); + txtRange.Text = _selectedMagicInfo.Range.ToString(); + ItemInfo Book = Envir.GetBook((short)_selectedMagicInfo.Spell); + if (Book != null) + { + lblBookValid.Text = Book.Name; + } + else + { + lblBookValid.Text = "No book found"; + lblBookValid.BackColor = Color.Red; + } + textBoxName.Text = _selectedMagicInfo.Name; + } } private int GetMaxPower(byte level) { if (_selectedMagicInfo == null) return 0; - return (int)Math.Round((((_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus) / 4F) * (level + 1) + (_selectedMagicInfo.PowerBase + _selectedMagicInfo.PowerBonus))* (_selectedMagicInfo.MultiplierBase + (level * _selectedMagicInfo.MultiplierBonus))); + return (int)Math.Round((((_selectedMagicInfo.MPowerBase + _selectedMagicInfo.MPowerBonus) / 4F) * (level + 1) + (_selectedMagicInfo.PowerBase + _selectedMagicInfo.PowerBonus)) * (_selectedMagicInfo.MultiplierBase + (level * _selectedMagicInfo.MultiplierBonus))); } private int GetMinPower(byte level) { @@ -102,621 +106,632 @@ private int GetMinPower(byte level) private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.MagiclistBox = new System.Windows.Forms.ListBox(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.lblDamageExample = new System.Windows.Forms.Label(); - this.lblDamageExplained = new System.Windows.Forms.Label(); - this.lblSelected = new System.Windows.Forms.Label(); - this.panel4 = new System.Windows.Forms.Panel(); - this.txtDmgMultBoost = new System.Windows.Forms.TextBox(); - this.txtDmgMultBase = new System.Windows.Forms.TextBox(); - this.label21 = new System.Windows.Forms.Label(); - this.label22 = new System.Windows.Forms.Label(); - this.txtDmgBonusMax = new System.Windows.Forms.TextBox(); - this.txtDmgBonusMin = new System.Windows.Forms.TextBox(); - this.label18 = new System.Windows.Forms.Label(); - this.label19 = new System.Windows.Forms.Label(); - this.txtDmgBaseMax = new System.Windows.Forms.TextBox(); - this.txtDmgBaseMin = new System.Windows.Forms.TextBox(); - this.label17 = new System.Windows.Forms.Label(); - this.label16 = new System.Windows.Forms.Label(); - this.label15 = new System.Windows.Forms.Label(); - this.panel3 = new System.Windows.Forms.Panel(); - this.label20 = new System.Windows.Forms.Label(); - this.txtRange = new System.Windows.Forms.TextBox(); - this.txtDelayReduction = new System.Windows.Forms.TextBox(); - this.txtDelayBase = new System.Windows.Forms.TextBox(); - this.label14 = new System.Windows.Forms.Label(); - this.label13 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.panel2 = new System.Windows.Forms.Panel(); - this.txtMPIncrease = new System.Windows.Forms.TextBox(); - this.txtMPBase = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.txtSkillLvl3Points = new System.Windows.Forms.TextBox(); - this.txtSkillLvl2Points = new System.Windows.Forms.TextBox(); - this.txtSkillLvl1Points = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.txtSkillLvl3Req = new System.Windows.Forms.TextBox(); - this.txtSkillLvl2Req = new System.Windows.Forms.TextBox(); - this.txtSkillLvl1Req = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.txtSkillIcon = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.lblBookValid = new System.Windows.Forms.Label(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.textBoxName = new System.Windows.Forms.TextBox(); - this.label23 = new System.Windows.Forms.Label(); - this.label24 = new System.Windows.Forms.Label(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.panel4.SuspendLayout(); - this.panel3.SuspendLayout(); - this.panel2.SuspendLayout(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); + components = new System.ComponentModel.Container(); + MagiclistBox = new ListBox(); + tabControl1 = new TabControl(); + tabPage1 = new TabPage(); + label24 = new Label(); + label23 = new Label(); + textBoxName = new TextBox(); + lblDamageExample = new Label(); + lblDamageExplained = new Label(); + lblSelected = new Label(); + panel4 = new Panel(); + txtDmgMultBoost = new TextBox(); + txtDmgMultBase = new TextBox(); + label21 = new Label(); + label22 = new Label(); + txtDmgBonusMax = new TextBox(); + txtDmgBonusMin = new TextBox(); + label18 = new Label(); + label19 = new Label(); + txtDmgBaseMax = new TextBox(); + txtDmgBaseMin = new TextBox(); + label17 = new Label(); + label16 = new Label(); + label15 = new Label(); + panel3 = new Panel(); + label20 = new Label(); + txtRange = new TextBox(); + txtDelayReduction = new TextBox(); + txtDelayBase = new TextBox(); + label14 = new Label(); + label13 = new Label(); + label12 = new Label(); + panel2 = new Panel(); + txtMPIncrease = new TextBox(); + txtMPBase = new TextBox(); + label11 = new Label(); + label10 = new Label(); + label9 = new Label(); + panel1 = new Panel(); + txtSkillLvl3Points = new TextBox(); + txtSkillLvl2Points = new TextBox(); + txtSkillLvl1Points = new TextBox(); + label6 = new Label(); + label7 = new Label(); + label8 = new Label(); + txtSkillLvl3Req = new TextBox(); + txtSkillLvl2Req = new TextBox(); + txtSkillLvl1Req = new TextBox(); + label5 = new Label(); + label4 = new Label(); + label3 = new Label(); + label2 = new Label(); + txtSkillIcon = new TextBox(); + label1 = new Label(); + lblBookValid = new Label(); + toolTip1 = new ToolTip(components); + MagicSearchBox = new TextBox(); + tabControl1.SuspendLayout(); + tabPage1.SuspendLayout(); + panel4.SuspendLayout(); + panel3.SuspendLayout(); + panel2.SuspendLayout(); + panel1.SuspendLayout(); + SuspendLayout(); // // MagiclistBox // - this.MagiclistBox.Dock = System.Windows.Forms.DockStyle.Left; - this.MagiclistBox.FormattingEnabled = true; - this.MagiclistBox.ItemHeight = 12; - this.MagiclistBox.Location = new System.Drawing.Point(0, 0); - this.MagiclistBox.Name = "MagiclistBox"; - this.MagiclistBox.Size = new System.Drawing.Size(225, 542); - this.MagiclistBox.TabIndex = 0; - this.MagiclistBox.SelectedIndexChanged += new System.EventHandler(this.MagiclistBox_SelectedIndexChanged); + MagiclistBox.Dock = DockStyle.Left; + MagiclistBox.FormattingEnabled = true; + MagiclistBox.ItemHeight = 15; + MagiclistBox.Location = new Point(0, 0); + MagiclistBox.Name = "MagiclistBox"; + MagiclistBox.Size = new Size(225, 542); + MagiclistBox.TabIndex = 0; + MagiclistBox.SelectedIndexChanged += MagiclistBox_SelectedIndexChanged; // // tabControl1 // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.Location = new System.Drawing.Point(225, 0); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(702, 542); - this.tabControl1.TabIndex = 1; + tabControl1.Controls.Add(tabPage1); + tabControl1.Dock = DockStyle.Fill; + tabControl1.Location = new Point(225, 0); + tabControl1.Name = "tabControl1"; + tabControl1.SelectedIndex = 0; + tabControl1.Size = new Size(702, 542); + tabControl1.TabIndex = 1; // // tabPage1 // - this.tabPage1.Controls.Add(this.label24); - this.tabPage1.Controls.Add(this.label23); - this.tabPage1.Controls.Add(this.textBoxName); - this.tabPage1.Controls.Add(this.lblDamageExample); - this.tabPage1.Controls.Add(this.lblDamageExplained); - this.tabPage1.Controls.Add(this.lblSelected); - this.tabPage1.Controls.Add(this.panel4); - this.tabPage1.Controls.Add(this.panel3); - this.tabPage1.Controls.Add(this.panel2); - this.tabPage1.Controls.Add(this.panel1); - this.tabPage1.Controls.Add(this.txtSkillIcon); - this.tabPage1.Controls.Add(this.label1); - this.tabPage1.Controls.Add(this.lblBookValid); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(694, 516); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Basics"; - this.tabPage1.UseVisualStyleBackColor = true; + tabPage1.Controls.Add(label24); + tabPage1.Controls.Add(label23); + tabPage1.Controls.Add(textBoxName); + tabPage1.Controls.Add(lblDamageExample); + tabPage1.Controls.Add(lblDamageExplained); + tabPage1.Controls.Add(lblSelected); + tabPage1.Controls.Add(panel4); + tabPage1.Controls.Add(panel3); + tabPage1.Controls.Add(panel2); + tabPage1.Controls.Add(panel1); + tabPage1.Controls.Add(txtSkillIcon); + tabPage1.Controls.Add(label1); + tabPage1.Controls.Add(lblBookValid); + tabPage1.Location = new Point(4, 24); + tabPage1.Name = "tabPage1"; + tabPage1.Padding = new Padding(3); + tabPage1.Size = new Size(694, 514); + tabPage1.TabIndex = 0; + tabPage1.Text = "Basics"; + tabPage1.UseVisualStyleBackColor = true; + // + // label24 + // + label24.AutoSize = true; + label24.Location = new Point(20, 23); + label24.Name = "label24"; + label24.Size = new Size(63, 15); + label24.TabIndex = 12; + label24.Text = "SkillName:"; + // + // label23 + // + label23.AutoSize = true; + label23.Location = new Point(181, 3); + label23.Name = "label23"; + label23.Size = new Size(37, 15); + label23.TabIndex = 11; + label23.Text = "book:"; + // + // textBoxName + // + textBoxName.Location = new Point(89, 18); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(112, 23); + textBoxName.TabIndex = 10; + textBoxName.TextChanged += textBoxName_TextChanged; // // lblDamageExample // - this.lblDamageExample.AutoSize = true; - this.lblDamageExample.Location = new System.Drawing.Point(11, 394); - this.lblDamageExample.Name = "lblDamageExample"; - this.lblDamageExample.Size = new System.Drawing.Size(89, 12); - this.lblDamageExample.TabIndex = 0; - this.lblDamageExample.Text = "Damage example"; + lblDamageExample.AutoSize = true; + lblDamageExample.Location = new Point(11, 394); + lblDamageExample.Name = "lblDamageExample"; + lblDamageExample.Size = new Size(98, 15); + lblDamageExample.TabIndex = 0; + lblDamageExample.Text = "Damage example"; // // lblDamageExplained // - this.lblDamageExplained.AutoSize = true; - this.lblDamageExplained.Location = new System.Drawing.Point(11, 366); - this.lblDamageExplained.Name = "lblDamageExplained"; - this.lblDamageExplained.Size = new System.Drawing.Size(47, 12); - this.lblDamageExplained.TabIndex = 9; - this.lblDamageExplained.Text = "Damage:"; + lblDamageExplained.AutoSize = true; + lblDamageExplained.Location = new Point(11, 366); + lblDamageExplained.Name = "lblDamageExplained"; + lblDamageExplained.Size = new Size(54, 15); + lblDamageExplained.TabIndex = 9; + lblDamageExplained.Text = "Damage:"; // // lblSelected // - this.lblSelected.AutoSize = true; - this.lblSelected.Location = new System.Drawing.Point(20, 3); - this.lblSelected.Name = "lblSelected"; - this.lblSelected.Size = new System.Drawing.Size(101, 12); - this.lblSelected.TabIndex = 8; - this.lblSelected.Text = "Selected skill: "; + lblSelected.AutoSize = true; + lblSelected.Location = new Point(20, 3); + lblSelected.Name = "lblSelected"; + lblSelected.Size = new Size(80, 15); + lblSelected.TabIndex = 8; + lblSelected.Text = "Selected skill: "; // // panel4 // - this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel4.Controls.Add(this.txtDmgMultBoost); - this.panel4.Controls.Add(this.txtDmgMultBase); - this.panel4.Controls.Add(this.label21); - this.panel4.Controls.Add(this.label22); - this.panel4.Controls.Add(this.txtDmgBonusMax); - this.panel4.Controls.Add(this.txtDmgBonusMin); - this.panel4.Controls.Add(this.label18); - this.panel4.Controls.Add(this.label19); - this.panel4.Controls.Add(this.txtDmgBaseMax); - this.panel4.Controls.Add(this.txtDmgBaseMin); - this.panel4.Controls.Add(this.label17); - this.panel4.Controls.Add(this.label16); - this.panel4.Controls.Add(this.label15); - this.panel4.Location = new System.Drawing.Point(14, 166); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(233, 191); - this.panel4.TabIndex = 6; + panel4.BorderStyle = BorderStyle.FixedSingle; + panel4.Controls.Add(txtDmgMultBoost); + panel4.Controls.Add(txtDmgMultBase); + panel4.Controls.Add(label21); + panel4.Controls.Add(label22); + panel4.Controls.Add(txtDmgBonusMax); + panel4.Controls.Add(txtDmgBonusMin); + panel4.Controls.Add(label18); + panel4.Controls.Add(label19); + panel4.Controls.Add(txtDmgBaseMax); + panel4.Controls.Add(txtDmgBaseMin); + panel4.Controls.Add(label17); + panel4.Controls.Add(label16); + panel4.Controls.Add(label15); + panel4.Location = new Point(14, 166); + panel4.Name = "panel4"; + panel4.Size = new Size(233, 191); + panel4.TabIndex = 6; // // txtDmgMultBoost // - this.txtDmgMultBoost.Location = new System.Drawing.Point(168, 157); - this.txtDmgMultBoost.Name = "txtDmgMultBoost"; - this.txtDmgMultBoost.Size = new System.Drawing.Size(46, 21); - this.txtDmgMultBoost.TabIndex = 14; - this.toolTip1.SetToolTip(this.txtDmgMultBoost, "extra multiplyer apply\'d for every skill level"); - this.txtDmgMultBoost.TextChanged += new System.EventHandler(this.txtDmgMultBoost_TextChanged); + txtDmgMultBoost.Location = new Point(168, 157); + txtDmgMultBoost.Name = "txtDmgMultBoost"; + txtDmgMultBoost.Size = new Size(46, 23); + txtDmgMultBoost.TabIndex = 14; + toolTip1.SetToolTip(txtDmgMultBoost, "extra multiplyer apply'd for every skill level"); + txtDmgMultBoost.TextChanged += txtDmgMultBoost_TextChanged; // // txtDmgMultBase // - this.txtDmgMultBase.Location = new System.Drawing.Point(168, 131); - this.txtDmgMultBase.Name = "txtDmgMultBase"; - this.txtDmgMultBase.Size = new System.Drawing.Size(46, 21); - this.txtDmgMultBase.TabIndex = 13; - this.toolTip1.SetToolTip(this.txtDmgMultBase, "multiplier apply\'d to total skill dmg"); - this.txtDmgMultBase.TextChanged += new System.EventHandler(this.txtDmgMultBase_TextChanged); + txtDmgMultBase.Location = new Point(168, 131); + txtDmgMultBase.Name = "txtDmgMultBase"; + txtDmgMultBase.Size = new Size(46, 23); + txtDmgMultBase.TabIndex = 13; + toolTip1.SetToolTip(txtDmgMultBase, "multiplier apply'd to total skill dmg"); + txtDmgMultBase.TextChanged += txtDmgMultBase_TextChanged; // // label21 // - this.label21.AutoSize = true; - this.label21.Location = new System.Drawing.Point(12, 160); - this.label21.Name = "label21"; - this.label21.Size = new System.Drawing.Size(197, 12); - this.label21.TabIndex = 12; - this.label21.Text = "Damage multiplyer boost/skilllvl"; + label21.AutoSize = true; + label21.Location = new Point(12, 160); + label21.Name = "label21"; + label21.Size = new Size(178, 15); + label21.TabIndex = 12; + label21.Text = "Damage multiplyer boost/skilllvl"; // // label22 // - this.label22.AutoSize = true; - this.label22.Location = new System.Drawing.Point(12, 134); - this.label22.Name = "label22"; - this.label22.Size = new System.Drawing.Size(137, 12); - this.label22.TabIndex = 11; - this.label22.Text = "Damage multiplyer base"; + label22.AutoSize = true; + label22.Location = new Point(12, 134); + label22.Name = "label22"; + label22.Size = new Size(135, 15); + label22.TabIndex = 11; + label22.Text = "Damage multiplyer base"; // // txtDmgBonusMax // - this.txtDmgBonusMax.Location = new System.Drawing.Point(168, 105); - this.txtDmgBonusMax.Name = "txtDmgBonusMax"; - this.txtDmgBonusMax.Size = new System.Drawing.Size(46, 21); - this.txtDmgBonusMax.TabIndex = 10; - this.toolTip1.SetToolTip(this.txtDmgBonusMax, "Damage bonus at skill level \'4\' "); - this.txtDmgBonusMax.TextChanged += new System.EventHandler(this.txtDmgBonusMax_TextChanged); + txtDmgBonusMax.Location = new Point(168, 105); + txtDmgBonusMax.Name = "txtDmgBonusMax"; + txtDmgBonusMax.Size = new Size(46, 23); + txtDmgBonusMax.TabIndex = 10; + toolTip1.SetToolTip(txtDmgBonusMax, "Damage bonus at skill level '4' "); + txtDmgBonusMax.TextChanged += txtDmgBonusMax_TextChanged; // // txtDmgBonusMin // - this.txtDmgBonusMin.Location = new System.Drawing.Point(168, 79); - this.txtDmgBonusMin.Name = "txtDmgBonusMin"; - this.txtDmgBonusMin.Size = new System.Drawing.Size(46, 21); - this.txtDmgBonusMin.TabIndex = 9; - this.toolTip1.SetToolTip(this.txtDmgBonusMin, "Damage bonus at skill level \'4\' \r\nyou will get 1/4th of this bonus for every skil" + - "l level\r\nnote ingame level 0 = 1 bonus, so level 3 = max bonus (4)"); - this.txtDmgBonusMin.TextChanged += new System.EventHandler(this.txtDmgBonusMin_TextChanged); + txtDmgBonusMin.Location = new Point(168, 79); + txtDmgBonusMin.Name = "txtDmgBonusMin"; + txtDmgBonusMin.Size = new Size(46, 23); + txtDmgBonusMin.TabIndex = 9; + toolTip1.SetToolTip(txtDmgBonusMin, "Damage bonus at skill level '4' \r\nyou will get 1/4th of this bonus for every skill level\r\nnote ingame level 0 = 1 bonus, so level 3 = max bonus (4)"); + txtDmgBonusMin.TextChanged += txtDmgBonusMin_TextChanged; // // label18 // - this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(12, 108); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(161, 12); - this.label18.TabIndex = 8; - this.label18.Text = "Maximum skill lvl 3 damage"; + label18.AutoSize = true; + label18.Location = new Point(12, 108); + label18.Name = "label18"; + label18.Size = new Size(154, 15); + label18.TabIndex = 8; + label18.Text = "Maximum skill lvl 3 damage"; // // label19 // - this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(12, 82); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(167, 12); - this.label19.TabIndex = 7; - this.label19.Text = "Minimum skill lvl 3 damage:"; + label19.AutoSize = true; + label19.Location = new Point(12, 82); + label19.Name = "label19"; + label19.Size = new Size(156, 15); + label19.TabIndex = 7; + label19.Text = "Minimum skill lvl 3 damage:"; // // txtDmgBaseMax // - this.txtDmgBaseMax.Location = new System.Drawing.Point(168, 53); - this.txtDmgBaseMax.Name = "txtDmgBaseMax"; - this.txtDmgBaseMax.Size = new System.Drawing.Size(46, 21); - this.txtDmgBaseMax.TabIndex = 6; - this.toolTip1.SetToolTip(this.txtDmgBaseMax, "Damage at skill level 0"); - this.txtDmgBaseMax.TextChanged += new System.EventHandler(this.txtDmgBaseMax_TextChanged); + txtDmgBaseMax.Location = new Point(168, 53); + txtDmgBaseMax.Name = "txtDmgBaseMax"; + txtDmgBaseMax.Size = new Size(46, 23); + txtDmgBaseMax.TabIndex = 6; + toolTip1.SetToolTip(txtDmgBaseMax, "Damage at skill level 0"); + txtDmgBaseMax.TextChanged += txtDmgBaseMax_TextChanged; // // txtDmgBaseMin // - this.txtDmgBaseMin.Location = new System.Drawing.Point(168, 27); - this.txtDmgBaseMin.Name = "txtDmgBaseMin"; - this.txtDmgBaseMin.Size = new System.Drawing.Size(46, 21); - this.txtDmgBaseMin.TabIndex = 5; - this.toolTip1.SetToolTip(this.txtDmgBaseMin, "Damage at skill level 0"); - this.txtDmgBaseMin.TextChanged += new System.EventHandler(this.txtDmgBaseMin_TextChanged); + txtDmgBaseMin.Location = new Point(168, 27); + txtDmgBaseMin.Name = "txtDmgBaseMin"; + txtDmgBaseMin.Size = new Size(46, 23); + txtDmgBaseMin.TabIndex = 5; + toolTip1.SetToolTip(txtDmgBaseMin, "Damage at skill level 0"); + txtDmgBaseMin.TextChanged += txtDmgBaseMin_TextChanged; // // label17 // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(12, 56); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(119, 12); - this.label17.TabIndex = 2; - this.label17.Text = "Maximum base damage"; + label17.AutoSize = true; + label17.Location = new Point(12, 56); + label17.Name = "label17"; + label17.Size = new Size(134, 15); + label17.TabIndex = 2; + label17.Text = "Maximum base damage"; // // label16 // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(12, 30); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(125, 12); - this.label16.TabIndex = 1; - this.label16.Text = "Minimum base damage:"; + label16.AutoSize = true; + label16.Location = new Point(12, 30); + label16.Name = "label16"; + label16.Size = new Size(136, 15); + label16.TabIndex = 1; + label16.Text = "Minimum base damage:"; // // label15 // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(5, 8); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(95, 12); - this.label15.TabIndex = 0; - this.label15.Text = "Damage settings"; + label15.AutoSize = true; + label15.Location = new Point(5, 8); + label15.Name = "label15"; + label15.Size = new Size(95, 15); + label15.TabIndex = 0; + label15.Text = "Damage settings"; // // panel3 // - this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel3.Controls.Add(this.label20); - this.panel3.Controls.Add(this.txtRange); - this.panel3.Controls.Add(this.txtDelayReduction); - this.panel3.Controls.Add(this.txtDelayBase); - this.panel3.Controls.Add(this.label14); - this.panel3.Controls.Add(this.label13); - this.panel3.Controls.Add(this.label12); - this.panel3.Location = new System.Drawing.Point(253, 166); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(216, 191); - this.panel3.TabIndex = 5; - this.toolTip1.SetToolTip(this.panel3, "delay = - (skill level * )"); + panel3.BorderStyle = BorderStyle.FixedSingle; + panel3.Controls.Add(label20); + panel3.Controls.Add(txtRange); + panel3.Controls.Add(txtDelayReduction); + panel3.Controls.Add(txtDelayBase); + panel3.Controls.Add(label14); + panel3.Controls.Add(label13); + panel3.Controls.Add(label12); + panel3.Location = new Point(253, 166); + panel3.Name = "panel3"; + panel3.Size = new Size(216, 191); + panel3.TabIndex = 5; + toolTip1.SetToolTip(panel3, "delay = - (skill level * )"); // // label20 // - this.label20.AutoSize = true; - this.label20.Location = new System.Drawing.Point(12, 77); - this.label20.Name = "label20"; - this.label20.Size = new System.Drawing.Size(113, 12); - this.label20.TabIndex = 15; - this.label20.Text = "Range (0 No limit)"; + label20.AutoSize = true; + label20.Location = new Point(12, 77); + label20.Name = "label20"; + label20.Size = new Size(103, 15); + label20.TabIndex = 15; + label20.Text = "Range (0 No limit)"; // // txtRange // - this.txtRange.Location = new System.Drawing.Point(121, 74); - this.txtRange.Name = "txtRange"; - this.txtRange.Size = new System.Drawing.Size(79, 21); - this.txtRange.TabIndex = 14; - this.txtRange.TextChanged += new System.EventHandler(this.txtRange_TextChanged); + txtRange.Location = new Point(121, 74); + txtRange.Name = "txtRange"; + txtRange.Size = new Size(79, 23); + txtRange.TabIndex = 14; + txtRange.TextChanged += txtRange_TextChanged; // // txtDelayReduction // - this.txtDelayReduction.Location = new System.Drawing.Point(121, 47); - this.txtDelayReduction.Name = "txtDelayReduction"; - this.txtDelayReduction.Size = new System.Drawing.Size(79, 21); - this.txtDelayReduction.TabIndex = 13; - this.toolTip1.SetToolTip(this.txtDelayReduction, "delay = - (skill level * )"); - this.txtDelayReduction.TextChanged += new System.EventHandler(this.txtDelayReduction_TextChanged); + txtDelayReduction.Location = new Point(121, 47); + txtDelayReduction.Name = "txtDelayReduction"; + txtDelayReduction.Size = new Size(79, 23); + txtDelayReduction.TabIndex = 13; + toolTip1.SetToolTip(txtDelayReduction, "delay = - (skill level * )"); + txtDelayReduction.TextChanged += txtDelayReduction_TextChanged; // // txtDelayBase // - this.txtDelayBase.Location = new System.Drawing.Point(121, 22); - this.txtDelayBase.Name = "txtDelayBase"; - this.txtDelayBase.Size = new System.Drawing.Size(79, 21); - this.txtDelayBase.TabIndex = 12; - this.toolTip1.SetToolTip(this.txtDelayBase, "delay = - (skill level * )"); - this.txtDelayBase.TextChanged += new System.EventHandler(this.txtDelayBase_TextChanged); + txtDelayBase.Location = new Point(121, 22); + txtDelayBase.Name = "txtDelayBase"; + txtDelayBase.Size = new Size(79, 23); + txtDelayBase.TabIndex = 12; + toolTip1.SetToolTip(txtDelayBase, "delay = - (skill level * )"); + txtDelayBase.TextChanged += txtDelayBase_TextChanged; // // label14 // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(12, 50); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(137, 12); - this.label14.TabIndex = 2; - this.label14.Text = "Decrease / skill level"; + label14.AutoSize = true; + label14.Location = new Point(12, 50); + label14.Name = "label14"; + label14.Size = new Size(112, 15); + label14.TabIndex = 2; + label14.Text = "Decrease / skill level"; // // label13 // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(12, 25); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(65, 12); - this.label13.TabIndex = 1; - this.label13.Text = "Base delay"; + label13.AutoSize = true; + label13.Location = new Point(12, 25); + label13.Name = "label13"; + label13.Size = new Size(62, 15); + label13.TabIndex = 1; + label13.Text = "Base delay"; // // label12 // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(12, 8); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(149, 12); - this.label12.TabIndex = 0; - this.label12.Text = "Delay (in milliseconds!)"; + label12.AutoSize = true; + label12.Location = new Point(12, 8); + label12.Name = "label12"; + label12.Size = new Size(129, 15); + label12.TabIndex = 0; + label12.Text = "Delay (in milliseconds!)"; // // panel2 // - this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.txtMPIncrease); - this.panel2.Controls.Add(this.txtMPBase); - this.panel2.Controls.Add(this.label11); - this.panel2.Controls.Add(this.label10); - this.panel2.Controls.Add(this.label9); - this.panel2.Location = new System.Drawing.Point(253, 53); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(216, 107); - this.panel2.TabIndex = 4; + panel2.BorderStyle = BorderStyle.FixedSingle; + panel2.Controls.Add(txtMPIncrease); + panel2.Controls.Add(txtMPBase); + panel2.Controls.Add(label11); + panel2.Controls.Add(label10); + panel2.Controls.Add(label9); + panel2.Location = new Point(253, 53); + panel2.Name = "panel2"; + panel2.Size = new Size(216, 107); + panel2.TabIndex = 4; // // txtMPIncrease // - this.txtMPIncrease.Location = new System.Drawing.Point(135, 47); - this.txtMPIncrease.Name = "txtMPIncrease"; - this.txtMPIncrease.Size = new System.Drawing.Size(46, 21); - this.txtMPIncrease.TabIndex = 12; - this.toolTip1.SetToolTip(this.txtMPIncrease, "extra amount of mp used each level"); - this.txtMPIncrease.TextChanged += new System.EventHandler(this.txtMPIncrease_TextChanged); + txtMPIncrease.Location = new Point(135, 47); + txtMPIncrease.Name = "txtMPIncrease"; + txtMPIncrease.Size = new Size(46, 23); + txtMPIncrease.TabIndex = 12; + toolTip1.SetToolTip(txtMPIncrease, "extra amount of mp used each level"); + txtMPIncrease.TextChanged += txtMPIncrease_TextChanged; // // txtMPBase // - this.txtMPBase.Location = new System.Drawing.Point(135, 22); - this.txtMPBase.Name = "txtMPBase"; - this.txtMPBase.Size = new System.Drawing.Size(46, 21); - this.txtMPBase.TabIndex = 11; - this.toolTip1.SetToolTip(this.txtMPBase, "Mp usage when skill is level 0"); - this.txtMPBase.TextChanged += new System.EventHandler(this.txtMPBase_TextChanged); + txtMPBase.Location = new Point(135, 22); + txtMPBase.Name = "txtMPBase"; + txtMPBase.Size = new Size(46, 23); + txtMPBase.TabIndex = 11; + toolTip1.SetToolTip(txtMPBase, "Mp usage when skill is level 0"); + txtMPBase.TextChanged += txtMPBase_TextChanged; // // label11 // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(12, 50); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(137, 12); - this.label11.TabIndex = 2; - this.label11.Text = "MP increase each level"; + label11.AutoSize = true; + label11.Location = new Point(12, 50); + label11.Name = "label11"; + label11.Size = new Size(126, 15); + label11.TabIndex = 2; + label11.Text = "MP increase each level"; // // label10 // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(12, 25); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(83, 12); - this.label10.TabIndex = 1; - this.label10.Text = "Base mp usage"; + label10.AutoSize = true; + label10.Location = new Point(12, 25); + label10.Name = "label10"; + label10.Size = new Size(86, 15); + label10.TabIndex = 1; + label10.Text = "Base mp usage"; // // label9 // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(12, 6); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(53, 12); - this.label9.TabIndex = 0; - this.label9.Text = "MP usage"; + label9.AutoSize = true; + label9.Location = new Point(12, 6); + label9.Name = "label9"; + label9.Size = new Size(59, 15); + label9.TabIndex = 0; + label9.Text = "MP usage"; // // panel1 // - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Controls.Add(this.txtSkillLvl3Points); - this.panel1.Controls.Add(this.txtSkillLvl2Points); - this.panel1.Controls.Add(this.txtSkillLvl1Points); - this.panel1.Controls.Add(this.label6); - this.panel1.Controls.Add(this.label7); - this.panel1.Controls.Add(this.label8); - this.panel1.Controls.Add(this.txtSkillLvl3Req); - this.panel1.Controls.Add(this.txtSkillLvl2Req); - this.panel1.Controls.Add(this.txtSkillLvl1Req); - this.panel1.Controls.Add(this.label5); - this.panel1.Controls.Add(this.label4); - this.panel1.Controls.Add(this.label3); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(13, 53); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(234, 107); - this.panel1.TabIndex = 3; + panel1.BorderStyle = BorderStyle.FixedSingle; + panel1.Controls.Add(txtSkillLvl3Points); + panel1.Controls.Add(txtSkillLvl2Points); + panel1.Controls.Add(txtSkillLvl1Points); + panel1.Controls.Add(label6); + panel1.Controls.Add(label7); + panel1.Controls.Add(label8); + panel1.Controls.Add(txtSkillLvl3Req); + panel1.Controls.Add(txtSkillLvl2Req); + panel1.Controls.Add(txtSkillLvl1Req); + panel1.Controls.Add(label5); + panel1.Controls.Add(label4); + panel1.Controls.Add(label3); + panel1.Controls.Add(label2); + panel1.Location = new Point(13, 53); + panel1.Name = "panel1"; + panel1.Size = new Size(234, 107); + panel1.TabIndex = 3; // // txtSkillLvl3Points // - this.txtSkillLvl3Points.Location = new System.Drawing.Point(169, 72); - this.txtSkillLvl3Points.Name = "txtSkillLvl3Points"; - this.txtSkillLvl3Points.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl3Points.TabIndex = 12; - this.txtSkillLvl3Points.TextChanged += new System.EventHandler(this.txtSkillLvl3Points_TextChanged); + txtSkillLvl3Points.Location = new Point(169, 72); + txtSkillLvl3Points.Name = "txtSkillLvl3Points"; + txtSkillLvl3Points.Size = new Size(46, 23); + txtSkillLvl3Points.TabIndex = 12; + txtSkillLvl3Points.TextChanged += txtSkillLvl3Points_TextChanged; // // txtSkillLvl2Points // - this.txtSkillLvl2Points.Location = new System.Drawing.Point(169, 47); - this.txtSkillLvl2Points.Name = "txtSkillLvl2Points"; - this.txtSkillLvl2Points.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl2Points.TabIndex = 11; - this.txtSkillLvl2Points.TextChanged += new System.EventHandler(this.txtSkillLvl2Points_TextChanged); + txtSkillLvl2Points.Location = new Point(169, 47); + txtSkillLvl2Points.Name = "txtSkillLvl2Points"; + txtSkillLvl2Points.Size = new Size(46, 23); + txtSkillLvl2Points.TabIndex = 11; + txtSkillLvl2Points.TextChanged += txtSkillLvl2Points_TextChanged; // // txtSkillLvl1Points // - this.txtSkillLvl1Points.Location = new System.Drawing.Point(169, 22); - this.txtSkillLvl1Points.Name = "txtSkillLvl1Points"; - this.txtSkillLvl1Points.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl1Points.TabIndex = 10; - this.txtSkillLvl1Points.TextChanged += new System.EventHandler(this.txtSkillLvl1Points_TextChanged); + txtSkillLvl1Points.Location = new Point(169, 22); + txtSkillLvl1Points.Name = "txtSkillLvl1Points"; + txtSkillLvl1Points.Size = new Size(46, 23); + txtSkillLvl1Points.TabIndex = 10; + txtSkillLvl1Points.TextChanged += txtSkillLvl1Points_TextChanged; // // label6 // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(110, 75); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(77, 12); - this.label6.TabIndex = 9; - this.label6.Text = "Skill points"; + label6.AutoSize = true; + label6.Location = new Point(110, 75); + label6.Name = "label6"; + label6.Size = new Size(64, 15); + label6.TabIndex = 9; + label6.Text = "Skill points"; // // label7 // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(110, 50); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(77, 12); - this.label7.TabIndex = 8; - this.label7.Text = "Skill points"; + label7.AutoSize = true; + label7.Location = new Point(110, 50); + label7.Name = "label7"; + label7.Size = new Size(64, 15); + label7.TabIndex = 8; + label7.Text = "Skill points"; // // label8 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(110, 25); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(77, 12); - this.label8.TabIndex = 7; - this.label8.Text = "Skill points"; + label8.AutoSize = true; + label8.Location = new Point(110, 25); + label8.Name = "label8"; + label8.Size = new Size(64, 15); + label8.TabIndex = 7; + label8.Text = "Skill points"; // // txtSkillLvl3Req // - this.txtSkillLvl3Req.Location = new System.Drawing.Point(57, 72); - this.txtSkillLvl3Req.Name = "txtSkillLvl3Req"; - this.txtSkillLvl3Req.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl3Req.TabIndex = 6; - this.txtSkillLvl3Req.TextChanged += new System.EventHandler(this.txtSkillLvl3Req_TextChanged); + txtSkillLvl3Req.Location = new Point(57, 72); + txtSkillLvl3Req.Name = "txtSkillLvl3Req"; + txtSkillLvl3Req.Size = new Size(46, 23); + txtSkillLvl3Req.TabIndex = 6; + txtSkillLvl3Req.TextChanged += txtSkillLvl3Req_TextChanged; // // txtSkillLvl2Req // - this.txtSkillLvl2Req.Location = new System.Drawing.Point(57, 47); - this.txtSkillLvl2Req.Name = "txtSkillLvl2Req"; - this.txtSkillLvl2Req.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl2Req.TabIndex = 5; - this.txtSkillLvl2Req.TextChanged += new System.EventHandler(this.txtSkillLvl2Req_TextChanged); + txtSkillLvl2Req.Location = new Point(57, 47); + txtSkillLvl2Req.Name = "txtSkillLvl2Req"; + txtSkillLvl2Req.Size = new Size(46, 23); + txtSkillLvl2Req.TabIndex = 5; + txtSkillLvl2Req.TextChanged += txtSkillLvl2Req_TextChanged; // // txtSkillLvl1Req // - this.txtSkillLvl1Req.Location = new System.Drawing.Point(57, 22); - this.txtSkillLvl1Req.Name = "txtSkillLvl1Req"; - this.txtSkillLvl1Req.Size = new System.Drawing.Size(46, 21); - this.txtSkillLvl1Req.TabIndex = 4; - this.txtSkillLvl1Req.TextChanged += new System.EventHandler(this.txtSkillLvl1Req_TextChanged); + txtSkillLvl1Req.Location = new Point(57, 22); + txtSkillLvl1Req.Name = "txtSkillLvl1Req"; + txtSkillLvl1Req.Size = new Size(46, 23); + txtSkillLvl1Req.TabIndex = 4; + txtSkillLvl1Req.TextChanged += txtSkillLvl1Req_TextChanged; // // label5 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(13, 75); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(47, 12); - this.label5.TabIndex = 3; - this.label5.Text = "level 3"; + label5.AutoSize = true; + label5.Location = new Point(13, 75); + label5.Name = "label5"; + label5.Size = new Size(40, 15); + label5.TabIndex = 3; + label5.Text = "level 3"; // // label4 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(13, 50); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(47, 12); - this.label4.TabIndex = 2; - this.label4.Text = "level 2"; + label4.AutoSize = true; + label4.Location = new Point(13, 50); + label4.Name = "label4"; + label4.Size = new Size(40, 15); + label4.TabIndex = 2; + label4.Text = "level 2"; // // label3 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(13, 25); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(47, 12); - this.label3.TabIndex = 1; - this.label3.Text = "level 1"; + label3.AutoSize = true; + label3.Location = new Point(13, 25); + label3.Name = "label3"; + label3.Size = new Size(40, 15); + label3.TabIndex = 1; + label3.Text = "level 1"; // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 6); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(203, 12); - this.label2.TabIndex = 0; - this.label2.Text = "Skill level increase requirements"; + label2.AutoSize = true; + label2.Location = new Point(6, 6); + label2.Name = "label2"; + label2.Size = new Size(174, 15); + label2.TabIndex = 0; + label2.Text = "Skill level increase requirements"; // // txtSkillIcon // - this.txtSkillIcon.Location = new System.Drawing.Point(311, 20); - this.txtSkillIcon.Name = "txtSkillIcon"; - this.txtSkillIcon.Size = new System.Drawing.Size(41, 21); - this.txtSkillIcon.TabIndex = 2; - this.txtSkillIcon.TextChanged += new System.EventHandler(this.txtSkillIcon_TextChanged); + txtSkillIcon.Location = new Point(311, 20); + txtSkillIcon.Name = "txtSkillIcon"; + txtSkillIcon.Size = new Size(41, 23); + txtSkillIcon.TabIndex = 2; + txtSkillIcon.TextChanged += txtSkillIcon_TextChanged; // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(250, 23); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(77, 12); - this.label1.TabIndex = 1; - this.label1.Text = "Skill icon: "; + label1.AutoSize = true; + label1.Location = new Point(250, 23); + label1.Name = "label1"; + label1.Size = new Size(60, 15); + label1.TabIndex = 1; + label1.Text = "Skill icon: "; // // lblBookValid // - this.lblBookValid.AutoSize = true; - this.lblBookValid.Location = new System.Drawing.Point(222, 3); - this.lblBookValid.Name = "lblBookValid"; - this.lblBookValid.Size = new System.Drawing.Size(119, 12); - this.lblBookValid.TabIndex = 0; - this.lblBookValid.Text = "Searching for books"; - // - // textBoxName - // - this.textBoxName.Location = new System.Drawing.Point(89, 18); - this.textBoxName.Name = "textBoxName"; - this.textBoxName.Size = new System.Drawing.Size(112, 21); - this.textBoxName.TabIndex = 10; - this.textBoxName.TextChanged += new System.EventHandler(this.textBoxName_TextChanged); - // - // label23 - // - this.label23.AutoSize = true; - this.label23.Location = new System.Drawing.Point(181, 3); - this.label23.Name = "label23"; - this.label23.Size = new System.Drawing.Size(35, 12); - this.label23.TabIndex = 11; - this.label23.Text = "book:"; + lblBookValid.AutoSize = true; + lblBookValid.Location = new Point(222, 3); + lblBookValid.Name = "lblBookValid"; + lblBookValid.Size = new Size(112, 15); + lblBookValid.TabIndex = 0; + lblBookValid.Text = "Searching for books"; // - // label24 + // MagicSearchBox // - this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(20, 23); - this.label24.Name = "label24"; - this.label24.Size = new System.Drawing.Size(65, 12); - this.label24.TabIndex = 12; - this.label24.Text = "SkillName:"; + MagicSearchBox.Location = new Point(276, 0); + MagicSearchBox.Name = "MagicSearchBox"; + MagicSearchBox.Size = new Size(201, 23); + MagicSearchBox.TabIndex = 2; + MagicSearchBox.TextChanged += MagicSearchBox_TextChanged; + MagicSearchBox.Enter += MagicSearchBox_Enter; + MagicSearchBox.Leave += MagicSearchBox_Leave; // // MagicInfoForm // - this.ClientSize = new System.Drawing.Size(927, 542); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.MagiclistBox); - this.Name = "MagicInfoForm"; - this.Text = "Magic Settings"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MagicInfoForm_FormClosed); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - this.panel4.ResumeLayout(false); - this.panel4.PerformLayout(); - this.panel3.ResumeLayout(false); - this.panel3.PerformLayout(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - + ClientSize = new Size(927, 542); + Controls.Add(MagicSearchBox); + Controls.Add(tabControl1); + Controls.Add(MagiclistBox); + Name = "MagicInfoForm"; + Text = "Magic Settings"; + FormClosed += MagicInfoForm_FormClosed; + tabControl1.ResumeLayout(false); + tabPage1.ResumeLayout(false); + tabPage1.PerformLayout(); + panel4.ResumeLayout(false); + panel4.PerformLayout(); + panel3.ResumeLayout(false); + panel3.PerformLayout(); + panel2.ResumeLayout(false); + panel2.PerformLayout(); + panel1.ResumeLayout(false); + panel1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } private void MagicInfoForm_FormClosed(object sender, FormClosedEventArgs e) @@ -881,7 +896,7 @@ private void txtDmgBaseMax_TextChanged(object sender, EventArgs e) return; } ActiveControl.BackColor = SystemColors.Window; - _selectedMagicInfo.PowerBonus = (ushort)(temp - _selectedMagicInfo.PowerBase); + _selectedMagicInfo.PowerBonus = (ushort)(temp - _selectedMagicInfo.PowerBase); UpdateMagicForm(); } @@ -937,7 +952,7 @@ private void txtRange_TextChanged(object sender, EventArgs e) if (ActiveControl != sender) return; byte temp = 0; if (!IsValid(ref temp)) return; - + ActiveControl.BackColor = SystemColors.Window; _selectedMagicInfo.Range = temp; } @@ -974,9 +989,58 @@ private void textBoxName_TextChanged(object sender, EventArgs e) { ActiveControl.BackColor = Color.Red; } - else { - ActiveControl.BackColor = SystemColors.Window; - } + else + { + ActiveControl.BackColor = SystemColors.Window; + } + } + + #region Search Box + private void MagicSearchBox_TextChanged(object sender, EventArgs e) + { + if (isMagicSearchPlaceholderActive || string.IsNullOrWhiteSpace(MagicSearchBox.Text)) + { + // Show all items when search box is cleared or placeholder is active + MagiclistBox.Items.Clear(); + foreach (var magic in Envir.MagicInfoList) + { + MagiclistBox.Items.Add(magic); + } + return; + } + + string searchText = MagicSearchBox.Text.ToLower(); + MagiclistBox.Items.Clear(); + + // Add filtered items to the list + foreach (var magic in Envir.MagicInfoList) + { + if (!string.IsNullOrEmpty(magic.Name) && magic.Name.ToLower().Contains(searchText)) + { + MagiclistBox.Items.Add(magic); + } + } + } + + private void MagicSearchBox_Enter(object sender, EventArgs e) + { + if (isMagicSearchPlaceholderActive) + { + MagicSearchBox.Text = string.Empty; + MagicSearchBox.ForeColor = Color.Black; // Reset to normal text color + isMagicSearchPlaceholderActive = false; + } + } + + private void MagicSearchBox_Leave(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(MagicSearchBox.Text)) + { + MagicSearchBox.Text = "Search"; + MagicSearchBox.ForeColor = Color.Gray; // Placeholder text color + isMagicSearchPlaceholderActive = true; + } } + #endregion } -} +} \ No newline at end of file diff --git a/Server.MirForms/Database/MagicInfoForm.resx b/Server.MirForms/Database/MagicInfoForm.resx index d54ad1e47..c87be788e 100644 --- a/Server.MirForms/Database/MagicInfoForm.resx +++ b/Server.MirForms/Database/MagicInfoForm.resx @@ -1,17 +1,17 @@  - diff --git a/Server.MirForms/Database/NPCInfoForm.Designer.cs b/Server.MirForms/Database/NPCInfoForm.Designer.cs index aebf62d97..13b9849e6 100644 --- a/Server.MirForms/Database/NPCInfoForm.Designer.cs +++ b/Server.MirForms/Database/NPCInfoForm.Designer.cs @@ -84,6 +84,7 @@ private void InitializeComponent() ExportButton = new Button(); ImportButton = new Button(); ExportSelectedButton = new Button(); + NPCSearchBox = new TextBox(); tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)NPCPreview).BeginInit(); @@ -154,7 +155,7 @@ private void InitializeComponent() TeleportToCheckBox.Location = new Point(293, 268); TeleportToCheckBox.Margin = new Padding(4, 3, 4, 3); TeleportToCheckBox.Name = "TeleportToCheckBox"; - TeleportToCheckBox.Size = new Size(107, 19); + TeleportToCheckBox.Size = new Size(109, 19); TeleportToCheckBox.TabIndex = 63; TeleportToCheckBox.Text = "Can Teleport To"; TeleportToCheckBox.UseVisualStyleBackColor = true; @@ -340,7 +341,7 @@ private void InitializeComponent() label1.Location = new Point(23, 8); label1.Margin = new Padding(4, 0, 4, 0); label1.Name = "label1"; - label1.Size = new Size(66, 15); + label1.Size = new Size(65, 15); label1.TabIndex = 4; label1.Text = "NPC Index:"; // @@ -564,7 +565,7 @@ private void InitializeComponent() TimeVisible_checkbox.Location = new Point(35, 135); TimeVisible_checkbox.Margin = new Padding(4, 3, 4, 3); TimeVisible_checkbox.Name = "TimeVisible_checkbox"; - TimeVisible_checkbox.Size = new Size(153, 19); + TimeVisible_checkbox.Size = new Size(154, 19); TimeVisible_checkbox.TabIndex = 44; TimeVisible_checkbox.Text = "Only Visible at set Times"; TimeVisible_checkbox.UseVisualStyleBackColor = true; @@ -576,7 +577,7 @@ private void InitializeComponent() label7.Location = new Point(195, 7); label7.Margin = new Padding(4, 0, 4, 0); label7.Name = "label7"; - label7.Size = new Size(63, 15); + label7.Size = new Size(62, 15); label7.TabIndex = 43; label7.Text = "Max Level:"; // @@ -667,11 +668,11 @@ private void InitializeComponent() NPCInfoListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; NPCInfoListBox.FormattingEnabled = true; NPCInfoListBox.ItemHeight = 15; - NPCInfoListBox.Location = new Point(14, 47); + NPCInfoListBox.Location = new Point(14, 77); NPCInfoListBox.Margin = new Padding(4, 3, 4, 3); NPCInfoListBox.Name = "NPCInfoListBox"; NPCInfoListBox.SelectionMode = SelectionMode.MultiExtended; - NPCInfoListBox.Size = new Size(276, 334); + NPCInfoListBox.Size = new Size(276, 304); NPCInfoListBox.TabIndex = 15; NPCInfoListBox.SelectedIndexChanged += NPCInfoListBox_SelectedIndexChanged; // @@ -730,11 +731,22 @@ private void InitializeComponent() ExportSelectedButton.UseVisualStyleBackColor = true; ExportSelectedButton.Click += ExportSelected_Click; // + // NPCSearchBox + // + NPCSearchBox.Location = new Point(14, 49); + NPCSearchBox.Name = "NPCSearchBox"; + NPCSearchBox.Size = new Size(276, 23); + NPCSearchBox.TabIndex = 26; + NPCSearchBox.TextChanged += NPCSearchBox_TextChanged; + NPCSearchBox.Enter += NPCSearchBox_Enter; + NPCSearchBox.Leave += NPCSearchBox_Leave; + // // NPCInfoForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1131, 400); + Controls.Add(NPCSearchBox); Controls.Add(ExportSelectedButton); Controls.Add(ImportButton); Controls.Add(ExportButton); @@ -758,6 +770,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)EndMin_num).EndInit(); ((System.ComponentModel.ISupportInitialize)StartMin_num).EndInit(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -818,5 +831,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox TeleportToCheckBox; private CheckBox ConquestVisible_checkbox; private PictureBox NPCPreview; + private TextBox NPCSearchBox; } } \ No newline at end of file diff --git a/Server.MirForms/Database/NPCInfoForm.cs b/Server.MirForms/Database/NPCInfoForm.cs index b8fad4f03..97f54a80a 100644 --- a/Server.MirForms/Database/NPCInfoForm.cs +++ b/Server.MirForms/Database/NPCInfoForm.cs @@ -12,6 +12,7 @@ public partial class NPCInfoForm : Form public Envir Envir => SMain.EditEnvir; private List _selectedNPCInfos; + private bool isNPCSearchPlaceholderActive = true; public NPCInfoForm() { @@ -30,6 +31,12 @@ public NPCInfoForm() } } + NPCSearchBox.Text = "Search"; + NPCSearchBox.ForeColor = Color.Gray; // Placeholder text color + isNPCSearchPlaceholderActive = true; + + NPCSearchBox_TextChanged(this, EventArgs.Empty); + UpdateInterface(); } @@ -53,42 +60,11 @@ private void RemoveButton_Click(object sender, EventArgs e) private void UpdateInterface() { - if (NPCInfoListBox.Items.Count != Envir.NPCInfoList.Count) - { - NPCInfoListBox.Items.Clear(); - - for (int i = 0; i < Envir.NPCInfoList.Count; i++) - NPCInfoListBox.Items.Add(Envir.NPCInfoList[i]); - } - _selectedNPCInfos = NPCInfoListBox.SelectedItems.Cast().ToList(); if (_selectedNPCInfos.Count == 0) { - tabPage1.Enabled = false; - tabPage2.Enabled = false; - NPCIndexTextBox.Text = string.Empty; - NFileNameTextBox.Text = string.Empty; - NNameTextBox.Text = string.Empty; - NXTextBox.Text = string.Empty; - NYTextBox.Text = string.Empty; - NImageTextBox.Text = string.Empty; - NRateTextBox.Text = string.Empty; - MapComboBox.SelectedItem = null; - MinLev_textbox.Text = string.Empty; - MaxLev_textbox.Text = string.Empty; - Class_combo.Text = string.Empty; - ConquestHidden_combo.SelectedIndex = -1; - Day_combo.Text = string.Empty; - TimeVisible_checkbox.Checked = false; - StartHour_combo.Text = string.Empty; - EndHour_combo.Text = string.Empty; - StartMin_num.Value = 0; - EndMin_num.Value = 1; - Flag_textbox.Text = string.Empty; - ShowBigMapCheckBox.Checked = false; - BigMapIconTextBox.Text = string.Empty; - ConquestVisible_checkbox.Checked = true; + ClearInterface(); return; } @@ -121,23 +97,38 @@ private void UpdateInterface() TeleportToCheckBox.Checked = info.CanTeleportTo; ConquestVisible_checkbox.Checked = info.ConquestVisible; LoadImage(info.Image); + } - - for (int i = 1; i < _selectedNPCInfos.Count; i++) - { - info = _selectedNPCInfos[i]; - - if (NFileNameTextBox.Text != info.FileName) NFileNameTextBox.Text = string.Empty; - if (NNameTextBox.Text != info.Name) NNameTextBox.Text = string.Empty; - if (NXTextBox.Text != info.Location.X.ToString()) NXTextBox.Text = string.Empty; - - if (NYTextBox.Text != info.Location.Y.ToString()) NYTextBox.Text = string.Empty; - if (NImageTextBox.Text != info.Image.ToString()) NImageTextBox.Text = string.Empty; - if (NRateTextBox.Text != info.Rate.ToString()) NRateTextBox.Text = string.Empty; - if (BigMapIconTextBox.Text != info.BigMapIcon.ToString()) BigMapIconTextBox.Text = string.Empty; - } + // Clear the interface when no NPCs are selected + private void ClearInterface() + { + tabPage1.Enabled = false; + tabPage2.Enabled = false; + NPCIndexTextBox.Text = string.Empty; + NFileNameTextBox.Text = string.Empty; + NNameTextBox.Text = string.Empty; + NXTextBox.Text = string.Empty; + NYTextBox.Text = string.Empty; + NImageTextBox.Text = string.Empty; + NRateTextBox.Text = string.Empty; + MapComboBox.SelectedItem = null; + MinLev_textbox.Text = string.Empty; + MaxLev_textbox.Text = string.Empty; + Class_combo.Text = string.Empty; + ConquestHidden_combo.SelectedIndex = -1; + Day_combo.Text = string.Empty; + TimeVisible_checkbox.Checked = false; + StartHour_combo.Text = string.Empty; + EndHour_combo.Text = string.Empty; + StartMin_num.Value = 0; + EndMin_num.Value = 1; + Flag_textbox.Text = string.Empty; + ShowBigMapCheckBox.Checked = false; + BigMapIconTextBox.Text = string.Empty; + ConquestVisible_checkbox.Checked = true; } + private void RefreshNPCList() { NPCInfoListBox.SelectedIndexChanged -= NPCInfoListBox_SelectedIndexChanged; @@ -642,5 +633,46 @@ private void ConquestVisible_checkbox_CheckedChanged(object sender, EventArgs e) for (int i = 0; i < _selectedNPCInfos.Count; i++) _selectedNPCInfos[i].ConquestVisible = ConquestVisible_checkbox.Checked; } + + #region NPC Search + private void NPCSearchBox_TextChanged(object sender, EventArgs e) + { + if (isNPCSearchPlaceholderActive || string.IsNullOrWhiteSpace(NPCSearchBox.Text)) + { + RefreshNPCList(); // Show all items if placeholder or empty + return; + } + + string searchText = NPCSearchBox.Text.ToLower(); + NPCInfoListBox.Items.Clear(); + foreach (var npc in Envir.NPCInfoList) + { + if (npc.Name.ToLower().Contains(searchText) || npc.FileName.ToLower().Contains(searchText)) + { + NPCInfoListBox.Items.Add(npc); + } + } + } + + private void NPCSearchBox_Enter(object sender, EventArgs e) + { + if (isNPCSearchPlaceholderActive) + { + NPCSearchBox.Text = string.Empty; + NPCSearchBox.ForeColor = Color.Black; // Reset to normal text color + isNPCSearchPlaceholderActive = false; + } + } + + private void NPCSearchBox_Leave(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(NPCSearchBox.Text)) + { + NPCSearchBox.Text = "Search"; + NPCSearchBox.ForeColor = Color.Gray; // Placeholder text color + isNPCSearchPlaceholderActive = true; + } + } + #endregion } } diff --git a/Server.MirForms/Database/NPCInfoForm.resx b/Server.MirForms/Database/NPCInfoForm.resx index af32865ec..8b2ff64a1 100644 --- a/Server.MirForms/Database/NPCInfoForm.resx +++ b/Server.MirForms/Database/NPCInfoForm.resx @@ -1,7 +1,7 @@  diff --git a/Server.MirForms/Database/RecipeInfoForm.Designer.cs b/Server.MirForms/Database/RecipeInfoForm.Designer.cs index 3d8aaa25d..17cc4360d 100644 --- a/Server.MirForms/Database/RecipeInfoForm.Designer.cs +++ b/Server.MirForms/Database/RecipeInfoForm.Designer.cs @@ -71,6 +71,7 @@ private void InitializeComponent() groupBox1 = new GroupBox(); RecipeCountLabel = new Label(); DeleteButton = new Button(); + RecipeSearchBox = new TextBox(); RecipeGroupBox.SuspendLayout(); ToolsGroupBox.SuspendLayout(); IngredientsGroupBox.SuspendLayout(); @@ -81,9 +82,9 @@ private void InitializeComponent() // RecipeList.FormattingEnabled = true; RecipeList.ItemHeight = 15; - RecipeList.Location = new Point(12, 12); + RecipeList.Location = new Point(12, 42); RecipeList.Name = "RecipeList"; - RecipeList.Size = new Size(135, 319); + RecipeList.Size = new Size(135, 289); RecipeList.TabIndex = 0; RecipeList.SelectedIndexChanged += RecipeList_SelectedIndexChanged; // @@ -119,7 +120,7 @@ private void InitializeComponent() label4.AutoSize = true; label4.Location = new Point(83, 15); label4.Name = "label4"; - label4.Size = new Size(34, 15); + label4.Size = new Size(35, 15); label4.TabIndex = 4; label4.Text = "Tools"; // @@ -468,11 +469,22 @@ private void InitializeComponent() DeleteButton.UseVisualStyleBackColor = true; DeleteButton.Click += DeleteButton_Click; // + // RecipeSearchBox + // + RecipeSearchBox.Location = new Point(12, 12); + RecipeSearchBox.Name = "RecipeSearchBox"; + RecipeSearchBox.Size = new Size(135, 23); + RecipeSearchBox.TabIndex = 13; + RecipeSearchBox.TextChanged += RecipeSearchBox_TextChanged; + RecipeSearchBox.Enter += RecipeSearchBox_Enter; + RecipeSearchBox.Leave += RecipeSearchBox_Leave; + // // RecipeInfoForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(432, 517); + Controls.Add(RecipeSearchBox); Controls.Add(groupBox1); Controls.Add(IngredientsGroupBox); Controls.Add(ToolsGroupBox); @@ -491,6 +503,7 @@ private void InitializeComponent() groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -538,5 +551,6 @@ private void InitializeComponent() private GroupBox groupBox1; private Button DeleteButton; private Label RecipeCountLabel; + private TextBox RecipeSearchBox; } } \ No newline at end of file diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index ea1e3d8d2..555c87ef4 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -8,12 +8,17 @@ public partial class RecipeInfoForm : Form { private string currentFilePath; private bool isModified = false; + private bool isRecipeSearchPlaceholderActive = true; public RecipeInfoForm() { InitializeComponent(); this.Load += RecipeInfoForm_Load; SaveButton.Click += SaveButton_Click; + + RecipeSearchBox.Text = "Search"; + RecipeSearchBox.ForeColor = SystemColors.GrayText; + isRecipeSearchPlaceholderActive = true; } #region Form Load @@ -565,7 +570,7 @@ private void UpdateRecipeFileName(string newItemName) } catch (Exception ex) { - + } } } @@ -748,5 +753,57 @@ private void ClearForm() IngredientDura6TextBox.Text = string.Empty; } #endregion + + #region Search Box + private void RecipeSearchBox_TextChanged(object sender, EventArgs e) + { + if (isRecipeSearchPlaceholderActive || string.IsNullOrWhiteSpace(RecipeSearchBox.Text)) + { + // Show all recipes when search box is empty or placeholder is active + ReloadRecipeList(string.Empty); + return; + } + + string searchText = RecipeSearchBox.Text.ToLower(); + RecipeList.Items.Clear(); + + // Add filtered recipes to the list + string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; + string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); + + if (Directory.Exists(directoryPath)) + { + string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); + foreach (var file in recipeFiles) + { + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); + if (fileNameWithoutExtension.ToLower().Contains(searchText)) + { + RecipeList.Items.Add(fileNameWithoutExtension); + } + } + } + } + + private void RecipeSearchBox_Enter(object sender, EventArgs e) + { + if (isRecipeSearchPlaceholderActive) + { + isRecipeSearchPlaceholderActive = false; + RecipeSearchBox.Text = string.Empty; + RecipeSearchBox.ForeColor = SystemColors.WindowText; // Set text color to default + } + } + + private void RecipeSearchBox_Leave(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(RecipeSearchBox.Text)) + { + isRecipeSearchPlaceholderActive = true; + RecipeSearchBox.Text = "Search"; + RecipeSearchBox.ForeColor = SystemColors.GrayText; // Set placeholder text color + } + } + #endregion } } \ No newline at end of file From bc8b0a01811b27bf4396a74530b15c659cb7d723 Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Sun, 29 Dec 2024 18:07:40 +0000 Subject: [PATCH 2/6] Placeholder Text Replaced with Placeholder textbox property and cleaned up the code I had added. --- Server.MirForms/Database/GameShop.cs | 34 +- Server.MirForms/Database/GameShop.designer.cs | 3 +- Server.MirForms/Database/MagicInfoForm.cs | 32 +- Server.MirForms/Database/MagicInfoForm.resx | 3 - .../Database/MapInfoForm.Designer.cs | 19 +- .../Database/MonsterInfoFormNew.Designer.cs | 532 +++++++++--------- .../Database/MonsterInfoFormNew.resx | 54 +- .../Database/NPCInfoForm.Designer.cs | 3 +- Server.MirForms/Database/NPCInfoForm.cs | 38 +- .../Database/QuestInfoForm.Designer.cs | 3 +- Server.MirForms/Database/QuestInfoForm.cs | 38 +- .../Database/RecipeInfoForm.Designer.cs | 3 +- Server.MirForms/Database/RecipeInfoForm.cs | 38 +- 13 files changed, 330 insertions(+), 470 deletions(-) diff --git a/Server.MirForms/Database/GameShop.cs b/Server.MirForms/Database/GameShop.cs index baf363399..653869070 100644 --- a/Server.MirForms/Database/GameShop.cs +++ b/Server.MirForms/Database/GameShop.cs @@ -6,7 +6,6 @@ public partial class GameShop : Form { private List SelectedItems; - private bool isGameShopSearchPlaceholderActive = true; public Envir Envir => SMain.EditEnvir; @@ -17,10 +16,6 @@ public GameShop() LoadGameShopItems(); GameShopSearchBox_TextChanged(this, EventArgs.Empty); - - GameShopSearchBox.Text = "Search"; - GameShopSearchBox.ForeColor = Color.Gray; // Make the placeholder text look distinct - isGameShopSearchPlaceholderActive = true; } private void GameShop_Load(object sender, EventArgs e) @@ -482,15 +477,12 @@ private void ItemComboBox_SelectedIndexChanged(object sender, EventArgs e) #region Search Box private void GameShopSearchBox_TextChanged(object sender, EventArgs e) { - // Ignore filtering if placeholder is active or if the text is "Search" - if (isGameShopSearchPlaceholderActive || GameShopSearchBox.Text.Trim() == "Search") return; - string searchText = GameShopSearchBox.Text.Trim().ToLower(); GameShopListBox.Items.Clear(); - // If the search box is empty, display all game shop items - if (string.IsNullOrEmpty(searchText)) + // Display all items if the search box is empty + if (string.IsNullOrWhiteSpace(searchText)) { foreach (var item in SMain.EditEnvir.GameShopList) { @@ -499,7 +491,7 @@ private void GameShopSearchBox_TextChanged(object sender, EventArgs e) return; } - // Filter game shop items that match the search text + // Filter and add matching items to the list box foreach (var item in SMain.EditEnvir.GameShopList) { if (!string.IsNullOrEmpty(item.Info?.Name) && item.Info.Name.ToLower().Contains(searchText)) @@ -508,26 +500,6 @@ private void GameShopSearchBox_TextChanged(object sender, EventArgs e) } } } - - private void GameShopSearchBox_Enter(object sender, EventArgs e) - { - if (isGameShopSearchPlaceholderActive) - { - GameShopSearchBox.Text = string.Empty; - GameShopSearchBox.ForeColor = Color.Black; // Reset to normal text color - isGameShopSearchPlaceholderActive = false; - } - } - - private void GameShopSearchBox_Leave(object sender, EventArgs e) - { - if (string.IsNullOrWhiteSpace(GameShopSearchBox.Text)) - { - GameShopSearchBox.Text = "Search"; - GameShopSearchBox.ForeColor = Color.Gray; // Set placeholder color - isGameShopSearchPlaceholderActive = true; - } - } #endregion } } diff --git a/Server.MirForms/Database/GameShop.designer.cs b/Server.MirForms/Database/GameShop.designer.cs index a9b28f743..2e718dd65 100644 --- a/Server.MirForms/Database/GameShop.designer.cs +++ b/Server.MirForms/Database/GameShop.designer.cs @@ -476,11 +476,10 @@ private void InitializeComponent() // GameShopSearchBox.Location = new Point(14, 88); GameShopSearchBox.Name = "GameShopSearchBox"; + GameShopSearchBox.PlaceholderText = "Search..."; GameShopSearchBox.Size = new Size(234, 23); GameShopSearchBox.TabIndex = 114; GameShopSearchBox.TextChanged += GameShopSearchBox_TextChanged; - GameShopSearchBox.Enter += GameShopSearchBox_Enter; - GameShopSearchBox.Leave += GameShopSearchBox_Leave; // // GameShop // diff --git a/Server.MirForms/Database/MagicInfoForm.cs b/Server.MirForms/Database/MagicInfoForm.cs index f74a59921..10b1e509b 100644 --- a/Server.MirForms/Database/MagicInfoForm.cs +++ b/Server.MirForms/Database/MagicInfoForm.cs @@ -9,17 +9,12 @@ public partial class MagicInfoForm : Form public Envir Envir => SMain.EditEnvir; private MagicInfo _selectedMagicInfo; - private bool isMagicSearchPlaceholderActive = true; public MagicInfoForm() { InitializeComponent(); MagicSearchBox_TextChanged(this, EventArgs.Empty); UpdateMagicForm(); - - MagicSearchBox.Text = "Search"; - MagicSearchBox.ForeColor = Color.Gray; // Placeholder text color - isMagicSearchPlaceholderActive = true; } private void UpdateMagicForm(byte field = 0) @@ -704,11 +699,10 @@ private void InitializeComponent() // MagicSearchBox.Location = new Point(276, 0); MagicSearchBox.Name = "MagicSearchBox"; + MagicSearchBox.PlaceholderText = "Search..."; MagicSearchBox.Size = new Size(201, 23); MagicSearchBox.TabIndex = 2; MagicSearchBox.TextChanged += MagicSearchBox_TextChanged; - MagicSearchBox.Enter += MagicSearchBox_Enter; - MagicSearchBox.Leave += MagicSearchBox_Leave; // // MagicInfoForm // @@ -998,9 +992,9 @@ private void textBoxName_TextChanged(object sender, EventArgs e) #region Search Box private void MagicSearchBox_TextChanged(object sender, EventArgs e) { - if (isMagicSearchPlaceholderActive || string.IsNullOrWhiteSpace(MagicSearchBox.Text)) + // Show all items when the search box is cleared or placeholder is active + if (string.IsNullOrWhiteSpace(MagicSearchBox.Text)) { - // Show all items when search box is cleared or placeholder is active MagiclistBox.Items.Clear(); foreach (var magic in Envir.MagicInfoList) { @@ -1021,26 +1015,6 @@ private void MagicSearchBox_TextChanged(object sender, EventArgs e) } } } - - private void MagicSearchBox_Enter(object sender, EventArgs e) - { - if (isMagicSearchPlaceholderActive) - { - MagicSearchBox.Text = string.Empty; - MagicSearchBox.ForeColor = Color.Black; // Reset to normal text color - isMagicSearchPlaceholderActive = false; - } - } - - private void MagicSearchBox_Leave(object sender, EventArgs e) - { - if (string.IsNullOrWhiteSpace(MagicSearchBox.Text)) - { - MagicSearchBox.Text = "Search"; - MagicSearchBox.ForeColor = Color.Gray; // Placeholder text color - isMagicSearchPlaceholderActive = true; - } - } #endregion } } \ No newline at end of file diff --git a/Server.MirForms/Database/MagicInfoForm.resx b/Server.MirForms/Database/MagicInfoForm.resx index c87be788e..dcfd08d0f 100644 --- a/Server.MirForms/Database/MagicInfoForm.resx +++ b/Server.MirForms/Database/MagicInfoForm.resx @@ -120,7 +120,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file diff --git a/Server.MirForms/Database/MapInfoForm.Designer.cs b/Server.MirForms/Database/MapInfoForm.Designer.cs index e442af183..68b81bad8 100644 --- a/Server.MirForms/Database/MapInfoForm.Designer.cs +++ b/Server.MirForms/Database/MapInfoForm.Designer.cs @@ -281,7 +281,7 @@ private void InitializeComponent() label33.Location = new Point(19, 177); label33.Margin = new Padding(4, 0, 4, 0); label33.Name = "label33"; - label33.Size = new Size(64, 15); + label33.Size = new Size(65, 15); label33.TabIndex = 16; label33.Text = "Mine Type:"; // @@ -343,7 +343,7 @@ private void InitializeComponent() label1.Location = new Point(19, 21); label1.Margin = new Padding(4, 0, 4, 0); label1.Name = "label1"; - label1.Size = new Size(66, 15); + label1.Size = new Size(65, 15); label1.TabIndex = 4; label1.Text = "Map Index:"; // @@ -467,7 +467,7 @@ private void InitializeComponent() NoTownTeleportCheckbox.Location = new Point(397, 137); NoTownTeleportCheckbox.Margin = new Padding(4, 3, 4, 3); NoTownTeleportCheckbox.Name = "NoTownTeleportCheckbox"; - NoTownTeleportCheckbox.Size = new Size(115, 19); + NoTownTeleportCheckbox.Size = new Size(117, 19); NoTownTeleportCheckbox.TabIndex = 44; NoTownTeleportCheckbox.Text = "No TownTeleport"; NoTownTeleportCheckbox.UseVisualStyleBackColor = true; @@ -570,7 +570,7 @@ private void InitializeComponent() NoThrowItemCheckbox.Location = new Point(203, 20); NoThrowItemCheckbox.Margin = new Padding(4, 3, 4, 3); NoThrowItemCheckbox.Name = "NoThrowItemCheckbox"; - NoThrowItemCheckbox.Size = new Size(105, 19); + NoThrowItemCheckbox.Size = new Size(106, 19); NoThrowItemCheckbox.TabIndex = 35; NoThrowItemCheckbox.Text = "No Throw Item"; NoThrowItemCheckbox.UseVisualStyleBackColor = true; @@ -717,7 +717,7 @@ private void InitializeComponent() NoTeleportCheckbox.Location = new Point(19, 20); NoTeleportCheckbox.Margin = new Padding(4, 3, 4, 3); NoTeleportCheckbox.Name = "NoTeleportCheckbox"; - NoTeleportCheckbox.Size = new Size(87, 19); + NoTeleportCheckbox.Size = new Size(88, 19); NoTeleportCheckbox.TabIndex = 21; NoTeleportCheckbox.Text = "No Teleport"; NoTeleportCheckbox.UseVisualStyleBackColor = true; @@ -1319,7 +1319,7 @@ private void InitializeComponent() label22.Location = new Point(13, 43); label22.Margin = new Padding(4, 0, 4, 0); label22.Name = "label22"; - label22.Size = new Size(49, 15); + label22.Size = new Size(50, 15); label22.TabIndex = 16; label22.Text = "To Map:"; // @@ -1340,7 +1340,7 @@ private void InitializeComponent() label18.Location = new Point(138, 73); label18.Margin = new Padding(4, 0, 4, 0); label18.Name = "label18"; - label18.Size = new Size(32, 15); + label18.Size = new Size(33, 15); label18.TabIndex = 14; label18.Text = "To Y:"; // @@ -1360,7 +1360,7 @@ private void InitializeComponent() label21.Location = new Point(27, 73); label21.Margin = new Padding(4, 0, 4, 0); label21.Name = "label21"; - label21.Size = new Size(32, 15); + label21.Size = new Size(33, 15); label21.TabIndex = 13; label21.Text = "To X:"; // @@ -1488,7 +1488,7 @@ private void InitializeComponent() label27.Location = new Point(14, 20); label27.Margin = new Padding(4, 0, 4, 0); label27.Name = "label27"; - label27.Size = new Size(64, 15); + label27.Size = new Size(65, 15); label27.TabIndex = 14; label27.Text = "Mine Type:"; // @@ -1701,6 +1701,7 @@ private void InitializeComponent() // MapSearchTextBox.Location = new Point(14, 41); MapSearchTextBox.Name = "MapSearchTextBox"; + MapSearchTextBox.PlaceholderText = "Search..."; MapSearchTextBox.Size = new Size(220, 23); MapSearchTextBox.TabIndex = 35; // diff --git a/Server.MirForms/Database/MonsterInfoFormNew.Designer.cs b/Server.MirForms/Database/MonsterInfoFormNew.Designer.cs index c34f7b65f..748f506f3 100644 --- a/Server.MirForms/Database/MonsterInfoFormNew.Designer.cs +++ b/Server.MirForms/Database/MonsterInfoFormNew.Designer.cs @@ -29,340 +29,323 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.monsterInfoGridView = new System.Windows.Forms.DataGridView(); - this.panel1 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.btnExport = new System.Windows.Forms.Button(); - this.btnImport = new System.Windows.Forms.Button(); - this.groupView = new System.Windows.Forms.GroupBox(); - this.rbtnViewAll = new System.Windows.Forms.RadioButton(); - this.rbtnViewBasic = new System.Windows.Forms.RadioButton(); - this.lblSearch = new System.Windows.Forms.Label(); - this.txtSearch = new System.Windows.Forms.TextBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.Modified = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.MonsterIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterImage = new System.Windows.Forms.DataGridViewComboBoxColumn(); - this.MonsterAI = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterEffect = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterLevel = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterLight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterAttackSpeed = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterMoveSpeed = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterViewRange = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterCoolEye = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterExperience = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MonsterCanPush = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.MonsterAutoRev = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.MonsterUndead = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.MonsterCanTame = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.MonsterDropPath = new System.Windows.Forms.DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)(this.monsterInfoGridView)).BeginInit(); - this.panel1.SuspendLayout(); - this.panel3.SuspendLayout(); - this.groupView.SuspendLayout(); - this.panel2.SuspendLayout(); - this.SuspendLayout(); + DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); + monsterInfoGridView = new DataGridView(); + Modified = new DataGridViewCheckBoxColumn(); + MonsterIndex = new DataGridViewTextBoxColumn(); + MonsterName = new DataGridViewTextBoxColumn(); + MonsterImage = new DataGridViewComboBoxColumn(); + MonsterAI = new DataGridViewTextBoxColumn(); + MonsterEffect = new DataGridViewTextBoxColumn(); + MonsterLevel = new DataGridViewTextBoxColumn(); + MonsterLight = new DataGridViewTextBoxColumn(); + MonsterAttackSpeed = new DataGridViewTextBoxColumn(); + MonsterMoveSpeed = new DataGridViewTextBoxColumn(); + MonsterViewRange = new DataGridViewTextBoxColumn(); + MonsterCoolEye = new DataGridViewTextBoxColumn(); + MonsterExperience = new DataGridViewTextBoxColumn(); + MonsterCanPush = new DataGridViewCheckBoxColumn(); + MonsterAutoRev = new DataGridViewCheckBoxColumn(); + MonsterUndead = new DataGridViewCheckBoxColumn(); + MonsterCanTame = new DataGridViewCheckBoxColumn(); + MonsterDropPath = new DataGridViewTextBoxColumn(); + panel1 = new Panel(); + panel3 = new Panel(); + btnExport = new Button(); + btnImport = new Button(); + groupView = new GroupBox(); + rbtnViewAll = new RadioButton(); + rbtnViewBasic = new RadioButton(); + txtSearch = new TextBox(); + panel2 = new Panel(); + ((System.ComponentModel.ISupportInitialize)monsterInfoGridView).BeginInit(); + panel1.SuspendLayout(); + panel3.SuspendLayout(); + groupView.SuspendLayout(); + panel2.SuspendLayout(); + SuspendLayout(); // // monsterInfoGridView // - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.monsterInfoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.monsterInfoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.monsterInfoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Modified, - this.MonsterIndex, - this.MonsterName, - this.MonsterImage, - this.MonsterAI, - this.MonsterEffect, - this.MonsterLevel, - this.MonsterLight, - this.MonsterAttackSpeed, - this.MonsterMoveSpeed, - this.MonsterViewRange, - this.MonsterCoolEye, - this.MonsterExperience, - this.MonsterCanPush, - this.MonsterAutoRev, - this.MonsterUndead, - this.MonsterCanTame, - this.MonsterDropPath}); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.monsterInfoGridView.DefaultCellStyle = dataGridViewCellStyle2; - this.monsterInfoGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.monsterInfoGridView.Location = new System.Drawing.Point(0, 0); - this.monsterInfoGridView.Name = "monsterInfoGridView"; - this.monsterInfoGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.monsterInfoGridView.Size = new System.Drawing.Size(956, 433); - this.monsterInfoGridView.TabIndex = 0; - this.monsterInfoGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.monsterInfoGridView_CellValidating); - this.monsterInfoGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.monsterInfoGridView_DataError); - this.monsterInfoGridView.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.monsterInfoGridView_DefaultValuesNeeded); - this.monsterInfoGridView.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.monsterInfoGridView_UserDeletingRow); - // - // panel1 - // - this.panel1.Controls.Add(this.panel3); - this.panel1.Dock = System.Windows.Forms.DockStyle.Top; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(956, 47); - this.panel1.TabIndex = 1; - // - // panel3 - // - this.panel3.Controls.Add(this.btnExport); - this.panel3.Controls.Add(this.btnImport); - this.panel3.Controls.Add(this.groupView); - this.panel3.Controls.Add(this.lblSearch); - this.panel3.Controls.Add(this.txtSearch); - this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel3.Location = new System.Drawing.Point(0, 0); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(956, 47); - this.panel3.TabIndex = 5; - // - // btnExport - // - this.btnExport.Location = new System.Drawing.Point(693, 22); - this.btnExport.Name = "btnExport"; - this.btnExport.Size = new System.Drawing.Size(75, 23); - this.btnExport.TabIndex = 6; - this.btnExport.Text = "Export"; - this.btnExport.UseVisualStyleBackColor = true; - this.btnExport.Click += new System.EventHandler(this.btnExport_Click); - // - // btnImport - // - this.btnImport.Location = new System.Drawing.Point(611, 22); - this.btnImport.Name = "btnImport"; - this.btnImport.Size = new System.Drawing.Size(75, 23); - this.btnImport.TabIndex = 5; - this.btnImport.Text = "Import"; - this.btnImport.UseVisualStyleBackColor = true; - this.btnImport.Click += new System.EventHandler(this.btnImport_Click); - // - // groupView - // - this.groupView.Controls.Add(this.rbtnViewAll); - this.groupView.Controls.Add(this.rbtnViewBasic); - this.groupView.Enabled = false; - this.groupView.Location = new System.Drawing.Point(3, 3); - this.groupView.Name = "groupView"; - this.groupView.Size = new System.Drawing.Size(134, 42); - this.groupView.TabIndex = 4; - this.groupView.TabStop = false; - this.groupView.Text = "View Mode"; - // - // rbtnViewAll - // - this.rbtnViewAll.AutoSize = true; - this.rbtnViewAll.Checked = true; - this.rbtnViewAll.Location = new System.Drawing.Point(27, 19); - this.rbtnViewAll.Name = "rbtnViewAll"; - this.rbtnViewAll.Size = new System.Drawing.Size(36, 17); - this.rbtnViewAll.TabIndex = 0; - this.rbtnViewAll.TabStop = true; - this.rbtnViewAll.Text = "All"; - this.rbtnViewAll.UseVisualStyleBackColor = true; - this.rbtnViewAll.CheckedChanged += new System.EventHandler(this.rbtnViewAll_CheckedChanged); - // - // rbtnViewBasic - // - this.rbtnViewBasic.AutoSize = true; - this.rbtnViewBasic.Location = new System.Drawing.Point(69, 19); - this.rbtnViewBasic.Name = "rbtnViewBasic"; - this.rbtnViewBasic.Size = new System.Drawing.Size(51, 17); - this.rbtnViewBasic.TabIndex = 1; - this.rbtnViewBasic.Text = "Basic"; - this.rbtnViewBasic.UseVisualStyleBackColor = true; - this.rbtnViewBasic.CheckedChanged += new System.EventHandler(this.rbtnViewBasic_CheckedChanged); - // - // lblSearch - // - this.lblSearch.AutoSize = true; - this.lblSearch.Location = new System.Drawing.Point(461, 9); - this.lblSearch.Name = "lblSearch"; - this.lblSearch.Size = new System.Drawing.Size(44, 13); - this.lblSearch.TabIndex = 1; - this.lblSearch.Text = "Search:"; - // - // txtSearch - // - this.txtSearch.Location = new System.Drawing.Point(464, 25); - this.txtSearch.Name = "txtSearch"; - this.txtSearch.Size = new System.Drawing.Size(141, 20); - this.txtSearch.TabIndex = 0; - this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown); - // - // panel2 - // - this.panel2.Controls.Add(this.monsterInfoGridView); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(0, 47); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(956, 433); - this.panel2.TabIndex = 2; + dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter; + monsterInfoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + monsterInfoGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + monsterInfoGridView.Columns.AddRange(new DataGridViewColumn[] { Modified, MonsterIndex, MonsterName, MonsterImage, MonsterAI, MonsterEffect, MonsterLevel, MonsterLight, MonsterAttackSpeed, MonsterMoveSpeed, MonsterViewRange, MonsterCoolEye, MonsterExperience, MonsterCanPush, MonsterAutoRev, MonsterUndead, MonsterCanTame, MonsterDropPath }); + dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.BackColor = SystemColors.Window; + dataGridViewCellStyle2.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); + dataGridViewCellStyle2.ForeColor = SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = DataGridViewTriState.False; + monsterInfoGridView.DefaultCellStyle = dataGridViewCellStyle2; + monsterInfoGridView.Dock = DockStyle.Fill; + monsterInfoGridView.Location = new Point(0, 0); + monsterInfoGridView.Margin = new Padding(4, 3, 4, 3); + monsterInfoGridView.Name = "monsterInfoGridView"; + monsterInfoGridView.RowTemplate.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; + monsterInfoGridView.Size = new Size(1115, 500); + monsterInfoGridView.TabIndex = 0; + monsterInfoGridView.CellValidating += monsterInfoGridView_CellValidating; + monsterInfoGridView.DataError += monsterInfoGridView_DataError; + monsterInfoGridView.DefaultValuesNeeded += monsterInfoGridView_DefaultValuesNeeded; + monsterInfoGridView.UserDeletingRow += monsterInfoGridView_UserDeletingRow; // // Modified // - this.Modified.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader; - this.Modified.DataPropertyName = "Modified"; - this.Modified.Frozen = true; - this.Modified.HeaderText = "Modified"; - this.Modified.Name = "Modified"; - this.Modified.ReadOnly = true; - this.Modified.Width = 53; + Modified.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; + Modified.DataPropertyName = "Modified"; + Modified.Frozen = true; + Modified.HeaderText = "Modified"; + Modified.Name = "Modified"; + Modified.ReadOnly = true; + Modified.Width = 61; // // MonsterIndex // - this.MonsterIndex.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.MonsterIndex.DataPropertyName = "MonsterIndex"; - this.MonsterIndex.Frozen = true; - this.MonsterIndex.HeaderText = "Index"; - this.MonsterIndex.Name = "MonsterIndex"; - this.MonsterIndex.ReadOnly = true; - this.MonsterIndex.Width = 58; + MonsterIndex.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; + MonsterIndex.DataPropertyName = "MonsterIndex"; + MonsterIndex.Frozen = true; + MonsterIndex.HeaderText = "Index"; + MonsterIndex.Name = "MonsterIndex"; + MonsterIndex.ReadOnly = true; + MonsterIndex.Width = 60; // // MonsterName // - this.MonsterName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.MonsterName.DataPropertyName = "MonsterName"; - this.MonsterName.Frozen = true; - this.MonsterName.HeaderText = "Name"; - this.MonsterName.Name = "MonsterName"; - this.MonsterName.Width = 60; + MonsterName.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; + MonsterName.DataPropertyName = "MonsterName"; + MonsterName.Frozen = true; + MonsterName.HeaderText = "Name"; + MonsterName.Name = "MonsterName"; + MonsterName.Width = 64; // // MonsterImage // - this.MonsterImage.DataPropertyName = "MonsterImage"; - this.MonsterImage.HeaderText = "Image"; - this.MonsterImage.Name = "MonsterImage"; - this.MonsterImage.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + MonsterImage.DataPropertyName = "MonsterImage"; + MonsterImage.HeaderText = "Image"; + MonsterImage.Name = "MonsterImage"; + MonsterImage.SortMode = DataGridViewColumnSortMode.Automatic; // // MonsterAI // - this.MonsterAI.DataPropertyName = "MonsterAI"; - this.MonsterAI.HeaderText = "AI"; - this.MonsterAI.Name = "MonsterAI"; + MonsterAI.DataPropertyName = "MonsterAI"; + MonsterAI.HeaderText = "AI"; + MonsterAI.Name = "MonsterAI"; // // MonsterEffect // - this.MonsterEffect.DataPropertyName = "MonsterEffect"; - this.MonsterEffect.HeaderText = "Effect"; - this.MonsterEffect.Name = "MonsterEffect"; + MonsterEffect.DataPropertyName = "MonsterEffect"; + MonsterEffect.HeaderText = "Effect"; + MonsterEffect.Name = "MonsterEffect"; // // MonsterLevel // - this.MonsterLevel.DataPropertyName = "MonsterLevel"; - this.MonsterLevel.HeaderText = "Level"; - this.MonsterLevel.Name = "MonsterLevel"; + MonsterLevel.DataPropertyName = "MonsterLevel"; + MonsterLevel.HeaderText = "Level"; + MonsterLevel.Name = "MonsterLevel"; // // MonsterLight // - this.MonsterLight.DataPropertyName = "MonsterLight"; - this.MonsterLight.HeaderText = "Light"; - this.MonsterLight.Name = "MonsterLight"; + MonsterLight.DataPropertyName = "MonsterLight"; + MonsterLight.HeaderText = "Light"; + MonsterLight.Name = "MonsterLight"; // // MonsterAttackSpeed // - this.MonsterAttackSpeed.DataPropertyName = "MonsterAttackSpeed"; - this.MonsterAttackSpeed.HeaderText = "Attack Speed"; - this.MonsterAttackSpeed.Name = "MonsterAttackSpeed"; + MonsterAttackSpeed.DataPropertyName = "MonsterAttackSpeed"; + MonsterAttackSpeed.HeaderText = "Attack Speed"; + MonsterAttackSpeed.Name = "MonsterAttackSpeed"; // // MonsterMoveSpeed // - this.MonsterMoveSpeed.DataPropertyName = "MonsterMoveSpeed"; - this.MonsterMoveSpeed.HeaderText = "Move Speed"; - this.MonsterMoveSpeed.Name = "MonsterMoveSpeed"; + MonsterMoveSpeed.DataPropertyName = "MonsterMoveSpeed"; + MonsterMoveSpeed.HeaderText = "Move Speed"; + MonsterMoveSpeed.Name = "MonsterMoveSpeed"; // // MonsterViewRange // - this.MonsterViewRange.DataPropertyName = "MonsterViewRange"; - this.MonsterViewRange.HeaderText = "View Range"; - this.MonsterViewRange.Name = "MonsterViewRange"; + MonsterViewRange.DataPropertyName = "MonsterViewRange"; + MonsterViewRange.HeaderText = "View Range"; + MonsterViewRange.Name = "MonsterViewRange"; // // MonsterCoolEye // - this.MonsterCoolEye.DataPropertyName = "MonsterCoolEye"; - this.MonsterCoolEye.HeaderText = "Cool Eye"; - this.MonsterCoolEye.Name = "MonsterCoolEye"; + MonsterCoolEye.DataPropertyName = "MonsterCoolEye"; + MonsterCoolEye.HeaderText = "Cool Eye"; + MonsterCoolEye.Name = "MonsterCoolEye"; // // MonsterExperience // - this.MonsterExperience.DataPropertyName = "MonsterExperience"; - this.MonsterExperience.HeaderText = "Experience"; - this.MonsterExperience.Name = "MonsterExperience"; + MonsterExperience.DataPropertyName = "MonsterExperience"; + MonsterExperience.HeaderText = "Experience"; + MonsterExperience.Name = "MonsterExperience"; // // MonsterCanPush // - this.MonsterCanPush.DataPropertyName = "MonsterCanPush"; - this.MonsterCanPush.HeaderText = "Can Push"; - this.MonsterCanPush.Name = "MonsterCanPush"; - this.MonsterCanPush.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.MonsterCanPush.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + MonsterCanPush.DataPropertyName = "MonsterCanPush"; + MonsterCanPush.HeaderText = "Can Push"; + MonsterCanPush.Name = "MonsterCanPush"; + MonsterCanPush.Resizable = DataGridViewTriState.True; + MonsterCanPush.SortMode = DataGridViewColumnSortMode.Automatic; // // MonsterAutoRev // - this.MonsterAutoRev.DataPropertyName = "MonsterAutoRev"; - this.MonsterAutoRev.HeaderText = "Auto Rev"; - this.MonsterAutoRev.Name = "MonsterAutoRev"; - this.MonsterAutoRev.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.MonsterAutoRev.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + MonsterAutoRev.DataPropertyName = "MonsterAutoRev"; + MonsterAutoRev.HeaderText = "Auto Rev"; + MonsterAutoRev.Name = "MonsterAutoRev"; + MonsterAutoRev.Resizable = DataGridViewTriState.True; + MonsterAutoRev.SortMode = DataGridViewColumnSortMode.Automatic; // // MonsterUndead // - this.MonsterUndead.DataPropertyName = "MonsterUndead"; - this.MonsterUndead.HeaderText = "Undead"; - this.MonsterUndead.Name = "MonsterUndead"; - this.MonsterUndead.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.MonsterUndead.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + MonsterUndead.DataPropertyName = "MonsterUndead"; + MonsterUndead.HeaderText = "Undead"; + MonsterUndead.Name = "MonsterUndead"; + MonsterUndead.Resizable = DataGridViewTriState.True; + MonsterUndead.SortMode = DataGridViewColumnSortMode.Automatic; // // MonsterCanTame // - this.MonsterCanTame.DataPropertyName = "MonsterCanTame"; - this.MonsterCanTame.HeaderText = "Can Tame"; - this.MonsterCanTame.Name = "MonsterCanTame"; - this.MonsterCanTame.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.MonsterCanTame.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + MonsterCanTame.DataPropertyName = "MonsterCanTame"; + MonsterCanTame.HeaderText = "Can Tame"; + MonsterCanTame.Name = "MonsterCanTame"; + MonsterCanTame.Resizable = DataGridViewTriState.True; + MonsterCanTame.SortMode = DataGridViewColumnSortMode.Automatic; // // MonsterDropPath // - this.MonsterDropPath.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.MonsterDropPath.DataPropertyName = "MonsterDropPath"; - this.MonsterDropPath.HeaderText = "Drop Path"; - this.MonsterDropPath.Name = "MonsterDropPath"; - this.MonsterDropPath.Width = 80; + MonsterDropPath.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; + MonsterDropPath.DataPropertyName = "MonsterDropPath"; + MonsterDropPath.HeaderText = "Drop Path"; + MonsterDropPath.Name = "MonsterDropPath"; + MonsterDropPath.Width = 85; + // + // panel1 + // + panel1.Controls.Add(panel3); + panel1.Dock = DockStyle.Top; + panel1.Location = new Point(0, 0); + panel1.Margin = new Padding(4, 3, 4, 3); + panel1.Name = "panel1"; + panel1.Size = new Size(1115, 54); + panel1.TabIndex = 1; + // + // panel3 + // + panel3.Controls.Add(btnExport); + panel3.Controls.Add(btnImport); + panel3.Controls.Add(groupView); + panel3.Controls.Add(txtSearch); + panel3.Dock = DockStyle.Fill; + panel3.Location = new Point(0, 0); + panel3.Margin = new Padding(4, 3, 4, 3); + panel3.Name = "panel3"; + panel3.Size = new Size(1115, 54); + panel3.TabIndex = 5; + // + // btnExport + // + btnExport.Location = new Point(808, 25); + btnExport.Margin = new Padding(4, 3, 4, 3); + btnExport.Name = "btnExport"; + btnExport.Size = new Size(88, 27); + btnExport.TabIndex = 6; + btnExport.Text = "Export"; + btnExport.UseVisualStyleBackColor = true; + btnExport.Click += btnExport_Click; + // + // btnImport + // + btnImport.Location = new Point(713, 25); + btnImport.Margin = new Padding(4, 3, 4, 3); + btnImport.Name = "btnImport"; + btnImport.Size = new Size(88, 27); + btnImport.TabIndex = 5; + btnImport.Text = "Import"; + btnImport.UseVisualStyleBackColor = true; + btnImport.Click += btnImport_Click; + // + // groupView + // + groupView.Controls.Add(rbtnViewAll); + groupView.Controls.Add(rbtnViewBasic); + groupView.Enabled = false; + groupView.Location = new Point(4, 3); + groupView.Margin = new Padding(4, 3, 4, 3); + groupView.Name = "groupView"; + groupView.Padding = new Padding(4, 3, 4, 3); + groupView.Size = new Size(156, 48); + groupView.TabIndex = 4; + groupView.TabStop = false; + groupView.Text = "View Mode"; + // + // rbtnViewAll + // + rbtnViewAll.AutoSize = true; + rbtnViewAll.Checked = true; + rbtnViewAll.Location = new Point(31, 22); + rbtnViewAll.Margin = new Padding(4, 3, 4, 3); + rbtnViewAll.Name = "rbtnViewAll"; + rbtnViewAll.Size = new Size(39, 19); + rbtnViewAll.TabIndex = 0; + rbtnViewAll.TabStop = true; + rbtnViewAll.Text = "All"; + rbtnViewAll.UseVisualStyleBackColor = true; + rbtnViewAll.CheckedChanged += rbtnViewAll_CheckedChanged; + // + // rbtnViewBasic + // + rbtnViewBasic.AutoSize = true; + rbtnViewBasic.Location = new Point(80, 22); + rbtnViewBasic.Margin = new Padding(4, 3, 4, 3); + rbtnViewBasic.Name = "rbtnViewBasic"; + rbtnViewBasic.Size = new Size(52, 19); + rbtnViewBasic.TabIndex = 1; + rbtnViewBasic.Text = "Basic"; + rbtnViewBasic.UseVisualStyleBackColor = true; + rbtnViewBasic.CheckedChanged += rbtnViewBasic_CheckedChanged; + // + // txtSearch + // + txtSearch.Location = new Point(541, 27); + txtSearch.Margin = new Padding(4, 3, 4, 3); + txtSearch.Name = "txtSearch"; + txtSearch.PlaceholderText = "Search..."; + txtSearch.Size = new Size(164, 23); + txtSearch.TabIndex = 0; + txtSearch.KeyDown += txtSearch_KeyDown; + // + // panel2 + // + panel2.Controls.Add(monsterInfoGridView); + panel2.Dock = DockStyle.Fill; + panel2.Location = new Point(0, 54); + panel2.Margin = new Padding(4, 3, 4, 3); + panel2.Name = "panel2"; + panel2.Size = new Size(1115, 500); + panel2.TabIndex = 2; // // MonsterInfoFormNew // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(956, 480); - this.Controls.Add(this.panel2); - this.Controls.Add(this.panel1); - this.Name = "MonsterInfoFormNew"; - this.Text = "MonsterInfoFormNew"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.monsterInfoFormNew_FormClosed); - ((System.ComponentModel.ISupportInitialize)(this.monsterInfoGridView)).EndInit(); - this.panel1.ResumeLayout(false); - this.panel3.ResumeLayout(false); - this.panel3.PerformLayout(); - this.groupView.ResumeLayout(false); - this.groupView.PerformLayout(); - this.panel2.ResumeLayout(false); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1115, 554); + Controls.Add(panel2); + Controls.Add(panel1); + Margin = new Padding(4, 3, 4, 3); + Name = "MonsterInfoFormNew"; + Text = "MonsterInfoFormNew"; + FormClosed += monsterInfoFormNew_FormClosed; + ((System.ComponentModel.ISupportInitialize)monsterInfoGridView).EndInit(); + panel1.ResumeLayout(false); + panel3.ResumeLayout(false); + panel3.PerformLayout(); + groupView.ResumeLayout(false); + groupView.PerformLayout(); + panel2.ResumeLayout(false); + ResumeLayout(false); } #endregion @@ -374,7 +357,6 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton rbtnViewAll; private System.Windows.Forms.RadioButton rbtnViewBasic; private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Label lblSearch; private System.Windows.Forms.TextBox txtSearch; private System.Windows.Forms.Button btnExport; private System.Windows.Forms.Button btnImport; diff --git a/Server.MirForms/Database/MonsterInfoFormNew.resx b/Server.MirForms/Database/MonsterInfoFormNew.resx index 3336cdfb6..fb75b6983 100644 --- a/Server.MirForms/Database/MonsterInfoFormNew.resx +++ b/Server.MirForms/Database/MonsterInfoFormNew.resx @@ -1,17 +1,17 @@  - diff --git a/Server.MirForms/Database/NPCInfoForm.Designer.cs b/Server.MirForms/Database/NPCInfoForm.Designer.cs index 13b9849e6..07daa7fe7 100644 --- a/Server.MirForms/Database/NPCInfoForm.Designer.cs +++ b/Server.MirForms/Database/NPCInfoForm.Designer.cs @@ -735,11 +735,10 @@ private void InitializeComponent() // NPCSearchBox.Location = new Point(14, 49); NPCSearchBox.Name = "NPCSearchBox"; + NPCSearchBox.PlaceholderText = "Search..."; NPCSearchBox.Size = new Size(276, 23); NPCSearchBox.TabIndex = 26; NPCSearchBox.TextChanged += NPCSearchBox_TextChanged; - NPCSearchBox.Enter += NPCSearchBox_Enter; - NPCSearchBox.Leave += NPCSearchBox_Leave; // // NPCInfoForm // diff --git a/Server.MirForms/Database/NPCInfoForm.cs b/Server.MirForms/Database/NPCInfoForm.cs index 97f54a80a..1f21b3231 100644 --- a/Server.MirForms/Database/NPCInfoForm.cs +++ b/Server.MirForms/Database/NPCInfoForm.cs @@ -12,7 +12,6 @@ public partial class NPCInfoForm : Form public Envir Envir => SMain.EditEnvir; private List _selectedNPCInfos; - private bool isNPCSearchPlaceholderActive = true; public NPCInfoForm() { @@ -31,10 +30,6 @@ public NPCInfoForm() } } - NPCSearchBox.Text = "Search"; - NPCSearchBox.ForeColor = Color.Gray; // Placeholder text color - isNPCSearchPlaceholderActive = true; - NPCSearchBox_TextChanged(this, EventArgs.Empty); UpdateInterface(); @@ -637,42 +632,27 @@ private void ConquestVisible_checkbox_CheckedChanged(object sender, EventArgs e) #region NPC Search private void NPCSearchBox_TextChanged(object sender, EventArgs e) { - if (isNPCSearchPlaceholderActive || string.IsNullOrWhiteSpace(NPCSearchBox.Text)) + string searchText = NPCSearchBox.Text.Trim().ToLower(); + + // Show all items if the search box is empty or contains only whitespace + if (string.IsNullOrWhiteSpace(searchText)) { - RefreshNPCList(); // Show all items if placeholder or empty + RefreshNPCList(); return; } - string searchText = NPCSearchBox.Text.ToLower(); NPCInfoListBox.Items.Clear(); + + // Filter NPCs based on search text foreach (var npc in Envir.NPCInfoList) { - if (npc.Name.ToLower().Contains(searchText) || npc.FileName.ToLower().Contains(searchText)) + if (!string.IsNullOrEmpty(npc.Name) && npc.Name.ToLower().Contains(searchText) || + !string.IsNullOrEmpty(npc.FileName) && npc.FileName.ToLower().Contains(searchText)) { NPCInfoListBox.Items.Add(npc); } } } - - private void NPCSearchBox_Enter(object sender, EventArgs e) - { - if (isNPCSearchPlaceholderActive) - { - NPCSearchBox.Text = string.Empty; - NPCSearchBox.ForeColor = Color.Black; // Reset to normal text color - isNPCSearchPlaceholderActive = false; - } - } - - private void NPCSearchBox_Leave(object sender, EventArgs e) - { - if (string.IsNullOrWhiteSpace(NPCSearchBox.Text)) - { - NPCSearchBox.Text = "Search"; - NPCSearchBox.ForeColor = Color.Gray; // Placeholder text color - isNPCSearchPlaceholderActive = true; - } - } #endregion } } diff --git a/Server.MirForms/Database/QuestInfoForm.Designer.cs b/Server.MirForms/Database/QuestInfoForm.Designer.cs index cdbd3e1de..c6a4d7a0d 100644 --- a/Server.MirForms/Database/QuestInfoForm.Designer.cs +++ b/Server.MirForms/Database/QuestInfoForm.Designer.cs @@ -516,11 +516,10 @@ private void InitializeComponent() // QuestSearchBox.Location = new Point(12, 43); QuestSearchBox.Name = "QuestSearchBox"; + QuestSearchBox.PlaceholderText = "Search..."; QuestSearchBox.Size = new Size(182, 23); QuestSearchBox.TabIndex = 26; QuestSearchBox.TextChanged += QuestSearchBox_TextChanged; - QuestSearchBox.Enter += QuestSearchBox_Enter; - QuestSearchBox.Leave += QuestSearchBox_Leave; // // QuestInfoForm // diff --git a/Server.MirForms/Database/QuestInfoForm.cs b/Server.MirForms/Database/QuestInfoForm.cs index 3bb638965..41b6912df 100644 --- a/Server.MirForms/Database/QuestInfoForm.cs +++ b/Server.MirForms/Database/QuestInfoForm.cs @@ -11,7 +11,6 @@ public partial class QuestInfoForm : Form public Envir Envir => SMain.EditEnvir; private List _selectedQuestInfos; - private bool isQuestSearchPlaceholderActive = true; public QuestInfoForm() { @@ -22,10 +21,6 @@ public QuestInfoForm() QuestSearchBox_TextChanged(this, EventArgs.Empty); - QuestSearchBox.Text = "Search"; - QuestSearchBox.ForeColor = Color.Gray; // Placeholder text color - isQuestSearchPlaceholderActive = true; - UpdateInterface(); } @@ -387,42 +382,27 @@ private void TimeLimitTextBox_TextChanged(object sender, EventArgs e) #region Quest Search private void QuestSearchBox_TextChanged(object sender, EventArgs e) { - if (isQuestSearchPlaceholderActive || string.IsNullOrWhiteSpace(QuestSearchBox.Text)) + string searchText = QuestSearchBox.Text.Trim().ToLower(); + + // Show all items if the search box is empty or contains only whitespace + if (string.IsNullOrWhiteSpace(searchText)) { - RefreshQuestList(); // Show all items if placeholder or empty + RefreshQuestList(); return; } - string searchText = QuestSearchBox.Text.ToLower(); QuestInfoListBox.Items.Clear(); + + // Filter quests based on search text foreach (var quest in Envir.QuestInfoList) { - if (quest.Name.ToLower().Contains(searchText) || quest.FileName.ToLower().Contains(searchText)) + if (!string.IsNullOrEmpty(quest.Name) && quest.Name.ToLower().Contains(searchText) || + !string.IsNullOrEmpty(quest.FileName) && quest.FileName.ToLower().Contains(searchText)) { QuestInfoListBox.Items.Add(quest); } } } - - private void QuestSearchBox_Enter(object sender, EventArgs e) - { - if (isQuestSearchPlaceholderActive) - { - QuestSearchBox.Text = string.Empty; - QuestSearchBox.ForeColor = Color.Black; // Reset to normal text color - isQuestSearchPlaceholderActive = false; - } - } - - private void QuestSearchBox_Leave(object sender, EventArgs e) - { - if (string.IsNullOrWhiteSpace(QuestSearchBox.Text)) - { - QuestSearchBox.Text = "Search"; - QuestSearchBox.ForeColor = Color.Gray; // Placeholder text color - isQuestSearchPlaceholderActive = true; - } - } #endregion } } diff --git a/Server.MirForms/Database/RecipeInfoForm.Designer.cs b/Server.MirForms/Database/RecipeInfoForm.Designer.cs index 17cc4360d..b7c13e19f 100644 --- a/Server.MirForms/Database/RecipeInfoForm.Designer.cs +++ b/Server.MirForms/Database/RecipeInfoForm.Designer.cs @@ -473,11 +473,10 @@ private void InitializeComponent() // RecipeSearchBox.Location = new Point(12, 12); RecipeSearchBox.Name = "RecipeSearchBox"; + RecipeSearchBox.PlaceholderText = "Search..."; RecipeSearchBox.Size = new Size(135, 23); RecipeSearchBox.TabIndex = 13; RecipeSearchBox.TextChanged += RecipeSearchBox_TextChanged; - RecipeSearchBox.Enter += RecipeSearchBox_Enter; - RecipeSearchBox.Leave += RecipeSearchBox_Leave; // // RecipeInfoForm // diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index 555c87ef4..d02e9f9fd 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -8,17 +8,12 @@ public partial class RecipeInfoForm : Form { private string currentFilePath; private bool isModified = false; - private bool isRecipeSearchPlaceholderActive = true; public RecipeInfoForm() { InitializeComponent(); this.Load += RecipeInfoForm_Load; SaveButton.Click += SaveButton_Click; - - RecipeSearchBox.Text = "Search"; - RecipeSearchBox.ForeColor = SystemColors.GrayText; - isRecipeSearchPlaceholderActive = true; } #region Form Load @@ -757,53 +752,36 @@ private void ClearForm() #region Search Box private void RecipeSearchBox_TextChanged(object sender, EventArgs e) { - if (isRecipeSearchPlaceholderActive || string.IsNullOrWhiteSpace(RecipeSearchBox.Text)) + string searchText = RecipeSearchBox.Text.Trim().ToLower(); + + // Show all recipes if the search box is empty or contains only whitespace + if (string.IsNullOrWhiteSpace(searchText)) { - // Show all recipes when search box is empty or placeholder is active ReloadRecipeList(string.Empty); return; } - string searchText = RecipeSearchBox.Text.ToLower(); RecipeList.Items.Clear(); - // Add filtered recipes to the list + // Get the directory path for recipe files string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); if (Directory.Exists(directoryPath)) { + // Retrieve and filter recipe files string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); foreach (var file in recipeFiles) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); - if (fileNameWithoutExtension.ToLower().Contains(searchText)) + if (!string.IsNullOrEmpty(fileNameWithoutExtension) && + fileNameWithoutExtension.ToLower().Contains(searchText)) { RecipeList.Items.Add(fileNameWithoutExtension); } } } } - - private void RecipeSearchBox_Enter(object sender, EventArgs e) - { - if (isRecipeSearchPlaceholderActive) - { - isRecipeSearchPlaceholderActive = false; - RecipeSearchBox.Text = string.Empty; - RecipeSearchBox.ForeColor = SystemColors.WindowText; // Set text color to default - } - } - - private void RecipeSearchBox_Leave(object sender, EventArgs e) - { - if (string.IsNullOrWhiteSpace(RecipeSearchBox.Text)) - { - isRecipeSearchPlaceholderActive = true; - RecipeSearchBox.Text = "Search"; - RecipeSearchBox.ForeColor = SystemColors.GrayText; // Set placeholder text color - } - } #endregion } } \ No newline at end of file From 2d9cee1950845d476da761a4d6263719d4863559 Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Sat, 4 Jan 2025 15:24:38 +0000 Subject: [PATCH 3/6] PR Fix #1038 --- Server.MirForms/Database/GameShop.cs | 16 ++------ Server.MirForms/Database/QuestInfoForm.cs | 28 +++++++++++++ .../Database/RecipeInfoForm.Designer.cs | 2 +- Server.MirForms/Database/RecipeInfoForm.cs | 40 +++++++++---------- 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/Server.MirForms/Database/GameShop.cs b/Server.MirForms/Database/GameShop.cs index 653869070..067d4e649 100644 --- a/Server.MirForms/Database/GameShop.cs +++ b/Server.MirForms/Database/GameShop.cs @@ -481,25 +481,17 @@ private void GameShopSearchBox_TextChanged(object sender, EventArgs e) GameShopListBox.Items.Clear(); - // Display all items if the search box is empty - if (string.IsNullOrWhiteSpace(searchText)) - { - foreach (var item in SMain.EditEnvir.GameShopList) - { - GameShopListBox.Items.Add(item); - } - return; - } - - // Filter and add matching items to the list box foreach (var item in SMain.EditEnvir.GameShopList) { - if (!string.IsNullOrEmpty(item.Info?.Name) && item.Info.Name.ToLower().Contains(searchText)) + // Add to list if search text is empty or the item matches the search criteria + if (string.IsNullOrEmpty(searchText) || + (!string.IsNullOrEmpty(item.Info?.Name) && item.Info.Name.ToLower().Contains(searchText))) { GameShopListBox.Items.Add(item); } } } + #endregion } } diff --git a/Server.MirForms/Database/QuestInfoForm.cs b/Server.MirForms/Database/QuestInfoForm.cs index 41b6912df..366a59c46 100644 --- a/Server.MirForms/Database/QuestInfoForm.cs +++ b/Server.MirForms/Database/QuestInfoForm.cs @@ -83,6 +83,34 @@ private void UpdateInterface() RequiredClassComboBox.SelectedItem = info.RequiredClass; TimeLimitTextBox.Text = info.TimeLimitInSeconds.ToString(); + + for (int i = 1; i < _selectedQuestInfos.Count; i++) + { + info = _selectedQuestInfos[i]; + + if (QFileNameTextBox.Text != info.FileName) QFileNameTextBox.Text = string.Empty; + if (QNameTextBox.Text != info.Name) QNameTextBox.Text = string.Empty; + if (QGroupTextBox.Text != info.Group) QGroupTextBox.Text = string.Empty; + + if (QTypeComboBox.SelectedItem != null) + if ((QuestType)QTypeComboBox.SelectedItem != info.Type) QTypeComboBox.SelectedItem = null; + + if (QGotoTextBox.Text != info.GotoMessage) QGotoTextBox.Text = string.Empty; + if (QKillTextBox.Text != info.KillMessage) QKillTextBox.Text = string.Empty; + if (QItemTextBox.Text != info.ItemMessage) QItemTextBox.Text = string.Empty; + if (QFlagTextBox.Text != info.ItemMessage) QFlagTextBox.Text = string.Empty; + + if (RequiredMinLevelTextBox.Text != info.RequiredMinLevel.ToString()) RequiredMinLevelTextBox.Text = string.Empty; + if (RequiredMaxLevelTextBox.Text != info.RequiredMaxLevel.ToString()) RequiredMaxLevelTextBox.Text = byte.MaxValue.ToString(); + + if (RequiredQuestComboBox.SelectedValue != null) + if ((string)RequiredQuestComboBox.SelectedValue != info.RequiredQuest.ToString()) RequiredQuestComboBox.SelectedItem = null; + + if (RequiredClassComboBox.SelectedItem != null) + if ((RequiredClass)RequiredClassComboBox.SelectedItem != info.RequiredClass) RequiredClassComboBox.SelectedItem = null; + + if (TimeLimitTextBox.SelectedText != info.TimeLimitInSeconds.ToString()) TimeLimitTextBox.Text = "0"; + } } // Method to clear the interface diff --git a/Server.MirForms/Database/RecipeInfoForm.Designer.cs b/Server.MirForms/Database/RecipeInfoForm.Designer.cs index b7c13e19f..124a5b7ce 100644 --- a/Server.MirForms/Database/RecipeInfoForm.Designer.cs +++ b/Server.MirForms/Database/RecipeInfoForm.Designer.cs @@ -476,7 +476,7 @@ private void InitializeComponent() RecipeSearchBox.PlaceholderText = "Search..."; RecipeSearchBox.Size = new Size(135, 23); RecipeSearchBox.TabIndex = 13; - RecipeSearchBox.TextChanged += RecipeSearchBox_TextChanged; + RecipeSearchBox.KeyDown += RecipeSearchBox_KeyDown; // // RecipeInfoForm // diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index d02e9f9fd..cab71d0e8 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -750,34 +750,32 @@ private void ClearForm() #endregion #region Search Box - private void RecipeSearchBox_TextChanged(object sender, EventArgs e) + private void RecipeSearchBox_KeyDown(object sender, KeyEventArgs e) { - string searchText = RecipeSearchBox.Text.Trim().ToLower(); - - // Show all recipes if the search box is empty or contains only whitespace - if (string.IsNullOrWhiteSpace(searchText)) + // Trigger search only on Enter key press + if (e.KeyCode == Keys.Enter) { - ReloadRecipeList(string.Empty); - return; - } + string searchText = RecipeSearchBox.Text.Trim().ToLower(); - RecipeList.Items.Clear(); + RecipeList.Items.Clear(); - // Get the directory path for recipe files - string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; - string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); + // Get the directory path for recipe files + string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; + string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); - if (Directory.Exists(directoryPath)) - { - // Retrieve and filter recipe files - string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); - foreach (var file in recipeFiles) + if (Directory.Exists(directoryPath)) { - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); - if (!string.IsNullOrEmpty(fileNameWithoutExtension) && - fileNameWithoutExtension.ToLower().Contains(searchText)) + // Retrieve and filter recipe files + string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); + + foreach (var file in recipeFiles) { - RecipeList.Items.Add(fileNameWithoutExtension); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); + if (string.IsNullOrEmpty(searchText) || + (!string.IsNullOrEmpty(fileNameWithoutExtension) && fileNameWithoutExtension.ToLower().Contains(searchText))) + { + RecipeList.Items.Add(fileNameWithoutExtension); + } } } } From 02dc9164b07459687293fbf4e0c604ab35cf7be0 Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Sun, 26 Jan 2025 16:08:33 +0000 Subject: [PATCH 4/6] Recipe Info Form Loading *Removed the call to ReloadRecipeList(...) in ItemComboBox_SelectedIndexChanged. Reloading the entire list from disk on each selection causes needless UI lag. *Directly renamed the list item in RecipeList after renaming the file on disk. This way, only one entry is updated instead of refreshing the entire list. * Set isModified = true; after changing the item name so that saving logic still works correctly. --- Server.MirForms/Database/RecipeInfoForm.cs | 236 ++++++++++++--------- 1 file changed, 130 insertions(+), 106 deletions(-) diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index cab71d0e8..bd21da95c 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -8,6 +8,7 @@ public partial class RecipeInfoForm : Form { private string currentFilePath; private bool isModified = false; + private bool _ignoreItemSelectionEvent = false; public RecipeInfoForm() { @@ -40,8 +41,6 @@ private void RecipeInfoForm_Load(object sender, EventArgs e) { // Get the filename without the extension string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(recipeFile); - - // Add the file name to the RecipeList RecipeList.Items.Add(fileNameWithoutExtension); } } @@ -136,12 +135,20 @@ private void LoadRecipe(string recipeName) string[] fileLines = File.ReadAllLines(filePath); ParseAndDisplayRecipe(fileLines); - // Set the selected item in the ComboBox - SetItemComboBoxSelection(recipeName); + // Temporarily ignore the combo box event while we select the item + _ignoreItemSelectionEvent = true; + try + { + SetItemComboBoxSelection(recipeName); + } + finally + { + _ignoreItemSelectionEvent = false; + } - // Set isModified to true since the recipe was loaded and the user might modify it + // Set isModified to true since the recipe was loaded and might be changed isModified = true; - currentFilePath = filePath; // Store the current file path for renaming later + currentFilePath = filePath; // Store the current file path for later rename operations } else { @@ -153,12 +160,12 @@ private void LoadRecipe(string recipeName) #region Item Combo Box private void SetItemComboBoxSelection(string recipeName) { - // Find the item name matching the recipe (e.g., (HP)DrugXL) + // Look for an item name matching the recipe foreach (var item in SMain.EditEnvir.ItemInfoList) { if (item.Name.Equals(recipeName, StringComparison.OrdinalIgnoreCase)) { - // Set the ComboBox selection to the item name + // Programmatically set the ComboBox ItemComboBox.SelectedItem = item.Name; break; } @@ -169,7 +176,7 @@ private void SetItemComboBoxSelection(string recipeName) #region Parse Recipe private void ParseAndDisplayRecipe(string[] fileLines) { - // Initialize default values + // Initialise default values string amount = ""; string chance = ""; string gold = ""; @@ -248,13 +255,13 @@ private void ParseAndDisplayRecipe(string[] fileLines) if (ingredientParts.Length >= 1) { - ingredientNames[ingredientIndex] = ingredientParts[0].Trim(); // Ingredient name + ingredientNames[ingredientIndex] = ingredientParts[0].Trim(); if (ingredientParts.Length >= 2) - ingredientAmounts[ingredientIndex] = ingredientParts[1].Trim(); // Ingredient amount + ingredientAmounts[ingredientIndex] = ingredientParts[1].Trim(); if (ingredientParts.Length == 3) - ingredientDurabilities[ingredientIndex] = ingredientParts[2].Trim(); // Ingredient durability + ingredientDurabilities[ingredientIndex] = ingredientParts[2].Trim(); ingredientIndex++; } @@ -396,15 +403,69 @@ private void LoadItemsIntoComboBox() #region Save Recipe private void SaveRecipe() { + if (string.IsNullOrEmpty(currentFilePath)) return; + + try + { + using (StreamWriter writer = new StreamWriter(currentFilePath)) + { + // Write [Recipe] section + writer.WriteLine("[Recipe]"); + writer.WriteLine($"Amount {CraftAmountTextBox.Text}"); + writer.WriteLine($"Chance {ChanceTextBox.Text}"); + writer.WriteLine($"Gold {GoldTextBox.Text}"); + + writer.WriteLine(); + writer.WriteLine("[Tools]"); + + // Write tools, skipping None + if (Tool1ComboBox.SelectedItem.ToString() != "None") + writer.WriteLine(Tool1ComboBox.SelectedItem.ToString()); + if (Tool2ComboBox.SelectedItem.ToString() != "None") + writer.WriteLine(Tool2ComboBox.SelectedItem.ToString()); + if (Tool3ComboBox.SelectedItem.ToString() != "None") + writer.WriteLine(Tool3ComboBox.SelectedItem.ToString()); + + writer.WriteLine(); + writer.WriteLine("[Ingredients]"); + + // Write ingredients, skipping None + WriteIngredient(writer, IngredientName1ComboBox, IngredientAmount1TextBox, IngredientDura1TextBox); + WriteIngredient(writer, IngredientName2ComboBox, IngredientAmount2TextBox, IngredientDura2TextBox); + WriteIngredient(writer, IngredientName3ComboBox, IngredientAmount3TextBox, IngredientDura3TextBox); + WriteIngredient(writer, IngredientName4ComboBox, IngredientAmount4TextBox, IngredientDura4TextBox); + WriteIngredient(writer, IngredientName5ComboBox, IngredientAmount5TextBox, IngredientDura5TextBox); + WriteIngredient(writer, IngredientName6ComboBox, IngredientAmount6TextBox, IngredientDura6TextBox); + } + + MessageBox.Show("Recipe saved successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + isModified = false; + } + catch (Exception ex) + { + MessageBox.Show($"Error saving recipe: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void WriteIngredient(StreamWriter writer, ComboBox nameComboBox, TextBox amountTextBox, TextBox duraTextBox) + { + if (nameComboBox.SelectedItem.ToString() == "None") return; // Skip if None is selected + string name = nameComboBox.SelectedItem.ToString(); + string amount = string.IsNullOrWhiteSpace(amountTextBox.Text) ? "" : amountTextBox.Text; + string dura = string.IsNullOrWhiteSpace(duraTextBox.Text) ? "" : duraTextBox.Text; + + // Write ingredient line with optional amount and durability + writer.WriteLine($"{name} {amount} {dura}".Trim()); } #endregion #region Form Close private void RecipeInfoForm_FormClosing(object sender, FormClosingEventArgs e) { + // Prompt to save only if isModified is true if (isModified) { + // You could prompt before auto-saving, but here we'll just save SaveRecipe(); } } @@ -505,67 +566,73 @@ private void NewRecipeButton_Click(object sender, EventArgs e) #region Item Combo Box Index Change Event private void ItemComboBox_SelectedIndexChanged(object sender, EventArgs e) { - // Get the selected item name - var selectedItemName = ItemComboBox.SelectedItem?.ToString(); + // If we're currently ignoring this event (because we're loading), do nothing + if (_ignoreItemSelectionEvent) return; - if (!string.IsNullOrEmpty(selectedItemName)) - { - // Update the recipe filename based on the selected item name - UpdateRecipeFileName(selectedItemName); + // If there's no file loaded, do nothing + if (string.IsNullOrEmpty(currentFilePath)) return; - // After changing the item name, reload the RecipeList with the updated item name - ReloadRecipeList(selectedItemName); - } - } - #endregion + string selectedItemName = ItemComboBox.SelectedItem?.ToString(); + if (string.IsNullOrEmpty(selectedItemName)) return; - #region Reload Recipe List Box - private void ReloadRecipeList(string newItemName) - { - string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; - string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); + // Compare old vs new + string oldRecipeName = Path.GetFileNameWithoutExtension(currentFilePath); + string oldTrimmed = oldRecipeName.Trim(); + string newTrimmed = selectedItemName.Trim(); - // Reload the recipe files into the list after renaming - string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); + // If the name is effectively the same, skip + if (oldTrimmed.Equals(newTrimmed, StringComparison.OrdinalIgnoreCase)) + { + return; + } - RecipeList.Items.Clear(); - foreach (string recipeFile in recipeFiles) + // Otherwise rename + UpdateRecipeFileName(selectedItemName); + + // Update the list item if something was actually renamed + if (RecipeList.SelectedIndex >= 0) { - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(recipeFile); - RecipeList.Items.Add(fileNameWithoutExtension); + RecipeList.Items[RecipeList.SelectedIndex] = selectedItemName; } - // Optionally, select the updated item in the RecipeList - RecipeList.SelectedItem = newItemName; + isModified = true; } #endregion #region Update Recipe File Name private void UpdateRecipeFileName(string newItemName) { - // Get the current recipe file path - string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; - string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); - - // Construct the new file path based on the selected item name + string directoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Envir", "Recipe"); string newFilePath = Path.Combine(directoryPath, newItemName + ".txt"); - // Log the paths for debugging - Console.WriteLine($"Current File Path: {currentFilePath}"); - Console.WriteLine($"New File Path: {newFilePath}"); + // If both paths match (ignoring case), skip the rename + if (currentFilePath.Equals(newFilePath, StringComparison.OrdinalIgnoreCase)) + return; + + // If a different file with that new name already exists, warn and skip + if (File.Exists(newFilePath)) + { + MessageBox.Show( + $"A recipe named '{newItemName}' already exists. Cannot rename.", + "Rename Error", + MessageBoxButtons.OK, + MessageBoxIcon.Warning + ); + return; + } - // Check if the current recipe file exists and rename it + // Rename the existing file if (File.Exists(currentFilePath)) { try { - // Rename the recipe file File.Move(currentFilePath, newFilePath); - currentFilePath = newFilePath; // Update the current file path to reflect the new name + currentFilePath = newFilePath; } catch (Exception ex) { - + MessageBox.Show($"Error renaming recipe file: {ex.Message}", + "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } @@ -592,21 +659,21 @@ private void OpenRecipeButton_Click(object sender, EventArgs e) { try { - // Use Process.Start with the file path and ensure spaces are handled by enclosing in quotes + // Use Process.Start with the file path System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo { FileName = filePath, - UseShellExecute = true // Use the default system shell to open the file + UseShellExecute = true // Use the default system shell to open }); } catch (Exception ex) { - + MessageBox.Show($"Error opening file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { - + MessageBox.Show("The selected recipe file does not exist.", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } #endregion @@ -614,56 +681,7 @@ private void OpenRecipeButton_Click(object sender, EventArgs e) #region Save Button private void SaveButton_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(currentFilePath)) return; - - try - { - using (StreamWriter writer = new StreamWriter(currentFilePath)) - { - // Write [Recipe] section - writer.WriteLine("[Recipe]"); - writer.WriteLine($"Amount {CraftAmountTextBox.Text}"); - writer.WriteLine($"Chance {ChanceTextBox.Text}"); - writer.WriteLine($"Gold {GoldTextBox.Text}"); - - writer.WriteLine(); - writer.WriteLine("[Tools]"); - - // Write tools, skipping None - if (Tool1ComboBox.SelectedItem.ToString() != "None") writer.WriteLine(Tool1ComboBox.SelectedItem.ToString()); - if (Tool2ComboBox.SelectedItem.ToString() != "None") writer.WriteLine(Tool2ComboBox.SelectedItem.ToString()); - if (Tool3ComboBox.SelectedItem.ToString() != "None") writer.WriteLine(Tool3ComboBox.SelectedItem.ToString()); - - writer.WriteLine(); - writer.WriteLine("[Ingredients]"); - - // Write ingredients, skipping None - WriteIngredient(writer, IngredientName1ComboBox, IngredientAmount1TextBox, IngredientDura1TextBox); - WriteIngredient(writer, IngredientName2ComboBox, IngredientAmount2TextBox, IngredientDura2TextBox); - WriteIngredient(writer, IngredientName3ComboBox, IngredientAmount3TextBox, IngredientDura3TextBox); - WriteIngredient(writer, IngredientName4ComboBox, IngredientAmount4TextBox, IngredientDura4TextBox); - WriteIngredient(writer, IngredientName5ComboBox, IngredientAmount5TextBox, IngredientDura5TextBox); - WriteIngredient(writer, IngredientName6ComboBox, IngredientAmount6TextBox, IngredientDura6TextBox); - } - - MessageBox.Show("Recipe saved successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - catch (Exception ex) - { - MessageBox.Show($"Error saving recipe: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void WriteIngredient(StreamWriter writer, ComboBox nameComboBox, TextBox amountTextBox, TextBox duraTextBox) - { - if (nameComboBox.SelectedItem.ToString() == "None") return; // Skip if None is selected - - string name = nameComboBox.SelectedItem.ToString(); - string amount = string.IsNullOrWhiteSpace(amountTextBox.Text) ? "" : amountTextBox.Text; - string dura = string.IsNullOrWhiteSpace(duraTextBox.Text) ? "" : duraTextBox.Text; - - // Write ingredient line with optional amount and durability - writer.WriteLine($"{name} {amount} {dura}".Trim()); + SaveRecipe(); } #endregion @@ -684,7 +702,12 @@ private void DeleteButton_Click(object sender, EventArgs e) string filePath = Path.Combine(directoryPath, $"{selectedRecipeName}.txt"); // Confirm deletion - var result = MessageBox.Show($"Are you sure you want to delete the recipe: {selectedRecipeName}?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + var result = MessageBox.Show( + $"Are you sure you want to delete the recipe: {selectedRecipeName}?", + "Confirm Deletion", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question + ); if (result != DialogResult.Yes) return; // Delete the file @@ -723,8 +746,8 @@ private void ClearForm() GoldTextBox.Text = string.Empty; Tool1ComboBox.SelectedIndex = 0; // Reset to "None" - Tool2ComboBox.SelectedIndex = 0; // Reset to "None" - Tool3ComboBox.SelectedIndex = 0; // Reset to "None" + Tool2ComboBox.SelectedIndex = 0; + Tool3ComboBox.SelectedIndex = 0; IngredientName1ComboBox.SelectedIndex = 0; // Reset to "None" IngredientName2ComboBox.SelectedIndex = 0; @@ -772,7 +795,8 @@ private void RecipeSearchBox_KeyDown(object sender, KeyEventArgs e) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); if (string.IsNullOrEmpty(searchText) || - (!string.IsNullOrEmpty(fileNameWithoutExtension) && fileNameWithoutExtension.ToLower().Contains(searchText))) + (!string.IsNullOrEmpty(fileNameWithoutExtension) && + fileNameWithoutExtension.ToLower().Contains(searchText))) { RecipeList.Items.Add(fileNameWithoutExtension); } From 8918f4508195cc9fc6f6da0f18bf1428539ed8b1 Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:17:23 +0000 Subject: [PATCH 5/6] Removed Recipe Search for now --- .../Database/RecipeInfoForm.Designer.cs | 2 +- Server.MirForms/Database/RecipeInfoForm.cs | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Server.MirForms/Database/RecipeInfoForm.Designer.cs b/Server.MirForms/Database/RecipeInfoForm.Designer.cs index 124a5b7ce..2abfde976 100644 --- a/Server.MirForms/Database/RecipeInfoForm.Designer.cs +++ b/Server.MirForms/Database/RecipeInfoForm.Designer.cs @@ -473,7 +473,7 @@ private void InitializeComponent() // RecipeSearchBox.Location = new Point(12, 12); RecipeSearchBox.Name = "RecipeSearchBox"; - RecipeSearchBox.PlaceholderText = "Search..."; + RecipeSearchBox.PlaceholderText = "In Progress..."; RecipeSearchBox.Size = new Size(135, 23); RecipeSearchBox.TabIndex = 13; RecipeSearchBox.KeyDown += RecipeSearchBox_KeyDown; diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index bd21da95c..10998d794 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -776,33 +776,33 @@ private void ClearForm() private void RecipeSearchBox_KeyDown(object sender, KeyEventArgs e) { // Trigger search only on Enter key press - if (e.KeyCode == Keys.Enter) - { - string searchText = RecipeSearchBox.Text.Trim().ToLower(); + // if (e.KeyCode == Keys.Enter) + // { + // string searchText = RecipeSearchBox.Text.Trim().ToLower(); - RecipeList.Items.Clear(); + // RecipeList.Items.Clear(); // Get the directory path for recipe files - string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; - string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); + // string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; + // string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); - if (Directory.Exists(directoryPath)) - { + // if (Directory.Exists(directoryPath)) + // { // Retrieve and filter recipe files - string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); - - foreach (var file in recipeFiles) - { - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); - if (string.IsNullOrEmpty(searchText) || - (!string.IsNullOrEmpty(fileNameWithoutExtension) && - fileNameWithoutExtension.ToLower().Contains(searchText))) - { - RecipeList.Items.Add(fileNameWithoutExtension); - } - } - } - } + // string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); + + // foreach (var file in recipeFiles) + // { + // string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); + // if (string.IsNullOrEmpty(searchText) || + // (!string.IsNullOrEmpty(fileNameWithoutExtension) && + // fileNameWithoutExtension.ToLower().Contains(searchText))) + // { + // RecipeList.Items.Add(fileNameWithoutExtension); + // } + // } + // } + // } } #endregion } From 8d39e7901441f49e160e904f191ebd8e84b295df Mon Sep 17 00:00:00 2001 From: Jev <68875342+JevLOMCN@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:48:50 +0000 Subject: [PATCH 6/6] Removed Recipe Search fully until reimplemented --- .../Database/RecipeInfoForm.Designer.cs | 17 ++------- Server.MirForms/Database/RecipeInfoForm.cs | 35 +------------------ 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/Server.MirForms/Database/RecipeInfoForm.Designer.cs b/Server.MirForms/Database/RecipeInfoForm.Designer.cs index 2abfde976..abe2a1ead 100644 --- a/Server.MirForms/Database/RecipeInfoForm.Designer.cs +++ b/Server.MirForms/Database/RecipeInfoForm.Designer.cs @@ -71,7 +71,6 @@ private void InitializeComponent() groupBox1 = new GroupBox(); RecipeCountLabel = new Label(); DeleteButton = new Button(); - RecipeSearchBox = new TextBox(); RecipeGroupBox.SuspendLayout(); ToolsGroupBox.SuspendLayout(); IngredientsGroupBox.SuspendLayout(); @@ -82,9 +81,9 @@ private void InitializeComponent() // RecipeList.FormattingEnabled = true; RecipeList.ItemHeight = 15; - RecipeList.Location = new Point(12, 42); + RecipeList.Location = new Point(12, 12); RecipeList.Name = "RecipeList"; - RecipeList.Size = new Size(135, 289); + RecipeList.Size = new Size(135, 319); RecipeList.TabIndex = 0; RecipeList.SelectedIndexChanged += RecipeList_SelectedIndexChanged; // @@ -469,21 +468,11 @@ private void InitializeComponent() DeleteButton.UseVisualStyleBackColor = true; DeleteButton.Click += DeleteButton_Click; // - // RecipeSearchBox - // - RecipeSearchBox.Location = new Point(12, 12); - RecipeSearchBox.Name = "RecipeSearchBox"; - RecipeSearchBox.PlaceholderText = "In Progress..."; - RecipeSearchBox.Size = new Size(135, 23); - RecipeSearchBox.TabIndex = 13; - RecipeSearchBox.KeyDown += RecipeSearchBox_KeyDown; - // // RecipeInfoForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(432, 517); - Controls.Add(RecipeSearchBox); Controls.Add(groupBox1); Controls.Add(IngredientsGroupBox); Controls.Add(ToolsGroupBox); @@ -502,7 +491,6 @@ private void InitializeComponent() groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); ResumeLayout(false); - PerformLayout(); } #endregion @@ -550,6 +538,5 @@ private void InitializeComponent() private GroupBox groupBox1; private Button DeleteButton; private Label RecipeCountLabel; - private TextBox RecipeSearchBox; } } \ No newline at end of file diff --git a/Server.MirForms/Database/RecipeInfoForm.cs b/Server.MirForms/Database/RecipeInfoForm.cs index 10998d794..710a1ebed 100644 --- a/Server.MirForms/Database/RecipeInfoForm.cs +++ b/Server.MirForms/Database/RecipeInfoForm.cs @@ -770,40 +770,7 @@ private void ClearForm() IngredientDura5TextBox.Text = string.Empty; IngredientDura6TextBox.Text = string.Empty; } - #endregion - #region Search Box - private void RecipeSearchBox_KeyDown(object sender, KeyEventArgs e) - { - // Trigger search only on Enter key press - // if (e.KeyCode == Keys.Enter) - // { - // string searchText = RecipeSearchBox.Text.Trim().ToLower(); - - // RecipeList.Items.Clear(); - - // Get the directory path for recipe files - // string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; - // string directoryPath = Path.Combine(currentDirectory, "Envir", "Recipe"); - - // if (Directory.Exists(directoryPath)) - // { - // Retrieve and filter recipe files - // string[] recipeFiles = Directory.GetFiles(directoryPath, "*.txt"); - - // foreach (var file in recipeFiles) - // { - // string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); - // if (string.IsNullOrEmpty(searchText) || - // (!string.IsNullOrEmpty(fileNameWithoutExtension) && - // fileNameWithoutExtension.ToLower().Contains(searchText))) - // { - // RecipeList.Items.Add(fileNameWithoutExtension); - // } - // } - // } - // } - } - #endregion +#endregion } } \ No newline at end of file