예제 #1
0
        private void MapSearchBT_Click(object sender, EventArgs e)
        {
            uint id = 0;

            using (var dialog = new NewIDDialog("Find Map by ID", map_names_.Length - 1))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }


            for (var i = 0; i < maps_.Count; ++i)
            {
                if (maps_[i].id == id)
                {
                    MapListBox.SelectedIndex = i;
                    return;
                }
            }

            ErrMsg("ID not found.");
        }
예제 #2
0
        private void SkillSearchBT_Click(object sender, EventArgs e)
        {
            uint id = 0;

            using (var dialog = new NewIDDialog("Find Skill by ID", 1023))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }


            for (var i = 0; i < SkillDataCB.Items.Count; ++i)
            {
                if (((Tuple <string, uint>)SkillDataCB.Items[i]).Item2 == id)
                {
                    SkillDataCB.SelectedIndex = i;
                    return;
                }
            }

            ErrMsg("ID not found.");
        }
예제 #3
0
        private void NewSkillBT_Click(object sender, EventArgs e)
        {
            uint id = 0;

            using (var dialog = new NewIDDialog("New Skill", 1023))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }

            if (skills_.ContainsKey(id))
            {
                ErrMsg("ID already in use!");
                return;
            }

            var str = "Skill" + id.ToString();

            skill_names_[id] = str;
            skill_descs_[id] = str;
            skills_[id]      = new SkillData {
                id = id, name = str
            };

            var index = SkillDataCB.Items.Add(new Tuple <string, uint>(str, id));

            SkillDataCB.SelectedIndex = index;
        }
예제 #4
0
        private void NewTrainerBT_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(working_dir_) || dods_.Count == 0)
            {
                return;
            }

            int id = 0;

            using (var dialog = new NewIDDialog("New Trainer", 2047))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = dialog.ID;
            }

            var path = working_dir_ + (is_ynk_ ? "/gn_dat5.arc/script/dollOperator/" : "/gn_dat3.arc/script/dollOperator/") + id.ToString("D4") + ".dod";

            if (File.Exists(path))
            {
                ErrMsg("Trainer ID already exists!");
                return;
            }

            try
            {
                byte[] buf = new byte[0x42A];
                File.WriteAllBytes(path, buf);
            }
            catch (Exception ex)
            {
                ErrMsg("Failed to write to file: " + path + "\r\n" + ex.Message);
                return;
            }

            var dod = new DodJson();

            dod.filepath      = path.Replace(".dod", ".json");
            dod.id            = id;
            dod.trainer_name  = "New Trainer";
            dod.trainer_title = "New Trainer";
            dods_.Add(dod);
            TrainerLB.Items.Add(dod.trainer_name);
            TrainerLB.SelectedIndex = TrainerLB.Items.Count - 1;
            WriteDod(dod);
        }
예제 #5
0
        private void TrainerSearchBT_Click(object sender, EventArgs e)
        {
            uint id = 0;

            using (var dialog = new NewIDDialog("Find Trainer by ID", 2047))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }

            for (var i = 0; i < dods_.Count; ++i)
            {
                if (dods_[i].id == id)
                {
                    TrainerLB.SelectedIndex = i;
                    return;
                }
            }

            ErrMsg("ID not found.");
        }
예제 #6
0
        private void NewPuppetButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(working_dir_) || puppets_.Count == 0)
            {
                ErrMsg("No data loaded!");
                return;
            }

            uint id = 0;

            using (var dialog = new NewIDDialog("New Puppet", 511))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }

            if (puppets_.ContainsKey(id))
            {
                ErrMsg("Puppet ID in use! Select a different ID.");
                return;
            }

            if ((id >= puppet_names_.Length) || (id >= 512))
            {
                var min = Math.Min(puppet_names_.Length, 512);
                ErrMsg("Puppet ID too large! ID must be less than " + min.ToString() + ".");
                return;
            }

            uint puppetdex_pos = 0;

            foreach (var i in puppets_)
            {
                if (i.Value.puppetdex_index > puppetdex_pos)
                {
                    puppetdex_pos = i.Value.puppetdex_index;
                }
            }

            if (++puppetdex_pos > 511)
            {
                puppetdex_pos = 0;
            }

            var puppet = new DollData()
            {
                id = id, puppetdex_index = puppetdex_pos
            };

            puppets_[id] = puppet;
            PuppetLB.Items.Add(new Tuple <string, uint>(puppet_names_[id], puppet.id));
            PuppetLB.SelectedIndex = PuppetLB.FindStringExact(puppet_names_[id]);
            obj_flags_[id]         = 1;
            if (is_ynk_)
            {
                obj_flags_[id + 400] = 1;
            }
            for (var i = 0; i < (is_ynk_ ? 4 : 3); ++i)
            {
                puppet_flags_[(id * 4) + i] = 1;
            }
        }