예제 #1
0
        private void addScroll()
        {
            int id = int.Parse(txtScrollID.Text);

            if (!_items.ContainsKey(id))
            {
                return;
            }

            if (_scrolls.ContainsKey(id))
            {
                return;
            }

            UpgradeScroll s = new UpgradeScroll();

            s.ID    = _items[id].ID;
            s.Grade = UpgradeScroll.GradeLevel.BLESSED;
            s.Type  = UpgradeScroll.UpgradeType.REGULAR;
            s.Name  = _items[id].Name;
            s.Rates = new List <Rate>();

            for (int i = 0; i < 11; i++)
            {
                s.Rates.Add(new Rate()
                {
                    Cost = 0, Grade = i, Percent = 10000
                });
            }

            _scrolls.Add(s.ID, s);
            lbScrolls.Items.Add(s);
        }
예제 #2
0
        private void lbScrolls_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbScrolls.SelectedItem == null)
            {
                return;
            }

            UpgradeScroll s = (UpgradeScroll)lbScrolls.SelectedItem;

            lbGrades.Items.Clear();

            checkGrade(s.Grade);
            checkType(s.Type);

            cbAccessory.Checked = s.Accessory;
            cbArmor.Checked     = s.Armor;
            cbWeapon.Checked    = s.Weapon;

            foreach (Rate r in s.Rates)
            {
                lbGrades.Items.Add(r);
            }

            lblSelectedScroll.Text = s.Name;
            lbGrades.SelectedIndex = 0;
        }
예제 #3
0
        private void addScroll()
        {
            int id = int.Parse(txtScrollID.Text);
            if(!_items.ContainsKey(id))
                return;

            if (_scrolls.ContainsKey(id))
                return;

            UpgradeScroll s = new UpgradeScroll();
            s.ID = _items[id].ID;
            s.Grade = UpgradeScroll.GradeLevel.BLESSED;
            s.Type = UpgradeScroll.UpgradeType.REGULAR;
            s.Name = _items[id].Name;
            s.Rates = new List<Rate>();

            for (int i = 0; i < 11; i++)
                s.Rates.Add(new Rate() { Cost = 0, Grade = i, Percent = 10000 });

            _scrolls.Add(s.ID, s);
            lbScrolls.Items.Add(s);
        }
예제 #4
0
        private void setGenericItemUpgrades(UpgradeScroll s, int i)
        {
            for (int c = s.Grade == UpgradeScroll.GradeLevel.BLESSED ? 0 : 1; c < 2; c++)
            {
                Rate sr = s.Rates[i];
                UpgradeRow r;
                switch (s.Type)
                {
                    case UpgradeScroll.UpgradeType.REGULAR:
                        #region Generic Item Upgrades

                        string[] weaponUpgradeNames = { "", "Reduce", "Poison" };
                        int[] weaponUpgradeIDs = { 0, 30, 40 };
                        for (int n = 0; n < weaponUpgradeNames.Length; n++)
                        {
                            r = new UpgradeRow(CURRENT_WEAPON_INDEX++, s.Modifier, "Generic Weapon Upgrade" + (weaponUpgradeNames[n].Length > 0 ? " (" + weaponUpgradeNames[n] + ")" : ""), sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                            if (c == 0)
                            {
                                r.RequiredItems[0] = TRINA_ID;
                                r.RequiredItems[1] = s.ID;
                            }
                            else
                                r.RequiredItems[0] = s.ID;

                            r.Item = weaponUpgradeIDs[n] + sr.Grade;
                            r.Percent = c == 0 ? sr.TrinaPercent : sr.Percent;
                            upgradeRows.Add(r.Index, r);
                        }

                        string[] armorUpgradeNames = { "", "Strength", "Intelligence", "Magic Power", "Health", "Dexterity", "Intelligence", "Magic Power" };
                        int[] armorUpgradeIDs = { 0, 10, 20, 30, 500, 510, 520, 530 };

                        for (int n = 0; n < armorUpgradeNames.Length; n++)
                        {
                            r = new UpgradeRow(CURRENT_ARMOR_INDEX++, s.Modifier, "Generic Armor Upgrade" + (armorUpgradeNames[n].Length > 0 ? " (" + armorUpgradeNames[n] + ")" : ""), sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                            if (c == 0)
                            {
                                r.RequiredItems[0] = TRINA_ID;
                                r.RequiredItems[1] = s.ID;
                            }
                            else
                                r.RequiredItems[0] = s.ID;
                            r.Item = i + armorUpgradeIDs[n];
                            r.Percent = c == 0 ? sr.TrinaPercent : sr.Percent;
                            upgradeRows.Add(r.Index, r);
                            r = r.Clone();
                            r.Index = CURRENT_HIGHARMOR_INDEX++;
                            upgradeRows.Add(r.Index, r);
                        }
                        #endregion
                        break;
                    case UpgradeScroll.UpgradeType.ACCESSORYCOMPOUND:
                        #region Generic Accessories
                        int[] arr = { 0, 10, 20, 30, 70 };
                        int[] arr2 = { 500, 510, 520, 530, 550, 560, 570, 580, 600, 610, 620, 630, 650, 660, 670, 680, 700, 710, 720, 730 };
                        for (int n = 0; n < arr.Length; n++)
                        {
                            r = new UpgradeRow(CURRENT_ACCESSORY_INDEX++, s.Modifier, "Generic Accessory Upgrade", sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                            r.Item = i + arr[n];
                            r.Percent = sr.Percent;
                            r.RequiredItems[0] = s.ID;
                            upgradeRows.Add(r.Index, r);
                        }

                        sr = s.Rates[i + 10];

                        for (int n = 0; n < arr2.Length; n++)
                        {
                            r = new UpgradeRow(CURRENT_ACCESSORY_INDEX++, s.Modifier, "Generic Accessory Upgrade", sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                            r.Item = i + arr2[n];
                            r.Percent = sr.Percent;
                            r.RequiredItems[0] = s.ID;
                            upgradeRows.Add(r.Index, r);
                        }
                        #endregion
                        break;
                    case UpgradeScroll.UpgradeType.ACCESSORYENCHANT:
                    #region Accessory Enchants
                    Dictionary<int, int> items = new Dictionary<int, int>();
                    switch (s.ID)
                    {
                        case 379160000:
                            items.Add(20, 531);
                            items.Add(30, 571);
                            items.Add(40, 611);
                            items.Add(80, 621);
                            break;
                        case 379161000:
                            items.Add(10, 491);
                            items.Add(30, 581);
                            items.Add(40, 621);
                            items.Add(80, 631);
                            break;
                        case 379162000:
                            items.Add(10, 491);
                            items.Add(30, 581);
                            items.Add(40, 621);
                            items.Add(80, 631);
                            break;
                        case 379163000:
                            items.Add(10, 491);
                            items.Add(30, 581);
                            items.Add(40, 621);
                            items.Add(80, 631);
                            break;
                        case 379164000:
                            items.Add(10, 521);
                            items.Add(20, 561);
                            items.Add(30, 601);
                            items.Add(40, 641);
                            break;
                    }
                    foreach (KeyValuePair<int, int> kvp in items)
                    {
                        r = new UpgradeRow() { Index = CURRENT_ACCESSORY_INDEX++, Item = kvp.Key, Percent = sr.Percent, Modifier = kvp.Value, Name = "Generic Accessory Upgrade", Note = "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")", Cost = sr.Cost, Extension = -1 };
                        r.RequiredItems[0] = s.ID;
                        upgradeRows.Add(r.Index, r);
                    }
                    #endregion
                        break;
                }
            }
        }
예제 #5
0
 private void checkType(UpgradeScroll.UpgradeType t)
 {
     switch (t)
     {
         case UpgradeScroll.UpgradeType.REGULAR:
             rbNormal.Checked = true;
             break;
         case UpgradeScroll.UpgradeType.ELEMENT:
             rbElemental.Checked = true;
             break;
         case UpgradeScroll.UpgradeType.STAT:
             rbStat.Checked = true;
             break;
         case UpgradeScroll.UpgradeType.ACCESSORYCOMPOUND:
             rbAccessoryCompound.Checked = true;
             break;
         case UpgradeScroll.UpgradeType.ACCESSORYENCHANT:
             rbAccessoryEnchant.Checked = true;
             break;
     }
 }
예제 #6
0
 private void checkGrade(UpgradeScroll.GradeLevel gl)
 {
     switch (gl)
     {
         case UpgradeScroll.GradeLevel.BLESSED:
             rbBlessed.Checked = true;
             break;
         case UpgradeScroll.GradeLevel.HIGH:
             rbHigh.Checked = true;
             break;
         case UpgradeScroll.GradeLevel.MIDDLE:
             rbMiddle.Checked = true;
             break;
         case UpgradeScroll.GradeLevel.LOW:
             rbLow.Checked = true;
             break;
     }
 }
예제 #7
0
        // update current entry
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int newCost, newPercent, newModifier, newTrinaPercent = 0, selectedIndex;

            selectedIndex = lbGrades.SelectedIndex;
            try
            {
                newCost         = int.Parse(txtCost.Text);
                newPercent      = int.Parse(txtPercent.Text);
                newModifier     = int.Parse(txtModifier.Text);
                newTrinaPercent = gradeLevel == UpgradeScroll.GradeLevel.BLESSED ? int.Parse(txtTrinaPercent.Text) : 0;
            }
            catch
            {
                MessageBox.Show("Cost and Percent must be valid integers (Cost 0 - 2100000000; Percent 0 - 10000)", "Invalid data");
                return;
            }

            if (newPercent > 10000 || newPercent < 0)
            {
                newPercent = 0;
            }

            if (newCost < 0)
            {
                newCost = 0;
            }

            UpgradeScroll s = _scrolls[((UpgradeScroll)lbScrolls.SelectedItem).ID];

            s.Armor     = cbArmor.Checked;
            s.Weapon    = cbWeapon.Checked;
            s.Accessory = cbAccessory.Checked;
            if (s.Accessory && s.Rates.Count < 21)
            {
                for (int i = 1; s.Rates.Count < 21; i++)
                {
                    s.Rates.Add(new Rate()
                    {
                        Cost = 0, Grade = i + 10, Percent = 10000
                    });
                }
            }

            if (!s.Accessory && s.Rates.Count > 11)
            {
                while (s.Rates.Count > 11)
                {
                    s.Rates.RemoveAt(s.Rates.Count - 1);
                }
            }
            s.Type     = type;
            s.Grade    = gradeLevel;
            s.Modifier = newModifier;
            s.Rates[lbGrades.SelectedIndex].Cost         = newCost;
            s.Rates[lbGrades.SelectedIndex].Percent      = newPercent;
            s.Rates[lbGrades.SelectedIndex].TrinaPercent = newTrinaPercent;


            lbScrolls.Items[lbScrolls.SelectedIndex] = s;
            lbGrades.SelectedIndex = selectedIndex;
        }
예제 #8
0
        private void setGenericItemUpgrades(UpgradeScroll s, int i)
        {
            for (int c = s.Grade == UpgradeScroll.GradeLevel.BLESSED ? 0 : 1; c < 2; c++)
            {
                Rate       sr = s.Rates[i];
                UpgradeRow r;
                switch (s.Type)
                {
                case UpgradeScroll.UpgradeType.REGULAR:
                    #region Generic Item Upgrades

                    string[] weaponUpgradeNames = { "", "Reduce", "Poison" };
                    int[]    weaponUpgradeIDs   = { 0, 30, 40 };
                    for (int n = 0; n < weaponUpgradeNames.Length; n++)
                    {
                        r = new UpgradeRow(CURRENT_WEAPON_INDEX++, s.Modifier, "Generic Weapon Upgrade" + (weaponUpgradeNames[n].Length > 0 ? " (" + weaponUpgradeNames[n] + ")" : ""), sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                        if (c == 0)
                        {
                            r.RequiredItems[0] = TRINA_ID;
                            r.RequiredItems[1] = s.ID;
                        }
                        else
                        {
                            r.RequiredItems[0] = s.ID;
                        }

                        r.Item    = weaponUpgradeIDs[n] + sr.Grade;
                        r.Percent = c == 0 ? sr.TrinaPercent : sr.Percent;
                        upgradeRows.Add(r.Index, r);
                    }

                    string[] armorUpgradeNames = { "", "Strength", "Intelligence", "Magic Power", "Health", "Dexterity", "Intelligence", "Magic Power" };
                    int[]    armorUpgradeIDs   = { 0, 10, 20, 30, 500, 510, 520, 530 };

                    for (int n = 0; n < armorUpgradeNames.Length; n++)
                    {
                        r = new UpgradeRow(CURRENT_ARMOR_INDEX++, s.Modifier, "Generic Armor Upgrade" + (armorUpgradeNames[n].Length > 0 ? " (" + armorUpgradeNames[n] + ")" : ""), sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                        if (c == 0)
                        {
                            r.RequiredItems[0] = TRINA_ID;
                            r.RequiredItems[1] = s.ID;
                        }
                        else
                        {
                            r.RequiredItems[0] = s.ID;
                        }
                        r.Item    = i + armorUpgradeIDs[n];
                        r.Percent = c == 0 ? sr.TrinaPercent : sr.Percent;
                        upgradeRows.Add(r.Index, r);
                        r       = r.Clone();
                        r.Index = CURRENT_HIGHARMOR_INDEX++;
                        upgradeRows.Add(r.Index, r);
                    }
                    #endregion
                    break;

                case UpgradeScroll.UpgradeType.ACCESSORYCOMPOUND:
                    #region Generic Accessories
                    int[] arr  = { 0, 10, 20, 30, 70 };
                    int[] arr2 = { 500, 510, 520, 530, 550, 560, 570, 580, 600, 610, 620, 630, 650, 660, 670, 680, 700, 710, 720, 730 };
                    for (int n = 0; n < arr.Length; n++)
                    {
                        r                  = new UpgradeRow(CURRENT_ACCESSORY_INDEX++, s.Modifier, "Generic Accessory Upgrade", sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                        r.Item             = i + arr[n];
                        r.Percent          = sr.Percent;
                        r.RequiredItems[0] = s.ID;
                        upgradeRows.Add(r.Index, r);
                    }

                    sr = s.Rates[i + 10];

                    for (int n = 0; n < arr2.Length; n++)
                    {
                        r                  = new UpgradeRow(CURRENT_ACCESSORY_INDEX++, s.Modifier, "Generic Accessory Upgrade", sr.Cost, "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")");
                        r.Item             = i + arr2[n];
                        r.Percent          = sr.Percent;
                        r.RequiredItems[0] = s.ID;
                        upgradeRows.Add(r.Index, r);
                    }
                    #endregion
                    break;

                case UpgradeScroll.UpgradeType.ACCESSORYENCHANT:
                    #region Accessory Enchants
                    Dictionary <int, int> items = new Dictionary <int, int>();
                    switch (s.ID)
                    {
                    case 379160000:
                        items.Add(20, 531);
                        items.Add(30, 571);
                        items.Add(40, 611);
                        items.Add(80, 621);
                        break;

                    case 379161000:
                        items.Add(10, 491);
                        items.Add(30, 581);
                        items.Add(40, 621);
                        items.Add(80, 631);
                        break;

                    case 379162000:
                        items.Add(10, 491);
                        items.Add(30, 581);
                        items.Add(40, 621);
                        items.Add(80, 631);
                        break;

                    case 379163000:
                        items.Add(10, 491);
                        items.Add(30, 581);
                        items.Add(40, 621);
                        items.Add(80, 631);
                        break;

                    case 379164000:
                        items.Add(10, 521);
                        items.Add(20, 561);
                        items.Add(30, 601);
                        items.Add(40, 641);
                        break;
                    }
                    foreach (KeyValuePair <int, int> kvp in items)
                    {
                        r = new UpgradeRow()
                        {
                            Index = CURRENT_ACCESSORY_INDEX++, Item = kvp.Key, Percent = sr.Percent, Modifier = kvp.Value, Name = "Generic Accessory Upgrade", Note = "(+" + sr.Grade + " -> +" + (sr.Grade + 1) + ")", Cost = sr.Cost, Extension = -1
                        };
                        r.RequiredItems[0] = s.ID;
                        upgradeRows.Add(r.Index, r);
                    }
                    #endregion
                    break;
                }
            }
        }