private void AddFurnitureAction(DFBlock.RmbBlock3dObjectRecord obj, GameObject go, PlayerGPS.DiscoveredBuilding buildingData) { // Create unique LoadID for save system, using 9 lsb and the sign bit from each coord pos int ulong loadID = ((ulong)buildingData.buildingKey) << 30 | (uint)(obj.XPos << 1 & posMask) << 20 | (uint)(obj.YPos << 1 & posMask) << 10 | (uint)(obj.ZPos << 1 & posMask); DFLocation.BuildingTypes buildingType = buildingData.buildingType; // Handle shelves: if (shopShelvesObjectGroupIndices.Contains(obj.ModelIdNum - containerObjectGroupOffset)) { if (RMBLayout.IsShop(buildingType)) { // Shop shelves, so add a DaggerfallLoot component DaggerfallLoot loot = go.AddComponent <DaggerfallLoot>(); if (loot) { // Set as shelves, assign load id and create serialization object loot.ContainerType = LootContainerTypes.ShopShelves; loot.ContainerImage = InventoryContainerImages.Shelves; loot.LoadID = loadID; if (SaveLoadManager.Instance != null) { go.AddComponent <SerializableLootContainer>(); } } } else if (buildingType == DFLocation.BuildingTypes.Library || buildingType == DFLocation.BuildingTypes.GuildHall || buildingType == DFLocation.BuildingTypes.Temple) { // Bookshelves, add DaggerfallBookshelf component go.AddComponent <DaggerfallBookshelf>(); } else if (DaggerfallBankManager.IsHouseOwned(buildingData.buildingKey)) { // Player owned house, everything is a house container MakeHouseContainer(obj, go, loadID); } } // Handle generic furniture as (private) house containers: // (e.g. shelves, boxes, wardrobes, drawers etc) else if (obj.ModelIdNum / 100 == houseContainerObjectGroup || houseContainerObjectGroupIndices.Contains(obj.ModelIdNum - containerObjectGroupOffset)) { MakeHouseContainer(obj, go, loadID); } }
/// <summary> /// Add interior flats. /// </summary> private void AddFlats(PlayerGPS.DiscoveredBuilding buildingData) { GameObject node = new GameObject("Interior Flats"); node.transform.parent = this.transform; // Add block flats markers.Clear(); foreach (DFBlock.RmbBlockFlatObjectRecord obj in recordData.Interior.BlockFlatObjectRecords) { // Calculate position Vector3 billboardPosition = new Vector3(obj.XPos, -obj.YPos, obj.ZPos) * MeshReader.GlobalScale; // Import custom 3d gameobject instead of flat if (MeshReplacement.ImportCustomFlatGameobject(obj.TextureArchive, obj.TextureRecord, billboardPosition, node.transform) != null) { continue; } // Spawn billboard gameobject GameObject go = GameObjectHelper.CreateDaggerfallBillboardGameObject(obj.TextureArchive, obj.TextureRecord, node.transform); // Set position DaggerfallBillboard dfBillboard = go.GetComponent <DaggerfallBillboard>(); go.transform.position = billboardPosition; go.transform.position += new Vector3(0, dfBillboard.Summary.Size.y / 2, 0); // Add editor markers to list if (obj.TextureArchive == TextureReader.EditorFlatsTextureArchive) { InteriorEditorMarker marker = new InteriorEditorMarker(); marker.type = (InteriorMarkerTypes)obj.TextureRecord; marker.gameObject = go; markers.Add(marker); // Add loot containers for treasure markers (always use pile of clothes icon) if (marker.type == InteriorMarkerTypes.Treasure) { // Create unique LoadID for save system, using 9 lsb and the sign bit from each coord pos int ulong loadID = ((ulong)buildingData.buildingKey) << 30 | (uint)(obj.XPos << 1 & posMask) << 20 | (uint)(obj.YPos << 1 & posMask) << 10 | (uint)(obj.ZPos << 1 & posMask); DaggerfallLoot loot = GameObjectHelper.CreateLootContainer( LootContainerTypes.RandomTreasure, InventoryContainerImages.Chest, billboardPosition, node.transform, DaggerfallLootDataTables.clothingArchive, 0, loadID); if (!LootTables.GenerateLoot(loot, (int)GameManager.Instance.PlayerGPS.CurrentLocationType)) { DaggerfallUnity.LogMessage(string.Format("DaggerfallInterior: Location type {0} is out of range or unknown.", GameManager.Instance.PlayerGPS.CurrentLocationType), true); } } } // Add point lights if (obj.TextureArchive == TextureReader.LightsTextureArchive) { AddLight(obj, go.transform); } } }
/// <summary> /// Layout interior based on data in exterior door and optional location for climate settings. /// </summary> /// <param name="doorOwner">Parent transform owning door array.</param> /// <param name="door">Exterior door player clicked on.</param> /// <returns>True if successful.</returns> public bool DoLayout(Transform doorOwner, StaticDoor door, ClimateBases climateBase, PlayerGPS.DiscoveredBuilding buildingData) { if (dfUnity == null) { dfUnity = DaggerfallUnity.Instance; } // Use specified climate this.climateBase = climateBase; // Save exterior information this.entryDoor = door; this.doorOwner = doorOwner; // Get block data blockData = dfUnity.ContentReader.BlockFileReader.GetBlock(door.blockIndex); if (blockData.Type != DFBlock.BlockTypes.Rmb) { throw new Exception(string.Format("Could not load RMB block index {0}", door.blockIndex), null); } // Get record data recordData = blockData.RmbBlock.SubRecords[door.recordIndex]; if (recordData.Interior.Header.Num3dObjectRecords == 0) { throw new Exception(string.Format("No interior 3D models found for record index {0}", door.recordIndex), null); } // Layout interior data AddModels(buildingData); AddFlats(buildingData); AddPeople(buildingData); AddActionDoors(); AddSpawnPoints(); return(true); }
/// <summary> /// Add interior models. /// </summary> private void AddModels(PlayerGPS.DiscoveredBuilding buildingData) { List <StaticDoor> doors = new List <StaticDoor>(); GameObject node = new GameObject("Models"); GameObject doorsNode = new GameObject("Doors"); node.transform.parent = this.transform; doorsNode.transform.parent = this.transform; // Iterate through models in this subrecord combiner.NewCombiner(); foreach (DFBlock.RmbBlock3dObjectRecord obj in recordData.Interior.Block3dObjectRecords) { bool stopCombine = false; // Get model data ModelData modelData; dfUnity.MeshReader.GetModelData(obj.ModelIdNum, out modelData); // Get model position by type (3 seems to indicate props/clutter) // Also stop these from being combined as some may carry a loot container Vector3 modelPosition; if (obj.ObjectType == propModelType) { // Props axis needs to be transformed to lowest Y point Vector3 bottom = modelData.Vertices[0]; for (int i = 0; i < modelData.Vertices.Length; i++) { if (modelData.Vertices[i].y < bottom.y) { bottom = modelData.Vertices[i]; } } modelPosition = new Vector3(obj.XPos, obj.YPos, obj.ZPos) * MeshReader.GlobalScale; modelPosition += new Vector3(0, -bottom.y, 0); stopCombine = true; } else { modelPosition = new Vector3(obj.XPos, -obj.YPos, obj.ZPos) * MeshReader.GlobalScale; } // Stop special object from being combined if (obj.ModelIdNum == ladderModelId) { stopCombine = true; } // Get model transform Vector3 modelRotation = new Vector3(0, -obj.YRotation / BlocksFile.RotationDivisor, 0); Matrix4x4 modelMatrix = Matrix4x4.TRS(modelPosition, Quaternion.Euler(modelRotation), Vector3.one); // Does this model have doors? if (modelData.Doors != null) { doors.AddRange(GameObjectHelper.GetStaticDoors(ref modelData, entryDoor.blockIndex, entryDoor.recordIndex, modelMatrix)); } // Inject custom GameObject if available GameObject go = MeshReplacement.ImportCustomGameobject(obj.ModelIdNum, node.transform, modelMatrix); // Otherwise use Daggerfall mesh - combine or add if (!go) { if (dfUnity.Option_CombineRMB && !stopCombine) { combiner.Add(ref modelData, modelMatrix); } else { // Add individual GameObject go = GameObjectHelper.CreateDaggerfallMeshGameObject(obj.ModelIdNum, node.transform, dfUnity.Option_SetStaticFlags); go.transform.position = modelMatrix.GetColumn(3); go.transform.rotation = GameObjectHelper.QuaternionFromMatrix(modelMatrix); // Update climate DaggerfallMesh dfMesh = go.GetComponent <DaggerfallMesh>(); dfMesh.SetClimate(climateBase, climateSeason, WindowStyle.Disabled); } } // Make ladder collider convex if (obj.ModelIdNum == ladderModelId) { var meshCollider = go.GetComponent <MeshCollider>(); if (meshCollider) { meshCollider.convex = true; } go.AddComponent <DaggerfallLadder>(); } // Optionally add action objects to specific furniture items (e.g. loot containers), except when laying out map (buildingType=AllValid) if (obj.ObjectType == propModelType && buildingData.buildingType != DFLocation.BuildingTypes.AllValid) { AddFurnitureAction(obj, go, buildingData); } } // Add combined GameObject if (dfUnity.Option_CombineRMB) { if (combiner.VertexCount > 0) { combiner.Apply(); GameObject go = GameObjectHelper.CreateCombinedMeshGameObject(combiner, "CombinedModels", node.transform, dfUnity.Option_SetStaticFlags); // Update climate DaggerfallMesh dfMesh = go.GetComponent <DaggerfallMesh>(); dfMesh.SetClimate(climateBase, climateSeason, WindowStyle.Disabled); } } // Add static doors component DaggerfallStaticDoors c = this.gameObject.AddComponent <DaggerfallStaticDoors>(); c.Doors = doors.ToArray(); }
/// <summary> /// Layout interior based on data in exterior door and optional location for climate settings. /// </summary> /// <param name="doorOwner">Parent transform owning door array.</param> /// <param name="door">Exterior door player clicked on.</param> /// <returns>True if successful.</returns> public bool DoLayout(Transform doorOwner, StaticDoor door, ClimateBases climateBase, PlayerGPS.DiscoveredBuilding buildingData) { if (dfUnity == null) { dfUnity = DaggerfallUnity.Instance; } // Use specified climate this.climateBase = climateBase; // Save exterior information this.entryDoor = door; this.doorOwner = doorOwner; AssignBlockData(door); // Layout interior data AddModels(buildingData); AddFlats(buildingData); AddPeople(buildingData); AddActionDoors(); AddSpawnPoints(); return(true); }
public void StockHouseContainer(PlayerGPS.DiscoveredBuilding buildingData) { stockedDate = CreateStockedDate(DaggerfallUnity.Instance.WorldTime.Now); items.Clear(); DFLocation.BuildingTypes buildingType = buildingData.buildingType; uint modelIndex = (uint)TextureRecord; //int buildingQuality = buildingData.quality; byte[] privatePropertyList = null; DaggerfallUnityItem item = null; Game.Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; if (buildingType < DFLocation.BuildingTypes.House5) { if (modelIndex >= 2) { if (modelIndex >= 4) { if (modelIndex >= 11) { if (modelIndex >= 15) { privatePropertyList = DaggerfallLootDataTables.privatePropertyItemsModels15AndUp[(int)buildingType]; } else { privatePropertyList = DaggerfallLootDataTables.privatePropertyItemsModels11to14[(int)buildingType]; } } else { privatePropertyList = DaggerfallLootDataTables.privatePropertyItemsModels4to10[(int)buildingType]; } } else { privatePropertyList = DaggerfallLootDataTables.privatePropertyItemsModels2to3[(int)buildingType]; } } else { privatePropertyList = DaggerfallLootDataTables.privatePropertyItemsModels0to1[(int)buildingType]; } if (privatePropertyList == null) { return; } int randomChoice = Random.Range(0, privatePropertyList.Length); ItemGroups itemGroup = (ItemGroups)privatePropertyList[randomChoice]; int continueChance = 100; bool keepGoing = true; while (keepGoing) { if (itemGroup != ItemGroups.MensClothing && itemGroup != ItemGroups.WomensClothing) { if (itemGroup == ItemGroups.MagicItems) { item = ItemBuilder.CreateRandomMagicItem(playerEntity.Level, playerEntity.Gender, playerEntity.Race); } else if (itemGroup == ItemGroups.Books) { item = ItemBuilder.CreateRandomBook(); } else { if (itemGroup == ItemGroups.Weapons) { item = ItemBuilder.CreateRandomWeapon(playerEntity.Level); } else if (itemGroup == ItemGroups.Armor) { item = ItemBuilder.CreateRandomArmor(playerEntity.Level, playerEntity.Gender, playerEntity.Race); } else { System.Array enumArray = DaggerfallUnity.Instance.ItemHelper.GetEnumArray(itemGroup); item = new DaggerfallUnityItem(itemGroup, Random.Range(0, enumArray.Length)); } } } else { item = ItemBuilder.CreateRandomClothing(playerEntity.Gender, playerEntity.Race); } continueChance >>= 1; if (DFRandom.rand() % 100 > continueChance) { keepGoing = false; } items.AddItem(item); } } }
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); } } } } } } }
/// <summary> /// Add interior people flats. /// </summary> private void AddPeople(PlayerGPS.DiscoveredBuilding buildingData) { GameObject node = new GameObject(peopleFlats); node.transform.parent = this.transform; IGuild guild = GameManager.Instance.GuildManager.GetGuild(buildingData.factionID); bool isMemberOfBuildingGuild = guild.IsMember(); // Add block flats foreach (DFBlock.RmbBlockPeopleRecord obj in recordData.Interior.BlockPeopleRecords) { // Calculate position Vector3 billboardPosition = new Vector3(obj.XPos, -obj.YPos, obj.ZPos) * MeshReader.GlobalScale; // Make person gameobject GameObject go = MeshReplacement.ImportCustomFlatGameobject(obj.TextureArchive, obj.TextureRecord, billboardPosition, node.transform); if (!go) { // Spawn billboard gameobject go = GameObjectHelper.CreateDaggerfallBillboardGameObject(obj.TextureArchive, obj.TextureRecord, node.transform); // Handle non-classic textures, which may not have had their collision component added if (!go.GetComponent <Collider>()) { Collider col = go.AddComponent <BoxCollider>(); col.isTrigger = true; } // Set position Billboard dfBillboard = go.GetComponent <Billboard>(); go.transform.position = billboardPosition; go.transform.position += new Vector3(0, dfBillboard.Summary.Size.y / 2, 0); // Add RMB data to billboard dfBillboard.SetRMBPeopleData(obj); } else { Billboard dfBillboard = go.GetComponent <Billboard>(); if (dfBillboard) { dfBillboard.SetRMBPeopleData(obj); } } // Add StaticNPC behaviour StaticNPC npc = go.AddComponent <StaticNPC>(); npc.SetLayoutData(obj, entryDoor.buildingKey); // Disable people if shop or building is closed DFLocation.BuildingTypes buildingType = buildingData.buildingType; if ((RMBLayout.IsShop(buildingType) && !GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop) || (buildingType <= DFLocation.BuildingTypes.Palace && !RMBLayout.IsShop(buildingType) && !(PlayerActivate.IsBuildingOpen(buildingType) || buildingType == DFLocation.BuildingTypes.GuildHall && guild.HallAccessAnytime()))) { go.SetActive(false); } // Disable people if player owns this house else if (DaggerfallBankManager.IsHouseOwned(buildingData.buildingKey)) { go.SetActive(false); } // Disable people if this is TG/DB house and player is not a member else if (buildingData.buildingType == DFLocation.BuildingTypes.House2 && buildingData.factionID != 0 && !isMemberOfBuildingGuild) { go.SetActive(false); } } }
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; 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 = DaggerfallUnity.Instance.ItemHelper.GetEnumArray(itemGroup); for (int j = 0; j < enumArray.Length; ++j) { DaggerfallConnect.FallExe.ItemTemplate itemTemplate = DaggerfallUnity.Instance.ItemHelper.GetItemTemplate(itemGroup, j); if (itemTemplate.rarity <= shopQuality) { int stockChance = chanceMod * 5 * (21 - itemTemplate.rarity) / 100; if (Random.Range(1, 101) <= stockChance) { DaggerfallUnityItem item = null; if (itemGroup == ItemGroups.Weapons) { item = ItemBuilder.CreateWeapon(j + Weapons.Dagger, ItemBuilder.RandomMaterial(playerEntity.Level)); } else if (itemGroup == ItemGroups.Armor) { item = ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, j + Armor.Cuirass, ItemBuilder.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 { item = new DaggerfallUnityItem(itemGroup, j); } items.AddItem(item); } } } } } } }