예제 #1
0
        void Awake()
        {
            //Unleveled gold and daedra drops
            FormulaHelper.RegisterOverride(mod, "ModifyFoundLootItems", (Func <DaggerfallUnityItem[], int>)UnleveledGoldLootPiles);
            EnemyDeath.OnEnemyDeath += UnlevelDroppedLoot_OnEnemyDeath;

            PlayerEnterExit.OnPreTransition      += SetDungeon_OnPreTransition;
            PlayerEnterExit.OnTransitionExterior += ClearData_OnTransitionExterior;

            //Override of material mechanics.
            FormulaHelper.RegisterOverride <Func <int, WeaponMaterialTypes> >(mod, "RandomMaterial", (player) =>
            {
                luckMod = GameManager.Instance.PlayerEntity.Stats.LiveLuck / 10;
                matRoll = UnityEngine.Random.Range(0, 92) + luckMod;
                WeaponMaterialTypes material = WpnMatSelector();
                return(material);
            });
            FormulaHelper.RegisterOverride <Func <int, ArmorMaterialTypes> >(mod, "RandomArmorMaterial", (player) =>
            {
                luckMod = GameManager.Instance.PlayerEntity.Stats.LiveLuck / 10;
                matRoll = UnityEngine.Random.Range(0, 92) + luckMod;
                ArmorMaterialTypes material = ArmMatSelector();
                return(material);
            });


            mod.IsReady = true;
        }
예제 #2
0
        /// <summary>
        /// Creates random armor.
        /// </summary>
        /// <param name="playerLevel">Player level for material type.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateRandomArmor(int playerLevel, Genders gender, Races race)
        {
            // Create random armor type
            Array enumArray             = DaggerfallUnity.Instance.ItemHelper.GetEnumArray(ItemGroups.Armor);
            int   groupIndex            = UnityEngine.Random.Range(0, enumArray.Length);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            // Adjust for gender
            if (gender == Genders.Female)
            {
                newItem.PlayerTextureArchive = firstFemaleArchive;
            }
            else
            {
                newItem.PlayerTextureArchive = firstMaleArchive;
            }

            // Adjust for body morphology
            SetRace(newItem, race);

            // Random armor material
            ArmorMaterialTypes material = RandomArmorMaterial(playerLevel);

            newItem.nativeMaterialValue = (int)material;
            newItem.dyeColor            = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);

            // Random variant
            SetVariant(newItem, UnityEngine.Random.Range(0, newItem.TotalVariants));

            return(newItem);
        }
예제 #3
0
        private static ArmorMaterialTypes ArmMatSelector()
        {
            ArmorMaterialTypes armorMaterial = ArmorMaterialTypes.Leather;
            int rollMod = 0;
            int armRoll = UnityEngine.Random.Range(1, 91) + luckMod;

            if (GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop)
            {
                rollMod += GameManager.Instance.PlayerEnterExit.Interior.BuildingData.Quality * 6;
            }
            else if (GameManager.Instance.PlayerEnterExit.IsPlayerInsideDungeon)
            {
                rollMod += dungeonQuality();
            }
            if (armRoll + rollMod > 50)
            {
                if (armRoll + rollMod > 80)
                {
                    WeaponMaterialTypes material = WpnMatSelector();
                    armorMaterial = (ArmorMaterialTypes)(0x0200 + material);
                }
                else
                {
                    armorMaterial = ArmorMaterialTypes.Chain;
                }
            }
            return(armorMaterial);
        }
        /// <summary>
        /// Resolves full item name using parameters like %it and material type.
        /// </summary>
        public string ResolveItemLongName(DaggerfallUnityItem item)
        {
            string result = ResolveItemName(item);

            // Return result without material prefix if item is unidentified or an Artifact.
            if (!item.IsIdentified || item.IsArtifact)
            {
                return(result);
            }

            // Resolve weapon material
            if (item.ItemGroup == ItemGroups.Weapons && item.TemplateIndex != (int)Weapons.Arrow)
            {
                WeaponMaterialTypes weaponMaterial = (WeaponMaterialTypes)item.nativeMaterialValue;
                string materialName = DaggerfallUnity.Instance.TextProvider.GetWeaponMaterialName(weaponMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            // Resolve armor material
            if (item.ItemGroup == ItemGroups.Armor && ArmorShouldShowMaterial(item))
            {
                ArmorMaterialTypes armorMaterial = (ArmorMaterialTypes)item.nativeMaterialValue;
                string             materialName  = DaggerfallUnity.Instance.TextProvider.GetArmorMaterialName(armorMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            // Resolve potion names
            if (item.ItemGroup == ItemGroups.UselessItems1 && item.TemplateIndex == (int)UselessItems1.Glass_Bottle)
            {
                return(MacroHelper.GetValue("%po", item));
            }

            return(result);
        }
예제 #5
0
        /// <summary>
        /// Resolves full item name using parameters like %it and material type.
        /// </summary>
        public string ResolveItemLongName(DaggerfallUnityItem item)
        {
            string result = ResolveItemName(item);

            // Return result without material prefix if item is unidentified or an Artifact.
            if (!item.IsIdentified || item.IsArtifact)
            {
                return(result);
            }

            // Resolve weapon material
            if (item.ItemGroup == ItemGroups.Weapons && item.TemplateIndex != (int)Weapons.Arrow)
            {
                WeaponMaterialTypes weaponMaterial = (WeaponMaterialTypes)item.nativeMaterialValue;
                string materialName = DaggerfallUnity.Instance.TextProvider.GetWeaponMaterialName(weaponMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            // Resolve armor material
            if (item.ItemGroup == ItemGroups.Armor && !item.IsShield && item.TemplateIndex != (int)Armor.Helm)
            {
                ArmorMaterialTypes armorMaterial = (ArmorMaterialTypes)item.nativeMaterialValue;
                string             materialName  = DaggerfallUnity.Instance.TextProvider.GetArmorMaterialName(armorMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            return(result);
        }
예제 #6
0
        /// <summary>
        /// Resolves full item name using parameters like %it and material type.
        /// </summary>
        public string ResolveItemName(DaggerfallUnityItem item)
        {
            // Start with base name
            string result = item.shortName;

            // Get item template
            ItemTemplate template = item.ItemTemplate;

            // Resolve %it parameter
            result = result.Replace("%it", template.name);

            // Resolve weapon material
            if (item.ItemGroup == ItemGroups.Weapons)
            {
                WeaponMaterialTypes weaponMaterial = (WeaponMaterialTypes)item.nativeMaterialValue;
                string materialName = DaggerfallUnity.Instance.TextProvider.GetWeaponMaterialName(weaponMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            // Resolve armor material
            if (item.ItemGroup == ItemGroups.Armor)
            {
                ArmorMaterialTypes armorMaterial = (ArmorMaterialTypes)item.nativeMaterialValue;
                string             materialName  = DaggerfallUnity.Instance.TextProvider.GetArmorMaterialName(armorMaterial);
                result = string.Format("{0} {1}", materialName, result);
            }

            return(result);
        }
예제 #7
0
        /// <summary>
        /// Generates a random weapon material.
        /// </summary>
        /// <param name="minMaterial">Lowest quality of material.</param>
        /// <param name="maxMaterial">Highest quality of material.</param>
        /// <returns>ArmorMaterialTypes</returns>
        public static ArmorMaterialTypes RandomArmorMaterial(
            ArmorMaterialTypes minMaterial = ArmorMaterialTypes.Leather,
            ArmorMaterialTypes maxMaterial = ArmorMaterialTypes.Daedric)
        {
            Array materialValues = Enum.GetValues(typeof(ArmorMaterialTypes));
            int   index          = UnityEngine.Random.Range((int)minMaterial, (int)maxMaterial);

            return((ArmorMaterialTypes)materialValues.GetValue(index));
        }
예제 #8
0
        public string GetArmorMaterialName(ArmorMaterialTypes material)
        {
            switch (material)
            {
            case ArmorMaterialTypes.Leather:
                return("Leather");

            case ArmorMaterialTypes.Chain:
            case ArmorMaterialTypes.Chain2:
                return("Chain");

            case ArmorMaterialTypes.Iron:
                return("Iron");

            case ArmorMaterialTypes.Steel:
                return("Steel");

            case ArmorMaterialTypes.Silver:
                return("Silver");

            case ArmorMaterialTypes.Elven:
                return("Elven");

            case ArmorMaterialTypes.Dwarven:
                return("Dwarven");

            case ArmorMaterialTypes.Mithril:
                return("Mithril");

            case ArmorMaterialTypes.Adamantium:
                return("Adamantium");

            case ArmorMaterialTypes.Ebony:
                return("Ebony");

            case ArmorMaterialTypes.Orcish:
                return("Orcish");

            case ArmorMaterialTypes.Daedric:
                return("Daedric");
            }

            // Standard material type value not found.
            // Try again using material value masked to material type only.
            // Some save editors will not write back correct material mask, so we must try to handle this if possible.
            // Clamping range so we don't end up in infinite loop.
            int value = (int)material >> 8;

            value = Mathf.Clamp(value, (int)ArmorMaterialTypes.Iron, (int)ArmorMaterialTypes.Daedric);
            return(GetArmorMaterialName((ArmorMaterialTypes)value));
        }
예제 #9
0
        /// <summary>
        /// Creates random armor.
        /// </summary>
        /// <param name="playerLevel">Player level for material type.</param>
        /// <param name="gender">Gender armor is created for.</param>
        /// <param name="race">Race armor is created for.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateRandomArmor(int playerLevel, Genders gender, Races race)
        {
            // Create random armor type
            Array enumArray             = DaggerfallUnity.Instance.ItemHelper.GetEnumArray(ItemGroups.Armor);
            int   groupIndex            = UnityEngine.Random.Range(0, enumArray.Length);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            // Adjust for gender
            if (gender == Genders.Female)
            {
                newItem.PlayerTextureArchive = firstFemaleArchive;
            }
            else
            {
                newItem.PlayerTextureArchive = firstMaleArchive;
            }

            // Adjust for body morphology
            SetRace(newItem, race);

            // Random armor material
            ArmorMaterialTypes material = RandomArmorMaterial(playerLevel);

            newItem.nativeMaterialValue = (int)material;

            if (newItem.nativeMaterialValue == (int)ArmorMaterialTypes.Leather)
            {
                newItem.weightInKg /= 2;
            }

            else if (newItem.nativeMaterialValue == (int)ArmorMaterialTypes.Chain)
            {
                newItem.value *= 2;
            }

            else if (newItem.nativeMaterialValue >= (int)ArmorMaterialTypes.Iron)
            {
                int plateMaterial = newItem.nativeMaterialValue - 0x0200;
                newItem = SetItemPropertiesByMaterial(newItem, (WeaponMaterialTypes)plateMaterial);
            }

            newItem.dyeColor = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);
            FixLeatherHelm(newItem);
            RandomizeArmorVariant(newItem);

            return(newItem);
        }
 public void ReceiveArmor(PlayerEntity playerEntity)
 {
     if ((flags & ArmorFlagMask) > 0)
     {
         DaggerfallUI.MessageBox(NoArmorId);
     }
     else
     {   // Give a random armor piece, allowing player to choose one out of 3-6
         ItemCollection     rewardArmor = new ItemCollection();
         ArmorMaterialTypes material    = ArmorMaterialTypes.Iron + rank;
         for (int i = UnityEngine.Random.Range(3, 7); i >= 0; i--)
         {
             Armor armor = (Armor)UnityEngine.Random.Range(102, 108 + 1);
             rewardArmor.AddItem(ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, armor, material));
         }
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(ArmorId);
         DaggerfallUI.Instance.InventoryWindow.SetChooseOne(rewardArmor, item => flags = flags | ArmorFlagMask);
         mb.OnClose += ReceiveArmorPopup_OnClose;
     }
 }
예제 #11
0
        /// <summary>Set material and adjust armor stats accordingly</summary>
        public static void ApplyArmorMaterial(DaggerfallUnityItem armor, ArmorMaterialTypes material)
        {
            armor.nativeMaterialValue = (int)material;

            if (armor.nativeMaterialValue == (int)ArmorMaterialTypes.Leather)
            {
                armor.weightInKg /= 2;
            }
            else if (armor.nativeMaterialValue == (int)ArmorMaterialTypes.Chain)
            {
                armor.value *= 2;
            }
            else if (armor.nativeMaterialValue >= (int)ArmorMaterialTypes.Iron)
            {
                int plateMaterial = armor.nativeMaterialValue - 0x0200;
                armor = SetItemPropertiesByMaterial(armor, (WeaponMaterialTypes)plateMaterial);
            }

            armor.dyeColor = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);
        }
예제 #12
0
        /// <summary>
        /// Converts armor material to appropriate dye colour.
        /// </summary>
        /// <param name="material">ArmorMaterialTypes.</param>
        /// <returns>DyeColors.</returns>
        public DyeColors GetArmorDyeColor(ArmorMaterialTypes material)
        {
            switch (material)
            {
            case ArmorMaterialTypes.Chain:
            case ArmorMaterialTypes.Chain2:
                return(DyeColors.Chain);

            case ArmorMaterialTypes.Iron:
                return(DyeColors.Iron);

            case ArmorMaterialTypes.Steel:
                return(DyeColors.Steel);

            case ArmorMaterialTypes.Silver:
            case ArmorMaterialTypes.Elven:
                return(DyeColors.SilverOrElven);

            case ArmorMaterialTypes.Dwarven:
                return(DyeColors.Dwarven);

            case ArmorMaterialTypes.Mithril:
                return(DyeColors.Mithril);

            case ArmorMaterialTypes.Adamantium:
                return(DyeColors.Adamantium);

            case ArmorMaterialTypes.Ebony:
                return(DyeColors.Ebony);

            case ArmorMaterialTypes.Orcish:
                return(DyeColors.Orcish);

            case ArmorMaterialTypes.Daedric:
                return(DyeColors.Daedric);

            default:
                return(DyeColors.Unchanged);
            }
        }
예제 #13
0
        /// <summary>
        /// Generates armour.
        /// </summary>
        /// <param name="gender">Gender armor is created for.</param>
        /// <param name="race">Race armor is created for.</param>
        /// <param name="armor">Type of armor item to create.</param>
        /// <param name="material">Material of armor.</param>
        /// <param name="variant">Visual variant of armor. If -1, a random variant is chosen.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateArmor(Genders gender, Races race, Armor armor, ArmorMaterialTypes material, int variant = -1)
        {
            // Create item
            int groupIndex = DaggerfallUnity.Instance.ItemHelper.GetGroupIndex(ItemGroups.Armor, (int)armor);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            // Adjust for gender
            if (gender == Genders.Female)
            {
                newItem.PlayerTextureArchive = firstFemaleArchive;
            }
            else
            {
                newItem.PlayerTextureArchive = firstMaleArchive;
            }

            // Adjust for body morphology
            SetRace(newItem, race);

            // Adjust material
            newItem.nativeMaterialValue = (int)material;

            if (newItem.nativeMaterialValue == (int)ArmorMaterialTypes.Leather)
            {
                newItem.weightInKg /= 2;
            }

            else if (newItem.nativeMaterialValue == (int)ArmorMaterialTypes.Chain)
            {
                newItem.value *= 2;
            }

            else if (newItem.nativeMaterialValue >= (int)ArmorMaterialTypes.Iron)
            {
                int plateMaterial = newItem.nativeMaterialValue - 0x0200;
                newItem = SetItemPropertiesByMaterial(newItem, (WeaponMaterialTypes)plateMaterial);
            }

            newItem.dyeColor = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor((ArmorMaterialTypes)newItem.nativeMaterialValue);
            FixLeatherHelm(newItem);

            // Adjust for variant
            if (variant >= 0)
            {
                SetVariant(newItem, variant);
            }
            else
            {
                RandomizeArmorVariant(newItem);
            }

            return(newItem);
        }
        /// <summary>
        /// Generates armour.
        /// </summary>
        /// <param name="armor">Armor item.</param>
        /// <param name="material">Material.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateArmor(Genders gender, Races race, Armor armor, ArmorMaterialTypes material, int variant = 0)
        {
            // Create item
            int groupIndex = DaggerfallUnity.Instance.ItemHelper.GetGroupIndex(ItemGroups.Armor, (int)armor);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            // Adjust for gender
            if (gender == Genders.Female)
                newItem.PlayerTextureArchive = firstFemaleArchive;
            else
                newItem.PlayerTextureArchive = firstMaleArchive;

            // Adjust for body morphology
            SetRace(newItem, race);

            // Adjust material
            newItem.nativeMaterialValue = (int)material;
            newItem.dyeColor = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);

            // Adjust for variant
            SetVariant(newItem, variant);

            return newItem;
        }
예제 #15
0
        /// <summary>Set gender, body morphology and material of armor</summary>
        public static void ApplyArmorSettings(DaggerfallUnityItem armor, Genders gender, Races race, ArmorMaterialTypes material, int variant = 0)
        {
            // Adjust for gender
            if (gender == Genders.Female)
            {
                armor.PlayerTextureArchive = firstFemaleArchive;
            }
            else
            {
                armor.PlayerTextureArchive = firstMaleArchive;
            }

            // Adjust for body morphology
            SetRace(armor, race);

            // Adjust material
            ApplyArmorMaterial(armor, material);

            // Adjust for variant
            if (variant >= 0)
            {
                SetVariant(armor, variant);
            }
            else
            {
                RandomizeArmorVariant(armor);
            }
        }
예제 #16
0
        /// <summary>
        /// Generates armour.
        /// </summary>
        /// <param name="gender">Gender armor is created for.</param>
        /// <param name="race">Race armor is created for.</param>
        /// <param name="armor">Type of armor item to create.</param>
        /// <param name="material">Material of armor.</param>
        /// <param name="variant">Visual variant of armor. If -1, a random variant is chosen.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateArmor(Genders gender, Races race, Armor armor, ArmorMaterialTypes material, int variant = -1)
        {
            // Create item
            int groupIndex = DaggerfallUnity.Instance.ItemHelper.GetGroupIndex(ItemGroups.Armor, (int)armor);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            ApplyArmorSettings(newItem, gender, race, material, variant);

            return(newItem);
        }
예제 #17
0
        public void StockShopShelf(PlayerGPS.DiscoveredBuilding buildingData)
        {
            stockedDate = CreateStockedDate(DaggerfallUnity.Instance.WorldTime.Now);
            items.Clear();

            DFLocation.BuildingTypes buildingType = buildingData.buildingType;
            int shopQuality = buildingData.quality;

            Game.Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
            int        playerLuck = playerEntity.Stats.LiveLuck;
            ItemHelper itemHelper = DaggerfallUnity.Instance.ItemHelper;

            byte[] itemGroups   = { 0 };
            int[]  discrimItems = new int[] { };

            switch (buildingType)
            {
            case DFLocation.BuildingTypes.Alchemist:
                float alchChance    = 60;
                float alchChanceMod = 0.75f;
                while (Dice100.SuccessRoll((int)alchChance))
                {
                    RandomlyAddPotion(100, items);
                    alchChance *= alchChanceMod;
                }
                alchChance = 40;
                while (Dice100.SuccessRoll((int)alchChance))
                {
                    RandomlyAddPotionRecipe(100, items);
                    alchChance *= alchChanceMod;
                }
                itemGroups = DaggerfallLootDataTables.itemGroupsAlchemist;
                break;

            case DFLocation.BuildingTypes.Armorer:
                itemGroups   = DaggerfallLootDataTables.itemGroupsArmorer;
                discrimItems = new int[] { (int)Repair_Tools.Charging_Powder, (int)Repair_Tools.Epoxy_Glue, (int)Repair_Tools.Whetstone };
                break;

            case DFLocation.BuildingTypes.Bookseller:
                itemGroups = DaggerfallLootDataTables.itemGroupsBookseller;
                break;

            case DFLocation.BuildingTypes.ClothingStore:
                itemGroups = DaggerfallLootDataTables.itemGroupsClothingStore;
                break;

            case DFLocation.BuildingTypes.GemStore:
                itemGroups = DaggerfallLootDataTables.itemGroupsGemStore;
                break;

            case DFLocation.BuildingTypes.GeneralStore:
                if (Dice100.SuccessRoll(20))
                {
                    items.AddItem(ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Horse));
                }
                if (Dice100.SuccessRoll(30))
                {
                    items.AddItem(ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Small_cart));
                }
                itemGroups   = DaggerfallLootDataTables.itemGroupsGeneralStore;
                discrimItems = new int[] { (int)Containers.Barrel, (int)Containers.Lockbox, (int)Liquid_Containers.Gem_Encrusted_Gold_Goblet, (int)Liquid_Containers.Gem_Encrusted_Silver_Goblet, (int)Liquid_Containers.Gold_Goblet, (int)Liquid_Containers.Silver_Goblet };
                break;

            case DFLocation.BuildingTypes.PawnShop:
                itemGroups   = DaggerfallLootDataTables.itemGroupsPawnShop;
                discrimItems = new int[] { (int)Containers.Barrel, (int)Containers.Bucket, (int)Containers.Urn, (int)Containers.Urn, (int)Containers.Snuff_Box, (int)Containers.Quiver, (int)Liquid_Containers.Empty_Bottle, (int)Liquid_Containers.Wooden_Cup, (int)Liquid_Containers.Tin_Goblet };
                break;

            case DFLocation.BuildingTypes.WeaponSmith:
                itemGroups   = DaggerfallLootDataTables.itemGroupsWeaponSmith;
                discrimItems = new int[] { (int)Repair_Tools.Charging_Powder, (int)Repair_Tools.Armorers_Hammer, (int)Repair_Tools.Jewelers_Pliers, (int)Repair_Tools.Sewing_Kit };
                break;
            }

            for (int i = 0; i < itemGroups.Length; i += 2) // Alright, that makes more sense to me now at least, from what it seems at least. Odd values are the itemGroup, Even are the chance for that itemGroup, makes much more sense.
            {
                ItemGroups itemGroup = (ItemGroups)itemGroups[i];
                float      chance    = itemGroups[i + 1];
                float      chanceMod = 0.45f;

                if (itemGroup != ItemGroups.Furniture && itemGroup != ItemGroups.UselessItems1)
                {
                    while (Dice100.SuccessRoll((int)chance))                      // I think order will be, roll if item of group is generated, then actually pick the item of said group randomly and then continue from there until loop roll fails.
                    {
                        DaggerfallUnityItem item = null;                          // Don't forget to have weapons and armor and such have variable condition values depending on the quality of the store they were bought/generated in.
                        chanceMod = Mathf.Clamp(chanceMod + 0.05f, 0.10f, 0.85f); // Will likely have to tweak this around and see how the results are. Possibly have shop quality modify these chance values as well.
                        if (itemGroup == ItemGroups.Weapons)
                        {
                            item = ItemBuilder.CreateWeapon((Weapons)Random.Range((int)Weapons.Dagger, (int)Weapons.Arrow + 1), FormulaHelper.RandomMaterial(-1, shopQuality, playerLuck)); // May rework and give weapons different rarity values later.
                        }
                        else if (itemGroup == ItemGroups.Armor)
                        {
                            item = ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, (Armor)Random.Range((int)Armor.Cuirass, (int)Armor.Tower_Shield + 1), FormulaHelper.RandomArmorMaterial(-1, shopQuality, playerLuck));
                        }
                        else if (itemGroup == ItemGroups.MensClothing)
                        {
                            item          = ItemBuilder.CreateMensClothing((MensClothing)Random.Range((int)MensClothing.Straps, (int)MensClothing.Champion_straps + 1), playerEntity.Race);
                            item.dyeColor = ItemBuilder.RandomClothingDye();
                        }
                        else if (itemGroup == ItemGroups.WomensClothing)
                        {
                            item          = ItemBuilder.CreateWomensClothing((WomensClothing)Random.Range((int)WomensClothing.Brassier, (int)WomensClothing.Vest + 1), playerEntity.Race);
                            item.dyeColor = ItemBuilder.RandomClothingDye();
                        }
                        else if (itemGroup == ItemGroups.Books)
                        {
                            item = ItemBuilder.CreateRandomBookOfRandomSubject(-1, shopQuality, playerLuck);
                        }
                        else if (itemGroup == ItemGroups.MagicItems)
                        {
                            item = ItemBuilder.CreateRandomMagicItem(playerEntity.Gender, playerEntity.Race, -1, shopQuality, playerLuck);
                        }
                        else if ((int)itemGroup == (int)ItemGroups.Jewellery || ((int)itemGroup >= (int)ItemGroups.Tiara_Jewelry && (int)itemGroup <= (int)ItemGroups.Bracelet_Jewelry))
                        {
                            item = ItemBuilder.CreateRandomJewelryOfRandomSlot(-1, shopQuality, playerLuck, discrimItems);
                        }
                        else
                        {
                            item = ItemBuilder.CreateRandomItemOfItemgroup(itemGroup, -1, shopQuality, playerLuck, discrimItems); // For filter could make a method to populate the discrimItem para values and just change them based on shop types, maybe.
                            if (item != null && DaggerfallUnity.Settings.PlayerTorchFromItems && item.IsOfTemplate(ItemGroups.UselessItems2, (int)UselessItems2.Oil))
                            {
                                item.stackCount = Random.Range(5, 20 + 1);  // Shops stock 5-20 bottles
                            }
                        }
                        items.AddItem(item);

                        chance *= chanceMod; // Likely determine chanceMod by the itemGroup being currently ran.
                    }

                    // Add any modded items registered in applicable groups
                    int[] customItemTemplates = itemHelper.GetCustomItemsForGroup(itemGroup);
                    for (int j = 0; j < customItemTemplates.Length; j++)
                    {
                        ItemTemplate itemTemplate = itemHelper.GetItemTemplate(itemGroup, customItemTemplates[j]);
                        if (itemTemplate.rarity <= shopQuality)
                        {
                            int stockChance = (int)Mathf.Round(chance * 5 * (21 - itemTemplate.rarity) / 100);
                            if (Dice100.SuccessRoll(stockChance))
                            {
                                DaggerfallUnityItem item = ItemBuilder.CreateItem(itemGroup, customItemTemplates[j]);

                                // Setup specific group stats
                                if (itemGroup == ItemGroups.Weapons)
                                {
                                    WeaponMaterialTypes material = FormulaHelper.RandomMaterial(-1, shopQuality, playerLuck);
                                    ItemBuilder.ApplyWeaponMaterial(item, material);
                                }
                                else if (itemGroup == ItemGroups.Armor)
                                {
                                    ArmorMaterialTypes material = FormulaHelper.RandomArmorMaterial(-1, shopQuality, playerLuck);
                                    ItemBuilder.ApplyArmorSettings(item, playerEntity.Gender, playerEntity.Race, material);
                                }
                                else if (item.TemplateIndex == 810)
                                {
                                    WeaponMaterialTypes material = FormulaHelper.RandomMaterial(-1, shopQuality, playerLuck);
                                    ItemBuilder.ApplyIngotMaterial(item, material);
                                }

                                items.AddItem(item);
                            }
                        }
                    }
                }
            }
        }
예제 #18
0
        /// <summary>
        /// Converts native Daggerfall weapon and armor material types to generic Daggerfall Unity MetalType.
        /// The old metal type enum may be retired as true materials become better integrated.
        /// </summary>
        /// <param name="item">Item to convert material to metal type.</param>
        /// <returns>MetalTypes.</returns>
        public MetalTypes ConvertItemMaterialToAPIMetalType(DaggerfallUnityItem item)
        {
            // Determine metal type
            if (item.ItemGroup == ItemGroups.Weapons)
            {
                WeaponMaterialTypes weaponMaterial = (WeaponMaterialTypes)item.nativeMaterialValue;
                switch (weaponMaterial)
                {
                case WeaponMaterialTypes.Iron:
                    return(MetalTypes.Iron);

                case WeaponMaterialTypes.Steel:
                    return(MetalTypes.Steel);

                case WeaponMaterialTypes.Silver:
                    return(MetalTypes.Silver);

                case WeaponMaterialTypes.Elven:
                    return(MetalTypes.Elven);

                case WeaponMaterialTypes.Dwarven:
                    return(MetalTypes.Dwarven);

                case WeaponMaterialTypes.Mithril:
                    return(MetalTypes.Mithril);

                case WeaponMaterialTypes.Adamantium:
                    return(MetalTypes.Adamantium);

                case WeaponMaterialTypes.Ebony:
                    return(MetalTypes.Ebony);

                case WeaponMaterialTypes.Orcish:
                    return(MetalTypes.Orcish);

                case WeaponMaterialTypes.Daedric:
                    return(MetalTypes.Daedric);

                default:
                    return(MetalTypes.None);
                }
            }
            else if (item.ItemGroup == ItemGroups.Armor)
            {
                ArmorMaterialTypes armorMaterial = (ArmorMaterialTypes)item.nativeMaterialValue;
                switch (armorMaterial)
                {
                case ArmorMaterialTypes.Iron:
                    return(MetalTypes.Iron);

                case ArmorMaterialTypes.Steel:
                    return(MetalTypes.Steel);

                case ArmorMaterialTypes.Chain:
                case ArmorMaterialTypes.Chain2:
                    return(MetalTypes.Chain);

                case ArmorMaterialTypes.Silver:
                    return(MetalTypes.Silver);

                case ArmorMaterialTypes.Elven:
                    return(MetalTypes.Elven);

                case ArmorMaterialTypes.Dwarven:
                    return(MetalTypes.Dwarven);

                case ArmorMaterialTypes.Mithril:
                    return(MetalTypes.Mithril);

                case ArmorMaterialTypes.Adamantium:
                    return(MetalTypes.Adamantium);

                case ArmorMaterialTypes.Ebony:
                    return(MetalTypes.Ebony);

                case ArmorMaterialTypes.Orcish:
                    return(MetalTypes.Orcish);

                case ArmorMaterialTypes.Daedric:
                    return(MetalTypes.Daedric);

                default:
                    return(MetalTypes.None);
                }
            }
            else
            {
                return(MetalTypes.None);
            }
        }
예제 #19
0
 private static float GetSoundParameterForArmorType(ArmorMaterialTypes armorMaterialType)
 {
     return((float)armorMaterialType * 0.1f);
 }
예제 #20
0
        /// <summary>
        /// Generates armour.
        /// </summary>
        /// <param name="armor">Armor item.</param>
        /// <param name="material">Material.</param>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateArmor(Genders gender, Races race, Armor armor, ArmorMaterialTypes material, int variant = 0)
        {
            // Create item
            int groupIndex = DaggerfallUnity.Instance.ItemHelper.GetGroupIndex(ItemGroups.Armor, (int)armor);
            DaggerfallUnityItem newItem = new DaggerfallUnityItem(ItemGroups.Armor, groupIndex);

            // Adjust for gender
            if (gender == Genders.Female)
            {
                newItem.PlayerTextureArchive = firstFemaleArchive;
            }
            else
            {
                newItem.PlayerTextureArchive = firstMaleArchive;
            }

            // Adjust for body morphology
            SetRace(newItem, race);

            // Adjust material
            newItem.nativeMaterialValue = (int)material;
            newItem.dyeColor            = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);

            // Adjust for variant
            SetVariant(newItem, variant);

            return(newItem);
        }
예제 #21
0
        static void AssignSkillItems(PlayerEntity playerEntity, DFCareer.Skills skill)
        {
            ItemCollection items  = playerEntity.Items;
            Genders        gender = playerEntity.Gender;
            Races          race   = playerEntity.Race;

            bool upgrade = Dice100.SuccessRoll(playerEntity.Career.Luck / (playerEntity.Career.Luck < 56 ? 2 : 1));
            WeaponMaterialTypes weaponMaterial = WeaponMaterialTypes.Iron;

            if ((upgrade && !playerEntity.Career.IsMaterialForbidden(DFCareer.MaterialFlags.Steel)) || playerEntity.Career.IsMaterialForbidden(DFCareer.MaterialFlags.Iron))
            {
                weaponMaterial = WeaponMaterialTypes.Steel;
            }
            ArmorMaterialTypes armorMaterial = ArmorMaterialTypes.Leather;

            if ((upgrade && !playerEntity.Career.IsArmorForbidden(DFCareer.ArmorFlags.Chain)) || playerEntity.Career.IsArmorForbidden(DFCareer.ArmorFlags.Leather))
            {
                armorMaterial = ArmorMaterialTypes.Chain;
            }

            switch (skill)
            {
            case DFCareer.Skills.Archery:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateWeapon(Weapons.Short_Bow, weaponMaterial));
                DaggerfallUnityItem arrowPile = ItemBuilder.CreateWeapon(Weapons.Arrow, WeaponMaterialTypes.Iron);
                arrowPile.stackCount = 30;
                items.AddItem(arrowPile);
                return;

            case DFCareer.Skills.Axe:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateWeapon(Dice100.SuccessRoll(50) ? Weapons.Battle_Axe : Weapons.War_Axe, weaponMaterial)); return;

            case DFCareer.Skills.Backstabbing:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Right_Pauldron, armorMaterial)); return;

            case DFCareer.Skills.BluntWeapon:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateWeapon(Dice100.SuccessRoll(50) ? Weapons.Mace : Weapons.Flail, weaponMaterial)); return;

            case DFCareer.Skills.Climbing:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Helm, armorMaterial, -1)); return;

            case DFCareer.Skills.CriticalStrike:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Greaves, armorMaterial)); return;

            case DFCareer.Skills.Dodging:
                AddOrEquipWornItem(playerEntity, (gender == Genders.Male) ? ItemBuilder.CreateMensClothing(MensClothing.Casual_cloak, race) : ItemBuilder.CreateWomensClothing(WomensClothing.Casual_cloak, race)); return;

            case DFCareer.Skills.Etiquette:
                AddOrEquipWornItem(playerEntity, (gender == Genders.Male) ? ItemBuilder.CreateMensClothing(MensClothing.Formal_tunic, race) : ItemBuilder.CreateWomensClothing(WomensClothing.Evening_gown, race)); return;

            case DFCareer.Skills.HandToHand:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Gauntlets, armorMaterial)); return;

            case DFCareer.Skills.Jumping:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Boots, armorMaterial)); return;

            case DFCareer.Skills.Lockpicking:
                items.AddItem(ItemBuilder.CreateRandomPotion()); return;

            case DFCareer.Skills.LongBlade:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateWeapon(Dice100.SuccessRoll(50) ? Weapons.Saber : Weapons.Broadsword, weaponMaterial)); return;

            case DFCareer.Skills.Medical:
                DaggerfallUnityItem bandages = ItemBuilder.CreateItem(ItemGroups.UselessItems2, (int)UselessItems2.Bandage);
                bandages.stackCount = 4;
                items.AddItem(bandages);
                return;

            case DFCareer.Skills.Mercantile:
                items.AddItem(ItemBuilder.CreateGoldPieces(UnityEngine.Random.Range(playerEntity.Career.Luck, playerEntity.Career.Luck * 4))); return;

            case DFCareer.Skills.Pickpocket:
                items.AddItem(ItemBuilder.CreateRandomGem()); return;

            case DFCareer.Skills.Running:
                AddOrEquipWornItem(playerEntity, (gender == Genders.Male) ? ItemBuilder.CreateMensClothing(MensClothing.Shoes, race) : ItemBuilder.CreateWomensClothing(WomensClothing.Shoes, race)); return;

            case DFCareer.Skills.ShortBlade:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateWeapon(Dice100.SuccessRoll(50) ? Weapons.Shortsword : Weapons.Tanto, weaponMaterial)); return;

            case DFCareer.Skills.Stealth:
                AddOrEquipWornItem(playerEntity, (gender == Genders.Male) ? ItemBuilder.CreateMensClothing(MensClothing.Khajiit_suit, race) : ItemBuilder.CreateWomensClothing(WomensClothing.Khajiit_suit, race)); return;

            case DFCareer.Skills.Streetwise:
                AddOrEquipWornItem(playerEntity, ItemBuilder.CreateArmor(gender, race, Armor.Cuirass, armorMaterial)); return;

            case DFCareer.Skills.Swimming:
                items.AddItem((gender == Genders.Male) ? ItemBuilder.CreateMensClothing(MensClothing.Loincloth, race) : ItemBuilder.CreateWomensClothing(WomensClothing.Loincloth, race)); return;

            case DFCareer.Skills.Daedric:
            case DFCareer.Skills.Dragonish:
            case DFCareer.Skills.Giantish:
            case DFCareer.Skills.Harpy:
            case DFCareer.Skills.Impish:
            case DFCareer.Skills.Orcish:
                items.AddItem(ItemBuilder.CreateRandomBook());
                for (int i = 0; i < 4; i++)
                {
                    items.AddItem(ItemBuilder.CreateRandomIngredient(ItemGroups.CreatureIngredients1));
                }
                return;

            case DFCareer.Skills.Centaurian:
            case DFCareer.Skills.Nymph:
            case DFCareer.Skills.Spriggan:
                items.AddItem(ItemBuilder.CreateRandomBook());
                for (int i = 0; i < 4; i++)
                {
                    items.AddItem(ItemBuilder.CreateRandomIngredient(ItemGroups.PlantIngredients1));
                }
                return;
            }
        }
        /// <summary>
        /// Converts armor material to appropriate dye colour.
        /// </summary>
        /// <param name="material">ArmorMaterialTypes.</param>
        /// <returns>DyeColors.</returns>
        public DyeColors GetArmorDyeColor(ArmorMaterialTypes material)
        {
            switch (material)
            {
                case ArmorMaterialTypes.Chain:
                case ArmorMaterialTypes.Chain2:
                    return DyeColors.Chain;
                case ArmorMaterialTypes.Iron:
                    return DyeColors.Iron;
                case ArmorMaterialTypes.Steel:
                    return DyeColors.Steel;
                case ArmorMaterialTypes.Silver:
                case ArmorMaterialTypes.Elven:
                    return DyeColors.SilverOrElven;
                case ArmorMaterialTypes.Dwarven:
                    return DyeColors.Dwarven;
                case ArmorMaterialTypes.Mithril:
                    return DyeColors.Mithril;
                case ArmorMaterialTypes.Adamantium:
                    return DyeColors.Adamantium;
                case ArmorMaterialTypes.Ebony:
                    return DyeColors.Ebony;
                case ArmorMaterialTypes.Orcish:
                    return DyeColors.Orcish;
                case ArmorMaterialTypes.Daedric:
                    return DyeColors.Daedric;
                default:
                    return DyeColors.Unchanged;

            }
        }
예제 #23
0
 /// <summary>
 /// Gets name of armor material type.
 /// </summary>
 /// <param name="material">Material type of armor.</param>
 /// <returns>String for armor material name.</returns>
 public virtual string GetArmorMaterialName(ArmorMaterialTypes material)
 {
     return(fallback.GetArmorMaterialName(material));
 }
        public string GetArmorMaterialName(ArmorMaterialTypes material)
        {
            switch (material)
            {
                case ArmorMaterialTypes.Leather:
                    return "Leather";
                case ArmorMaterialTypes.Chain:
                case ArmorMaterialTypes.Chain2:
                    return "Chain";
                case ArmorMaterialTypes.Iron:
                    return "Iron";
                case ArmorMaterialTypes.Steel:
                    return "Steel";
                case ArmorMaterialTypes.Silver:
                    return "Silver";
                case ArmorMaterialTypes.Elven:
                    return "Elven";
                case ArmorMaterialTypes.Dwarven:
                    return "Dwarven";
                case ArmorMaterialTypes.Mithril:
                    return "Mithril";
                case ArmorMaterialTypes.Adamantium:
                    return "Adamantium";
                case ArmorMaterialTypes.Ebony:
                    return "Ebony";
                case ArmorMaterialTypes.Orcish:
                    return "Orcish";
                case ArmorMaterialTypes.Daedric:
                    return "Daedric";
            }

            // Standard material type value not found.
            // Try again using material value masked to material type only.
            // Some save editors will not write back correct material mask, so we must try to handle this if possible.
            // Clamping range so we don't end up in infinite loop.
            int value = (int)material >> 8;
            value = Mathf.Clamp(value, (int)ArmorMaterialTypes.Iron, (int)ArmorMaterialTypes.Daedric);
            return GetArmorMaterialName((ArmorMaterialTypes)value);
        }
예제 #25
0
        public void StockShopShelf(PlayerGPS.DiscoveredBuilding buildingData)
        {
            stockedDate = CreateStockedDate(DaggerfallUnity.Instance.WorldTime.Now);
            items.Clear();

            DFLocation.BuildingTypes buildingType = buildingData.buildingType;
            int shopQuality = buildingData.quality;

            Game.Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
            ItemHelper itemHelper = DaggerfallUnity.Instance.ItemHelper;

            byte[] itemGroups = { 0 };

            switch (buildingType)
            {
            case DFLocation.BuildingTypes.Alchemist:
                itemGroups = DaggerfallLootDataTables.itemGroupsAlchemist;
                RandomlyAddPotionRecipe(25, items);
                break;

            case DFLocation.BuildingTypes.Armorer:
                itemGroups = DaggerfallLootDataTables.itemGroupsArmorer;
                break;

            case DFLocation.BuildingTypes.Bookseller:
                itemGroups = DaggerfallLootDataTables.itemGroupsBookseller;
                break;

            case DFLocation.BuildingTypes.ClothingStore:
                itemGroups = DaggerfallLootDataTables.itemGroupsClothingStore;
                break;

            case DFLocation.BuildingTypes.GemStore:
                itemGroups = DaggerfallLootDataTables.itemGroupsGemStore;
                break;

            case DFLocation.BuildingTypes.GeneralStore:
                itemGroups = DaggerfallLootDataTables.itemGroupsGeneralStore;
                items.AddItem(ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Horse));
                items.AddItem(ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Small_cart));
                break;

            case DFLocation.BuildingTypes.PawnShop:
                itemGroups = DaggerfallLootDataTables.itemGroupsPawnShop;
                break;

            case DFLocation.BuildingTypes.WeaponSmith:
                itemGroups = DaggerfallLootDataTables.itemGroupsWeaponSmith;
                break;
            }

            for (int i = 0; i < itemGroups.Length; i += 2)
            {
                ItemGroups itemGroup = (ItemGroups)itemGroups[i];
                int        chanceMod = itemGroups[i + 1];
                if (itemGroup == ItemGroups.MensClothing && playerEntity.Gender == Game.Entity.Genders.Female)
                {
                    itemGroup = ItemGroups.WomensClothing;
                }
                if (itemGroup == ItemGroups.WomensClothing && playerEntity.Gender == Game.Entity.Genders.Male)
                {
                    itemGroup = ItemGroups.MensClothing;
                }

                if (itemGroup != ItemGroups.Furniture && itemGroup != ItemGroups.UselessItems1)
                {
                    if (itemGroup == ItemGroups.Books)
                    {
                        int qualityMod = (shopQuality + 3) / 5;
                        if (qualityMod >= 4)
                        {
                            --qualityMod;
                        }
                        qualityMod++;
                        for (int j = 0; j <= qualityMod; ++j)
                        {
                            items.AddItem(ItemBuilder.CreateRandomBook());
                        }
                    }
                    else
                    {
                        System.Array enumArray = itemHelper.GetEnumArray(itemGroup);
                        for (int j = 0; j < enumArray.Length; ++j)
                        {
                            ItemTemplate itemTemplate = itemHelper.GetItemTemplate(itemGroup, j);
                            if (itemTemplate.rarity <= shopQuality)
                            {
                                int stockChance = chanceMod * 5 * (21 - itemTemplate.rarity) / 100;
                                if (Dice100.SuccessRoll(stockChance))
                                {
                                    DaggerfallUnityItem item = null;
                                    if (itemGroup == ItemGroups.Weapons)
                                    {
                                        item = ItemBuilder.CreateWeapon(j + Weapons.Dagger, FormulaHelper.RandomMaterial(playerEntity.Level));
                                    }
                                    else if (itemGroup == ItemGroups.Armor)
                                    {
                                        item = ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, j + Armor.Cuirass, FormulaHelper.RandomArmorMaterial(playerEntity.Level));
                                    }
                                    else if (itemGroup == ItemGroups.MensClothing)
                                    {
                                        item          = ItemBuilder.CreateMensClothing(j + MensClothing.Straps, playerEntity.Race);
                                        item.dyeColor = ItemBuilder.RandomClothingDye();
                                    }
                                    else if (itemGroup == ItemGroups.WomensClothing)
                                    {
                                        item          = ItemBuilder.CreateWomensClothing(j + WomensClothing.Brassier, playerEntity.Race);
                                        item.dyeColor = ItemBuilder.RandomClothingDye();
                                    }
                                    else if (itemGroup == ItemGroups.MagicItems)
                                    {
                                        item = ItemBuilder.CreateRandomMagicItem(playerEntity.Level, playerEntity.Gender, playerEntity.Race);
                                    }
                                    else
                                    {
                                        item = new DaggerfallUnityItem(itemGroup, j);
                                        if (DaggerfallUnity.Settings.PlayerTorchFromItems && item.IsOfTemplate(ItemGroups.UselessItems2, (int)UselessItems2.Oil))
                                        {
                                            item.stackCount = Random.Range(5, 20 + 1);  // Shops stock 5-20 bottles
                                        }
                                    }
                                    items.AddItem(item);
                                }
                            }
                        }
                        // Add any modded items registered in applicable groups
                        int[] customItemTemplates = itemHelper.GetCustomItemsForGroup(itemGroup);
                        for (int j = 0; j < customItemTemplates.Length; j++)
                        {
                            ItemTemplate itemTemplate = itemHelper.GetItemTemplate(itemGroup, customItemTemplates[j]);
                            if (itemTemplate.rarity <= shopQuality)
                            {
                                int stockChance = chanceMod * 5 * (21 - itemTemplate.rarity) / 100;
                                if (Dice100.SuccessRoll(stockChance))
                                {
                                    DaggerfallUnityItem item = ItemBuilder.CreateItem(itemGroup, customItemTemplates[j]);

                                    // Setup specific group stats
                                    if (itemGroup == ItemGroups.Weapons)
                                    {
                                        WeaponMaterialTypes material = FormulaHelper.RandomMaterial(playerEntity.Level);
                                        ItemBuilder.ApplyWeaponMaterial(item, material);
                                    }
                                    else if (itemGroup == ItemGroups.Armor)
                                    {
                                        ArmorMaterialTypes material = FormulaHelper.RandomArmorMaterial(playerEntity.Level);
                                        ItemBuilder.ApplyArmorSettings(item, playerEntity.Gender, playerEntity.Race, material);
                                    }

                                    items.AddItem(item);
                                }
                            }
                        }
                    }
                }
            }
        }