Esempio n. 1
0
        public static bool GetEffect(Item item, out IEffect effect)
        {
            ExtItemInfo extInfo = null;

            if (item is Clothing clothing)
            {
                if (clothing.clothesType.Value == (int)ClothesType.SHIRT)
                {
                    GetExtInfoByIndex <Shirt>(item.ParentSheetIndex, out extInfo);
                }
                else
                if (clothing.clothesType.Value == (int)ClothesType.PANTS)
                {
                    GetExtInfoByIndex <Pants>(item.ParentSheetIndex, out extInfo);
                }
            }
            else if (item is StardewValley.Objects.Hat hat)
            {
                GetExtInfoByIndex <HatDef>(hat.which.Value, out extInfo);
            }

            effect = extInfo?.Effect;

            return(effect != null);
        }
Esempio n. 2
0
        public static bool GetExtInfoByIndex <T>(int index, out ExtItemInfo extInfo)
        {
            if (typeof(T) == typeof(Shirt))
            {
                return(ShirtEffects.TryGetValue((Shirt)index, out extInfo));
            }

            if (typeof(T) == typeof(Pants))
            {
                return(PantsEffects.TryGetValue((Pants)index, out extInfo));
            }

            if (typeof(T) == typeof(HatDef))
            {
                return(HatEffects.TryGetValue((HatDef)index, out extInfo));
            }

            extInfo = null;
            return(false);
        }
Esempio n. 3
0
        public static bool GetExtInfo(Item item, out ExtItemInfo extInfo)
        {
            if (item is Clothing clothing)
            {
                if (clothing.clothesType.Value == (int)ClothesType.SHIRT)
                {
                    return(GetExtInfoByIndex <Shirt>(item.ParentSheetIndex, out extInfo));
                }
                else
                if (clothing.clothesType.Value == (int)ClothesType.PANTS)
                {
                    return(GetExtInfoByIndex <Pants>(item.ParentSheetIndex, out extInfo));
                }
            }
            else if (item is StardewValley.Objects.Hat hat)
            {
                return(GetExtInfoByIndex <HatDef>(hat.which.Value, out extInfo));
            }

            extInfo = null;
            return(false);
        }
Esempio n. 4
0
 public static bool GetExtInfo <T>(T value, out ExtItemInfo extInfo)
 {
     return(GetExtInfoByIndex <T>((int)(object)value, out extInfo));
 }