コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public Item GetByID(Enums.Item itemId)
        {
            var row = _data
                      .Elements("item")
                      .Where((x) => x.Attribute("id").Value == ((ushort)itemId).ToString())
                      .First();

            return(FromElement(row));
        }
コード例 #4
0
ファイル: ItemDatabase.cs プロジェクト: DoumanAsh/FEFTwiddler
        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)
            });
        }
コード例 #5
0
        public static InventoryItem FromID(Enums.Item itemId)
        {
            var raw = new byte[] { (byte)itemId, (byte)((ushort)itemId >> 8), 0x00, 0x00 };

            return(new InventoryItem(raw));
        }