public override Task LoadAll() { var property = Collection.Resolve("Server/NpcShop.img"); property.Children .ToDictionary( c => Convert.ToInt32(c.Name), c => NPCShopTemplate.Parse(Convert.ToInt32(c.Name), c) ) .ForEach(kv => Templates.Add(kv.Key, kv.Value)); return(Task.CompletedTask); }
public static NPCShopTemplate Parse(int id, IDataProperty property) { var t = new NPCShopTemplate { ID = id, Items = property.Children .Select(NPCShopItemTemplate.Parse) .DistinctBy(x => x.ID) .ToDictionary(x => x.ID, x => x) }; return(t); }