Example #1
0
        static void drawToolTip(ref Item hoveredItem)
        {
            // replace the hoveredItem with a wrapper class which allows us to
            // control Item.getExtraSpaceNeededForTooltipSpecialIcons

            if (hoveredItem != null)
            {
                // The "Trimmed Lucky Purple Shorts" from Major Lewis's quest are not an actual clothing item
                if (hoveredItem.Category == 0 && hoveredItem.ParentSheetIndex == 71)
                {
                    hoveredItem = ShimTrimmedLuckPurpleShorts;
                }
            }

            if (ItemDefinitions.GetEffect(hoveredItem, out IEffect effect))
            {
                if (hoveredItem is Clothing clothing)
                {
                    clothingDrawWrapper.Assign(clothing, effect);
                    hoveredItem = clothingDrawWrapper;
                }
                else if (hoveredItem is StardewValley.Objects.Hat hat)
                {
                    hatDrawWrapper.Assign(hat, effect);
                    hoveredItem = hatDrawWrapper;
                }
            }
        }
Example #2
0
        static int getDescriptionWidth(int __result, Item __instance)
        {
            // increase the width so that effect descriptions stay on one line and do not break
            if (ItemDefinitions.GetEffect(__instance, out IEffect effect))
            {
                return(Math.Max(__result, EffectHelper.getDescriptionWidth(effect)));
            }

            return(__result);
        }