public CK3Title(decimal province_id, string id_name, string pretty_name, string title_level, Color csv_color, Color title_color, CK3Title capital_county, List <CK3Title> dejure_titles, string religion, string culture, string holding_type) { this.province_id = province_id; this.id_name = id_name; this.pretty_name = pretty_name; this.title_level = title_level; this.csv_color = csv_color; this.title_color = title_color; this.capital_county = capital_county; this.dejure_titles = dejure_titles; this.religion = religion; this.culture = culture; this.holding_type = holding_type; }
private void create_title() { List <CK3Title> dejure_titles = new List <CK3Title>(); for (int i = 0; i < ValidDeJureTitles.CheckedItems.Count; i++) { dejure_titles.Add(titles[ValidDeJureTitles.CheckedItems[i].ToString()]); } CK3Title capital_title_stuff = null; if (titles.ContainsKey(CapitalSelect.Text)) { capital_title_stuff = titles[CapitalSelect.Text]; } CK3Title new_title = new CK3Title(ProvinceID.Value, InternalIDName.Text, PrettyNameBox.Text, TitleLevel.Text, CSVColor.BackColor, IGTitleColor.BackColor, capital_title_stuff, dejure_titles, ReligionBox.Text, CultureBox.Text, HoldingSelect.Text); titles.Add(new_title.id_name, new_title); SelectedEntry.Items.Add(InternalIDName.Text); SelectedEntry.Text = InternalIDName.Text; refresh_gui(); }
private void TitleLevel_SelectedIndexChanged(object sender, EventArgs e) { if (AutogenID.Checked) { generate_id_name(); } CK3Title SelectedTitle = titles[SelectedEntry.Text]; ValidDeJureTitles.Items.Clear(); switch (TitleLevel.Text) { case "Barony": ProvinceID.Enabled = true; CSVColor.Enabled = true; CapitalSelect.Enabled = false; ValidDeJureTitles.Enabled = false; HoldingSelect.Enabled = true; ReligionBox.Enabled = false; CultureBox.Enabled = false; break; case "County": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = false; ValidDeJureTitles.Enabled = true; HoldingSelect.Enabled = false; ReligionBox.Enabled = true; CultureBox.Enabled = true; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Barony") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Duchy": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; HoldingSelect.Enabled = false; ReligionBox.Enabled = false; CultureBox.Enabled = false; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "County") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Kingdom": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; HoldingSelect.Enabled = false; ReligionBox.Enabled = false; CultureBox.Enabled = false; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Duchy") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Empire": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; HoldingSelect.Enabled = false; ReligionBox.Enabled = false; CultureBox.Enabled = false; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Kingdom") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; } }
private void save_current_title() { CK3Title SelectedTitle = titles[SelectedEntry.Text]; SelectedTitle.pretty_name = PrettyNameBox.Text; titles.Remove(SelectedTitle.id_name); SelectedTitle.id_name = InternalIDName.Text; titles.Add(SelectedTitle.id_name, SelectedTitle); SelectedTitle.csv_color = CSVColor.BackColor; SelectedTitle.title_color = IGTitleColor.BackColor; if (SelectedTitle.title_level != TitleLevel.Text) { ValidDeJureTitles.Items.Clear(); SelectedTitle.dejure_titles.Clear(); switch (TitleLevel.Text) { case "Barony": break; case "County": foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Barony") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Duchy": foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "County") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Kingdom": foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Duchy") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Empire": foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Kingdom") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; } } List <CK3Title> dejure_titles = new List <CK3Title>(); for (int i = 0; i < ValidDeJureTitles.CheckedItems.Count; i++) { dejure_titles.Add(titles[ValidDeJureTitles.CheckedItems[i].ToString()]); } if (titles.ContainsKey(CapitalSelect.Text)) { SelectedTitle.capital_county = titles[CapitalSelect.Text]; } SelectedTitle.dejure_titles = dejure_titles; SelectedTitle.title_level = TitleLevel.Text; SelectedTitle.religion = ReligionBox.Text; SelectedTitle.culture = CultureBox.Text; SelectedTitle.holding_type = HoldingSelect.Text; }
private void refresh_gui() { CapitalSelect.Items.Clear(); foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "County") { CapitalSelect.Items.Add(checked_title.id_name); } } CK3Title SelectedTitle = titles[SelectedEntry.Text]; ValidDeJureTitles.Items.Clear(); switch (SelectedTitle.title_level.ToString()) { case "Barony": ProvinceID.Enabled = true; CSVColor.Enabled = true; CapitalSelect.Enabled = false; ValidDeJureTitles.Enabled = false; break; case "County": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = false; ValidDeJureTitles.Enabled = true; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Barony") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Duchy": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "County") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Kingdom": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Duchy") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; case "Empire": ProvinceID.Enabled = false; CSVColor.Enabled = false; CapitalSelect.Enabled = true; ValidDeJureTitles.Enabled = true; foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Kingdom") { ValidDeJureTitles.Items.Add(checked_title.id_name, SelectedTitle.dejure_titles.Contains(checked_title)); } } break; } PrettyNameBox.Text = SelectedTitle.pretty_name; InternalIDName.Text = SelectedTitle.id_name; IGTitleColor.BackColor = SelectedTitle.title_color; TitleLevel.Text = SelectedTitle.title_level; ReligionBox.Text = SelectedTitle.religion; CultureBox.Text = SelectedTitle.culture; HoldingSelect.Text = SelectedTitle.holding_type; if (ProvinceID.Enabled) { ProvinceID.Value = SelectedTitle.province_id; } if (CSVColor.Enabled) { CSVColor.BackColor = SelectedTitle.csv_color; } if (CapitalSelect.Enabled && SelectedTitle.capital_county != null) { CapitalSelect.Text = SelectedTitle.capital_county.id_name; } ProvinceHierarchy.Nodes.Clear(); ProvinceHierarchy.BeginUpdate(); foreach (var title in titles) { CK3Title checked_title = title.Value; if (checked_title.title_level == "Empire") { TreeNode BaseNode = ProvinceHierarchy.Nodes.Add(checked_title.id_name); if (checked_title.dejure_titles.Count() >= 1) { foreach (CK3Title kingdom in checked_title.dejure_titles) { TreeNode BaseKingdom = BaseNode.Nodes.Add(kingdom.id_name); if (kingdom.dejure_titles.Count() >= 1) { foreach (CK3Title duchy in kingdom.dejure_titles) { TreeNode BaseDuchy = BaseKingdom.Nodes.Add(duchy.id_name); if (duchy.dejure_titles.Count() >= 1) { foreach (CK3Title county in duchy.dejure_titles) { TreeNode BaseCounty = BaseDuchy.Nodes.Add(county.id_name); if (county.dejure_titles.Count() >= 1) { foreach (CK3Title barony in county.dejure_titles) { BaseCounty.Nodes.Add(barony.id_name); } } } } } } } } } } ProvinceHierarchy.EndUpdate(); }