public async Task <Item> ModifyItem(Guid id, ModifiedItem item)
        {
            string[] pena    = File.ReadAllLines(gameDevName);
            Item[]   tavarat = new Item[pena.Length];
            int      count   = 0;
            Item     itemsingle;

            foreach (var a in pena)
            {
                itemsingle     = JsonConvert.DeserializeObject <Item>(pena[count]);
                tavarat[count] = itemsingle;
                count++;
            }
            count = 0;
            var result = new Item();

            foreach (var c in tavarat)
            {
                if (c.Id == id)
                {
                    c.Level     = item.Level;
                    result      = c;
                    pena[count] = JsonConvert.SerializeObject(result);
                    File.WriteAllLines(gameDevName, pena);
                    break;
                }
                count++;
            }



            return(result);
        }
Exemple #2
0
 public Task <Item> Modify(Guid id, ModifiedItem item)
 {
     if (item.ItemType == "Sword" && item.player.Level < 3)
     {
         throw new RuleNotFollowedException();
     }
     return(repo.Modify(id, item));
 }
Exemple #3
0
 public Task <Item> Modify(Guid id, ModifiedItem item)
 {
     foreach (Item i in itemList)
     {
         if (i.ItemID == id)
         {
             i.OwningPlayer = item.player.Id;
             return(Task.FromResult(i));
         }
     }
     return(null);
 }
Exemple #4
0
 public Task <Item> ModifyItem(Guid id, ModifiedItem item)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 public async Task <Item> ModifyItem(Guid playerId, ModifiedItem item)
 {
     return(await _repository.ModifyItem(playerId, item));
 }
Exemple #6
0
 public Task <Item> Modify(Guid id, [FromBody] ModifiedItem item)
 {
     return(processor.Modify(id, item));
 }