public static string CreateHtml(Rule rule, bool showTitle) { StringBuilder blocks = new StringBuilder(); blocks.CreateHtmlHeader(); string name = rule.Name; string extraText = ""; if (rule.AbilityType != null && rule.AbilityType.Length > 0) { extraText += "(" + rule.AbilityType + ")"; } if (rule.Type == "Skills") { extraText += "(" + rule.Ability + (rule.Untrained ? "" : "; Trained Only") + ")"; } if (extraText.Length > 0) { name = name + " " + extraText; } if (showTitle) { if (rule.Subtype.NotNullString()) { blocks.CreateHeader(name, rule.Subtype); } else { blocks.CreateHeader(name); } } blocks.Append(rule.Details); blocks.AppendOpenTag("p"); if (SourceInfo.GetSourceType(rule.Source) != SourceType.Core) { blocks.CreateItemIfNotNull("Source: ", SourceInfo.GetSource(rule.Source)); } blocks.CreateItemIfNotNull("Format: ", true, rule.Format, "; ", false); blocks.CreateItemIfNotNull("Location: ", true, rule.Location, ".", true); blocks.CreateItemIfNotNull("Format: ", true, rule.Format2, "; ", false); blocks.CreateItemIfNotNull("Location: ", true, rule.Location2, ".", true); blocks.AppendCloseTag("p"); blocks.CreateHtmlFooter(); return(blocks.ToString()); }
public static string CreateHtml(Monster monster = null, Character ch = null, bool addDescription = true, bool completePage = true, string css = null) { Monster useMonster; if (ch != null) { useMonster = ch.Monster; } else { useMonster = monster; } StringBuilder blocks = new StringBuilder(); if (completePage) { blocks.CreateHtmlHeader(css); } CreateTopSection(useMonster, ch, blocks); CreateDefenseSection(useMonster, blocks); CreateOffenseSection(useMonster, blocks); CreateTacticsSection(useMonster, blocks); CreateStatisticsSection(useMonster, blocks); CreateEcologySection(useMonster, blocks); CreateSpecialAbilitiesSection(useMonster, blocks); if (addDescription) { CreateDescriptionSection(useMonster, blocks); } if (SourceInfo.GetSourceType(useMonster.Source) != SourceType.Core) { blocks.CreateItemIfNotNull("Source ", SourceInfo.GetSource(useMonster.Source)); } if (completePage) { blocks.CreateHtmlFooter(); } return(blocks.ToString()); }
public static String CreateHtml(MagicItem item, bool showTitle = true, bool completepage = true, string css = null) { StringBuilder blocks = new StringBuilder(); if (completepage) { blocks.CreateHtmlHeader(css); } if (showTitle) { blocks.CreateHeader(item.Name, item.Group); } /*Paragraph details = new Paragraph(); * details.Margin = new Thickness(0, 2, 0, 0);*/ blocks.AppendOpenTag("p"); blocks.CreateItemIfNotNull("Aura ", true, item.Aura, " ", false); blocks.CreateItemIfNotNull("[", false, item.AuraStrength, "]; ", false); blocks.CreateItemIfNotNull("CL ", true, item.CL.PastTense(), "", true); blocks.CreateItemIfNotNull("Slot ", true, item.Slot, "; ", false); blocks.CreateItemIfNotNull("Price ", true, item.Price, "; ", false); blocks.CreateItemIfNotNull("Weight ", true, item.Weight, "", true); blocks.AppendCloseTag("p"); if (!String.IsNullOrEmpty(item.DescHTML) || !String.IsNullOrEmpty(item.Description)) { blocks.CreateSectionHeader("DESCRIPTION"); if (!String.IsNullOrEmpty(item.DescHTML) && item.DescHTML != "NULL") { blocks.AppendOpenTag("p", "description"); blocks.Append(item.DescHTML); blocks.AppendCloseTag("p"); } else if (item.Description != "NULL") { blocks.AppendOpenTag("p", "description"); blocks.CreateItemIfNotNull(null, true, item.Description, null, true); blocks.AppendCloseTag("p"); } } if (item.Requirements != null && item.Requirements.Length > 0 && item.Cost != null && item.Cost.Length > 0) { blocks.CreateSectionHeader("CONSTRUCTION"); blocks.AppendOpenTag("p"); blocks.CreateItemIfNotNull("Requirements ", true, item.Requirements, "; ", false); blocks.CreateItemIfNotNull("Cost ", true, item.Cost, "", true); blocks.AppendCloseTag("p"); } if (!String.IsNullOrEmpty(item.Destruction) && item.Destruction != "NULL") { blocks.CreateSectionHeader("DESTRUCTION"); blocks.AppendOpenTag("p"); blocks.CreateItemIfNotNull(null, false, item.Destruction, null, true); blocks.AppendCloseTag("p"); } if (SourceInfo.GetSourceType(item.Source) != SourceType.Core) { blocks.CreateItemIfNotNull("Source: ", SourceInfo.GetSource(item.Source)); } if (completepage) { blocks.CreateHtmlFooter(); } return(blocks.ToString()); }