Exemplo n.º 1
0
        public static string CreateHtml(Monster monster, Character ch, bool addDescription)
        {
            StringBuilder blocks = new StringBuilder();

            blocks.CreateHtmlHeader();


            CreateTopSection(monster, ch, blocks);

            CreateDefenseSection(monster, blocks);

            CreateOffenseSection(monster, blocks);
            CreateTacticsSection(monster, blocks);
            CreateStatisticsSection(monster, blocks);
            CreateEcologySection(monster, blocks);
            CreateSpecialAbilitiesSection(monster, blocks);
            if (addDescription)
            {
                CreateDescriptionSection(monster, blocks);
            }



            if (SourceInfo.GetSourceType(monster.Source) != SourceType.Core)
            {
                blocks.CreateItemIfNotNull("Source ", SourceInfo.GetSource(monster.Source));
            }



            blocks.CreateHtmlFooter();

            return(blocks.ToString());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        private List <Block> CreateBlocks(Monster monster, Character ch, bool addDescription)
        {
            List <Block> blocks = new List <Block>();

            CreateTopSection(monster, ch, blocks);

            CreateDefenseSection(monster, blocks);

            CreateOffenseSection(monster, blocks);
            CreateTacticsSection(monster, blocks);
            CreateStatisticsSection(monster, blocks);
            CreateEcologySection(monster, blocks);
            CreateSpecialAbilitiesSection(monster, blocks);
            if (addDescription)
            {
                CreateDescriptionSection(monster, blocks);
            }



            if (SourceInfo.GetSourceType(monster.Source) != SourceType.Core)
            {
                Paragraph sourceParagraph = new Paragraph();

                sourceParagraph.Margin = new Thickness(0);
                CreateItemIfNotNull(sourceParagraph.Inlines, "Source ", SourceInfo.GetSource(monster.Source));
                blocks.Add(sourceParagraph);
            }


            return(blocks);
        }
Exemplo n.º 4
0
        public List <Block> CreateBlocks(MagicItem item, bool showTitle)
        {
            List <Block> blocks = new List <Block>();

            if (showTitle)
            {
                blocks.Add(CreateHeaderParagraph(item.Name, item.Group));
            }


            Paragraph details = new Paragraph();

            details.Margin = new Thickness(0, 2, 0, 0);

            CreateItemIfNotNull(details.Inlines, "Aura ", true, item.Aura, " ", false);
            CreateItemIfNotNull(details.Inlines, "[", false, item.AuraStrength, "]; ", false);
            CreateItemIfNotNull(details.Inlines, "CL ", true, (item.CL == -1)?"Varies":PastTenseNumber(item.CL), "", true);
            CreateItemIfNotNull(details.Inlines, "Slot ", true, item.Slot, "; ", false);
            CreateItemIfNotNull(details.Inlines, "Price ", true, item.Price, "; ", false);
            CreateItemIfNotNull(details.Inlines, "Weight ", true, item.Weight, "", true);


            blocks.Add(details);

            if (NotNullString(item.DescHTML) || NotNullString(item.Description))
            {
                blocks.AddRange(CreateSectionHeader("DESCRIPTION"));

                if (NotNullString(item.DescHTML))
                {
                    blocks.AddRange(CreateFlowFromDescription(item.DescHTML));
                }
                else
                {
                    Paragraph description = new Paragraph();
                    description.Margin = new Thickness(0, 2, 0, 0);

                    string text = FixBodyString(item.Description);

                    CreateItemIfNotNull(description.Inlines, null, true, text, null, true);


                    blocks.Add(description);
                }
            }

            if (item.Requirements != null && item.Requirements.Length > 0 &&
                item.Cost != null && item.Cost.Length > 0)
            {
                blocks.AddRange(CreateSectionHeader("CONSTRUCTION"));

                Paragraph construction = new Paragraph();
                construction.Margin = new Thickness(0, 2, 0, 0);

                CreateItemIfNotNull(construction.Inlines, "Requirements ", true, item.Requirements, "; ", false);
                CreateItemIfNotNull(construction.Inlines, "Cost ", true, item.Cost, "", true);

                blocks.Add(construction);
            }

            if (NotNullString(item.Destruction))
            {
                blocks.AddRange(CreateSectionHeader("DESTRUCTION"));

                Paragraph desctruction = new Paragraph();
                desctruction.Margin = new Thickness(0, 2, 0, 0);


                CreateItemIfNotNull(desctruction.Inlines, null, false, FixBodyString(item.Destruction), null, true);


                blocks.Add(desctruction);
            }

            if (SourceInfo.GetSourceType(item.Source) != SourceType.Core)
            {
                Paragraph source = new Paragraph();
                source.Margin = new Thickness(0, 2, 0, 0);
                CreateItemIfNotNull(source.Inlines, "Source: ", SourceInfo.GetSource(item.Source));
                blocks.Add(source);
            }


            return(blocks);
        }
Exemplo n.º 5
0
        private bool SourceFilter(Weapon wp)
        {
            SourceType type = SourceInfo.GetSourceType(wp.Source);

            return(type == SourceType.Core || type == SourceType.APG);
        }
Exemplo n.º 6
0
        public List <Block> CreateBlocks(Rule rule, bool showTitle)
        {
            List <Block> blocks = new List <Block>();


            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 (NotNullString(rule.Subtype))
                {
                    blocks.Add(CreateHeaderParagraph(name, rule.Subtype));
                }
                else
                {
                    blocks.Add(CreateHeaderParagraph(name));
                }
            }



            string detailsText = rule.Details;

            if (detailsText == null)
            {
                detailsText = "";
            }

            detailsText = Regex.Replace(detailsText, "&mdash;|&ndash;", "­–");
            detailsText = Regex.Replace(detailsText, "\t", "");
            detailsText = Regex.Replace(detailsText, "&hellip;", "...");


            if (detailsText.Length <= 2 || detailsText.Substring(0, 2) != "<p")
            {
                detailsText = "<p>" + detailsText + "</p>";
            }
            else
            {
                detailsText = detailsText.Replace("\n", "");
                detailsText = detailsText.Replace("\r", "");
            }


            blocks.AddRange(CreateFlowFromDescription(detailsText));


            Paragraph details = new Paragraph();

            if (showTitle)
            {
                details.Margin = new Thickness(0, 2, 0, 0);
            }
            else
            {
                if (rule.Subtype != null)
                {
                    extraText = rule.Subtype + " " + extraText;
                }

                details.Inlines.Add(new Italic(new Run(extraText)));
                details.Inlines.Add(new LineBreak());
            }

            if (SourceInfo.GetSourceType(rule.Source) != SourceType.Core)
            {
                CreateItemIfNotNull(details.Inlines, "Source: ", SourceInfo.GetSource(rule.Source));
            }

            CreateItemIfNotNull(details.Inlines, "Format: ", true, rule.Format, "; ", false);
            CreateItemIfNotNull(details.Inlines, "Location: ", true, rule.Location, ".", true);
            CreateItemIfNotNull(details.Inlines, "Format: ", true, rule.Format2, "; ", false);
            CreateItemIfNotNull(details.Inlines, "Location: ", true, rule.Location2, ".", true);


            blocks.Add(details);

            return(blocks);
        }
Exemplo n.º 7
0
        public static String CreateHtml(MagicItem item, bool showTitle)
        {
            StringBuilder blocks = new StringBuilder();

            blocks.CreateHtmlHeader();

            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.AppendOpenTagWithClass("p", "description");
                    blocks.Append(item.DescHTML);
                    blocks.AppendCloseTag("p");
                }
                else if (item.Description != "NULL")
                {
                    blocks.AppendOpenTagWithClass("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));
            }

            blocks.CreateHtmlFooter();

            return(blocks.ToString());
        }