예제 #1
0
        public static void Initialize()
        {
            DFHackReply<ListJobSkillsOut> job_skills;

            using (var client = new DFHackClient())
            {
                client.Open();

                m_world = client.GetWorldInfo();
                m_enums = client.ListEnums();

                job_skills = client.ListJobSkills();
            }

            m_labors = job_skills.Data.LaborList.ToDictionary(l => l.Id, l => new DwarfLabor(l));
            m_professions = job_skills.Data.ProfessionList.ToDictionary(p => p.Id, p => new DwarfProfession(p));
            m_skills = job_skills.Data.SkillList.ToDictionary(s => s.Id, s => new DwarfSkill(s));
            m_skills_by_labor = job_skills.Data.SkillList
                .Where(s => s.Labor != NONE)
                .ToDictionary(s => s.Labor, s => m_skills[s.Id]);
        }
예제 #2
0
        private void toolStrip_Refresh(object sender, EventArgs e)
        {
            DFHackReply<ListUnitsOut> reply;

            using (var client = new DFHackClient())
            {
                client.Open();
                reply = client.ListUnits();
            }

            var dwarves = new ObjectBindingList<Dwarf>(reply.Data.ValueList
                .Where(u => u.Race == GameData.World.RaceId)
                .Select(u => new Dwarf(u)));

            GameData.UpdateLabors(dwarves);
            grid_dwarves.DataSource = dwarves;
            grid_labors.DataSource = new ObjectBindingList<DwarfLabor>(GameData.GetLabors());
            ApplyFilters();
        }