public MinerStore Build()
        {
            var greeting = new[]
            {
                "Welcome to the miners store.", "You can type [help] for a list of the store commands.",
                "To leave the store type exit."
            };
            var storeState = new StoreInventory();
            var storeItems = _gateway.StoreItems.GetAll();

            foreach (var item in storeItems)
            {
                if (item.BuyingPrice == 0)
                {
                    storeState.ItemsForSale.Add(new StoreItem
                    {
                        Price = item.SellingPrice,
                        Count = item.MinCount,
                        Item  = _gateway.GameItems.GetAll().First(gi => gi.Id == item.GameItemId)
                    });
                }
                else
                {
                    storeState.ItemsBuying.Add(new StoreItem
                    {
                        Price = item.BuyingPrice,
                        Item  = _gateway.GameItems.GetAll().First(gi => gi.Id == item.GameItemId)
                    });
                }
            }

            var store = new MinerStore(
                _gameState,
                greeting,
                _baseCommandsGroup.Join(new StoreCommandsGroupFactory(_gameState, storeState).Build())
                );

            store.StoreState = storeState;
            return(store);
        }
示例#2
0
 public void MinerStore()
 {
     var gameState = new GameState();
     var store     = new MinerStore(gameState, new string[] { }, new CommandsGroup());
 }