public static int GetItemTotalAcrossUnits(Model.ChapterSave chapterSave, Enums.Item itemId) { int count = 0; foreach (var unit in chapterSave.UnitRegion.Units) { if (unit.Item_1.ItemID == itemId) { count++; } if (unit.Item_2.ItemID == itemId) { count++; } if (unit.Item_3.ItemID == itemId) { count++; } if (unit.Item_4.ItemID == itemId) { count++; } if (unit.Item_5.ItemID == itemId) { count++; } } return(count); }
private Model.ConvoyItem GetItem(Enums.Item itemId, byte charges) { var item = _chapterSave.ConvoyRegion.Convoy .Where((x) => x.ItemID == itemId && x.Uses == charges && !x.IsNamed) .FirstOrDefault(); return(item); }
public Item GetByID(Enums.Item itemId) { var row = _data .Elements("item") .Where((x) => x.Attribute("id").Value == ((ushort)itemId).ToString()) .First(); return(FromElement(row)); }
public Item GetByID(Enums.Item itemId) { var row = _data .Elements("item") .Where((x) => x.Attribute("id").Value == ((ushort)itemId).ToString()) .First(); var displayName = GetDisplayName(row); return(new Item { ItemID = (Enums.Item)row.GetAttribute <ushort>("id"), DisplayName = displayName, Type = (Enums.ItemType)Enum.Parse(typeof(Enums.ItemType), row.GetAttribute("type")), MaximumUses = row.GetAttribute <byte>("maxUses"), IsEnemyOnly = row.GetAttribute("enemyOnly", false), IsMapOnly = row.GetAttribute("mapOnly", false) }); }
public static InventoryItem FromID(Enums.Item itemId) { var raw = new byte[] { (byte)itemId, (byte)((ushort)itemId >> 8), 0x00, 0x00 }; return(new InventoryItem(raw)); }