Ejemplo n.º 1
0
        public override void Entry(IModHelper helper)
        {
            config = helper.ReadConfig <Config>();

            assetManager = new AssetManager(helper);

            AssetManager.LoadImagesInShop = config.loadCoversInShop;

            helper.ConsoleCommands.Add("comics", "", (s, p) =>
            {
                var itemPriceAndStock = new Dictionary <ISalable, int[]>();

                foreach (Issue issue in assetManager.LoadIssuesForToday(p.Length > 0 && !string.IsNullOrEmpty(p[0]) && int.TryParse(p[0], out int year) ? year : config.baseYear, Game1.stats.DaysPlayed))
                {
                    itemPriceAndStock.Add(Frame.GetNew(ComicBook.GetNew(issue.Id.ToString())), new int[] { 100, 1 });
                }

                OpenComicsShop(itemPriceAndStock);
            });
Ejemplo n.º 2
0
        public override void OnConstruction(IPlatoHelper helper, object linkedObject)
        {
            base.OnConstruction(helper, linkedObject);
            SaveIndex.ValidateIndex(Base?.parentSheetIndex.Value ?? -1);
            Data?.Set("IsComicFrameObject", true);
            CheckParentSheetIndex();

            if (!(Base?.heldObject.Value is StardewValley.Object))
            {
                if (Data != null && Data.TryGet("ComicId", out string comicId))
                {
                    Base?.heldObject.Set(ComicBook.GetNew(comicId));
                }
                else
                {
                    Base?.heldObject.Set(ComicBook.GetNew("216384"));
                }
            }

            Base?.updateDrawPosition();
        }