private void openLastTableToolStripMenuItem_Click(object sender, EventArgs e) { var lastTableContents = File.ReadAllLines("last_table.txt"); st = new SkillTable(lastTableContents[0]); snt = new SkillNameTable(lastTableContents[0].Replace("skilltable", "skillnametable")); // bad kludge. very bad kludge. who cares tho if (lastTableContents[0].Contains("player")) { rt = new RequirementsTable(lastTableContents[0].Replace("skilltable", "skilllearntable")); } InitSkillEditor(lastTableContents[0], snt); }
private void openTableToolStripMenuItem_Click(object sender, EventArgs e) { var openTableDialog = new OpenFileDialog(); openTableDialog.Filter = "Player skill table|playerskilltable.tbl|Enemy skill table|enemyskilltable.tbl"; openTableDialog.RestoreDirectory = true; if ((openTableDialog.ShowDialog() == DialogResult.OK)) { st = new SkillTable(openTableDialog.FileName); snt = new SkillNameTable(openTableDialog.FileName.Replace("skilltable", "skillnametable")); // bad kludge. very bad kludge. who cares tho if (openTableDialog.FileName.Contains("player")) { rt = new RequirementsTable(openTableDialog.FileName.Replace("skilltable", "skilllearntable")); ct = new SkillCustomTable(openTableDialog.FileName.Replace("playerskilltable", "skillcustomtable")); } InitSkillEditor(openTableDialog.FileName, snt); } }
private void InitSkillEditor(string tableName, SkillNameTable snt) { KeyPreview = true; KeyPress += ApplyOnEnter; skillList.Items.Clear(); for (int i = 0; i < snt.sjisStrings.Length; i++) { skillList.Items.Add( "0x" + i.ToString("X3") + ": " + snt.sjisStrings[i].GetAscii() ); } if (rt != null) { foreach (ComboBox skillList in requirementsEditorBox.Controls.OfType <ComboBox>()) { skillList.Items.Clear(); for (int i = 0; i < snt.sjisStrings.Length; i++) { skillList.Items.Add( "0x" + i.ToString("X3") + ": " + snt.sjisStrings[i].GetAscii() ); } } } skillList.SelectedIndex = 0; if (ct != null) { var skillStringsStart = skillList.SelectedIndex * 11; // magic number here for (int i = 0; i < 11; i++) { var textBoxToModify = customBox.Controls .OfType <TextBox>() .FirstOrDefault(x => x.Name == "customText" + (i + 1).ToString()); textBoxToModify.Text = ct.sjisStrings[skillStringsStart + i].GetAscii(); } } if (File.Exists("last_table.txt") == false) { File.Create("last_table.txt").Close(); } var lastTableContents = new List <string>(); lastTableContents.Add(tableName); File.WriteAllLines("last_table.txt", lastTableContents); foreach (Control skillEditControl in mainControlBox.Controls) { skillEditControl.Enabled = true; } foreach (RadioButton button in modifierStatusBox.Controls) { button.CheckedChanged += ModifierChanged; } disableVulnRadio.CheckedChanged += DisableChanged; inflictNo.CheckedChanged += DisableChanged; inflictYes.CheckedChanged += DisableChanged; inflictCures.CheckedChanged += DisableChanged; }