Esempio n. 1
0
        public async Task <Item> CreateItem(Guid playerId, NewItem item)
        {
            Item newItem = new Item();

            newItem.Modify(item);
            newItem.Id           = Guid.NewGuid();
            newItem.CreationDate = System.DateTime.Now;

            Player player = await _repository.GetPlayer(playerId);

            if (newItem.Type == Item.ItemType.Sword && player.Level < 3)
            {
                throw new LowLevelPlayerException("Player too low level for sword!");
            }

            return(await _repository.CreateItem(playerId, newItem));
        }
Esempio n. 2
0
 public void Modify(NewItem item)
 {
     Level = item.Level;
     Type  = item.Type;
 }
Esempio n. 3
0
 public Task <Item> CreateItem(Guid playerId, [FromBody] NewItem item)
 {
     return(_processor.CreateItem(playerId, item));
 }