private void ParsePopulationLine(string data) { data = data.Trim(); var pop = Convert.ToInt32(data.Substring(0, data.IndexOf(' '))); var race = data.Substring(data.IndexOf(' ') + 1); var thisRace = World.GetAddRace(race); if (race.Contains(" prisoner")) { if (Prisoners.ContainsKey(thisRace)) { Prisoners[thisRace]++; } else { Prisoners.Add(thisRace, pop); } } else if (race.Contains(" outcast")) { if (Outcasts.ContainsKey(thisRace)) { Outcasts[thisRace]++; } else { Outcasts.Add(thisRace, pop); } } else { if (Population.ContainsKey(thisRace)) { Population[thisRace] += pop; } else { Population.Add(thisRace, pop); } } }
public override void Select(MainForm frm) { if (frm.grpSite.Text == ToString() && frm.MainTab.SelectedTab == frm.tabSite) { return; } Program.MakeSelected(frm.tabSite, frm.lstSite, this); frm.grpSite.Text = ToString(); if (IsPlayerControlled) { frm.grpSite.Text += @" (PLAYER CONTROLLED)"; } #if DEBUG frm.grpSite.Text += $" - ID: {Id}"; #endif frm.grpSite.Show(); frm.lblSiteName.Text = ToString(); frm.lblSiteAltName.Text = AltName; frm.lblSiteType.Text = SiteType; frm.lblSiteCoord.Data = new Coordinate(Coords); frm.lblSiteOwner.Data = Owner; frm.lblSiteParentCiv.Data = Parent; frm.lblSiteCurOwner.Data = CurOwner; frm.lblSiteCiv.Data = Civ; var siteMapPath = World.MapPath.Replace("world_map", "site_map-" + Id); frm.SiteMapLabel.Visible = File.Exists(siteMapPath); frm.grpSiteCreated.Visible = CreatedEvent != null; if (CreatedEvent != null) { frm.lblSiteCreatedBy.Data = CreatedEvent.Entity_SiteCiv; frm.lblSiteCreatedByCiv.Data = CreatedEvent.Entity; frm.lblSiteCreatedTime.Data = CreatedEvent; frm.lblSiteCreatedTime.Text = CreatedEvent.Time.ToString(); } if (Population != null) { frm.grpSitePopulation.FillListboxWith(frm.lstSitePopulation, Population.Keys, this); frm.grpSitePopulation.Text = $"Population ({Population.Sum(x => x.Value)})"; } else { frm.grpSitePopulation.Visible = false; } frm.grpSiteArtifacts.FillListboxWith(frm.lstSiteArtifacts, CreatedArtifacts); frm.grpSiteStructures.FillListboxWith(frm.lstSiteStructures, Structures); if (Prisoners != null) { frm.grpSitePrisoners.FillListboxWith(frm.lstSitePrisoners, Prisoners.Keys, this); frm.grpSitePrisoners.Text = $"Prisoners ({Prisoners.Sum(x => x.Value)})"; } else { frm.grpSitePrisoners.Visible = false; } if (Outcasts != null) { frm.grpSiteOutcasts.FillListboxWith(frm.lstSiteOutcasts, Outcasts.Keys, this); frm.grpSiteOutcasts.Text = $"Outcasts ({Outcasts.Sum(x => x.Value)})"; } else { frm.grpSiteOutcasts.Visible = false; } frm.grpSiteInhabitants.FillListboxWith(frm.lstSiteInhabitants, Inhabitants); frm.grpSiteEvent.FillListboxWith(frm.lstSiteEvent, Events); frm.trvSiteEventCollection.Nodes.Clear(); if (AbductionEventCollections != null) { var thisNode = new TreeNode("Abduction"); foreach (var newNode in AbductionEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (BattleEventCollections != null) { var thisNode = new TreeNode("Battle"); foreach (var newNode in BattleEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (BeastAttackEventCollections != null) { var thisNode = new TreeNode("Beast Attack"); foreach (var newNode in BeastAttackEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (DuelEventCollections != null) { var thisNode = new TreeNode("Duel"); foreach (var newNode in DuelEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (SiteConqueredEventCollections != null) { var thisNode = new TreeNode("Site Conquered"); foreach (var newNode in SiteConqueredEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (TheftEventCollections != null) { var thisNode = new TreeNode("Theft"); foreach (var newNode in TheftEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } if (InsurrectionEventCollections != null) { var thisNode = new TreeNode("Insurrection"); foreach (var newNode in InsurrectionEventCollections.Select(evtcol => new TreeNode(evtcol.ToString()) { Tag = evtcol })) { thisNode.Nodes.Add(newNode); } thisNode.Text += $" ({thisNode.Nodes.Count})"; frm.trvSiteEventCollection.Nodes.Add(thisNode); } frm.grpSiteEventCollection.Visible = frm.trvSiteEventCollection.Nodes.Count > 0; frm.SetDisplayedItem(this); }