private static WorldObject CreateArmor(TreasureDeath profile, bool isMagical, bool isArmor, LootBias lootBias = LootBias.UnBiased, bool mutate = true) { var minType = LootTables.ArmorType.Helms; LootTables.ArmorType maxType; switch (profile.Tier) { case 1: default: maxType = LootTables.ArmorType.ChainmailArmor; break; case 2: maxType = LootTables.ArmorType.DiforsaArmor; break; case 3: case 4: maxType = LootTables.ArmorType.CovenantArmor; break; case 5: maxType = LootTables.ArmorType.AlduressaArmor; break; case 6: maxType = LootTables.ArmorType.HaebreanArmor; break; case 7: case 8: maxType = LootTables.ArmorType.OlthoiAlduressaArmor; break; } // Added for making clothing drops their own drop, and not involved in armor roll chance LootTables.ArmorType armorType; if (isArmor) { armorType = (LootTables.ArmorType)ThreadSafeRandom.Next((int)minType, (int)maxType); } else { armorType = LootTables.ArmorType.MiscClothing; } int[] table = LootTables.GetLootTable(armorType); int rng = ThreadSafeRandom.Next(0, table.Length - 1); int armorWeenie = table[rng]; WorldObject wo = WorldObjectFactory.CreateNewWorldObject((uint)armorWeenie); if (wo != null && mutate) { MutateArmor(wo, profile, isMagical, armorType); } return(wo); }
private static WorldObject CreateArmor(int tier, bool isMagical, LootBias lootBias = LootBias.UnBiased) { var minType = LootTables.ArmorType.MiscClothing; var maxType = new LootTables.ArmorType(); switch (tier) { case 1: default: maxType = LootTables.ArmorType.ChainmailArmor; break; case 2: maxType = LootTables.ArmorType.DiforsaArmor; break; case 3: case 4: maxType = LootTables.ArmorType.CovenantArmor; break; case 5: maxType = LootTables.ArmorType.AlduressaArmor; break; case 6: maxType = LootTables.ArmorType.HaebreanArmor; break; case 7: case 8: maxType = LootTables.ArmorType.OlthoiAlduressaArmor; // armor Mana Forge Chests don't include clothing type items if (lootBias == LootBias.Armor) { minType = LootTables.ArmorType.Helms; } break; } var armorType = (LootTables.ArmorType)ThreadSafeRandom.Next((int)minType, (int)maxType); int[] table = LootTables.GetLootTable(armorType); int rng = ThreadSafeRandom.Next(0, table.Length - 1); int armorWeenie = table[rng]; WorldObject wo = WorldObjectFactory.CreateNewWorldObject((uint)armorWeenie); if (wo == null) { return(null); } wo.SetProperty(PropertyString.LongDesc, wo.GetProperty(PropertyString.Name)); wo.SetProperty(PropertyInt.AppraisalItemSkill, 7); wo.SetProperty(PropertyInt.AppraisalLongDescDecoration, 1); int materialType = GetMaterialType(wo, tier); if (materialType > 0) { wo.MaterialType = (MaterialType)materialType; } int gemCount = ThreadSafeRandom.Next(1, 6); int gemType = ThreadSafeRandom.Next(10, 50); wo.SetProperty(PropertyInt.GemCount, gemCount); wo.SetProperty(PropertyInt.GemType, gemType); int workmanship = GetWorkmanship(tier); wo.SetProperty(PropertyInt.ItemWorkmanship, workmanship); double materialMod = LootTables.getMaterialValueModifier(wo); double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo); var value = GetValue(tier, workmanship, gemMaterialMod, materialMod); wo.Value = value; int wield; if (tier > 6 && armorType != LootTables.ArmorType.CovenantArmor) { wo.SetProperty(PropertyInt.WieldRequirements, (int)WieldRequirement.Level); wo.SetProperty(PropertyInt.WieldSkillType, (int)Skill.Axe); // Set by examples from PCAP data switch (tier) { case 7: wield = 150; // In this instance, used for indicating player level, rather than skill level break; default: wield = 180; // In this instance, used for indicating player level, rather than skill level break; } wo.SetProperty(PropertyInt.WieldDifficulty, wield); } if (armorType == LootTables.ArmorType.CovenantArmor) { Skill wieldSkill; int chance = ThreadSafeRandom.Next(1, 3); switch (chance) { case 1: // Magic Def wieldSkill = Skill.MagicDefense; break; case 2: // Missile Def wieldSkill = Skill.MissileDefense; break; default: // Melee Def wieldSkill = Skill.MeleeDefense; break; } wield = GetCovenantWieldReq(tier, wieldSkill); wo.SetProperty(PropertyInt.WieldRequirements, (int)WieldRequirement.RawSkill); wo.SetProperty(PropertyInt.WieldSkillType, (int)wieldSkill); wo.SetProperty(PropertyInt.WieldDifficulty, wield); } // Setting random color wo.SetProperty(PropertyInt.PaletteTemplate, ThreadSafeRandom.Next(1, 2047)); double shade = .1 * ThreadSafeRandom.Next(0, 9); wo.SetProperty(PropertyFloat.Shade, shade); wo = AssignArmorLevel(wo, tier, armorType); wo = AssignEquipmentSetId(wo, tier); if (isMagical) { wo = AssignMagic(wo, tier); } else { wo.RemoveProperty(PropertyInt.ItemManaCost); wo.RemoveProperty(PropertyInt.ItemMaxMana); wo.RemoveProperty(PropertyInt.ItemCurMana); wo.RemoveProperty(PropertyInt.ItemSpellcraft); wo.RemoveProperty(PropertyInt.ItemDifficulty); } wo = RandomizeColor(wo); return(wo); }
private static WorldObject CreateArmor(TreasureDeath profile, bool isMagical, bool isArmor, LootBias lootBias = LootBias.UnBiased) { var minType = LootTables.ArmorType.Helms; var maxType = new LootTables.ArmorType(); switch (profile.Tier) { case 1: default: maxType = LootTables.ArmorType.ChainmailArmor; break; case 2: maxType = LootTables.ArmorType.DiforsaArmor; break; case 3: case 4: maxType = LootTables.ArmorType.CovenantArmor; break; case 5: maxType = LootTables.ArmorType.AlduressaArmor; break; case 6: maxType = LootTables.ArmorType.HaebreanArmor; break; case 7: case 8: maxType = LootTables.ArmorType.OlthoiAlduressaArmor; break; } // Added for making clothing drops their own drop, and not involved in armor roll chance LootTables.ArmorType armorType; if (isArmor == true) { armorType = (LootTables.ArmorType)ThreadSafeRandom.Next((int)minType, (int)maxType); } else { armorType = LootTables.ArmorType.MiscClothing; } int[] table = LootTables.GetLootTable(armorType); int rng = ThreadSafeRandom.Next(0, table.Length - 1); int armorWeenie = table[rng]; WorldObject wo = WorldObjectFactory.CreateNewWorldObject((uint)armorWeenie); if (wo == null) { return(null); } wo.SetProperty(PropertyString.LongDesc, wo.GetProperty(PropertyString.Name)); wo.SetProperty(PropertyInt.AppraisalItemSkill, 7); wo.SetProperty(PropertyInt.AppraisalLongDescDecoration, 1); int materialType = GetMaterialType(wo, profile.Tier); if (materialType > 0) { wo.MaterialType = (MaterialType)materialType; } int gemCount = ThreadSafeRandom.Next(1, 6); int gemType = ThreadSafeRandom.Next(10, 50); wo.SetProperty(PropertyInt.GemCount, gemCount); wo.SetProperty(PropertyInt.GemType, gemType); int workmanship = GetWorkmanship(profile.Tier); wo.SetProperty(PropertyInt.ItemWorkmanship, workmanship); double materialMod = LootTables.getMaterialValueModifier(wo); double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo); var value = GetValue(profile.Tier, workmanship, gemMaterialMod, materialMod); wo.Value = value; int wield; if (profile.Tier > 6 && armorType != LootTables.ArmorType.CovenantArmor) { wo.SetProperty(PropertyInt.WieldRequirements, (int)WieldRequirement.Level); wo.SetProperty(PropertyInt.WieldSkillType, (int)Skill.Axe); // Set by examples from PCAP data wield = profile.Tier switch { 7 => 150, // In this instance, used for indicating player level, rather than skill level _ => 180, // In this instance, used for indicating player level, rather than skill level }; wo.SetProperty(PropertyInt.WieldDifficulty, wield); } if (armorType == LootTables.ArmorType.CovenantArmor) { int chance = ThreadSafeRandom.Next(1, 3); var wieldSkill = chance switch { // Magic Def 1 => Skill.MagicDefense, // Missile Def 2 => Skill.MissileDefense, // Melee Def _ => Skill.MeleeDefense, }; wield = GetCovenantWieldReq(profile.Tier, wieldSkill); wo.SetProperty(PropertyInt.WieldRequirements, (int)WieldRequirement.RawSkill); wo.SetProperty(PropertyInt.WieldSkillType, (int)wieldSkill); wo.SetProperty(PropertyInt.WieldDifficulty, wield); } // Setting random color wo.SetProperty(PropertyInt.PaletteTemplate, ThreadSafeRandom.Next(1, 2047)); double shade = .1 * ThreadSafeRandom.Next(0, 9); wo.SetProperty(PropertyFloat.Shade, shade); wo = AssignArmorLevel(wo, profile.Tier, armorType); wo = AssignEquipmentSetId(wo, profile); if (isMagical) { bool covenantArmor = false || (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor); wo = AssignMagic(wo, profile, covenantArmor); } else { wo.RemoveProperty(PropertyInt.ItemManaCost); wo.RemoveProperty(PropertyInt.ItemMaxMana); wo.RemoveProperty(PropertyInt.ItemCurMana); wo.RemoveProperty(PropertyInt.ItemSpellcraft); wo.RemoveProperty(PropertyInt.ItemDifficulty); } wo = RandomizeColor(wo); return(wo); }
private static WorldObject CreateArmor(int tier, bool isMagical, bool isArmor, LootBias lootBias = LootBias.UnBiased) { var minType = LootTables.ArmorType.Helms; var maxType = new LootTables.ArmorType(); switch (tier) { case 1: default: maxType = LootTables.ArmorType.ChainmailArmor; break; case 2: maxType = LootTables.ArmorType.DiforsaArmor; break; case 3: case 4: maxType = LootTables.ArmorType.CovenantArmor; break; case 5: maxType = LootTables.ArmorType.AlduressaArmor; break; case 6: maxType = LootTables.ArmorType.HaebreanArmor; break; case 7: case 8: maxType = LootTables.ArmorType.OlthoiAlduressaArmor; break; } // Added for making clothing drops their own drop, and not involved in armor roll chance LootTables.ArmorType armorType; if (isArmor == true) { armorType = (LootTables.ArmorType)ThreadSafeRandom.Next((int)minType, (int)maxType); } else { armorType = LootTables.ArmorType.MiscClothing; } int[] table = LootTables.GetLootTable(armorType); int rng = ThreadSafeRandom.Next(0, table.Length - 1); int armorWeenie = table[rng]; WorldObject wo = WorldObjectFactory.CreateNewWorldObject((uint)armorWeenie); if (wo == null) { return(null); } wo.SetProperty(PropertyString.LongDesc, wo.GetProperty(PropertyString.Name)); wo.SetProperty(PropertyInt.AppraisalItemSkill, 7); wo.SetProperty(PropertyInt.AppraisalLongDescDecoration, 1); int materialType = GetMaterialType(wo, tier); if (materialType > 0) { wo.MaterialType = (MaterialType)materialType; } int gemCount = ThreadSafeRandom.Next(1, 6); int gemType = ThreadSafeRandom.Next(10, 50); wo.SetProperty(PropertyInt.GemCount, gemCount); wo.SetProperty(PropertyInt.GemType, gemType); int workmanship = GetWorkmanship(tier); wo.SetProperty(PropertyInt.ItemWorkmanship, workmanship);