Example #1
0
        private ItemIcon GenerateItemIcon(ItemClass itemClass, ItemType itemType, EqType eqType = EqType.None, ItemSubType itemSubType = ItemSubType.None)
        {
            ItemIcon result          = null;
            int      iconIndex_index = CryptoRandom.Next(0, Enum.GetValues(ItemIndexManagement.GetItemTypeBy(itemClass, itemType, eqType, itemSubType)).Length - 1);
            int      iconIndex       = (int)Enum.GetValues(ItemIndexManagement.GetItemTypeBy(itemClass, itemType, eqType, itemSubType)).GetValue(iconIndex_index);

            result = new ItemIcon(iconIndex, this.GenerateRarityIndex());

            return(result);
        }
Example #2
0
        public Weapon GenerateWeapon(int itemLevel, ItemClass itemClass)
        {
            Weapon result = null;

            ItemIcon     itemIcon     = this.GenerateItemIcon(itemClass, ItemType.Weapon);
            string       itemName     = this.GenerateItemName(itemClass, EqType.Weapon);
            int          goldValue    = this.GenerateItemGoldValue(itemLevel);
            double       itemWeight   = Math.Round(CryptoRandom.NextDouble(0, 5), 2, MidpointRounding.AwayFromZero);
            ItemFeatures itemFeatures = new ItemFeatures();

            itemFeatures.EnableFeatures(ItemFeaturesType.IsDeleteAble, ItemFeaturesType.IsEquipAble,
                                        ItemFeaturesType.IsInfoAble, ItemFeaturesType.IsRepairAble, ItemFeaturesType.IsSellAble,
                                        ItemFeaturesType.IsUpgradeAble);

            switch (itemClass)
            {
            case ItemClass.Magic:
            {
                result = new Weapon(itemClass, ItemType.Weapon, ItemSubType.None, itemIcon, EqType.Weapon,
                                    itemFeatures, itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                break;
            }

            case ItemClass.Melle:
            {
                result = new Weapon(itemClass, ItemType.Weapon, ItemSubType.None, itemIcon, EqType.Weapon,
                                    itemFeatures, itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase));

                break;
            }

            case ItemClass.Ranged:
            {
                result = new Weapon(itemClass, ItemType.Weapon, ItemSubType.None, itemIcon, EqType.Weapon,
                                    itemFeatures, itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                    StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                break;
            }
            }

            return(result);
        }
Example #3
0
        public Armor GenerateArmor(int itemLevel, ItemClass itemClass, ItemType itemType, EqType eqType)
        {
            Armor result = null;

            if (itemClass == ItemClass.Ranged && eqType == EqType.Shield)
            {
                return(result);
            }

            ItemIcon     itemIcon  = this.GenerateItemIcon(itemClass, itemType, eqType);
            string       itemName  = this.GenerateItemName(itemClass, eqType);
            int          goldValue = this.GenerateItemGoldValue(itemLevel);
            double       itemWeight;
            ItemFeatures itemFeatures = new ItemFeatures();

            itemFeatures.EnableFeatures(ItemFeaturesType.IsDeleteAble, ItemFeaturesType.IsEquipAble,
                                        ItemFeaturesType.IsInfoAble, ItemFeaturesType.IsRepairAble, ItemFeaturesType.IsSellAble,
                                        ItemFeaturesType.IsUpgradeAble);

            if (itemType == ItemType.Armor)
            {
                itemWeight = Math.Round(CryptoRandom.NextDouble(0, 5), 2, MidpointRounding.AwayFromZero);

                Armor armor = null;

                switch (itemClass)
                {
                case ItemClass.Magic:
                {
                    armor = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                      itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                    break;
                }

                case ItemClass.Melle:
                {
                    armor = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                      itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease));
                    break;
                }

                case ItemClass.Ranged:
                {
                    armor = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                      itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                      StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                    break;
                }
                }

                result = armor;
            }
            else if (itemType == ItemType.Trinket)
            {
                itemWeight = Math.Round(CryptoRandom.NextDouble(0, 2), 2, MidpointRounding.AwayFromZero);

                Armor trinket = null;

                switch (itemClass)
                {
                case ItemClass.Magic:
                {
                    trinket = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                        itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                    break;
                }

                case ItemClass.Melle:
                {
                    trinket = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                        itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                    break;
                }

                case ItemClass.Ranged:
                {
                    trinket = new Armor(itemClass, itemType, ItemSubType.None, itemIcon, eqType, itemFeatures,
                                        itemName, string.Empty, goldValue, itemWeight, false, false, 100, itemLevel, 0,
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Increase),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Normal),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.Decrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaIncrease),
                                        StatisticsGenerator.GenerateItemStatistics(itemLevel, ItemIndexManagement.GetRarityFromIndex(itemIcon.Rarity), StatisticsGeneratorBoostType.MegaDecrease));
                    break;
                }
                }

                result = trinket;
            }

            return(result);
        }