Exemplo n.º 1
0
        private void GenerateBaseEnchantProperty(string name, int enchantQuality, float enchantChance, string enchantTitle, string enchantFormat, int maxRank, int xpFactor, int type1, int value1, int object1, float step1, int type2 = 0, int value2 = 0, int object2 = 0, float step2 = 0, int type3 = 0, int value3 = 0, int object3 = 0, float step3 = 0)
        {
            int firstRank = 0;

            for (int i = 0; i != maxRank; ++i)
            {
                ItemRandomProperty property = WorldWorker.CreateNewItemRandomProperty();
                if (i == 0)
                {
                    firstRank = property.ID;
                }
                SpellItemEnchantment enchant = WorldWorker.CreateNewSpellItemEnchant();

                item_enchant_data data = new item_enchant_data();
                data.FirstRank = firstRank;
                data.ID        = property.ID;
                data.Rank      = i + 1;
                item_enchant_upgrade_data upgrade = new item_enchant_upgrade_data();
                upgrade.Enchant = property.ID;
                upgrade.Level   = i + 1;
                upgrade.Next    = i == maxRank - 1 ? 0 : property.ID + 1; // hack!
                switch (enchantQuality)
                {
                case 1:
                    upgrade.UpgradeItem = 60327;
                    break;

                case 2:
                    upgrade.UpgradeItem = 60328;
                    break;

                case 3:
                    upgrade.UpgradeItem = 60329;
                    break;

                case 4:
                    upgrade.UpgradeItem = 60330;
                    break;

                case 5:
                    upgrade.UpgradeItem = 60331;
                    break;

                case 6:
                    upgrade.UpgradeItem = 60332;
                    break;

                case 7:
                    upgrade.UpgradeItem = 60333;
                    break;

                default:
                    upgrade.UpgradeItem = 60333;
                    break;
                }

                upgrade.UpgradeItemCount = upgrade.Next == 0 ? 0 : 10 + 20 * i;
                DB.LEGACY.item_enchant_data.Add(data);
                DB.LEGACY.item_enchant_upgrade_data.Add(upgrade);
                DB.LEGACY.SaveChanges();
                DB.Refresh();

                property.Enchant[0]    = enchant.ID;
                property.Name          = name;
                enchant.Object[0]      = object1;
                enchant.Object[1]      = object2;
                enchant.Object[2]      = object3;
                enchant.Min[0]         = (int)(value1 + step1 * i);
                enchant.Min[1]         = (int)(value2 + step2 * i);
                enchant.Min[2]         = (int)(value3 + step3 * i);
                enchant.Max[0]         = (int)(value1 + step1 * i);
                enchant.Max[1]         = (int)(value2 + step2 * i);
                enchant.Max[2]         = (int)(value3 + step3 * i);
                enchant.EnchantType[0] = type1;
                enchant.EnchantType[1] = type2;
                enchant.EnchantType[2] = type3;

                string enchantName = "遗产:" + String.Format(enchantTitle, i + 1);
                switch (enchantQuality)
                {
                case 1:
                    enchantName = "|cffffffff" + enchantName + "|r";
                    break;

                case 2:
                    enchantName = "|cff1eff00" + enchantName + "|r";
                    break;

                case 3:
                    enchantName = "|cff0070dd" + enchantName + "|r";
                    break;

                case 4:
                    enchantName = "|cffa335ee" + enchantName + "|r";
                    break;

                case 5:
                    enchantName = "|cffff8000" + enchantName + "|r";
                    break;

                case 6:
                    enchantName = "|cffe6cc80" + enchantName + "|r";
                    break;

                case 7:
                    enchantName = "|cffff0000" + enchantName + "|r";
                    break;

                default:
                    break;
                }
                enchant.Name = enchantName + Environment.NewLine + String.Format("  " + enchantFormat, enchant.Min[0], enchant.Min[1], enchant.Min[2]);
            }

            item_enchant_chance chance = new item_enchant_chance();

            chance.Enchant = firstRank;
            chance.Chance  = enchantChance;
            DB.LEGACY.item_enchant_chance.Add(chance);
            DB.LEGACY.SaveChanges();
            DB.Refresh();
        }