Пример #1
0
        /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void onMenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (!(e.NewMenu is ShopMenu menu) || menu.portraitPerson?.Name != "Marlon")
            {
                return;
            }

            Log.trace($"Adding bow to Marlon's shop.");

            var forSale           = menu.forSale;
            var itemPriceAndStock = menu.itemPriceAndStock;

            var bow = new BowTool();

            forSale.Add(bow);
            itemPriceAndStock.Add(bow, new int[] { 2500, 1 });
        }
Пример #2
0
        /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void onMenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (!(e.NewMenu is ShopMenu menu) || menu.portraitPerson?.Name != "Marlon")
            {
                return;
            }

            Log.trace($"Adding bow to Marlon's shop.");

            var forSale           = Helper.Reflection.GetField <List <Item> >(menu, "forSale").GetValue();
            var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <Item, int[]> >(menu, "itemPriceAndStock").GetValue();

            var bow = new BowTool();

            forSale.Add(bow);
            itemPriceAndStock.Add(bow, new int[] { 2500, 1 });
        }