public static ModifiedCommodityTemplate Parse(int id, IDataProperty property)
        {
            var t = new ModifiedCommodityTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.ItemID         = p.Resolve <int>("itemId");
                t.Count          = p.Resolve <short>("count");
                t.Priority       = p.Resolve <byte>("priority");
                t.Price          = p.Resolve <int>("price");
                t.Bonus          = p.Resolve <byte>("bonus");
                t.Period         = p.Resolve <short>("period");
                t.ReqPOP         = p.Resolve <short>("reqPOP");
                t.ReqLEV         = p.Resolve <short>("reqLEV");
                t.MaplePoint     = p.Resolve <int>("maplePoint");
                t.Meso           = p.Resolve <int>("meso");
                t.ForPremiumUser = p.Resolve <bool>("premium");
                t.Gender         = p.Resolve <byte>("gender");
                t.OnSale         = p.Resolve <bool>("onSale");
                t.Class          = p.Resolve <byte>("class");
                t.Limit          = p.Resolve <byte>("limit");
                t.PbCash         = p.Resolve <short>("pbCash");
                t.PbPoint        = p.Resolve <short>("pbPoint");
                t.PbGift         = p.Resolve <short>("pbGift");
                t.PackageSN      = property.Resolve("package")?.Children
                                   .Select(c => c.Resolve <int>() ?? 0)
                                   .ToArray() ?? null;
            });

            return(t);
        }
Ejemplo n.º 2
0
        public override Task LoadAll()
        {
            var property = Collection.Resolve("Server/ModifiedCommodity.img");

            property.Children
            .ToDictionary(
                c => Convert.ToInt32(c.Name),
                c => ModifiedCommodityTemplate.Parse(Convert.ToInt32(c.Name), c)
                )
            .ForEach(kv => Templates.Add(kv.Key, kv.Value));
            return(Task.CompletedTask);
        }