public StoreInventoryState GetState()
 {
     return(new StoreInventoryState
     {
         ItemsForSale = ItemsForSale.Select(x =>
                                            new StoreItemState
         {
             Price = x.Price,
             Count = x.Count,
             ItemId = x.Item.Id
         }).ToList(),
         ItemsBuying = ItemsBuying.Select(x =>
                                          new StoreItemState
         {
             Price = x.Price,
             Count = x.Count,
             ItemId = x.Item.Id
         }).ToList()
     });
 }
Пример #2
0
 public void AddItem(Item item, int stack = int.MaxValue, int?price = null)
 {
     ItemsForSale.Add(item);
     ItemsPriceAndStock.Add(item, new[] { price ?? item.salePrice(), stack });
 }