Exemplo n.º 1
0
        public static NPCTemplate Parse(int id, IDataProperty property)
        {
            var t = new NPCTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                p.Resolve("info").Resolve(i =>
                {
                    t.TrunkPut  = i.Resolve <int>("trunkPut") ?? 0;
                    t.TrunkGet  = i.Resolve <int>("trunkGet") ?? 0;
                    t.StoreBank = i.Resolve <bool>("storeBank") ?? false;
                    t.Parcel    = i.Resolve <bool>("parcel") ?? false;
                    t.Scripts   = i.Resolve("script")?.Children
                                  .Select(NPCScriptTemplate.Parse)
                                  .ToList()
                                  ?? new List <NPCScriptTemplate>();
                });

                t.Move = p.Resolve("move") != null;
            });
            return(t);
        }
Exemplo n.º 2
0
        public override Task <ITemplate> Load(int id)
        {
            var property = Collection.Resolve($"Npc/{id:D7}.img");

            return(Task.FromResult <ITemplate>(NPCTemplate.Parse(id, property)));
        }