public void InspectSlotItem(dynamic json, bool full = false) { if (!json.IsArray) { json = new[] { json } } ; if (full) { _itemInventory.Clear(); } foreach (var entry in json) { var id = (int)entry.api_id; if (id == -1) { continue; } _itemInventory[id] = new ItemStatus(id) { Spec = _itemMaster[(int)entry.api_slotitem_id], Level = entry.api_level() ? (int)entry.api_level : 0, Alv = entry.api_alv() ? (int)entry.api_alv : 0, Locked = entry.api_locked() && (int)entry.api_locked == 1 }; } }
public ItemStatus[] InjectItems(IEnumerable <int> itemIds) { var id = _itemInventory.MaxId + 1; return(itemIds.Select(itemId => { var spec = _itemMaster[itemId]; if (spec.Empty) { spec = new ItemSpec { Id = itemId }; _itemMaster[itemId] = spec; } var item = new ItemStatus { Id = id++, Spec = spec }; _itemInventory.Add(item); return item; }).ToArray()); }
private static string ItemStatusString(ItemStatus item) => (item.Alv == 0 ? "" : "+" + item.Alv) + (item.Level == 0 ? "" : "★" + item.Level);