コード例 #1
0
        public static ShopInfo GetItemByCode(string Code)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereCode(Code).ToOne());
            }
            string key   = string.Concat("pifa_BLL_ShopByCode_", Code);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(ShopInfo.Parse(value)); } catch { }
            }
            ShopInfo item = Select.WhereCode(Code).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
コード例 #2
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);
        }