Example #1
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());
        }
        public MainWindow()
        {
            InitializeComponent();

            spellView = new ListCollectionView(Spell.Spells);
            sources   = new SortedSet <string>();

            foreach (Spell spell in Spell.Spells)
            {
                sources.Add(SourceInfo.GetSource(spell.source));
            }
        }
Example #3
0
        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());
        }
Example #4
0
        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());
        }
        public static string CreateHtml(Spell spell, bool shortForm = false,
                                        bool showTitle = true, bool completepage = true, string css = null)
        {
            StringBuilder blocks = new StringBuilder();

            if (completepage)
            {
                blocks.CreateHtmlHeader(css);
            }


            if (!shortForm)
            {
                if (showTitle)
                {
                    blocks.CreateHeader(spell.name);
                }


                blocks.CreateItemIfNotNull("School ", true, spell.school, null, false);


                blocks.CreateItemIfNotNull(" (", false, spell.subschool, ")", false);
                blocks.CreateItemIfNotNull(" [", false, spell.descriptor, "]", false);

                blocks.AppendLineBreak();

                blocks.CreateItemIfNotNull("Level ", spell.spell_level);
                blocks.CreateItemIfNotNull("Preparation Time ", spell.preparation_time);
                blocks.CreateItemIfNotNull("Casting Time ", spell.casting_time);
                blocks.CreateItemIfNotNull("Components ", spell.components);
                blocks.CreateItemIfNotNull("Range ", spell.range);
                blocks.CreateItemIfNotNull("Area ", spell.area);
                blocks.CreateItemIfNotNull("Targets ", spell.targets);
                blocks.CreateItemIfNotNull("Effects ", spell.effect);

                blocks.CreateItemIfNotNull("Duration ", spell.duration);
                blocks.CreateItemIfNotNull("Saving Throw ", spell.saving_throw);

                blocks.CreateItemIfNotNull("Spell Resistance ", spell.spell_resistence);

                if (spell.source != "PFRPG Core")
                {
                    blocks.CreateItemIfNotNull("Source ", SourceInfo.GetSource(spell.source));
                }

                if (spell.description_formated != null && spell.description_formated.Length > 0)
                {
                    blocks.Append(spell.description_formated);
                }
                else if (spell.description != null && spell.description.Length > 0)
                {
                    blocks.AppendHtml(spell.description);
                }
            }
            else
            {
                if (showTitle)
                {
                    blocks.AppendEscapedTag("p", spell.name, "bolded");
                }

                if (spell.description_formated != null && spell.description_formated.Length > 0)
                {
                    blocks.Append(spell.description_formated);
                }
                else if (spell.description != null && spell.description.Length > 0)
                {
                    blocks.AppendHtml(spell.description);
                }
            }

            if (completepage)
            {
                blocks.CreateHtmlFooter();
            }


            return(blocks.ToString());
        }
        public static String CreateHtml(Feat feat, bool showTitle = true, bool completepage = true, string css = null)
        {
            StringBuilder blocks = new StringBuilder();

            if (completepage)
            {
                blocks.CreateHtmlHeader(css: css);
            }
            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", featString, "altheader");
                }
            }

            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");
            if (completepage)
            {
                blocks.CreateHtmlFooter();
            }

            return(blocks.ToString());
        }