public LootItem Create(LootItemDTO lootItemDTO) { if ((LootItemType)lootItemDTO.type == LootItemType.CONSUMABLE) { return CreateConsumable(lootItemDTO); } else { throw new NotSupportedException(String.Format("Item of type {0} is not currently supported.", lootItemDTO.type)); } }
private Consumable CreateConsumable(LootItemDTO lootItemDTO) { if ((LootItemSubType)lootItemDTO.subType == LootItemSubType.PROTEIN_SHAKE) { return new ProteinShake(lootItemDTO.name, ProteinShakeSprite, lootItemDTO.staminaRegeneration, new TimeSpan(0, 0, lootItemDTO.effectDuration)); } else if ((LootItemSubType)lootItemDTO.subType == LootItemSubType.ADRENALINE_SHOT) { return new AdrenalineShot(lootItemDTO.name, AdrenalineShotSprite, lootItemDTO.hypeGeneration, new TimeSpan(0, 0, lootItemDTO.effectDuration)); } else { throw new NotSupportedException(String.Format("Item subtype {0} is not currently supported.", lootItemDTO.subType)); } }
public void UseLootItem(LootItem lootItem) { LootItemDTO lootItemDTO = new LootItemDTO((int)lootItem.ItemType, (int)lootItem.ItemSubType, lootItem.Name, 1); webSocketService.SendCommand(new LootItemUsageDTO(new List<LootItemDTO>() { lootItemDTO })); lootItems.Remove(lootItem); }