private static void MutateDinnerware(WorldObject wo, int tier)
        {
            // Dinnerware has all these options (plates, tankards, etc)
            // This is just a short-term fix until Loot is overhauled
            // TODO - Doesn't handle damage/speed/etc that the mutate engine should for these types of items.

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(tier);

            wo.LongDesc = wo.Name;

            int materialType = GetMaterialType(wo, tier);

            wo.MaterialType = (MaterialType)materialType;
            int workmanship = GetWorkmanship(tier);

            wo.ItemWorkmanship = workmanship;

            //wo = SetAppraisalLongDescDecoration(wo);

            wo = AssignValue(wo);

            MutateColor(wo);
        }
Esempio n. 2
0
        private static void MutateSocietyArmor(WorldObject wo, TreasureDeath profile, bool isMagical)
        {
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 6);
            }

            wo.GemType = RollGemType(profile.Tier);

            int workmanship = GetWorkmanship(profile.Tier);

            wo.ItemWorkmanship = workmanship;

            double materialMod    = LootTables.getMaterialValueModifier(wo);
            double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);
            var    value          = GetValue(profile.Tier, workmanship, gemMaterialMod, materialMod);

            wo.Value = value;

            // wo.WieldSkillType = (int)Skill.Axe;  // Set by examples from PCAP data

            if (isMagical)
            {
                // looks like society armor always had impen on it
                AssignMagic(wo, profile, true);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }
            wo = AssignArmorLevel(wo, profile.Tier, LootTables.ArmorType.SocietyArmor);

            wo.LongDesc = GetLongDesc(wo);

            // try mutate burden, if MutateFilter exists
            if (wo.HasMutateFilter(MutateFilter.EncumbranceVal))
            {
                MutateBurden(wo, profile, false);
            }
        }
Esempio n. 3
0
        private static void MutateDinnerware(WorldObject wo, TreasureDeath profile, bool isMagical, TreasureRoll roll = null)
        {
            // dinnerware did not have its Damage / DamageVariance / WeaponSpeed mutated

            // material type
            wo.MaterialType = GetMaterialType(wo, profile.Tier);

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // "Empty Flask" was the only dinnerware that never received spells
            if (isMagical && wo.WeenieClassId != (uint)WeenieClassName.flasksimple)
            {
                AssignMagic(wo, profile, roll);
            }

            // item value
            if (wo.HasMutateFilter(MutateFilter.Value))
            {
                MutateValue(wo, profile.Tier, roll);
            }

            // long desc
            wo.LongDesc = GetLongDesc(wo);
        }
Esempio n. 4
0
        private static void MutateArmor(WorldObject wo, TreasureDeath profile, bool isMagical, LootTables.ArmorType armorType, TreasureRoll roll = null)
        {
            // material type
            var materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 6);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // burden
            if (wo.HasMutateFilter(MutateFilter.EncumbranceVal))  // fixme: data
            {
                MutateBurden(wo, profile, false);
            }

            if (roll == null)
            {
                if (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor)
                {
                    int chance     = ThreadSafeRandom.Next(1, 3);
                    var wieldSkill = chance switch
                    {
                        1 => Skill.MagicDefense,
                        2 => Skill.MissileDefense,
                        _ => Skill.MeleeDefense,
                    };

                    wo.WieldRequirements = WieldRequirement.RawSkill;
                    wo.WieldSkillType    = (int)wieldSkill;
                    wo.WieldDifficulty   = GetCovenantWieldReq(profile.Tier, wieldSkill);
                }
                else if (profile.Tier > 6)
                {
                    wo.WieldRequirements = WieldRequirement.Level;
                    wo.WieldSkillType    = (int)Skill.Axe; // Set by examples from PCAP data

                    wo.WieldDifficulty = 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
                    };
                }
            }
            else if (profile.Tier > 6 && !wo.HasArmorLevel())
            {
                // normally this is handled in the mutation script for armor
                // for clothing, just calling the generic method here
                RollWieldLevelReq_T7_T8(wo, profile);
            }

            if (roll == null)
            {
                AssignArmorLevel(wo, profile.Tier, armorType);
            }
            else
            {
                AssignArmorLevel_New(wo, profile, roll);
            }

            if (wo.HasMutateFilter(MutateFilter.ArmorModVsType))
            {
                MutateArmorModVsType(wo, profile);
            }

            if (isMagical)
            {
                AssignMagic(wo, profile, roll, true);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }

            if (profile.Tier > 6)
            {
                TryRollEquipmentSet(wo, profile, roll);
            }

            if (roll != null && profile.Tier == 8)
            {
                TryMutateGearRating(wo, profile, roll);
            }

            // item value
            //if (wo.HasMutateFilter(MutateFilter.Value))   // fixme: data
            MutateValue(wo, profile.Tier, roll);

            wo.LongDesc = GetLongDesc(wo);
        }
Esempio n. 5
0
        private static void MutateMissileWeapon(WorldObject wo, TreasureDeath profile, bool isMagical, int?wieldDifficulty = null, TreasureRoll roll = null)
        {
            if (roll == null)
            {
                // previous method

                // DamageMod
                wo.DamageMod = GetMissileDamageMod(wieldDifficulty.Value, wo.W_WeaponType);

                // ElementalDamageBonus
                if (wo.W_DamageType != DamageType.Undef)
                {
                    int elementalBonus = GetElementalDamageBonus(wieldDifficulty.Value);
                    if (elementalBonus > 0)
                    {
                        wo.ElementalDamageBonus = elementalBonus;
                    }
                }

                // Wield Requirements
                if (wieldDifficulty > 0)
                {
                    wo.WieldDifficulty   = wieldDifficulty;
                    wo.WieldRequirements = WieldRequirement.RawSkill;
                    wo.WieldSkillType    = (int)Skill.MissileWeapons;
                }
                else
                {
                    wo.WieldDifficulty   = null;
                    wo.WieldRequirements = WieldRequirement.Invalid;
                    wo.WieldSkillType    = null;
                }

                // WeaponDefense
                var meleeDMod = RollWeaponDefense(wieldDifficulty.Value, profile);
                if (meleeDMod > 0.0f)
                {
                    wo.WeaponDefense = meleeDMod;
                }
            }
            else
            {
                // new method / mutation scripts
                var isElemental = wo.W_DamageType != DamageType.Undef;

                var scriptName = GetMissileScript(roll.WeaponType, isElemental);

                // mutate DamageMod / ElementalDamageBonus / WieldRequirements
                var mutationFilter = MutationCache.GetMutation(scriptName);

                mutationFilter.TryMutate(wo, profile.Tier);

                // mutate WeaponDefense
                mutationFilter = MutationCache.GetMutation("MissileWeapons.weapon_defense.txt");

                mutationFilter.TryMutate(wo, profile.Tier);
            }

            // weapon speed
            if (wo.WeaponTime != null)
            {
                var weaponSpeedMod = RollWeaponSpeedMod(profile);
                wo.WeaponTime = (int)(wo.WeaponTime * weaponSpeedMod);
            }

            // material type
            var materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // burden
            MutateBurden(wo, profile, true);

            // missile / magic defense
            wo.WeaponMissileDefense = MissileMagicDefense.Roll(profile.Tier);
            wo.WeaponMagicDefense   = MissileMagicDefense.Roll(profile.Tier);

            // spells
            if (!isMagical)
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }
            else
            {
                AssignMagic(wo, profile, roll);
            }

            // item value
            //if (wo.HasMutateFilter(MutateFilter.Value))   // fixme: data
            MutateValue(wo, profile.Tier, roll);

            // long description
            wo.LongDesc = GetLongDesc(wo);
        }
        private static void MutateArmor(WorldObject wo, TreasureDeath profile, bool isMagical, LootTables.ArmorType armorType, TreasureRoll roll = null)
        {
            // material type
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 6);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // try mutate burden, if MutateFilter exists
            if (wo.HasMutateFilter(MutateFilter.EncumbranceVal))
            {
                MutateBurden(wo, profile, false);
            }

            if (profile.Tier > 6 && armorType != LootTables.ArmorType.CovenantArmor && armorType != LootTables.ArmorType.OlthoiArmor)
            {
                wo.WieldRequirements = WieldRequirement.Level;
                wo.WieldSkillType    = (int)Skill.Axe; // Set by examples from PCAP data

                wo.WieldDifficulty = 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
                };
            }

            if (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor)
            {
                int chance     = ThreadSafeRandom.Next(1, 3);
                var wieldSkill = chance switch
                {
                    1 => Skill.MagicDefense,
                    2 => Skill.MissileDefense,
                    _ => Skill.MeleeDefense,
                };

                wo.WieldRequirements = WieldRequirement.RawSkill;
                wo.WieldSkillType    = (int)wieldSkill;
                wo.WieldDifficulty   = GetCovenantWieldReq(profile.Tier, wieldSkill);

                // used by tinkering requirements for copper/silver
                wo.ItemSkillLimit = wieldSkill;
            }

            wo = AssignArmorLevel(wo, profile.Tier, armorType);

            wo = AssignEquipmentSetId(wo, profile);

            if (isMagical)
            {
                //bool covenantArmor = false || (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor);
                AssignMagic(wo, profile, roll, true);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }

            if (wo.HasMutateFilter(MutateFilter.ArmorModVsType) && wo.ArmorLevel > 0)
            {
                // covenant armor and olthoi armor appear to have different mutation methods possibly
                if (armorType != LootTables.ArmorType.CovenantArmor && armorType != LootTables.ArmorType.OlthoiArmor)
                {
                    MutateArmorModVsType(wo, profile);
                }
            }

            if (roll != null && profile.Tier == 8)
            {
                TryMutateGearRating(wo, profile, roll);
            }

            // item value
            wo.Value = Roll_ItemValue(wo, profile.Tier);

            wo.LongDesc = GetLongDesc(wo);
        }
        private static bool MutateMeleeWeapon(WorldObject wo, TreasureDeath profile, bool isMagical, TreasureWeaponType weaponType = TreasureWeaponType.Undef)
        {
            if (!(wo is MeleeWeapon))
            {
                return(false);
            }

            if (weaponType == TreasureWeaponType.Undef)
            {
                // previous method
                var wieldDifficulty = RollWieldDifficulty(profile.Tier, WieldType.MeleeWeapon);

                if (!MutateStats_OldMethod(wo, profile, wieldDifficulty))
                {
                    return(false);
                }
            }
            else
            {
                // thanks to 4eyebiped for helping with the data analysis of magloot retail logs
                // that went into reversing these mutation scripts

                var weaponSkill = wo.WeaponSkill.ToMeleeWeaponSkill();

                // mutate Damage / WieldDifficulty / Variance
                var scriptName = GetDamageScript(weaponSkill, weaponType);

                var mutationFilter = MutationCache.GetMutation(scriptName);

                mutationFilter.TryMutate(wo, profile.Tier);

                // mutate WeaponOffense / WeaponDefense
                scriptName = GetOffenseDefenseScript(weaponSkill, weaponType);

                mutationFilter = MutationCache.GetMutation(scriptName);

                mutationFilter.TryMutate(wo, profile.Tier);
            }

            // weapon speed
            if (wo.WeaponTime != null)
            {
                var weaponSpeedMod = RollWeaponSpeedMod(profile);
                wo.WeaponTime = (int)(wo.WeaponTime * weaponSpeedMod);
            }

            // material type
            var materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = GetWorkmanship(profile.Tier);

            // burden
            MutateBurden(wo, profile, true);

            // item value
            var materialMod    = LootTables.getMaterialValueModifier(wo);
            var gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);

            wo.Value = GetValue(profile.Tier, wo.ItemWorkmanship ?? 0, gemMaterialMod, materialMod);

            // missile / magic defense
            wo.WeaponMissileDefense = MissileMagicDefense.Roll(profile.Tier);
            wo.WeaponMagicDefense   = MissileMagicDefense.Roll(profile.Tier);

            // spells
            if (!isMagical)
            {
                // clear base
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }
            else
            {
                AssignMagic(wo, profile);
            }

            // long description
            wo.LongDesc = GetLongDesc(wo);

            return(true);
        }
        private static void MutateJewelry(WorldObject wo, TreasureDeath profile, bool isMagical)
        {
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            wo.ItemWorkmanship = GetWorkmanship(profile.Tier);

            double materialMod    = LootTables.getMaterialValueModifier(wo);
            double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);
            var    value          = GetValue(profile.Tier, wo.ItemWorkmanship.Value, gemMaterialMod, materialMod);

            wo.Value = value;

            wo.ItemSkillLevelLimit = null;

            if (profile.Tier > 6)
            {
                wo.WieldRequirements = WieldRequirement.Level;
                wo.WieldSkillType    = (int)Skill.Axe; // Set by examples from PCAP data

                var 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.WieldDifficulty = wield;
            }

            if (isMagical)
            {
                AssignMagic(wo, profile);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }

            //wo.AppraisalLongDescDecoration = AppraisalLongDescDecorations.PrependWorkmanship;
            wo.LongDesc = GetLongDesc(wo);

            MutateColor(wo);
        }
        private static void MutateJewelry(WorldObject wo, TreasureDeath profile, bool isMagical, TreasureRoll roll = null)
        {
            // material type
            var materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // wield level requirement for t7+
            if (profile.Tier > 6)
            {
                RollWieldLevelReq_T7_T8(wo, profile);
            }

            // assign magic
            if (isMagical)
            {
                AssignMagic(wo, profile, roll);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }

            // gear rating (t8)
            if (roll != null && profile.Tier == 8)
            {
                TryMutateGearRating(wo, profile, roll);
            }

            // item value
            //  if (wo.HasMutateFilter(MutateFilter.Value))     // fixme: data
            MutateValue(wo, profile.Tier, roll);

            wo.LongDesc = GetLongDesc(wo);
        }
Esempio n. 10
0
        private static void MutateCaster(WorldObject wo, TreasureDeath profile, bool isMagical, int?wieldDifficulty = null, TreasureRoll roll = null)
        {
            if (wieldDifficulty != null)
            {
                // previous method

                var wieldRequirement = WieldRequirement.RawSkill;
                var wieldSkillType   = Skill.None;

                double elementalDamageMod = 0;

                if (wieldDifficulty == 0)
                {
                    if (profile.Tier > 6)
                    {
                        wieldRequirement = WieldRequirement.Level;
                        wieldSkillType   = Skill.Axe; // Set by examples from PCAP data

                        wieldDifficulty = 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
                        };
                    }
                }
                else
                {
                    elementalDamageMod = RollElementalDamageMod(wieldDifficulty.Value);

                    if (wo.W_DamageType == DamageType.Nether)
                    {
                        wieldSkillType = Skill.VoidMagic;
                    }
                    else
                    {
                        wieldSkillType = Skill.WarMagic;
                    }
                }

                // ManaConversionMod
                var manaConversionMod = RollManaConversionMod(profile.Tier);
                if (manaConversionMod > 0.0f)
                {
                    wo.ManaConversionMod = manaConversionMod;
                }

                // ElementalDamageMod
                if (elementalDamageMod > 1.0f)
                {
                    wo.ElementalDamageMod = elementalDamageMod;
                }

                // WieldRequirements
                if (wieldDifficulty > 0 || wieldRequirement == WieldRequirement.Level)
                {
                    wo.WieldRequirements = wieldRequirement;
                    wo.WieldSkillType    = (int)wieldSkillType;
                    wo.WieldDifficulty   = wieldDifficulty;
                }
                else
                {
                    wo.WieldRequirements = WieldRequirement.Invalid;
                    wo.WieldSkillType    = null;
                    wo.WieldDifficulty   = null;
                }

                // WeaponDefense
                wo.WeaponDefense = RollWeaponDefense(wieldDifficulty.Value, profile);
            }
            else
            {
                // new method - mutation scripts

                // mutate ManaConversionMod
                var mutationFilter = MutationCache.GetMutation("Casters.caster.txt");
                mutationFilter.TryMutate(wo, profile.Tier);

                // mutate ElementalDamageMod / WieldRequirements
                var isElemental = wo.W_DamageType != DamageType.Undef;
                var scriptName  = GetCasterScript(isElemental);

                mutationFilter = MutationCache.GetMutation(scriptName);
                mutationFilter.TryMutate(wo, profile.Tier);

                // this part was not handled by mutation filter
                if (wo.WieldRequirements == WieldRequirement.RawSkill)
                {
                    if (wo.W_DamageType == DamageType.Nether)
                    {
                        wo.WieldSkillType = (int)Skill.VoidMagic;
                    }
                    else
                    {
                        wo.WieldSkillType = (int)Skill.WarMagic;
                    }
                }

                // mutate WeaponDefense
                mutationFilter = MutationCache.GetMutation("Casters.weapon_defense.txt");
                mutationFilter.TryMutate(wo, profile.Tier);
            }

            // material type
            var materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // burden?

            // missile defense / magic defense
            wo.WeaponMissileDefense = MissileMagicDefense.Roll(profile.Tier);
            wo.WeaponMagicDefense   = MissileMagicDefense.Roll(profile.Tier);

            // spells
            if (!isMagical)
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }
            else
            {
                // if a caster was from a MagicItem profile, it always had a SpellDID
                MutateCaster_SpellDID(wo, profile);

                AssignMagic(wo, profile, roll);
            }

            // item value
            //if (wo.HasMutateFilter(MutateFilter.Value))   // fixme: data
            MutateValue(wo, profile.Tier, roll);

            // long description
            wo.LongDesc = GetLongDesc(wo);
        }
        private static void MutateJewelry(WorldObject wo, TreasureDeath profile, bool isMagical, TreasureRoll roll = null)
        {
            // material type
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = WorkmanshipChance.Roll(profile.Tier);

            // wield requirements (verify)
            if (profile.Tier > 6)
            {
                wo.WieldRequirements = WieldRequirement.Level;
                wo.WieldSkillType    = (int)Skill.Axe; // Set by examples from PCAP data

                var 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.WieldDifficulty = wield;
            }

            // assign magic
            if (isMagical)
            {
                AssignMagic(wo, profile, roll);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }

            // gear rating (t8)
            if (roll != null && profile.Tier == 8)
            {
                TryMutateGearRating(wo, profile, roll);
            }

            // item value
            wo.Value = Roll_ItemValue(wo, profile.Tier);

            wo.LongDesc = GetLongDesc(wo);
        }
Esempio n. 12
0
        private static void MutateArmor(WorldObject wo, TreasureDeath profile, bool isMagical, LootTables.ArmorType armorType)
        {
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 6);
            }

            wo.GemType = RollGemType(profile.Tier);

            int workmanship = GetWorkmanship(profile.Tier);

            wo.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 && armorType != LootTables.ArmorType.OlthoiArmor)
            {
                wo.WieldRequirements = WieldRequirement.Level;
                wo.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.WieldDifficulty = wield;
            }

            if (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor)
            {
                int chance     = ThreadSafeRandom.Next(1, 3);
                var wieldSkill = chance switch
                {
                    1 => Skill.MagicDefense,
                    2 => Skill.MissileDefense,
                    _ => Skill.MeleeDefense,
                };
                wield = GetCovenantWieldReq(profile.Tier, wieldSkill);

                wo.WieldRequirements = WieldRequirement.RawSkill;
                wo.WieldSkillType    = (int)wieldSkill;
                wo.WieldDifficulty   = wield;

                // used by tinkering requirements for copper/silver
                wo.ItemSkillLimit = (uint)wieldSkill;
            }

            // Setting random color
            wo.PaletteTemplate = ThreadSafeRandom.Next(1, 2047);
            wo.Shade           = .1 * ThreadSafeRandom.Next(0, 9);

            wo = AssignArmorLevel(wo, profile.Tier, armorType);

            wo = AssignEquipmentSetId(wo, profile);

            if (isMagical)
            {
                //bool covenantArmor = false || (armorType == LootTables.ArmorType.CovenantArmor || armorType == LootTables.ArmorType.OlthoiArmor);
                AssignMagic(wo, profile, true);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }

            wo.LongDesc = GetLongDesc(wo);

            //wo.AppraisalItemSkill = 7;
            //wo.AppraisalLongDescDecoration = AppraisalLongDescDecorations.PrependWorkmanship;

            // try mutate burden, if MutateFilter exists
            if (wo.HasMutateFilter(MutateFilter.EncumbranceVal))
            {
                MutateBurden(wo, profile, false);
            }

            MutateColor(wo);
        }
        private static void MutateMissileWeapon(WorldObject wo, TreasureDeath profile, bool isMagical, int?wieldDifficulty = null, TreasureWeaponType?weaponType = null)
        {
            if (wieldDifficulty != null)
            {
                // previous method

                // DamageMod
                wo.DamageMod = GetMissileDamageMod(wieldDifficulty.Value, wo.W_WeaponType);

                // ElementalDamageBonus
                if (wo.W_DamageType != DamageType.Undef)
                {
                    int elementalBonus = GetElementalDamageBonus(wieldDifficulty.Value);
                    if (elementalBonus > 0)
                    {
                        wo.ElementalDamageBonus = elementalBonus;
                    }
                }

                // Wield Requirements
                if (wieldDifficulty > 0)
                {
                    wo.WieldDifficulty   = wieldDifficulty;
                    wo.WieldRequirements = WieldRequirement.RawSkill;
                    wo.WieldSkillType    = (int)Skill.MissileWeapons;
                }
                else
                {
                    wo.WieldDifficulty   = null;
                    wo.WieldRequirements = WieldRequirement.Invalid;
                    wo.WieldSkillType    = null;
                }

                // WeaponDefense
                var meleeDMod = RollWeaponDefense(wieldDifficulty.Value, profile);
                if (meleeDMod > 0.0f)
                {
                    wo.WeaponDefense = meleeDMod;
                }
            }
            else if (weaponType != null)
            {
                // new method / mutation scripts
                var isElemental = wo.W_DamageType != DamageType.Undef;

                var scriptName = GetMissileScript(weaponType.Value, isElemental);

                // mutate DamageMod / ElementalDamageBonus / WieldRequirements
                var mutationFilter = MutationCache.GetMutation(scriptName);

                mutationFilter.TryMutate(wo, profile.Tier);

                // mutate WeaponDefense
                mutationFilter = MutationCache.GetMutation("MissileWeapons.weapon_defense.txt");

                mutationFilter.TryMutate(wo, profile.Tier);
            }
            else
            {
                log.Warn($"LootGenerationFactory_Missile.MutateMissileWeapon({wo.Name}, {profile.TreasureType}, {isMagical}, {wieldDifficulty}, {weaponType}) - unexpected: WieldDifficulty and WeaponType are both null!");
            }

            // weapon speed
            if (wo.WeaponTime != null)
            {
                var weaponSpeedMod = RollWeaponSpeedMod(profile);
                wo.WeaponTime = (int)(wo.WeaponTime * weaponSpeedMod);
            }

            // material type
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            // item color
            MutateColor(wo);

            // gem count / gem material
            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            // workmanship
            wo.ItemWorkmanship = GetWorkmanship(profile.Tier);

            // burden
            MutateBurden(wo, profile, true);

            // item value
            var materialMod    = LootTables.getMaterialValueModifier(wo);
            var gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);

            wo.Value = GetValue(profile.Tier, (int)wo.Workmanship, gemMaterialMod, materialMod);

            // missile / magic defense
            wo.WeaponMissileDefense = RollWeapon_MissileMagicDefense(profile.Tier);
            wo.WeaponMagicDefense   = RollWeapon_MissileMagicDefense(profile.Tier);

            // spells
            if (!isMagical)
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }
            else
            {
                AssignMagic(wo, profile);
            }

            // long description
            wo.LongDesc = GetLongDesc(wo);
        }
Esempio n. 14
0
        private static void MutateCaster(WorldObject wo, TreasureDeath profile, bool isMagical, int wield)
        {
            WieldRequirement wieldRequirement = WieldRequirement.RawSkill;
            Skill            wieldSkillType   = Skill.None;

            double elementalDamageMod = 0;

            if (wield == 0)
            {
                if (profile.Tier > 6)
                {
                    wieldRequirement = WieldRequirement.Level;
                    wieldSkillType   = 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
                    };
                }
            }
            else
            {
                // Determine the Elemental Damage Mod amount
                elementalDamageMod = DetermineElementMod(wield);

                // If element is Nether, Void Magic is required, else War Magic is required for all other elements
                if (wo.W_DamageType == DamageType.Nether)
                {
                    wieldSkillType = Skill.VoidMagic;
                }
                else
                {
                    wieldSkillType = Skill.WarMagic;
                }
            }

            // Setting MagicD and MissileD Bonuses to null (some weenies have a value)
            wo.WeaponMagicDefense   = null;
            wo.WeaponMissileDefense = null;
            // Not sure why this is here, guessing some wienies have it by default
            wo.ItemSkillLevelLimit = null;

            // Setting general traits of weapon
            wo.ItemWorkmanship = GetWorkmanship(profile.Tier);

            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            wo.Value = GetValue(profile.Tier, wo.ItemWorkmanship.Value, LootTables.getMaterialValueModifier(wo), LootTables.getGemMaterialValueModifier(wo));

            // Is this right??
            wo.LongDesc = wo.Name;

            // Setting Weapon defensive mods
            wo.WeaponDefense        = GetWieldReqMeleeDMod(wield, profile);
            wo.WeaponMagicDefense   = GetMagicMissileDMod(profile.Tier);
            wo.WeaponMissileDefense = GetMagicMissileDMod(profile.Tier);

            // Setting weapon Offensive Mods
            if (elementalDamageMod > 1.0f)
            {
                wo.ElementalDamageMod = elementalDamageMod;
            }

            // Setting Wield Reqs for weapon
            if (wield > 0 || wieldRequirement == WieldRequirement.Level)
            {
                wo.WieldRequirements = wieldRequirement;
                wo.WieldSkillType    = (int)wieldSkillType;
                wo.WieldDifficulty   = wield;
            }
            else
            {
                wo.WieldRequirements = WieldRequirement.Invalid;
                wo.WieldSkillType    = null;
                wo.WieldDifficulty   = null;
            }

            // Adjusting Properties if weapon has magic (spells)
            double manaConMod = GetManaCMod(profile.Tier);

            if (manaConMod > 0.0f)
            {
                wo.ManaConversionMod = manaConMod;
            }

            if (isMagical)
            {
                wo = AssignMagic(wo, profile);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }

            RandomizeColor(wo);
        }
        private static void MutateMissileWeapon(WorldObject wo, TreasureDeath profile, bool isMagical, int wieldDifficulty, bool isElemental)
        {
            int elemenatalBonus = 0;

            if (isElemental)
            {
                elemenatalBonus = GetElementalBonus(wieldDifficulty);
            }

            // Item Basics
            wo.ItemWorkmanship = GetWorkmanship(profile.Tier);
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }

            if (wo.GemCode != null)
            {
                wo.GemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                wo.GemCount = ThreadSafeRandom.Next(1, 5);
            }

            wo.GemType = RollGemType(profile.Tier);

            wo.LongDesc = wo.Name;
            //wo.AppraisalLongDescDecoration = AppraisalLongDescDecorations.PrependWorkmanship | AppraisalLongDescDecorations.AppendGemInfo;

            // Burden
            MutateBurden(wo, profile.Tier, true);

            // MeleeD/MagicD/Missile Bonus
            wo.WeaponMagicDefense   = GetMagicMissileDMod(profile.Tier);
            wo.WeaponMissileDefense = GetMagicMissileDMod(profile.Tier);
            double meleeDMod = GetWieldReqMeleeDMod(wieldDifficulty, profile);

            if (meleeDMod > 0.0f)
            {
                wo.WeaponDefense = meleeDMod;
            }

            // Damage
            wo.DamageMod = GetMissileDamageMod(wieldDifficulty, wo.GetProperty(PropertyInt.WeaponType));
            if (elemenatalBonus > 0)
            {
                wo.ElementalDamageBonus = elemenatalBonus;
            }

            // Wields
            if (wieldDifficulty > 0)
            {
                wo.WieldDifficulty   = wieldDifficulty;
                wo.WieldRequirements = WieldRequirement.RawSkill;
                wo.WieldSkillType    = (int)Skill.MissileWeapons;
            }
            else
            {
                wo.WieldDifficulty   = null;
                wo.WieldRequirements = WieldRequirement.Invalid;
                wo.WieldSkillType    = null;
            }

            // Magic
            if (isMagical)
            {
                wo = AssignMagic(wo, profile);
            }
            else
            {
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
                wo.ManaRate       = null;
            }

            // Material/Value/Color
            double materialMod    = LootTables.getMaterialValueModifier(wo);
            double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);
            var    value          = GetValue(profile.Tier, (int)wo.Workmanship, gemMaterialMod, materialMod);

            wo.Value = value;

            RandomizeColor(wo);
        }
Esempio n. 16
0
        private static bool MutateMeleeWeapon(WorldObject wo, TreasureDeath profile, bool isMagical)
        {
            if (!(wo is MeleeWeapon))
            {
                return(false);
            }

            Skill wieldSkillType = wo.WeaponSkill;

            int    damage         = 0;
            double damageVariance = 0;
            double weaponDefense  = 0;
            double weaponOffense  = 0;

            // Properties for weapons
            double magicD   = GetMagicMissileDMod(profile.Tier);
            double missileD = GetMagicMissileDMod(profile.Tier);

            int gemCount = 0;

            if (wo.GemCode != null)
            {
                gemCount = GemCountChance.Roll(wo.GemCode.Value, profile.Tier);
            }
            else
            {
                gemCount = ThreadSafeRandom.Next(1, 5);
            }

            MaterialType     gemType          = RollGemType(profile.Tier);
            int              workmanship      = GetWorkmanship(profile.Tier);
            int              wieldDiff        = GetWieldDifficulty(profile.Tier, WieldType.MeleeWeapon);
            WieldRequirement wieldRequirments = WieldRequirement.RawSkill;

            // Weapon Types
            // 0 = Heavy
            // 1 = Light
            // 2 = Finesse
            // default = Two Handed
            switch (wieldSkillType)
            {
            case Skill.HeavyWeapons:
                switch (wo.W_WeaponType)
                {
                case WeaponType.Axe:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 18);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 22);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Axe);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Axe);
                    break;

                case WeaponType.Dagger:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Dagger);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Dagger);

                    if (wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.DaggerMulti);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.DaggerMulti);
                    }
                    break;

                case WeaponType.Mace:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 22);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 18);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Mace);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Mace);
                    break;

                case WeaponType.Spear:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 15);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 25);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Spear);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Spear);
                    break;

                case WeaponType.Staff:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 25);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 15);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Staff);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Staff);
                    break;

                case WeaponType.Sword:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Sword);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Sword);

                    if (wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.SwordMulti);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.SwordMulti);
                    }
                    break;

                case WeaponType.Unarmed:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.UA);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.UA);
                    break;

                default:
                    return(false);
                }
                break;

            case Skill.LightWeapons:
                switch (wo.W_WeaponType)
                {
                case WeaponType.Axe:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 18);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 22);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Axe);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Axe);
                    break;

                case WeaponType.Dagger:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.DaggerMulti);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.DaggerMulti);

                    if (!wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Dagger);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.Dagger);
                    }
                    break;

                case WeaponType.Mace:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 22);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 18);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Mace);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Mace);
                    break;

                case WeaponType.Spear:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 15);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 25);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Spear);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Spear);
                    break;

                case WeaponType.Staff:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 25);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 15);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Staff);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Staff);
                    break;

                case WeaponType.Sword:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Sword);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Sword);

                    if (wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.SwordMulti);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.SwordMulti);
                    }
                    break;

                case WeaponType.Unarmed:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.UA);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.UA);
                    break;

                default:
                    return(false);
                }
                break;

            case Skill.FinesseWeapons:
                switch (wo.W_WeaponType)
                {
                case WeaponType.Axe:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 18);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 22);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Axe);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Axe);
                    break;

                case WeaponType.Dagger:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Dagger);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Dagger);

                    if (wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.DaggerMulti);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.DaggerMulti);
                    }
                    break;

                case WeaponType.Mace:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 22);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 18);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Mace);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Mace);

                    if (wo.TsysMutationData == 101188610)         // Unique data to the five Jitte wcids for lootgen, within WeaponType.Mace class weapons
                    {
                        weaponDefense  = GetMaxDamageMod(profile.Tier, 25);
                        weaponOffense  = GetMaxDamageMod(profile.Tier, 15);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.Jitte);
                    }
                    break;

                case WeaponType.Spear:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 15);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 25);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Spear);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Spear);
                    break;

                case WeaponType.Staff:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 25);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 15);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Staff);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Staff);
                    break;

                case WeaponType.Sword:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Sword);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.Sword);

                    if (wo.W_AttackType.IsMultiStrike())
                    {
                        damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.SwordMulti);
                        damageVariance = GetVariance(wieldSkillType, LootWeaponType.SwordMulti);
                    }
                    break;

                case WeaponType.Unarmed:
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.UA);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.UA);
                    break;

                default:
                    return(false);
                }
                break;

            case Skill.TwoHandedCombat:
                if (wo.IsCleaving)
                {
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 18);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 22);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Cleaving);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.TwoHanded);
                }
                else
                {
                    weaponDefense  = GetMaxDamageMod(profile.Tier, 20);
                    weaponOffense  = GetMaxDamageMod(profile.Tier, 20);
                    damage         = GetMeleeMaxDamage(wieldSkillType, wieldDiff, LootWeaponType.Spears);
                    damageVariance = GetVariance(wieldSkillType, LootWeaponType.TwoHanded);
                }
                break;

            default:
                return(false);
            }

            wo.LongDesc = wo.Name;

            // GemTypes, Material, Workmanship
            wo.GemCount = gemCount;
            wo.GemType  = gemType;
            int materialType = GetMaterialType(wo, profile.Tier);

            if (materialType > 0)
            {
                wo.MaterialType = (MaterialType)materialType;
            }
            wo.ItemWorkmanship = workmanship;

            // Burden
            MutateBurden(wo, profile.Tier, true);

            // Weapon Stats
            wo.Damage               = damage;
            wo.DamageVariance       = damageVariance;
            wo.WeaponDefense        = weaponDefense;
            wo.WeaponOffense        = weaponOffense;
            wo.WeaponMissileDefense = missileD;
            wo.WeaponMagicDefense   = magicD;

            // Adding Wield Reqs if required
            if (wieldDiff > 0)
            {
                wo.WieldDifficulty   = wieldDiff;
                wo.WieldRequirements = wieldRequirments;
                wo.WieldSkillType    = (int)wieldSkillType;
            }
            else
            {
                // If no wield, remove wield reqs
                wo.WieldDifficulty   = null;
                wo.WieldRequirements = WieldRequirement.Invalid;
                wo.WieldSkillType    = null;
            }

            // Adding Magic Spells
            if (isMagical)
            {
                wo = AssignMagic(wo, profile);
            }
            else
            {
                // If no spells remove magic properites
                wo.ItemManaCost   = null;
                wo.ItemMaxMana    = null;
                wo.ItemCurMana    = null;
                wo.ItemSpellcraft = null;
                wo.ItemDifficulty = null;
            }

            double materialMod    = LootTables.getMaterialValueModifier(wo);
            double gemMaterialMod = LootTables.getGemMaterialValueModifier(wo);
            var    value          = GetValue(profile.Tier, workmanship, gemMaterialMod, materialMod);

            wo.Value = value;

            RandomizeColor(wo);

            return(true);
        }