예제 #1
0
        /// <summary>
        /// Called whenever an item is clicked in the NPC's drops panel. First we check to see if the drop is
        /// a drop with a range of quantities. Next, we check if it is a drop with multiple possible quantities.
        /// Third, we check to see if the drop is a rare drop table drop. If the drop meets any of those
        /// criteria, we show the special form for handling those instances. Otherwise we just log the drop.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void dropsListView_ItemActivate(object sender, EventArgs e)
        {
            if (hasDropFormOpen)
            {
                return;
            }

            ListView     listView     = (ListView)sender;
            ListViewItem listViewItem = listView.SelectedItems[0];
            Drop         dropToLog    = (Drop)listViewItem.Tag;

            if (dropToLog.IsRangeOfDrops)
            {
                AddDropRangeForm addDropRangeFrom = new AddDropRangeForm();
                addDropRangeFrom.dropLabel.Text        = dropToLog.Name;
                addDropRangeFrom.rangeTextBox.KeyDown += RangeTextBox_KeyDown;
                addDropRangeFrom.addDropButton.Click  += AddDropButton_Click;
                addDropRangeFrom.rangeTextBox.Tag      = dropToLog;
                addDropRangeFrom.addDropButton.Tag     = dropToLog;

                addDropRangeFrom.Show(this);
                hasDropFormOpen = true;
            }
            else if (dropToLog.HasMultipleQuantities)
            {
                AddDropMultipleForm addDropMultipleForm = new AddDropMultipleForm();
                addDropMultipleForm.dropLabel.Text = dropToLog.Name;

                foreach (int quantityOption in dropToLog.MultipleQuantities)
                {
                    addDropMultipleForm.quantityOptionsListBox.Items.Add(quantityOption);
                }

                addDropMultipleForm.quantityOptionsListBox.Text = dropToLog.MultipleQuantities[0].ToString();
                addDropMultipleForm.quantityOptionsListBox.Tag  = dropToLog;

                addDropMultipleForm.addDropButton.Click += AddMultipleRangeDropButton_Click;

                addDropMultipleForm.Show(this);
                hasDropFormOpen = true;
            }
            else if (dropToLog.Name.Equals("RareDropTable"))
            {
                AddRareDropForm addRareDropForm = new AddRareDropForm();
                addRareDropForm.rareDropsOptionList.Items.AddRange(osrsDropContainers.RareDropTable.Cast <object>().ToArray());
                addRareDropForm.addRareDropButton.Click += AddRareDropButton_Click;

                addRareDropForm.Show(this);
                hasDropFormOpen = true;
            }
            else
            {
                osrsDropContainers.LogDrop(dropToLog);
            }
        }
예제 #2
0
        /// <summary>
        /// Called when a drop is added with a selected drop amount.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMultipleRangeDropButton_Click(object sender, EventArgs e)
        {
            Button button            = (Button)sender;
            AddDropMultipleForm form = (AddDropMultipleForm)button.TopLevelControl;
            Drop drop             = (Drop)form.quantityOptionsListBox.Tag;
            int  quantitySelected = Convert.ToInt32(form.quantityOptionsListBox.SelectedItem);

            drop.Quantity = quantitySelected;
            osrsDropContainers.LogDrop(drop);

            form.Close();
            hasDropFormOpen = false;
        }