public void UpdateInventory() { InventoryItems = new List <InventoryItem>(); string inventoryItemsJson = AmeisenCore.GetLocalizedText(GetInventoryItems.Lua(), GetInventoryItems.OutVar()); List <RawInventoryItem> rawInventoryItems = new List <RawInventoryItem>(); try { rawInventoryItems = JsonConvert.DeserializeObject <List <RawInventoryItem> >(inventoryItemsJson); } catch { InventoryItems = new List <InventoryItem>(); AmeisenLogger.Instance.Log(LogLevel.ERROR, $"Failes to parse InventoryItems", this); } foreach (RawInventoryItem rawInventoryItem in rawInventoryItems) { InventoryItems.Add(new InventoryItem(rawInventoryItem)); } }
public IEnumerable <InventoryItemDetails> Handle(GetInventoryItems query) { var items = InMemoryDatabase.Details.Values.ToList(); return(items); }
InventoryItemDetails[] Answer(GetInventoryItems _) => items.Values.ToArray();
public Task <List <InventoryItemListDto> > Handle(GetInventoryItems message, CancellationToken token = default) { return(Task.FromResult(InMemoryDatabase.List)); }