Пример #1
0
        private async void OnClusterChange(object source, ClusterChangedEvent args)
        {
            var logger = LoggerManager.GetLogger("CqlSharp.Cluster.Changes");

            if (args.Change.Equals(ClusterChange.New))
            {
                //get the connection from which we received the event
                var connection = (Connection)source;

                //get the new peer
                using (var result = await ExecQuery(connection, "select rpc_address, data_center, rack, tokens from system.peers where peer = '" + args.Node + "'", logger).ConfigureAwait(false))
                {
                    if (await result.ReadAsync().ConfigureAwait(false))
                    {
                        var newNode = new Node((IPAddress)result["rpc_address"], this)
                        {
                            DataCenter = (string)result["data_center"],
                            Rack       = (string)result["rack"],
                            Tokens     = (ISet <string>)result["tokens"]
                        };


                        if (InDiscoveryScope(_nodes.First(), newNode, _config.DiscoveryScope))
                        {
                            logger.LogInfo("{0} added to the cluster", newNode);
                            _nodes.Add(newNode);
                        }
                        else
                        {
                            logger.LogVerbose("new {0} is ignored as it does not fit in the discovery scope", newNode);
                        }
                    }
                }
            }
            else if (args.Change.Equals(ClusterChange.Removed))
            {
                Node removedNode = _nodes.FirstOrDefault(node => args.Node.Equals(node.Address));
                if (removedNode != null)
                {
                    _nodes.Remove(removedNode);
                    logger.LogInfo("{0} was removed from the cluster", removedNode);
                }
                else
                {
                    logger.LogVerbose("Node with address {0} was removed but not used within the current configuration", args.Node);
                }
            }
            else if (args.Change.Equals(ClusterChange.Up))
            {
                Node upNode = _nodes.FirstOrDefault(node => args.Node.Equals(node.Address));

                if (upNode != null)
                {
                    using (logger.ThreadBinding())
                    {
                        upNode.Reactivate();
                    }
                }
            }
        }
Пример #2
0
 public void AddNode(T node, string key)
 {
     for (var i = 0; i < VirtualReplication; i++)
     {
         var hash = HashAlgorithm.Hash(key + i);
         Ring.Add(hash, node);
     }
 }
Пример #3
0
        /* TODO
         * public Matrix MultStrassen(Matrix Mat) {
         *
         * }
         */
        public Matrix Add(Matrix matrix2, String resultMatrixName)
        {
            Matrix newMat = new Matrix(columns, rows, resultMatrixName, Ringtype);

            for (int column = 0; column < columns; column++)
            {
                for (int row = 0; row < matrix2.rows; row++)
                {
                    Ring elem = GetElem(column, row);
                    elem.Add(matrix2.GetElem(column, row));
                    newMat.SetElem(column, row, elem);
                }
            }
            return(newMat);
        }
Пример #4
0
    /// Update the branch growing.
    public void Tick()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }

        // Rotate growBase towards its target and add some noise to the rotation.
        growBase.rotation = Quaternion.RotateTowards(
            growBase.rotation, growDirection, Mathf.PI * turnSpeed * Time.deltaTime
            ) * Random.rotation.Pow(Time.deltaTime * directionVariance);

        var position = growBase.position;

        position += Time.deltaTime * growSpeed * growBase.up;

        growBase.position = position;

        // Create a new segment once the tip has moved far enouch away
        // from the rest of the branch.
        if (Vector3.Distance(lastPosition, position) > segmentLength)
        {
            lastPosition = position;

            Leaf leaf = null;

            if (Random.value < leafDensity)
            {
                leaf = AddLeaf();
            }

            var ring = new Ring(growBase, startRadius, nVertices, transform);

            if (leaf != null)
            {
                // ring.leaf = leaf;
                ring.Add(leaf.transform);
            }

            branchRings.Add(ring);
            // GenerateMesh();
        }

        ticks++;
    }
Пример #5
0
        public Matrix MultStandard(Matrix matrix2, String resultMatrixName)
        {
            Matrix newMat = new Matrix(columns, matrix2.GetRows(), resultMatrixName, Ringtype);

            for (int column = 0; column < columns; column++)
            {
                for (int row = 0; row < matrix2.GetRows(); row++)
                {
                    Ring productsum = GetElem(column, 0);
                    productsum.Multiply(matrix2.GetElem(0, row));
                    Ring temp;
                    for (int i = 1; i < rows; i++)
                    {
                        temp = GetElem(column, i);
                        temp.Multiply(matrix2.GetElem(i, row));
                        productsum.Add(temp);
                    }
                    newMat.SetElem(column, row, productsum);
                }
            }
            return(newMat);
        }
Пример #6
0
            public static void Create()
            {
                float headr = HeadR / W;

                Standard.Add(new Orbit(.1f, .2f, 1f / 13));
                Standard.Add(new Orbit(.367f, .2f, 1f / 13));
                Standard.Add(new Orbit(.633f, .2f, 1f / 13));
                Standard.Add(new Orbit(.9f, .2f, 1f / 13));
                Standard.Add(new Orbit(2f / 9, .5f, 1f / 13));
                Standard.Add(new Orbit(.5f, .5f, 1f / 13));
                Standard.Add(new Orbit(7f / 9, .5f, 1f / 13));
                Standard.Add(new Orbit(.1f, .8f, 1f / 13));
                Standard.Add(new Orbit(.367f, .8f, 1f / 13));
                Standard.Add(new Orbit(.633f, .8f, 1f / 13f));
                Standard.Add(new Orbit(.9f, .8f, 1f / 13));

                First.Add(new Orbit(1 / 12f, 1 / 6f, 1 / 21f));
                First.Add(new Orbit(11 / 12f, 1 / 6f, 1 / 21f));
                First.Add(new Orbit(1 / 12f, 5 / 6f, 1 / 21f));
                First.Add(new Orbit(11 / 12f, 5 / 6f, 1 / 21f));
                First.Add(new Orbit(.5f, .5f, 3 / 16f));
                First.Add(new Orbit(1 / 6f, .5f, 3 / 32f));
                First.Add(new Orbit(5 / 6f, .5f, 3 / 32f));
                First.Add(new Orbit(1 / 4f, 1 / 5f, 1 / 28f));
                First.Add(new Orbit(3 / 4f, 1 / 5f, 1 / 28f));
                First.Add(new Orbit(1 / 4f, 4 / 5f, 1 / 28f));
                First.Add(new Orbit(3 / 4f, 4 / 5f, 1 / 28f));

                Dense.Add(new Orbit(1 / 12f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 12f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 12f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 12f, 7 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 6f, 1 / 4f, 1 / 25f));
                Dense.Add(new Orbit(1 / 6f, 1 / 2f, 1 / 25f));
                Dense.Add(new Orbit(1 / 6f, 3 / 4f, 1 / 25f));
                Dense.Add(new Orbit(1 / 4f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 4f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 4f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 4f, 7 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 3f, 1 / 4f, 1 / 25f));
                Dense.Add(new Orbit(1 / 3f, 1 / 2f, 1 / 25f));
                Dense.Add(new Orbit(1 / 3f, 3 / 4f, 1 / 25f));
                Dense.Add(new Orbit(5 / 12f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(5 / 12f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(5 / 12f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(5 / 12f, 7 / 8f, 1 / 25f));
                Dense.Add(new Orbit(1 / 2f, 1 / 4f, 1 / 25f));
                Dense.Add(new Orbit(1 / 2f, 1 / 2f, 1 / 25f));
                Dense.Add(new Orbit(1 / 2f, 3 / 4f, 1 / 25f));
                Dense.Add(new Orbit(7 / 12f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(7 / 12f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(7 / 12f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(7 / 12f, 7 / 8f, 1 / 25f));
                Dense.Add(new Orbit(2 / 3f, 1 / 4f, 1 / 25f));
                Dense.Add(new Orbit(2 / 3f, 1 / 2f, 1 / 25f));
                Dense.Add(new Orbit(2 / 3f, 3 / 4f, 1 / 25f));
                Dense.Add(new Orbit(3 / 4f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(3 / 4f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(3 / 4f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(3 / 4f, 7 / 8f, 1 / 25f));
                Dense.Add(new Orbit(5 / 6f, 1 / 4f, 1 / 25f));
                Dense.Add(new Orbit(5 / 6f, 1 / 2f, 1 / 25f));
                Dense.Add(new Orbit(5 / 6f, 3 / 4f, 1 / 25f));
                Dense.Add(new Orbit(11 / 12f, 1 / 8f, 1 / 25f));
                Dense.Add(new Orbit(11 / 12f, 3 / 8f, 1 / 25f));
                Dense.Add(new Orbit(11 / 12f, 5 / 8f, 1 / 25f));
                Dense.Add(new Orbit(11 / 12f, 7 / 8f, 1 / 25f));

                Simple.Add(new Orbit(1 / 4f, .5f, .2f));
                Simple.Add(new Orbit(3 / 4f, .5f, .2f));
                Simple.Add(new Orbit(.5f, 1 / 6f, .05f));
                Simple.Add(new Orbit(.5f, 5 / 6f, .05f));

                Steps.Add(new Orbit(.12f + headr, .24f + headr * 2, .12f));
                Steps.Add(new Orbit(1 / 3f, .6f, .1f));
                Steps.Add(new Orbit(.5f, 14 / 16f - headr * 2, 1 / 16f));
                Steps.Add(new Orbit(2 / 3f, .6f, .1f));
                Steps.Add(new Orbit(.88f - headr, .24f + headr * 2, .12f));

                Isles.Add(new Orbit(1 / 12f + headr, 3 / 5f, 1 / 12f));
                Isles.Add(new Orbit(3 / 12f, 1 / 6f + headr * 2, 1 / 12f));
                Isles.Add(new Orbit(5 / 12f, 5 / 6f - headr * 2, 1 / 12f));
                Isles.Add(new Orbit(7 / 12f, 1 / 6f + headr * 2, 1 / 12f));
                Isles.Add(new Orbit(9 / 12f, 5 / 6f - headr * 2, 1 / 12f));
                Isles.Add(new Orbit(11 / 12f - headr, 2 / 5f, 1 / 12f));

                Moon.Add(new Orbit(1 / 4f, .3f + headr * 2, .15f));
                Moon.Add(new Orbit(.42f, .87f, 1 / 30f));
                Moon.Add(new Orbit(.3f, .5f, 1 / 30f));
                Moon.Add(new Orbit(.72381f, .18924f, 1 / 32f));
                Moon.Add(new Orbit(.62348f, .54328f, 1 / 18f));
                Moon.Add(new Orbit(.76483f, .43617f, 1 / 32f));
                Moon.Add(new Orbit(.32732f, .32711f, 1 / 26f));
                Moon.Add(new Orbit(.17231f, .79801f, 1 / 24f));
                Moon.Add(new Orbit(.79782f, .79701f, 1 / 20f));
                Moon.Add(new Orbit(.87982f, .33241f, 1 / 22f));
                Moon.Add(new Orbit(.54311f, .12411f, 1 / 28f));
                Moon.Add(new Orbit(.06251f, .56781f, 1 / 30f));
                Moon.Add(new Orbit(.52879f, .78232f, 1 / 34f));

                Ring.Add(new Orbit(3 / 13f, 1 / 9f + headr * 2, 1 / 18f));
                Ring.Add(new Orbit(5 / 13f, 1 / 9f + headr * 2, 1 / 18f));
                Ring.Add(new Orbit(7 / 13f, 1 / 9f + headr * 2, 1 / 18f));
                Ring.Add(new Orbit(9 / 13f, 1 / 9f + headr * 2, 1 / 18f));
                Ring.Add(new Orbit(4 / 13f, 8 / 9f - headr * 2, 1 / 18f));
                Ring.Add(new Orbit(6 / 13f, 8 / 9f - headr * 2, 1 / 18f));
                Ring.Add(new Orbit(8 / 13f, 8 / 9f - headr * 2, 1 / 18f));
                Ring.Add(new Orbit(10 / 13f, 8 / 9f - headr * 2, 1 / 18f));
                Ring.Add(new Orbit(1 / 15f + headr, 1 / 3f, 1 / 15f));
                Ring.Add(new Orbit(14 / 15f - headr, 2 / 3f, 1 / 15f));
                //Ring.Add(new Orbit(1/18f+headr, 1/8f, 1/18f));
                //Ring.Add(new Orbit(17/18f-headr, 7/8f, 1/18f));
                Ring.Add(new Orbit(.1f + headr, .8f - headr * 2, .1f));
                Ring.Add(new Orbit(.9f - headr, .2f + headr * 2, .1f));

                Wave.Add(new Orbit(1 / 6f, 2 / 9f + headr * 2, 1 / 9f));
                Wave.Add(new Orbit(2 / 6f, 7 / 9f - headr * 2, 1 / 9f));
                Wave.Add(new Orbit(3 / 6f, 2 / 9f + headr * 2, 1 / 9f));
                Wave.Add(new Orbit(4 / 6f, 7 / 9f - headr * 2, 1 / 9f));
                Wave.Add(new Orbit(5 / 6f, 2 / 9f + headr * 2, 1 / 9f));

                /*
                 * Me.Add(new Orbit(1/4f, 1/4f, .12f));
                 * Me.Add(new Orbit(1/4f, 3/4f, .12f));
                 * Me.Add(new Orbit(.52f, .155f, .06f));
                 * Me.Add(new Orbit(.67f, .155f, .06f));
                 * Me.Add(new Orbit(.82f, .155f, .06f));
                 * Me.Add(new Orbit(.595f, .5f, .12f));
                 * Me.Add(new Orbit(.52f, .85f, .06f));
                 * Me.Add(new Orbit(.875f, .85f, .05f));
                 */

                Me.Add(new Orbit(1 / 11f + headr, 9 / 11f - 2 * headr, 1 / 11f));
                Me.Add(new Orbit(13 / 44f + headr / 2, 29 / 44f - headr, 1 / 11f));
                Me.Add(new Orbit(.5f, .5f, 1 / 11f));
                Me.Add(new Orbit(31 / 44f - headr / 2, 15 / 44f + headr, 1 / 11f));
                Me.Add(new Orbit(10 / 11f - headr, 2 / 11f + 2 * headr, 1 / 11f));
            }
Пример #7
0
        // Load the monster.txt drop file.
        private void LoadDropFile(bool edit)
        {
            var lines = (edit == false) ? File.ReadAllLines(Path.Combine(Settings.DropPath, String.Format("{0}.txt", listBoxMonsters.SelectedItem)), Encoding.GetEncoding("euc-kr")) : textBoxDropList.Lines;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith(";Gold"))
                {
                    if (lines[i + 1].StartsWith("1/"))
                    {
                        var workingLine = lines[i + 1].Split(' ');
                        GoldOdds = workingLine[0].Remove(0, 2);
                        Gold     = workingLine[2];
                        break;
                    }
                    else
                    {
                        GoldOdds = "0";
                        Gold     = "0";
                    }
                }
            }

            string[] Headers = new string[34]
            {
                ";Weapons",
                ";Armours",
                ";Helmets",
                ";Necklaces",
                ";Bracelets",
                ";Rings",
                ";Amulets",
                ";Belts",
                ";Boots",
                ";Stones",
                ";Torches",
                ";Potions",
                ";Ores",
                ";Meat",
                ";Crafting Materials",
                ";Scrolls",
                ";Gems",
                ";Mount",
                ";Books",
                ";Nothing",
                ";Script",
                ";Reins",
                ";Bells",
                ";Saddle",
                ";Ribbon",
                ";Mask",
                ";Food",
                ";Hook",
                ";Float",
                ";Bait",
                ";Finder",
                ";Reel",
                ";Fish",
                ";Quest"
            };

            for (int i = 0; i < Headers.Length; i++)
            {
                for (int j = 0; j < lines.Length; j++)
                {
                    if (lines[j].StartsWith(Headers[i]))
                    {
                        for (int k = j + 1; k < lines.Length; k++)
                        {
                            if (lines[k].StartsWith(";"))
                            {
                                break;
                            }

                            var workingLine = lines[k].Split(' ');
                            if (workingLine.Length < 2)
                            {
                                continue;
                            }

                            var quest = "";

                            if (workingLine.Length > 2 && workingLine[2] == "Q")
                            {
                                quest = workingLine[2];
                            }

                            DropItem newDropItem = new DropItem {
                                Odds = workingLine[0], Name = workingLine[1], Quest = quest
                            };
                            switch (i)
                            {
                            case 0:
                                Weapon.Add(newDropItem);
                                break;

                            case 1:
                                Armour.Add(newDropItem);
                                break;

                            case 2:
                                Helmet.Add(newDropItem);
                                break;

                            case 3:
                                Necklace.Add(newDropItem);
                                break;

                            case 4:
                                Bracelet.Add(newDropItem);
                                break;

                            case 5:
                                Ring.Add(newDropItem);
                                break;

                            case 6:
                                Amulet.Add(newDropItem);
                                break;

                            case 7:
                                Belt.Add(newDropItem);
                                break;

                            case 8:
                                Boot.Add(newDropItem);
                                break;

                            case 9:
                                Stone.Add(newDropItem);
                                break;

                            case 10:
                                Torch.Add(newDropItem);
                                break;

                            case 11:
                                Potion.Add(newDropItem);
                                break;

                            case 12:
                                Ore.Add(newDropItem);
                                break;

                            case 13:
                                Meat.Add(newDropItem);
                                break;

                            case 14:
                                CraftingMaterial.Add(newDropItem);
                                break;

                            case 15:
                                Scrolls.Add(newDropItem);
                                break;

                            case 16:
                                Gem.Add(newDropItem);
                                break;

                            case 17:
                                Mount.Add(newDropItem);
                                break;

                            case 18:
                                Book.Add(newDropItem);
                                break;

                            case 19:
                                Nothing.Add(newDropItem);
                                break;

                            case 20:
                                Script.Add(newDropItem);
                                break;

                            case 21:
                                Reins.Add(newDropItem);
                                break;

                            case 22:
                                Bells.Add(newDropItem);
                                break;

                            case 23:
                                Saddle.Add(newDropItem);
                                break;

                            case 24:
                                Ribbon.Add(newDropItem);
                                break;

                            case 25:
                                Mask.Add(newDropItem);
                                break;

                            case 26:
                                Food.Add(newDropItem);
                                break;

                            case 27:
                                Hook.Add(newDropItem);
                                break;

                            case 28:
                                Float.Add(newDropItem);
                                break;

                            case 29:
                                Bait.Add(newDropItem);
                                break;

                            case 30:
                                Finder.Add(newDropItem);
                                break;

                            case 31:
                                Reel.Add(newDropItem);
                                break;

                            case 32:
                                Fish.Add(newDropItem);
                                break;

                            case 33:
                                Quest.Add(newDropItem);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
Пример #8
0
        // Add the item to the drop list
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int dropChance;

            int.TryParse(textBoxItemOdds.Text, out dropChance);

            if (dropChance < 1)
            {
                dropChance = 1;
            }

            string quest = QuestOnlyCheckBox.Checked ? "Q" : "";

            try
            {
                switch (tabControlSeperateItems.SelectedTab.Tag.ToString())
                {
                case "Weapon":
                    Weapon.Add(new DropItem {
                        Name = listBoxWeapon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Armour":
                    Armour.Add(new DropItem {
                        Name = listBoxArmour.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Helmet":
                    Helmet.Add(new DropItem {
                        Name = listBoxHelmet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Necklace":
                    Necklace.Add(new DropItem {
                        Name = listBoxNecklace.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bracelet":
                    Bracelet.Add(new DropItem {
                        Name = listBoxBracelet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ring":
                    Ring.Add(new DropItem {
                        Name = listBoxRing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Amulet":
                    Amulet.Add(new DropItem {
                        Name = listBoxAmulet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Belt":
                    Belt.Add(new DropItem {
                        Name = listBoxBelt.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Boots":
                    Boot.Add(new DropItem {
                        Name = listBoxBoot.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Stone":
                    Stone.Add(new DropItem {
                        Name = listBoxStone.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Torch":
                    Torch.Add(new DropItem {
                        Name = listBoxTorch.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Potion":
                    Potion.Add(new DropItem {
                        Name = listBoxPotion.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ore":
                    Ore.Add(new DropItem {
                        Name = listBoxOre.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Meat":
                    Meat.Add(new DropItem {
                        Name = listBoxMeat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "CraftingMaterial":
                    CraftingMaterial.Add(new DropItem {
                        Name = listBoxCraftingMaterial.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance)
                    });
                    break;

                case "Scroll":
                    Scrolls.Add(new DropItem {
                        Name = listBoxScroll.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Gem":
                    Gem.Add(new DropItem {
                        Name = listBoxGem.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mount":
                    Mount.Add(new DropItem {
                        Name = listBoxMount.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Book":
                    Book.Add(new DropItem {
                        Name = listBoxBook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Nothing":
                    Nothing.Add(new DropItem {
                        Name = listBoxNothing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Script":
                    Script.Add(new DropItem {
                        Name = listBoxScript.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Reins":
                    Reins.Add(new DropItem {
                        Name = listBoxReins.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bells":
                    Bells.Add(new DropItem {
                        Name = listBoxBells.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Saddle":
                    Saddle.Add(new DropItem {
                        Name = listBoxSaddle.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ribbon":
                    Ribbon.Add(new DropItem {
                        Name = listBoxRibbon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mask":
                    Mask.Add(new DropItem {
                        Name = listBoxMask.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Food":
                    Food.Add(new DropItem {
                        Name = listBoxFood.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Hook":
                    Hook.Add(new DropItem {
                        Name = listBoxHook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Float":
                    Float.Add(new DropItem {
                        Name = listBoxFloat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Bait":
                    Bait.Add(new DropItem {
                        Name = listBoxBait.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Finder":
                    Finder.Add(new DropItem {
                        Name = listBoxFinder.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Reel":
                    Reel.Add(new DropItem {
                        Name = listBoxReel.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Fish":
                    Fish.Add(new DropItem {
                        Name = listBoxFish.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Quest":
                    Quest.Add(new DropItem {
                        Name = listBoxQuest.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;
                }

                UpdateDropFile();
            }
            catch
            {
                //No item selected when trying to add an item to the drop
            }
        }