namespace ns0
{
    using ns1;
    using ns2;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    internal class frmAddMob : Form
    {
        private Button btnSearch;
        private Button button1;
        private frmMain frmMain_0;
        private IContainer icontainer_0 = null;
        private Label label1;
        private Label label2;
        private Label label3;
        private ComboBox lstIsKill;
        private ListBox lstMobs;
        private TextBox txtAmount;
        private TextBox txtMobID;
        private TextBox txtSearch;

        public frmAddMob(frmMain main)
        {
            this.frmMain_0 = main;
            this.InitializeComponent();
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.method_0(this.txtSearch.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ushort num = 0;
            ushort num2 = 0;
            bool flag = true;
            try
            {
                num = Convert.ToUInt16(this.txtMobID.Text);
                num2 = Convert.ToUInt16(this.txtAmount.Text);
                flag = Convert.ToBoolean(this.lstIsKill.SelectedIndex);
            }
            catch
            {
                MessageBox.Show("Please enter valid numbers!");
                return;
            }
            if (!(flag || (num2 <= 0)))
            {
                MessageBox.Show("NPCs need amount 0!");
                this.txtAmount.Text = "0";
            }
            else
            {
                Class4 item = new Class4 {
                    Amount = (byte) num2,
                    HasToBeKilled = flag,
                    ID = num,
                    isMob = false
                };
                this.frmMain_0.class3_0.list_0.Add(item);
                this.frmMain_0.method_8(this.frmMain_0.class3_0);
                base.Close();
            }
        }

        private void frmAddMob_Load(object sender, EventArgs e)
        {
            this.lstIsKill.Items.Clear();
            this.lstIsKill.Items.Add("False");
            this.lstIsKill.Items.Add("True");
            this.lstIsKill.SelectedIndex = 0;
            this.method_0("");
        }

        private void InitializeComponent()
        {
            this.lstMobs = new ListBox();
            this.txtSearch = new TextBox();
            this.btnSearch = new Button();
            this.label1 = new Label();
            this.txtMobID = new TextBox();
            this.label2 = new Label();
            this.lstIsKill = new ComboBox();
            this.txtAmount = new TextBox();
            this.label3 = new Label();
            this.button1 = new Button();
            base.SuspendLayout();
            this.lstMobs.FormattingEnabled = true;
            this.lstMobs.Location = new Point(7, 0x1f);
            this.lstMobs.Name = "lstMobs";
            this.lstMobs.Size = new Size(0xc1, 0x197);
            this.lstMobs.TabIndex = 0;
            this.lstMobs.MouseDoubleClick += new MouseEventHandler(this.lstMobs_MouseDoubleClick);
            this.lstMobs.SelectedIndexChanged += new EventHandler(this.lstMobs_SelectedIndexChanged);
            this.txtSearch.Location = new Point(7, 5);
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Size = new Size(100, 20);
            this.txtSearch.TabIndex = 1;
            this.btnSearch.Location = new Point(0x71, 3);
            this.btnSearch.Name = "btnSearch";
            this.btnSearch.Size = new Size(0x57, 0x16);
            this.btnSearch.TabIndex = 2;
            this.btnSearch.Text = "Search";
            this.btnSearch.UseVisualStyleBackColor = true;
            this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0xce, 0x1f);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x2a, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "MobID:";
            this.txtMobID.Location = new Point(0x10c, 0x1c);
            this.txtMobID.Name = "txtMobID";
            this.txtMobID.Size = new Size(0x39, 20);
            this.txtMobID.TabIndex = 4;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0xce, 0x4b);
            this.label2.Name = "label2";
            this.label2.Size = new Size(30, 13);
            this.label2.TabIndex = 5;
            this.label2.Text = "isKill:";
            this.lstIsKill.DropDownStyle = ComboBoxStyle.DropDownList;
            this.lstIsKill.FormattingEnabled = true;
            this.lstIsKill.Location = new Point(0x10c, 0x48);
            this.lstIsKill.Name = "lstIsKill";
            this.lstIsKill.Size = new Size(0x39, 0x15);
            this.lstIsKill.TabIndex = 6;
            this.txtAmount.Location = new Point(270, 0x76);
            this.txtAmount.Name = "txtAmount";
            this.txtAmount.Size = new Size(0x37, 20);
            this.txtAmount.TabIndex = 7;
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0xce, 0x79);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x2e, 13);
            this.label3.TabIndex = 8;
            this.label3.Text = "Amount:";
            this.button1.Location = new Point(0xe0, 0x9d);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0x58, 30);
            this.button1.TabIndex = 9;
            this.button1.Text = "Add Monster";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(350, 0x1c1);
            base.Controls.Add(this.button1);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.txtAmount);
            base.Controls.Add(this.lstIsKill);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.txtMobID);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.btnSearch);
            base.Controls.Add(this.txtSearch);
            base.Controls.Add(this.lstMobs);
            base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            base.Name = "frmAddMob";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Add Monster - NPC";
            base.Load += new EventHandler(this.frmAddMob_Load);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void lstMobs_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                ushort key = Convert.ToUInt16(this.lstMobs.Text.Split(new char[] { ' ' })[0]);
                if (this.frmMain_0.dictionary_1.ContainsKey(key))
                {
                    this.txtMobID.Text = key.ToString();
                }
            }
            catch
            {
            }
        }

        private void lstMobs_SelectedIndexChanged(object sender, EventArgs e)
        {
        }

        private void method_0(string string_0)
        {
            this.lstMobs.Items.Clear();
            if (string_0 == "")
            {
                foreach (KeyValuePair<ushort, string> pair in this.frmMain_0.dictionary_1)
                {
                    this.lstMobs.Items.Add(pair.Key.ToString() + " - " + pair.Value);
                }
            }
            else
            {
                foreach (KeyValuePair<ushort, string> pair in this.frmMain_0.dictionary_1)
                {
                    if (pair.Value.ToLower().Contains(string_0.ToLower()))
                    {
                        this.lstMobs.Items.Add(pair.Key.ToString() + " - " + pair.Value);
                    }
                }
            }
        }

        public void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer_0 != null))
            {
                this.icontainer_0.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}

