Exemple #1
0
        public static ItemInfo Parse(WZProperty characterItem)
        {
            WZProperty info    = characterItem.Resolve("info");
            ItemInfo   results = new ItemInfo();

            results.only        = (info.ResolveFor <int>("only") ?? 0) == 1;
            results.Equip       = EquipInfo.Parse(info);
            results.Cash        = CashInfo.Parse(info);
            results.Shop        = ShopInfo.Parse(info);
            results.Card        = CardInfo.Parse(info);
            results.Slot        = SlotInfo.Parse(info);
            results.Chair       = ChairInfo.Parse(info);
            results.Icon        = IconInfo.Parse(info);
            results.Set         = ItemSet.ParseItemInfo(info);
            results.ConsumeSpec = characterItem?.Resolve("spec")?.Children.ToDictionary(c => c.NameWithoutExtension, c => c.ResolveForOrNull <string>());

            if (characterItem?.FileContainer?.Collection is MSPackageCollection && int.TryParse(info.Parent.NameWithoutExtension, out int itemId))
            {
                ((MSPackageCollection)characterItem.FileContainer.Collection).ItemQuests?.TryGetValue(itemId, out results.RelatedQuests);
            }

            return(results);
        }