public static void RemoveCustomFeat(Feat f) { _FeatsDB.DeleteItem(f); feats.Remove(f); Feat old; if (FeatMap.TryGetValue(f.Name, out old)) { if (old == f) { FeatMap.Remove(f.Name); Feat replace = feats.FirstOrDefault(a => a.Name == f.Name); if (replace != null) { FeatMap[replace.Name] = replace; } } } }
private void CreateStatisticsSection(Monster monster, List <Block> blocks) { blocks.AddRange(CreateSectionHeader("STATISTICS")); Paragraph statsParagraph = new Paragraph(); statsParagraph.Margin = new Thickness(0); List <TitleValuePair> statsLine = new List <TitleValuePair>(); statsLine.Add(new TitleValuePair { Title = "Str ", Value = (monster.Strength == null) ? "-" : monster.Strength.ToString() }); statsLine.Add(new TitleValuePair { Title = "Dex ", Value = (monster.Dexterity == null) ? "-" : monster.Dexterity.ToString() }); statsLine.Add(new TitleValuePair { Title = "Con ", Value = (monster.Constitution == null) ? "-" : monster.Constitution.ToString() }); statsLine.Add(new TitleValuePair { Title = "Int ", Value = (monster.Intelligence == null) ? "-" : monster.Intelligence.ToString() }); statsLine.Add(new TitleValuePair { Title = "Wis ", Value = (monster.Wisdom == null) ? "-" : monster.Wisdom.ToString() }); statsLine.Add(new TitleValuePair { Title = "Cha ", Value = (monster.Charisma == null) ? "-" : monster.Charisma.ToString() }); statsParagraph.Inlines.AddRange(CreateMultiValueLine(statsLine, ", ")); List <TitleValuePair> combatLine = new List <TitleValuePair>(); combatLine.Add(new TitleValuePair { Title = "Base Atk ", Value = monster.BaseAtk.PlusFormat() }); combatLine.Add(new TitleValuePair { Title = "CMB ", Value = monster.CMB }); combatLine.Add(new TitleValuePair { Title = "CMD ", Value = monster.CMD }); statsParagraph.Inlines.AddRange(CreateMultiValueLine(combatLine, "; ")); if (monster.FeatsList.Count > 0) { int count = 0; statsParagraph.Inlines.Add(new Bold(new Run("Feats "))); foreach (string feat in monster.FeatsList) { if (count > 0) { statsParagraph.Inlines.Add(", "); } Hyperlink link = new Hyperlink(new Run(feat)); Regex regFeat = new Regex("(?<name>[-'\\p{L} ]+) +\\("); string featname = feat; Match m = regFeat.Match(feat); if (m.Success) { featname = m.Groups["name"].Value; } link.Tag = featname; link.Click += new RoutedEventHandler(FeatLinkClicked); Feat featObject = Feat.Feats.FirstOrDefault <Feat>(a => String.Compare(a.Name, featname, true) == 0); if (featObject != null) { link.DataContext = featObject; ToolTip t = (ToolTip)App.Current.MainWindow.FindResource("ObjectToolTip"); if (t != null) { ToolTipService.SetShowDuration(link, 360000); link.ToolTip = t; link.ToolTipOpening += new ToolTipEventHandler(link_ToolTipOpening); } } statsParagraph.Inlines.Add(link); count++; } statsParagraph.Inlines.Add(new LineBreak()); } if (monster.SkillValueDictionary.Count > 0) { statsParagraph.Inlines.Add(new Bold(new Run("Skills "))); int count = 0; foreach (SkillValue val in monster.SkillValueDictionary.Values) { if (count > 0) { statsParagraph.Inlines.Add(new Run(", ")); } statsParagraph.Inlines.AddRange(CreateRulesLink(val.FullName, val.Name, "Skills", " ")); statsParagraph.Inlines.Add(new Run(val.Mod.PlusFormat())); count++; } statsParagraph.Inlines.Add(new LineBreak()); } statsParagraph.Inlines.AddRange(CreateItemIfNotNull(" Racial Modifiers ", monster.RacialMods)); statsParagraph.Inlines.AddRange(CreateItemIfNotNull("Languages ", monster.Languages)); statsParagraph.Inlines.AddRange(CreateItemIfNotNull("SQ ", monster.SQ)); statsParagraph.Inlines.AddRange(CreateItemIfNotNull("Gear ", monster.Gear)); statsParagraph.Inlines.AddRange(CreateItemIfNotNull("Other Gear ", monster.OtherGear)); blocks.Add(statsParagraph); }
public Feat(Feat f) { CopyFrom(f); }
public static void UpdateCustomFeat(Feat f) { _FeatsDB.UpdateItem(f); }
public List <Block> CreateBlocks(Feat feat, bool showTitle) { List <Block> blocks = new List <Block>(); string featString = null; if (feat.Types != null) { featString = ""; bool first = true; foreach (String featType in feat.Types) { if (feat.Type != "General") { if (first) { first = false; } else { featString += ", "; } featString += featType; } } } Paragraph details = new Paragraph(); details.Margin = new Thickness(0, 2, 0, 0); if (showTitle) { Run titleRun = new Run(feat.Name); titleRun.FontStyle = FontStyles.Italic; titleRun.FontWeight = FontWeights.Bold; titleRun.FontSize = titleRun.FontSize * 1.8; string text = feat.Name; if (featString != null && featString.Length > 0) { text += " (" + featString + ")"; } blocks.Add(CreateHeaderParagraph(text)); } else { if (featString != null && featString.Length > 0) { details.Inlines.Add(new Italic(new Run(featString))); details.Inlines.Add(new LineBreak()); } } details.Inlines.AddRange(CreateItemIfNotNull(null, feat.Summary)); if (feat.Prerequistites != null) { details.Inlines.AddRange(CreateItemIfNotNull("Prerequisitites: ", feat.Prerequistites.Trim(new char[] { '-' }))); } details.Inlines.AddRange(CreateItemIfNotNull("Benefit: ", feat.Benefit)); details.Inlines.AddRange(CreateItemIfNotNull("Normal: ", feat.Normal)); details.Inlines.AddRange(CreateItemIfNotNull("Special: ", feat.Special)); if (feat.Source != "Pathfinder Core Rulebook") { CreateItemIfNotNull(details.Inlines, "Source: ", SourceInfo.GetSource(feat.Source)); } blocks.Add(details); return(blocks); }
public List <Block> CreateBlocks(Feat feat) { return(CreateBlocks(feat, true)); }
public static String CreateHtml(Feat feat, bool showTitle) { StringBuilder blocks = new StringBuilder(); blocks.CreateHtmlHeader(); string featString = null; if (feat.Types != null) { featString = ""; bool first = true; foreach (String featType in feat.Types) { if (feat.Type != "General") { if (first) { first = false; } else { featString += ", "; } featString += featType; } } } if (showTitle) { string text = feat.Name; if (featString != null && featString.Length > 0) { text += " (" + featString + ")"; } blocks.CreateHeader(text); } else { if (featString != null && featString.Length > 0) { blocks.AppendEscapedTag("p", "altheader", featString); } } blocks.AppendOpenTag("p"); blocks.CreateItemIfNotNull(null, feat.Summary); if (feat.Prerequistites != null) { blocks.CreateItemIfNotNull("Prerequisitites: ", feat.Prerequistites.Trim(new char[] { '-' })); } blocks.CreateItemIfNotNull("Benefit: ", feat.Benefit); blocks.CreateItemIfNotNull("Normal: ", feat.Normal); blocks.CreateItemIfNotNull("Special: ", feat.Special); if (feat.Source != "Pathfinder Core Rulebook") { blocks.CreateItemIfNotNull("Source: ", SourceInfo.GetSource(feat.Source)); } blocks.AppendCloseTag("p"); blocks.CreateHtmlFooter(); return(blocks.ToString()); }
public static String CreateHtml(Feat feat) { return(CreateHtml(feat, true)); }
public static bool TryByID(bool custom, int id, out Feat s) { s = ByID(custom, id); return(s != null); }