void update_view() { int level = (int)LevelBox.Value; int complexity = (int)CompBox.Value; LengthLbl.Text = SkillChallenge.GetSuccesses(complexity) + " successes before 3 failures"; InfoList.Items.Clear(); if (fChallenge.Level != -1) { ListViewItem lvi_easy = InfoList.Items.Add("Easy"); lvi_easy.SubItems.Add("DC " + AI.GetSkillDC(Difficulty.Easy, level)); lvi_easy.Group = InfoList.Groups[0]; ListViewItem lvi_mod = InfoList.Items.Add("Moderate"); lvi_mod.SubItems.Add("DC " + AI.GetSkillDC(Difficulty.Moderate, level)); lvi_mod.Group = InfoList.Groups[0]; ListViewItem lvi_hard = InfoList.Items.Add("Hard"); lvi_hard.SubItems.Add("DC " + AI.GetSkillDC(Difficulty.Hard, level)); lvi_hard.Group = InfoList.Groups[0]; XPLbl.Text = SkillChallenge.GetXP(level, complexity) + " XP"; } else { ListViewItem lvi = InfoList.Items.Add("DCs"); ListViewItem.ListViewSubItem lvsi = lvi.SubItems.Add("(varies by level)"); lvi.UseItemStyleForSubItems = false; lvsi.ForeColor = SystemColors.GrayText; lvi.Group = InfoList.Groups[0]; XPLbl.Text = "(XP varies by level)"; } SkillChallengeResult results = fChallenge.Results; SuccessCountLbl.Text = "Successes: " + results.Successes; FailureCountLbl.Text = "Failures: " + results.Fails; }
private void update_list() { this.ItemList.Items.Clear(); switch (this.fType) { case OverviewType.Encounters: { List <PlotPoint> .Enumerator enumerator = this.fPoints.GetEnumerator(); try { while (enumerator.MoveNext()) { PlotPoint current = enumerator.Current; if (current.Element == null || !(current.Element is Encounter)) { continue; } Encounter element = current.Element as Encounter; string str = ""; List <EncounterSlot> .Enumerator enumerator1 = element.AllSlots.GetEnumerator(); try { while (enumerator1.MoveNext()) { EncounterSlot encounterSlot = enumerator1.Current; if (str != "") { str = string.Concat(str, ", "); } str = string.Concat(str, encounterSlot.Card.Title); if (encounterSlot.CombatData.Count == 1) { continue; } object obj = str; object[] count = new object[] { obj, " (x", encounterSlot.CombatData.Count, ")" }; str = string.Concat(count); } } finally { ((IDisposable)enumerator1).Dispose(); } List <Trap> .Enumerator enumerator2 = element.Traps.GetEnumerator(); try { while (enumerator2.MoveNext()) { Trap trap = enumerator2.Current; if (str != "") { str = string.Concat(str, ", "); } str = string.Concat(str, trap.Name); } } finally { ((IDisposable)enumerator2).Dispose(); } ListViewItem pair = this.ItemList.Items.Add(current.Name); pair.SubItems.Add(string.Concat(element.GetXP(), " XP; ", str)); pair.Tag = new Pair <PlotPoint, Encounter>(current, element); } break; } finally { ((IDisposable)enumerator).Dispose(); } } case OverviewType.Traps: { List <PlotPoint> .Enumerator enumerator3 = this.fPoints.GetEnumerator(); try { while (enumerator3.MoveNext()) { PlotPoint plotPoint = enumerator3.Current; if (plotPoint.Element == null) { continue; } if (plotPoint.Element is TrapElement) { TrapElement trapElement = plotPoint.Element as TrapElement; ListViewItem listViewItem = this.ItemList.Items.Add(plotPoint.Name); listViewItem.SubItems.Add(string.Concat(Experience.GetCreatureXP(trapElement.Trap.Level), " XP; ", trapElement.Trap.Name)); listViewItem.Tag = new Pair <PlotPoint, Trap>(plotPoint, trapElement.Trap); } if (!(plotPoint.Element is Encounter)) { continue; } List <Trap> .Enumerator enumerator4 = (plotPoint.Element as Encounter).Traps.GetEnumerator(); try { while (enumerator4.MoveNext()) { Trap current1 = enumerator4.Current; ListViewItem pair1 = this.ItemList.Items.Add(plotPoint.Name); pair1.SubItems.Add(string.Concat(Experience.GetCreatureXP(current1.Level), " XP; ", current1.Name)); pair1.Tag = new Pair <PlotPoint, Trap>(plotPoint, current1); } } finally { ((IDisposable)enumerator4).Dispose(); } } break; } finally { ((IDisposable)enumerator3).Dispose(); } } case OverviewType.SkillChallenges: { List <PlotPoint> .Enumerator enumerator5 = this.fPoints.GetEnumerator(); try { while (enumerator5.MoveNext()) { PlotPoint plotPoint1 = enumerator5.Current; if (plotPoint1.Element == null) { continue; } if (plotPoint1.Element is SkillChallenge) { SkillChallenge skillChallenge = plotPoint1.Element as SkillChallenge; ListViewItem listViewItem1 = this.ItemList.Items.Add(plotPoint1.Name); listViewItem1.SubItems.Add(string.Concat(skillChallenge.GetXP(), " XP")); listViewItem1.Tag = new Pair <PlotPoint, SkillChallenge>(plotPoint1, skillChallenge); } if (!(plotPoint1.Element is Encounter)) { continue; } List <SkillChallenge> .Enumerator enumerator6 = (plotPoint1.Element as Encounter).SkillChallenges.GetEnumerator(); try { while (enumerator6.MoveNext()) { SkillChallenge skillChallenge1 = enumerator6.Current; ListViewItem pair2 = this.ItemList.Items.Add(plotPoint1.Name); pair2.SubItems.Add(string.Concat(skillChallenge1.GetXP(), " XP")); pair2.Tag = new Pair <PlotPoint, SkillChallenge>(plotPoint1, skillChallenge1); } } finally { ((IDisposable)enumerator6).Dispose(); } } break; } finally { ((IDisposable)enumerator5).Dispose(); } } case OverviewType.Treasure: { List <PlotPoint> .Enumerator enumerator7 = this.fPoints.GetEnumerator(); try { while (enumerator7.MoveNext()) { PlotPoint current2 = enumerator7.Current; List <Parcel> .Enumerator enumerator8 = current2.Parcels.GetEnumerator(); try { while (enumerator8.MoveNext()) { Parcel parcel = enumerator8.Current; string str1 = (parcel.Name != "" ? parcel.Name : "(undefined parcel)"); ListViewItem listViewItem2 = this.ItemList.Items.Add(current2.Name); listViewItem2.SubItems.Add(string.Concat(str1, ": ", parcel.Details)); listViewItem2.Tag = new Pair <PlotPoint, Parcel>(current2, parcel); } } finally { ((IDisposable)enumerator8).Dispose(); } } break; } finally { ((IDisposable)enumerator7).Dispose(); } } } if (this.ItemList.Items.Count == 0) { ListViewItem grayText = this.ItemList.Items.Add("(no items)"); grayText.ForeColor = SystemColors.GrayText; } this.ItemList.Sort(); }
void update_list() { ItemList.Items.Clear(); switch (fType) { case OverviewType.Encounters: { foreach (PlotPoint pp in fPoints) { if (pp.Element == null) { continue; } if (pp.Element is Encounter) { Encounter enc = pp.Element as Encounter; string creatures = ""; foreach (EncounterSlot slot in enc.AllSlots) { if (creatures != "") { creatures += ", "; } creatures += slot.Card.Title; if (slot.CombatData.Count != 1) { creatures += " (x" + slot.CombatData.Count + ")"; } } foreach (Trap trap in enc.Traps) { if (creatures != "") { creatures += ", "; } creatures += trap.Name; } ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(enc.GetXP() + " XP; " + creatures); lvi.Tag = new Pair <PlotPoint, Encounter>(pp, enc); } } } break; case OverviewType.Traps: { foreach (PlotPoint pp in fPoints) { if (pp.Element == null) { continue; } if (pp.Element is TrapElement) { TrapElement te = pp.Element as TrapElement; ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(Experience.GetCreatureXP(te.Trap.Level) + " XP; " + te.Trap.Name); lvi.Tag = new Pair <PlotPoint, Trap>(pp, te.Trap); } if (pp.Element is Encounter) { Encounter enc = pp.Element as Encounter; foreach (Trap trap in enc.Traps) { ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(Experience.GetCreatureXP(trap.Level) + " XP; " + trap.Name); lvi.Tag = new Pair <PlotPoint, Trap>(pp, trap); } } } } break; case OverviewType.SkillChallenges: { foreach (PlotPoint pp in fPoints) { if (pp.Element == null) { continue; } if (pp.Element is SkillChallenge) { SkillChallenge sc = pp.Element as SkillChallenge; ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(sc.GetXP() + " XP"); lvi.Tag = new Pair <PlotPoint, SkillChallenge>(pp, sc); } if (pp.Element is Encounter) { Encounter enc = pp.Element as Encounter; foreach (SkillChallenge sc in enc.SkillChallenges) { ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(sc.GetXP() + " XP"); lvi.Tag = new Pair <PlotPoint, SkillChallenge>(pp, sc); } } } } break; case OverviewType.Treasure: { foreach (PlotPoint pp in fPoints) { foreach (Parcel parcel in pp.Parcels) { string name = (parcel.Name != "") ? parcel.Name : "(undefined parcel)"; ListViewItem lvi = ItemList.Items.Add(pp.Name); lvi.SubItems.Add(name + ": " + parcel.Details); lvi.Tag = new Pair <PlotPoint, Parcel>(pp, parcel); } } } break; } if (ItemList.Items.Count == 0) { ListViewItem lvi = ItemList.Items.Add("(no items)"); lvi.ForeColor = SystemColors.GrayText; } ItemList.Sort(); }
void update_view() { SkillList.Items.Clear(); ListViewItem name_lvi = SkillList.Items.Add(fChallenge.Name + ": " + fChallenge.GetXP() + " XP"); name_lvi.Group = SkillList.Groups[0]; ListViewItem info_lvi = SkillList.Items.Add(fChallenge.Info); info_lvi.Group = SkillList.Groups[0]; if (fChallenge.MapID != Guid.Empty) { Map m = Session.Project.FindTacticalMap(fChallenge.MapID); if (m != null) { MapArea ma = m.FindArea(fChallenge.MapAreaID); if (ma != null) { string str = "Location: " + m.Name; if (ma != null) { str += " (" + ma.Name + ")"; } ListViewItem lvi_loc = SkillList.Items.Add(str); lvi_loc.Group = SkillList.Groups[0]; } } } foreach (SkillChallengeData scd in fChallenge.Skills) { string diff = scd.Difficulty.ToString().ToLower() + " DCs"; if (scd.DCModifier != 0) { if (scd.DCModifier > 0) { diff += " +" + scd.DCModifier; } else { diff += " " + scd.DCModifier; } } string str = scd.SkillName + " (" + diff + ")"; if (scd.Details != "") { str += ": " + scd.Details; } ListViewItem lvi = SkillList.Items.Add(str); lvi.Tag = scd; switch (scd.Type) { case SkillType.Primary: lvi.Group = SkillList.Groups[1]; break; case SkillType.Secondary: lvi.Group = SkillList.Groups[2]; break; case SkillType.AutoFail: lvi.Group = SkillList.Groups[3]; break; } if ((scd.Difficulty == Difficulty.Trivial) || (scd.Difficulty == Difficulty.Extreme)) { lvi.ForeColor = Color.Red; } } if (SkillList.Groups[1].Items.Count == 0) { ListViewItem lvi = SkillList.Items.Add("(none)"); lvi.Group = SkillList.Groups[1]; lvi.ForeColor = SystemColors.GrayText; } if (SkillList.Groups[2].Items.Count == 0) { ListViewItem lvi = SkillList.Items.Add("(none)"); lvi.Group = SkillList.Groups[2]; lvi.ForeColor = SystemColors.GrayText; } SkillList.Sort(); }