コード例 #1
0
        //      private static ModEntry Mod;
        //      public static void Init(ModEntry mod) {
        //          Mod = mod;
        //}

        public static void Prefix(StardewValley.Menus.DialogueBox __instance)
        {
            __instance.characterIndexInDialogue = __instance.getCurrentString().Length;
        }
コード例 #2
0
        private void OnMenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (e != null)
            {
                currentMenu = e.NewMenu;
                if (currentMenu != null)
                {
                    if (currentMenu is StardewValley.Menus.ShopMenu)
                    {
                        StardewValley.Menus.ShopMenu shopMenu = (StardewValley.Menus.ShopMenu)currentMenu;

                        if (shopMenu != null && shopMenu.portraitPerson != null && shopMenu.portraitPerson.Name == "Marnie")
                        {
                            IReflectedField <Dictionary <ISalable, int[]> > inventoryInformation = Helper.Reflection.GetField <Dictionary <ISalable, int[]> >(shopMenu, "itemPriceAndStock");
                            Dictionary <ISalable, int[]> itemPriceAndStock = null;
                            if (inventoryInformation != null)
                            {
                                itemPriceAndStock = inventoryInformation.GetValue();
                            }
                            IReflectedField <List <ISalable> > forSaleInformation = Helper.Reflection.GetField <List <ISalable> >(shopMenu, "forSale");
                            List <ISalable> forSale = null;
                            if (forSaleInformation != null)
                            {
                                forSale = forSaleInformation.GetValue();
                            }

                            if (forSale != null && itemPriceAndStock != null)
                            {
                                Item milk = new StardewValley.Object(184, config.numMilkToStock, false, -1, 0);
                                itemPriceAndStock.Add(milk, new[] { milk.salePrice() * 3, milk.Stack });
                                if (!forSale.Contains(milk))
                                {
                                    forSale.Add(milk);
                                }

                                List <Item> eggsToAdd = GetEggsOfTheDay();
                                if (eggsToAdd != null)
                                {
                                    foreach (Item eggToAdd in eggsToAdd)
                                    {
                                        itemPriceAndStock.Add(eggToAdd, new[] { eggToAdd.salePrice() * 5, eggToAdd.Stack });
                                        if (!forSale.Contains(eggToAdd))
                                        {
                                            forSale.Add(eggToAdd);
                                        }
                                    }
                                }

                                inventoryInformation.SetValue(itemPriceAndStock);
                                forSaleInformation.SetValue(forSale);
                            }
                        }
                    }
                    else if (currentMenu is StardewValley.Menus.DialogueBox)
                    {
                        StardewValley.Menus.DialogueBox dialogueBox = (StardewValley.Menus.DialogueBox)currentMenu;
                        if (eventText != "")
                        {
                            if (dialogueBox != null && dialogueBox.getCurrentString() == "??")
                            {
                                string eventTextClone = eventText;
                                Game1.drawObjectDialogue(eventTextClone);
                            }
                            eventText = "";
                        }
                    }
                }
            }
        }