Example #1
0
        ////////////////

        public void Initialize(int musicBoxItemType, IList <int> bannerItemTypes)
        {
            var list = AggregatorItemInfo.GetNpcSetsOfBanners(bannerItemTypes);

            this.IsInitialized             = true;
            this.MusicType                 = MusicBoxHelpers.GetMusicTypeOfVanillaMusicBox(musicBoxItemType);
            this.BannerItemTypesToNpcTypes = new List <KeyValuePair <int, ISet <int> > >(list).AsReadOnly();
        }
Example #2
0
        private Item MarkConsumeMusicBoxItem(int consumedItemGroupType)
        {
            var musicItemTypes = MusicBoxHelpers.GetVanillaMusicBoxItemIds();

            if (!musicItemTypes.Contains(consumedItemGroupType))
            {
                return(null);
            }

            Item[] inv = Main.LocalPlayer.inventory;
            //var musicItemTypes = MusicBoxHelpers.GetVanillaMusicBoxItemIds();

            Item musicBoxItem = inv.FirstOrDefault((item) => {
                return(!(item?.IsAir ?? true) &&
                       musicItemTypes.Contains(item.type));
            });

            this.MusicBoxItemType = musicBoxItem?.type ?? -1;

            return(musicBoxItem);
        }