Ejemplo n.º 1
0
 /**
  * <seealso cref="IHeadlineContentProvider.GetItemInformation(int)"/>
  */
 public ItemInformation GetItemInformation(int itemID)
 {
     if (!_ItemInfo.TryGetValue(itemID, out ItemInformation info))
     {
         info = new ItemInformation("???", 0);
     }
     return(info);
 }
Ejemplo n.º 2
0
        /**
         * <summary>Scrapes the game's object information array for canonical item prices and names.</summary>
         *
         * <param name="items">The IDs of the items whose information to retrieve.</param>
         * <returns>A dictionary linking item IDs to item information.</returns>
         */
        private static IReadOnlyDictionary <int, ItemInformation> LoadItemInformation(IEnumerable <int> items)
        {
            var allInfo = new Dictionary <int, ItemInformation>();

            foreach (int item in items)
            {
                var obj  = new StardewValley.Object(item, 1);
                var info = new ItemInformation(obj.DisplayName, obj.Price);
                allInfo[item] = info;
            }
            return(allInfo);
        }