private static List <SpellId> RollCantrips(WorldObject wo, TreasureDeath profile, TreasureRoll roll)
        {
            // no cantrips on dinnerware?
            if (roll.ItemType == TreasureItemType_Orig.ArtObject)
            {
                return(null);
            }

            var numCantrips = CantripChance.RollNumCantrips(profile);

            if (numCantrips == 0)
            {
                return(null);
            }

            var numAttempts = numCantrips * 3;

            var cantrips = new HashSet <SpellId>();

            for (var i = 0; i < numAttempts && cantrips.Count < numCantrips; i++)
            {
                var cantrip = RollCantrip(wo, profile, roll);

                cantrip = AdjustForWeaponMastery(wo, cantrip);

                if (cantrip != SpellId.Undef)
                {
                    cantrips.Add(cantrip);
                }
            }

            var finalCantrips = new List <SpellId>();

            foreach (var cantrip in cantrips)
            {
                var cantripLevel = CantripChance.RollCantripLevel(profile);

                var cantripLevels = SpellLevelProgression.GetSpellLevels(cantrip);

                if (cantripLevels.Count != 4)
                {
                    log.Error($"RollCantrips({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - {cantrip} has {cantripLevels.Count} cantrip levels, expected 4");
                    continue;
                }

                finalCantrips.Add(cantripLevels[cantripLevel - 1]);
            }
            return(finalCantrips);
        }
        private static List <SpellId> RollCantrips(WorldObject wo, TreasureDeath profile, TreasureRoll roll)
        {
            // no cantrips on dinnerware?
            if (roll.ItemType == TreasureItemType_Orig.ArtObject)
            {
                return(null);
            }

            var numCantrips = CantripChance.RollNumCantrips(profile);

            if (numCantrips == 0)
            {
                return(null);
            }

            var numAttempts = numCantrips * 3;

            var cantrips = new HashSet <SpellId>();

            for (var i = 0; i < numAttempts && cantrips.Count < numCantrips; i++)
            {
                var cantrip = RollCantrip(wo, profile, roll);

                if (cantrip != SpellId.Undef)
                {
                    cantrips.Add(cantrip);
                }
            }

            var finalCantrips = new List <SpellId>();

            var hasLegendary = false;

            foreach (var cantrip in cantrips)
            {
                var cantripLevel = CantripChance.RollCantripLevel(profile);

                var cantripLevels = SpellLevelProgression.GetSpellLevels(cantrip);

                if (cantripLevels.Count != 4)
                {
                    log.Error($"RollCantrips({wo.Name}, {profile.TreasureType}, {roll.ItemType}) - {cantrip} has {cantripLevels.Count} cantrip levels, expected 4");
                    continue;
                }

                finalCantrips.Add(cantripLevels[cantripLevel - 1]);

                if (cantripLevel == 4)
                {
                    hasLegendary = true;
                }
            }

            // if a legendary cantrip dropped on this item
            if (hasLegendary)
            {
                // and if the item has a level requirement, ensure the level requirement is at least 180
                // if the item does not already contain a level requirement, don't add one?

                if (wo.WieldRequirements == WieldRequirement.Level && wo.WieldDifficulty < 180)
                {
                    wo.WieldDifficulty = 180;
                }

                if (wo.WieldRequirements2 == WieldRequirement.Level && wo.WieldDifficulty2 < 180)
                {
                    wo.WieldDifficulty2 = 180;
                }
            }

            return(finalCantrips);
        }