Exemple #1
0
        private void CreatureList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string html = "";

            if (Template == null)
            {
                List <string> lines = new List <string>();

                lines.AddRange(HTML.GetHead("", "", Session.Preferences.TextSize));
                lines.Add("<BODY>");
                lines.Add("<P class=instruction>");
                lines.Add("(select a template from the list to see its details here)");
                lines.Add("</P>");
                lines.Add("</BODY>");
                lines.Add("</HTML>");

                html = HTML.Concatenate(lines);
            }
            else
            {
                html = HTML.CreatureTemplate(Template, Session.Preferences.TextSize, false);
            }

            Browser.Document.OpenNew(true);
            Browser.Document.Write(html);
        }
Exemple #2
0
        private void ExportBtn_Click(object sender, EventArgs e)
        {
            base.Close();
            int count = this.ItemList.CheckedItems.Count / 9;

            if (this.ItemList.CheckedItems.Count % 9 > 0)
            {
                count++;
            }
            for (int i = 0; i != count; i++)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog()
                {
                    Filter   = Program.HTMLFilter,
                    FileName = string.Concat(Session.Project.Name, " Treasure"),
                    Title    = "Export"
                };
                if (count != 1)
                {
                    SaveFileDialog saveFileDialog1 = saveFileDialog;
                    object         title           = saveFileDialog1.Title;
                    object[]       objArray        = new object[] { title, " (page ", i + 1, ")" };
                    saveFileDialog1.Title = string.Concat(objArray);
                }
                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    List <string> head = HTML.GetHead("Loot", "", DisplaySize.Small);
                    head.Add("<BODY>");
                    head.Add("<P>");
                    head.Add("<TABLE class=clear height=100%>");
                    for (int j = 0; j != 3; j++)
                    {
                        head.Add("<TR class=clear width=33% height=33%>");
                        for (int k = 0; k != 3; k++)
                        {
                            head.Add("<TD width=33% height=33%>");
                            int num = i * 9 + j * 3 + k;
                            if (this.ItemList.CheckedItems.Count > num)
                            {
                                MagicItem tag = this.ItemList.CheckedItems[num].Tag as MagicItem;
                                if (tag != null)
                                {
                                    head.Add(HTML.MagicItem(tag, DisplaySize.Small, false, false));
                                }
                            }
                            head.Add("</TD>");
                        }
                        head.Add("</TR>");
                    }
                    head.Add("</TABLE>");
                    head.Add("</P>");
                    head.Add("</BODY>");
                    head.Add("</HTML>");
                    string str = HTML.Concatenate(head);
                    File.WriteAllText(saveFileDialog.FileName, str);
                }
            }
        }
Exemple #3
0
        public PowerDetailsForm(string str, ICreature creature)
        {
            InitializeComponent();

            DetailsBox.Text = str;
            fCreature       = creature;

            int   level = (fCreature != null) ? fCreature.Level : 0;
            IRole role  = (fCreature != null) ? fCreature.Role : null;

            string damage = "1d8 + 2";

            if (role != null)
            {
                if (role is Minion)
                {
                    damage = Statistics.Damage(level, DamageExpressionType.Minion);
                }
                else
                {
                    damage = Statistics.Damage(level, DamageExpressionType.Normal);
                }
            }

            List <string> examples = new List <string>();

            examples.Add(damage + " damage");
            examples.Add(damage + " damage, and the target is knocked prone");
            examples.Add("The target is slowed (save ends)");
            examples.Add("The target is immobilised until the start of your next turn");

            List <string> lines = HTML.GetHead(null, null, Session.Preferences.TextSize);

            lines.Add("<BODY>");

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");

            lines.Add("<TR class=heading>");
            lines.Add("<TD><B>Examples</B></TD>");
            lines.Add("</TR>");

            foreach (string example in examples)
            {
                lines.Add("<TR>");
                lines.Add("<TD>" + example + "</TD>");
                lines.Add("</TR>");
            }

            lines.Add("</TABLE>");
            lines.Add("</P>");

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            Browser.DocumentText = HTML.Concatenate(lines);
        }
        private string get_html()
        {
            List <string> head = HTML.GetHead(null, null, DisplaySize.Small);

            head.Add("<P>This is the Libraries screen.</P>");
            head.Add("<P><B>What is a library?</B> A library is a file containing a collection of reusable items such as creatures, traps and hazards, magic items and map tiles. On the left you can see the list of libraries that are currently installed. When you select one of these libraries you can see the items it contains.</P>");
            head.Add("<P><B>I have a library file, how do I install it?</B> First, find the folder containing Masterplan; there will be a sub-folder called Libraries. Move your library file into this folder, and restart Masterplan.</P>");
            head.Add("<P><B>How do I import a creature from Adventure Tools?</B> If you have exported a .monster file from Adventure Tools you can import them into a library. Choose the library you want to add the creature to, and select it on the left. On the Creatures tab, press the down-arrow beside the Add button, and select Import from Adventure Tools to bring up a file browser. Select the .monster file, and it will be imported into your library.</P>");
            head.Add("<P><B>How do I create map tiles from image files?</B> If you have a selection of image files that you want to use as map tiles, you can import them into a library. Choose the library you want to add the tiles to, and select it on the left. On the Map Tiles tab, press the Add button to bring up a file browser. Select the image files to import them into your library. Masterplan will try to work out the dimensions of each tile, but you can edit any that are incorrect by right-clicking on the tile and selecting Set Size. You can also set the category of each tile – this is particularly useful if you want to use the Map AutoBuild feature to build random dungeon maps automatically.</P>");
            return(HTML.Concatenate(head));
        }
Exemple #5
0
        public PowerDetailsForm(string str, ICreature creature)
        {
            IRole role;

            this.InitializeComponent();
            this.DetailsBox.Text = str;
            this.fCreature       = creature;
            int num = (this.fCreature != null ? this.fCreature.Level : 0);

            if (this.fCreature != null)
            {
                role = this.fCreature.Role;
            }
            else
            {
                role = null;
            }
            IRole  role1 = role;
            string str1  = "1d8 + 2";

            if (role1 != null)
            {
                str1 = (!(role1 is Minion) ? Statistics.Damage(num, DamageExpressionType.Normal) : Statistics.Damage(num, DamageExpressionType.Minion));
            }
            List <string> strs = new List <string>()
            {
                string.Concat(str1, " damage"),
                string.Concat(str1, " damage, and the target is knocked prone"),
                "The target is slowed (save ends)",
                "The target is immobilised until the start of your next turn"
            };
            List <string> head = HTML.GetHead(null, null, DisplaySize.Small);

            head.Add("<BODY>");
            head.Add("<P class=table>");
            head.Add("<TABLE>");
            head.Add("<TR class=heading>");
            head.Add("<TD><B>Examples</B></TD>");
            head.Add("</TR>");
            foreach (string str2 in strs)
            {
                head.Add("<TR>");
                head.Add(string.Concat("<TD>", str2, "</TD>"));
                head.Add("</TR>");
            }
            head.Add("</TABLE>");
            head.Add("</P>");
            head.Add("</BODY>");
            head.Add("</HTML>");
            this.Browser.DocumentText = HTML.Concatenate(head);
        }
Exemple #6
0
        private void CompendiumBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (e.Url.ToString() != this.fItem.URL)
            {
                List <string> strs = new List <string>();
                strs.AddRange(HTML.GetHead(null, null, DisplaySize.Small));
                strs.Add("<BODY>");
                strs.Add("<P>You need to log into the Compendium to see this item.</P>");
                strs.Add("<P>When you do, the item will be imported and its details will be shown in this panel.</P>");
                strs.Add("<P>The imported item can then be edited if its details are incorrect.</P>");
                strs.Add("</BODY>");
                strs.Add("</HTML>");
                this.ItemBrowser.DocumentText = HTML.Concatenate(strs);
                return;
            }
            switch (this.fItem.Type)
            {
            case CompendiumHelper.ItemType.Creature:
            {
                this.fResult = CompendiumImport.ImportCreatureFromHTML(this.CompendiumBrowser.DocumentText, this.fItem.URL);
                break;
            }

            case CompendiumHelper.ItemType.Trap:
            {
                this.fResult = CompendiumImport.ImportTrapFromHTML(this.CompendiumBrowser.DocumentText, this.fItem.URL);
                break;
            }

            case CompendiumHelper.ItemType.MagicItem:
            {
                this.fResult = CompendiumImport.ImportItemFromHTML(this.CompendiumBrowser.DocumentText, this.fItem.URL);
                break;
            }
            }
            if (this.fResult != null)
            {
                this.display_result();
                return;
            }
            List <string> strs1 = new List <string>();

            strs1.AddRange(HTML.GetHead(null, null, DisplaySize.Small));
            strs1.Add("<BODY>");
            strs1.Add("<P class=instruction>The item could not be imported.</P>");
            strs1.Add("</BODY>");
            strs1.Add("</HTML>");
            this.ItemBrowser.DocumentText = HTML.Concatenate(strs1);
        }
        void update_stats()
        {
            List <string> lines = HTML.GetHead("", "", Session.Preferences.TextSize);

            lines.Add("<BODY>");

            if (fCreatures.Count != 0)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");
                lines.Add("<TR class=heading>");
                lines.Add("<TD colspan=3><B>Selected Creatures</B></TD>");
                lines.Add("</TR>");

                foreach (ICreature c in fCreatures)
                {
                    lines.Add("<TR class=header>");
                    lines.Add("<TD colspan=2>" + c.Name + "</TD>");
                    lines.Add("<TD align=center><A href=remove:" + c.ID + ">remove</A></TD>");
                    lines.Add("</TR>");
                }

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("You have not yet selected any creatures; to select a creature, drag it from the list at the left onto the box above");
                lines.Add("</P>");
            }

            foreach (ICreature creature in fCreatures)
            {
                EncounterCard card = new EncounterCard(creature);

                lines.Add("<P class=table>");
                lines.AddRange(card.AsText(null, CardMode.View, false));
                lines.Add("</P>");
            }

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            string html = HTML.Concatenate(lines);

            Browser.Document.OpenNew(true);
            Browser.Document.Write(html);
        }
        private void update_stats()
        {
            List <string> head = HTML.GetHead("", "", DisplaySize.Small);

            head.Add("<BODY>");
            if (this.fCreatures.Count == 0)
            {
                head.Add("<P class=instruction>");
                head.Add("You have not yet selected any creatures; to select a creature, drag it from the list at the left onto the box above");
                head.Add("</P>");
            }
            else
            {
                head.Add("<P class=table>");
                head.Add("<TABLE>");
                head.Add("<TR class=heading>");
                head.Add("<TD colspan=3><B>Selected Creatures</B></TD>");
                head.Add("</TR>");
                foreach (ICreature fCreature in this.fCreatures)
                {
                    head.Add("<TR class=header>");
                    head.Add(string.Concat("<TD colspan=2>", fCreature.Name, "</TD>"));
                    head.Add(string.Concat("<TD align=center><A href=remove:", fCreature.ID, ">remove</A></TD>"));
                    head.Add("</TR>");
                }
                head.Add("</TABLE>");
                head.Add("</P>");
            }
            foreach (ICreature creature in this.fCreatures)
            {
                EncounterCard encounterCard = new EncounterCard(creature);
                head.Add("<P class=table>");
                head.AddRange(encounterCard.AsText(null, CardMode.View, false));
                head.Add("</P>");
            }
            head.Add("</BODY>");
            head.Add("</HTML>");
            string str = HTML.Concatenate(head);

            this.Browser.Document.OpenNew(true);
            this.Browser.Document.Write(str);
        }
        private void update_statblock()
        {
            List <string> head = HTML.GetHead("Trap", "", DisplaySize.Small);

            head.Add("<BODY>");
            head.Add("<TABLE class=clear>");
            head.Add("<TR class=clear>");
            head.Add("<TD class=clear>");
            head.Add("<P class=table>");
            head.Add(HTML.Trap(this.fTrap, null, false, false, true, DisplaySize.Small));
            head.Add("</P>");
            head.Add("</TD>");
            head.Add("<TD class=clear>");
            head.AddRange(this.get_advice());
            head.Add("</TD>");
            head.Add("</TR>");
            head.Add("</TABLE>");
            head.Add("</BODY>");
            head.Add("</HTML>");
            this.StatBlockBrowser.DocumentText = HTML.Concatenate(head);
        }
        private void CreatureList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string str = "";

            if (this.Template != null)
            {
                str = HTML.CreatureTemplate(this.Template, DisplaySize.Small, false);
            }
            else
            {
                List <string> strs = new List <string>();
                strs.AddRange(HTML.GetHead("", "", DisplaySize.Small));
                strs.Add("<BODY>");
                strs.Add("<P class=instruction>");
                strs.Add("(select a template from the list to see its details here)");
                strs.Add("</P>");
                strs.Add("</BODY>");
                strs.Add("</HTML>");
                str = HTML.Concatenate(strs);
            }
            this.Browser.Document.OpenNew(true);
            this.Browser.Document.Write(str);
        }
        void update_statblock()
        {
            List <string> lines = HTML.GetHead("Trap", "", Session.Preferences.TextSize);

            lines.Add("<BODY>");

            lines.Add("<TABLE class=clear>");
            lines.Add("<TR class=clear>");
            lines.Add("<TD class=clear>");
            lines.Add("<P class=table>");
            lines.Add(HTML.Trap(fTrap, null, false, false, true, Session.Preferences.TextSize));
            lines.Add("</P>");
            lines.Add("</TD>");
            lines.Add("<TD class=clear>");
            lines.AddRange(get_advice());
            lines.Add("</TD>");
            lines.Add("</TR>");
            lines.Add("</TABLE>");

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            StatBlockBrowser.DocumentText = HTML.Concatenate(lines);
        }
Exemple #12
0
        public void RefreshOptions()
        {
            List <string> lines = new List <string>();

            lines.Add("<HTML>");
            lines.AddRange(HTML.GetHead("Masterplan", "Main Menu", Session.Preferences.TextSize));
            lines.Add("<BODY>");

            #region Getting Started

            lines.Add("<P class=table>");
            lines.Add("<TABLE class=wide>");

            lines.Add("<TR class=heading>");
            lines.Add("<TD>");
            lines.Add("<B>Getting Started</B>");
            lines.Add("</TD>");
            lines.Add("</TR>");

            if (show_last_file_option())
            {
                string name = FileName.Name(Session.Preferences.LastFile);

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:last\">Reopen <I>" + name + "</I></A>");
                lines.Add("</TD>");
                lines.Add("</TR>");
            }

            lines.Add("<TR>");
            lines.Add("<TD>");
            lines.Add("<A href=\"masterplan:new\">Create a new adventure project</A>");
            lines.Add("</TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>");
            lines.Add("<A href=\"masterplan:open\">Open an existing project</A>");
            lines.Add("</TD>");
            lines.Add("</TR>");

            if (show_delve_option())
            {
                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:delve\">Generate a random dungeon delve</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");
            }

            if (show_manual_option())
            {
                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:manual\">Read the Masterplan user manual</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");
            }

            lines.Add("</TABLE>");
            lines.Add("</P>");

            #endregion

            #region Development

            if (Program.IsBeta)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");

                lines.Add("<TR class=heading>");
                lines.Add("<TD>");
                lines.Add("<B>Development Links</B>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:genesis\">Project Genesis</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:exodus\">Project Exodus</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:minos\">Project Minos</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:excalibur\">Project Excalibur</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("<TR>");
                lines.Add("<TD>");
                lines.Add("<A href=\"masterplan:indiana\">Project Indiana</A>");
                lines.Add("</TD>");
                lines.Add("</TR>");

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }

            #endregion

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            MenuBrowser.Document.OpenNew(true);
            MenuBrowser.Document.Write(HTML.Concatenate(lines));
        }
Exemple #13
0
        private void update_statblock()
        {
            IRole role;
            int   num = (this.fCreature != null ? this.fCreature.Level : 0);

            if (this.fCreature != null)
            {
                role = this.fCreature.Role;
            }
            else
            {
                role = null;
            }
            IRole         role1 = role;
            List <string> head  = HTML.GetHead(null, null, DisplaySize.Small);

            head.Add("<BODY>");
            head.Add("<TABLE class=clear>");
            head.Add("<TR class=clear>");
            head.Add("<TD class=clear>");
            head.Add("<P class=table>");
            head.Add("<TABLE>");
            head.AddRange(this.fPower.AsHTML(null, CardMode.Build, this.fFromFunctionalTemplate));
            head.Add("</TABLE>");
            head.Add("</P>");
            head.Add("</TD>");
            head.Add("<TD class=clear>");
            head.Add("<P class=table>");
            head.Add("<TABLE>");
            head.Add("<TR class=heading>");
            head.Add("<TD colspan=2><B>Power Advice</B></TD>");
            head.Add("</TR>");
            head.Add("<TR class=shaded>");
            head.Add("<TD colspan=2><B>Attack Bonus</B></TD>");
            head.Add("</TR>");
            head.Add("<TR>");
            head.Add("<TD>Attack vs Armour Class</TD>");
            head.Add(string.Concat("<TD align=center>+", Statistics.AttackBonus(DefenceType.AC, num, role1), "</TD>"));
            head.Add("</TR>");
            head.Add("<TR>");
            head.Add("<TD>Attack vs Other Defence</TD>");
            head.Add(string.Concat("<TD align=center>+", Statistics.AttackBonus(DefenceType.Fortitude, num, role1), "</TD>"));
            head.Add("</TR>");
            if (role1 != null)
            {
                head.Add("<TR class=shaded>");
                head.Add("<TD colspan=2><B>Damage</B></TD>");
                head.Add("</TR>");
                if (!(role1 is Minion))
                {
                    head.Add("<TR>");
                    head.Add("<TD>Damage vs Single Targets</TD>");
                    head.Add(string.Concat("<TD align=center>", Statistics.Damage(num, DamageExpressionType.Normal), "</TD>"));
                    head.Add("</TR>");
                    head.Add("<TR>");
                    head.Add("<TD>Damage vs Multiple Targets</TD>");
                    head.Add(string.Concat("<TD align=center>", Statistics.Damage(num, DamageExpressionType.Multiple), "</TD>"));
                    head.Add("</TR>");
                }
                else
                {
                    head.Add("<TR>");
                    head.Add("<TD>Minion Damage</TD>");
                    head.Add(string.Concat("<TD align=center>", Statistics.Damage(num, DamageExpressionType.Minion), "</TD>"));
                    head.Add("</TR>");
                }
                if (this.fExamples.Count != 0)
                {
                    head.Add("<TR class=shaded>");
                    head.Add("<TD><B>Example Power Details</B></TD>");
                    head.Add("<TD align=center><A href=details:refresh>(refresh)</A></TD>");
                    head.Add("</TR>");
                    foreach (string fExample in this.fExamples)
                    {
                        int num1 = this.fExamples.IndexOf(fExample);
                        head.Add("<TR>");
                        object[] objArray = new object[] { "<TD colspan=2>", fExample, " <A href=details:", num1, ">(use this)</A></TD>" };
                        head.Add(string.Concat(objArray));
                        head.Add("</TR>");
                    }
                }
            }
            head.Add("</TABLE>");
            head.Add("</P>");
            head.Add("</TD>");
            head.Add("</TR>");
            head.Add("</TABLE>");
            head.Add("</BODY>");
            head.Add("</HTML>");
            this.StatBlockBrowser.DocumentText = HTML.Concatenate(head);
        }
Exemple #14
0
        private void ExportBtn_Click(object sender, EventArgs e)
        {
            Close();

            int pages     = ItemList.CheckedItems.Count / 9;
            int remainder = ItemList.CheckedItems.Count % 9;

            if (remainder > 0)
            {
                pages += 1;
            }

            for (int page = 0; page != pages; ++page)
            {
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Filter   = Program.HTMLFilter;
                dlg.FileName = Session.Project.Name + " Treasure";
                dlg.Title    = "Export";
                if (pages != 1)
                {
                    dlg.Title += " (page " + (page + 1) + ")";
                }

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    List <string> lines = HTML.GetHead("Loot", "", Session.Preferences.TextSize);

                    lines.Add("<BODY>");
                    lines.Add("<P>");
                    lines.Add("<TABLE class=clear height=100%>");

                    for (int row = 0; row != 3; ++row)
                    {
                        lines.Add("<TR class=clear width=33% height=33%>");

                        for (int col = 0; col != 3; ++col)
                        {
                            lines.Add("<TD width=33% height=33%>");

                            int index = (page * 9) + (row * 3) + col;
                            if (ItemList.CheckedItems.Count > index)
                            {
                                MagicItem mi = ItemList.CheckedItems[index].Tag as MagicItem;
                                if (mi != null)
                                {
                                    lines.Add(HTML.MagicItem(mi, Session.Preferences.TextSize, false, false));
                                }
                            }

                            lines.Add("</TD>");
                        }

                        lines.Add("</TR>");
                    }

                    lines.Add("</TABLE>");
                    lines.Add("</P>");
                    lines.Add("</BODY>");

                    lines.Add("</HTML>");

                    string html = HTML.Concatenate(lines);
                    File.WriteAllText(dlg.FileName, html);
                }
            }
        }
Exemple #15
0
        private void update_powers()
        {
            System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
            List <string> strs = new List <string>();

            this.fPowers = new List <CreaturePower>();
            strs.AddRange(HTML.GetHead(null, null, DisplaySize.Small));
            strs.Add("<BODY>");
            List <ICreature> selectedCreatures = this.SelectedCreatures;

            if (selectedCreatures == null || selectedCreatures.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(no creatures selected)");
                strs.Add("</P>");
            }
            else
            {
                strs.Add("<P class=instruction>");
                if (!this.fShowAll)
                {
                    strs.Add("The selected creatures have the following powers:");
                }
                else
                {
                    strs.Add("These creatures have the following powers:");
                }
                strs.Add("</P>");
                Dictionary <CreaturePowerCategory, List <CreaturePower> > creaturePowerCategories = new Dictionary <CreaturePowerCategory, List <CreaturePower> >();
                Array values = Enum.GetValues(typeof(CreaturePowerCategory));
                foreach (CreaturePowerCategory value in values)
                {
                    creaturePowerCategories[value] = new List <CreaturePower>();
                }
                foreach (ICreature selectedCreature in selectedCreatures)
                {
                    foreach (CreaturePower creaturePower in selectedCreature.CreaturePowers)
                    {
                        creaturePowerCategories[creaturePower.Category].Add(creaturePower);
                        this.fPowers.Add(creaturePower);
                    }
                }
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                foreach (CreaturePowerCategory creaturePowerCategory in values)
                {
                    if (creaturePowerCategories[creaturePowerCategory].Count == 0)
                    {
                        continue;
                    }
                    creaturePowerCategories[creaturePowerCategory].Sort();
                    string str = "";
                    switch (creaturePowerCategory)
                    {
                    case CreaturePowerCategory.Trait:
                    {
                        str = "Traits";
                        break;
                    }

                    case CreaturePowerCategory.Standard:
                    case CreaturePowerCategory.Move:
                    case CreaturePowerCategory.Minor:
                    case CreaturePowerCategory.Free:
                    {
                        str = string.Concat(creaturePowerCategory, " Actions");
                        break;
                    }

                    case CreaturePowerCategory.Triggered:
                    {
                        str = "Triggered Actions";
                        break;
                    }

                    case CreaturePowerCategory.Other:
                    {
                        str = "Other Actions";
                        break;
                    }
                    }
                    strs.Add("<TR class=creature>");
                    strs.Add("<TD colspan=3>");
                    strs.Add(string.Concat("<B>", str, "</B>"));
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (CreaturePower item in creaturePowerCategories[creaturePowerCategory])
                    {
                        strs.AddRange(item.AsHTML(null, CardMode.View, false));
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=3 align=center>");
                        if (this.fName == null || !(this.fName != ""))
                        {
                            strs.Add(string.Concat("<A href=copy:", item.ID, ">select this power</A>"));
                        }
                        else
                        {
                            object[] d = new object[] { "<A href=copy:", item.ID, ">copy this power into ", this.fName, "</A>" };
                            strs.Add(string.Concat(d));
                        }
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                }
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            strs.Add("</BODY>");
            strs.Add("</HTML>");
            this.PowerDisplay.DocumentText      = HTML.Concatenate(strs);
            System.Windows.Forms.Cursor.Current = Cursors.Default;
        }
Exemple #16
0
        private void update_table()
        {
            List <string> strs = new List <string>();

            strs.AddRange(HTML.GetHead("Power Statistics", "", DisplaySize.Small));
            strs.Add("<BODY>");
            strs.Add("<P class=table>");
            strs.Add("<TABLE>");
            strs.Add("<TR class=heading>");
            strs.Add("<TD colspan=3>");
            strs.Add("<B>Number of Powers</B>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            strs.Add("<TR>");
            strs.Add("<TD colspan=2>");
            strs.Add("Number of powers");
            strs.Add("</TD>");
            strs.Add("<TD align=right>");
            strs.Add(this.fPowers.Count.ToString());
            strs.Add("</TD>");
            strs.Add("</TR>");
            if (this.fCreatures != 0)
            {
                double count = (double)this.fPowers.Count / (double)this.fCreatures;
                strs.Add("<TR>");
                strs.Add("<TD colspan=2>");
                strs.Add("Powers per creature");
                strs.Add("</TD>");
                strs.Add("<TD align=right>");
                strs.Add(count.ToString("F1"));
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            strs.Add("</TABLE>");
            strs.Add("</P>");
            if (this.fPowers.Count != 0)
            {
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                Dictionary <string, int> conditionBreakdown = this.get_condition_breakdown();
                if (conditionBreakdown.Count != 0)
                {
                    strs.Add("<TR class=heading>");
                    strs.Add("<TD colspan=3>");
                    strs.Add("<B>Conditions</B>");
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (Pair <string, int> pair in this.sort_breakdown(conditionBreakdown))
                    {
                        int second = pair.Second;
                        if (second == 0)
                        {
                            continue;
                        }
                        double num = (double)second / (double)this.fPowers.Count;
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=2>");
                        strs.Add(pair.First);
                        strs.Add("</TD>");
                        strs.Add("<TD align=right>");
                        object[] str = new object[] { second, " (", num.ToString("P0"), ")" };
                        strs.Add(string.Concat(str));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                }
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            if (this.fPowers.Count != 0)
            {
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                Dictionary <string, int> damageTypeBreakdown = this.get_damage_type_breakdown();
                if (damageTypeBreakdown.Count != 0)
                {
                    strs.Add("<TR class=heading>");
                    strs.Add("<TD colspan=3>");
                    strs.Add("<B>Damage Types</B>");
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (Pair <string, int> pair1 in this.sort_breakdown(damageTypeBreakdown))
                    {
                        int    second1 = pair1.Second;
                        double count1  = (double)second1 / (double)this.fPowers.Count;
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=2>");
                        strs.Add(pair1.First);
                        strs.Add("</TD>");
                        strs.Add("<TD align=right>");
                        object[] objArray = new object[] { second1, " (", count1.ToString("P0"), ")" };
                        strs.Add(string.Concat(objArray));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                }
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            if (this.fPowers.Count != 0)
            {
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                Dictionary <string, int> keywordBreakdown = this.get_keyword_breakdown();
                if (keywordBreakdown.Count != 0)
                {
                    strs.Add("<TR class=heading>");
                    strs.Add("<TD colspan=3>");
                    strs.Add("<B>Keywords</B>");
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (Pair <string, int> pair2 in this.sort_breakdown(keywordBreakdown))
                    {
                        int    num1   = pair2.Second;
                        double count2 = (double)num1 / (double)this.fPowers.Count;
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=2>");
                        strs.Add(pair2.First);
                        strs.Add("</TD>");
                        strs.Add("<TD align=right>");
                        object[] str1 = new object[] { num1, " (", count2.ToString("P0"), ")" };
                        strs.Add(string.Concat(str1));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                }
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            if (this.fPowers.Count != 0)
            {
                Dictionary <string, double> categoryBreakdown = this.get_category_breakdown();
                if (categoryBreakdown.Count != 0)
                {
                    strs.Add("<P class=table>");
                    strs.Add("<TABLE>");
                    strs.Add("<TR class=heading>");
                    strs.Add("<TD colspan=3>");
                    strs.Add("<B>Powers Per Category</B>");
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (string key in categoryBreakdown.Keys)
                    {
                        double item = categoryBreakdown[key];
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=2>");
                        strs.Add(key);
                        strs.Add("</TD>");
                        strs.Add("<TD align=right>");
                        strs.Add(item.ToString("P0"));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                    strs.Add("</TABLE>");
                    strs.Add("</P>");
                }
            }
            if (this.fPowers.Count != 0)
            {
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                Dictionary <string, int> damageExpressionBreakdown = this.get_damage_expression_breakdown();
                if (damageExpressionBreakdown.Count != 0)
                {
                    strs.Add("<TR class=heading>");
                    strs.Add("<TD colspan=3>");
                    strs.Add("<B>Damage</B>");
                    strs.Add("</TD>");
                    strs.Add("</TR>");
                    foreach (Pair <string, int> pair3 in this.sort_breakdown(damageExpressionBreakdown))
                    {
                        int            second2        = pair3.Second;
                        double         num2           = (double)second2 / (double)this.fPowers.Count;
                        DiceExpression diceExpression = DiceExpression.Parse(pair3.First);
                        strs.Add("<TR>");
                        strs.Add("<TD colspan=2>");
                        object[] first = new object[] { pair3.First, " (avg ", diceExpression.Average, ", max ", diceExpression.Maximum, ")" };
                        strs.Add(string.Concat(first));
                        strs.Add("</TD>");
                        strs.Add("<TD align=right>");
                        object[] objArray1 = new object[] { second2, " (", num2.ToString("P0"), ")" };
                        strs.Add(string.Concat(objArray1));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                    }
                }
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            strs.Add("</BODY>");
            strs.Add("</HTML>");
            this.Browser.DocumentText = HTML.Concatenate(strs);
        }
        void update_power()
        {
            List <string> lines = new List <string>();

            lines.AddRange(HTML.GetHead(fPower.Name, "", Session.Preferences.TextSize));

            lines.Add("<BODY>");

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");
            lines.AddRange(fPower.AsHTML(null, CardMode.View, false));
            lines.Add("</TABLE>");
            lines.Add("</P>");

            lines.Add("<P class=instruction align=left>");
            lines.Add("Click to add an attack roll for:");
            string heroes = "";

            foreach (Hero hero in Session.Project.Heroes)
            {
                CombatData cd = hero.CombatData;

                if ((!roll_exists(hero.ID)) && (hero.GetState(cd.Damage) != CreatureState.Defeated))
                {
                    if (heroes != "")
                    {
                        heroes += " | ";
                    }

                    heroes += "<A href=hero:" + hero.ID + ">" + hero.Name + "</A>";
                }
            }
            if (heroes != "")
            {
                lines.Add("<BR>");
                lines.Add(heroes);
            }
            string creatures = "";

            foreach (EncounterSlot slot in fEncounter.Slots)
            {
                foreach (CombatData cd in slot.CombatData)
                {
                    if ((!roll_exists(cd.ID)) && (slot.GetState(cd) != CreatureState.Defeated))
                    {
                        if (creatures != "")
                        {
                            creatures += " | ";
                        }

                        creatures += "<A href=opponent:" + cd.ID + ">" + cd.DisplayName + "</A>";
                    }
                }
            }
            if (creatures != "")
            {
                lines.Add("<BR>");
                lines.Add(creatures);
            }
            lines.Add("<BR>");
            lines.Add("<A href=target:blank>An unnamed target</A>");
            lines.Add("</P>");

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            PowerBrowser.DocumentText = HTML.Concatenate(lines);
        }
Exemple #18
0
        void update_table()
        {
            List <string> lines = new List <string>();

            lines.AddRange(HTML.GetHead("Power Statistics", "", Session.Preferences.TextSize));
            lines.Add("<BODY>");

            #region Number of powers

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");

            lines.Add("<TR class=heading>");
            lines.Add("<TD colspan=3>");
            lines.Add("<B>Number of Powers</B>");
            lines.Add("</TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD colspan=2>");
            lines.Add("Number of powers");
            lines.Add("</TD>");
            lines.Add("<TD align=right>");
            lines.Add(fPowers.Count.ToString());
            lines.Add("</TD>");
            lines.Add("</TR>");

            if (fCreatures != 0)
            {
                // Powers per creature
                double ppc = (double)fPowers.Count / fCreatures;
                lines.Add("<TR>");
                lines.Add("<TD colspan=2>");
                lines.Add("Powers per creature");
                lines.Add("</TD>");
                lines.Add("<TD align=right>");
                lines.Add(ppc.ToString("F1"));
                lines.Add("</TD>");
                lines.Add("</TR>");
            }

            lines.Add("</TABLE>");
            lines.Add("</P>");

            #endregion

            #region Conditions

            if (fPowers.Count != 0)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");

                // Number of powers with each condition
                Dictionary <string, int> condition_breakdown = get_condition_breakdown();
                if (condition_breakdown.Count != 0)
                {
                    lines.Add("<TR class=heading>");
                    lines.Add("<TD colspan=3>");
                    lines.Add("<B>Conditions</B>");
                    lines.Add("</TD>");
                    lines.Add("</TR>");

                    List <Pair <string, int> > list = sort_breakdown(condition_breakdown);
                    foreach (Pair <string, int> condition in list)
                    {
                        int count = condition.Second;
                        if (count == 0)
                        {
                            continue;
                        }

                        double pc = (double)count / fPowers.Count;

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>");
                        lines.Add(condition.First);
                        lines.Add("</TD>");
                        lines.Add("<TD align=right>");
                        lines.Add(count + " (" + pc.ToString("P0") + ")");
                        lines.Add("</TD>");
                        lines.Add("</TR>");
                    }
                }

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }

            #endregion

            #region Damage types

            if (fPowers.Count != 0)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");

                // Number of powers with each damage type
                Dictionary <string, int> type_breakdown = get_damage_type_breakdown();
                if (type_breakdown.Count != 0)
                {
                    lines.Add("<TR class=heading>");
                    lines.Add("<TD colspan=3>");
                    lines.Add("<B>Damage Types</B>");
                    lines.Add("</TD>");
                    lines.Add("</TR>");

                    List <Pair <string, int> > list = sort_breakdown(type_breakdown);
                    foreach (Pair <string, int> type in list)
                    {
                        int    count = type.Second;
                        double pc    = (double)count / fPowers.Count;

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>");
                        lines.Add(type.First);
                        lines.Add("</TD>");
                        lines.Add("<TD align=right>");
                        lines.Add(count + " (" + pc.ToString("P0") + ")");
                        lines.Add("</TD>");
                        lines.Add("</TR>");
                    }
                }

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }

            #endregion

            #region Keywords

            if (fPowers.Count != 0)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");

                // Number of powers with each keyword
                Dictionary <string, int> keyword_breakdown = get_keyword_breakdown();
                if (keyword_breakdown.Count != 0)
                {
                    lines.Add("<TR class=heading>");
                    lines.Add("<TD colspan=3>");
                    lines.Add("<B>Keywords</B>");
                    lines.Add("</TD>");
                    lines.Add("</TR>");

                    List <Pair <string, int> > list = sort_breakdown(keyword_breakdown);
                    foreach (Pair <string, int> type in list)
                    {
                        int    count = type.Second;
                        double pc    = (double)count / fPowers.Count;

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>");
                        lines.Add(type.First);
                        lines.Add("</TD>");
                        lines.Add("<TD align=right>");
                        lines.Add(count + " (" + pc.ToString("P0") + ")");
                        lines.Add("</TD>");
                        lines.Add("</TR>");
                    }
                }

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }

            #endregion

            #region Categories

            if (fPowers.Count != 0)
            {
                // Number of powers per category
                Dictionary <string, double> category_breakdown = get_category_breakdown();
                if (category_breakdown.Count != 0)
                {
                    lines.Add("<P class=table>");
                    lines.Add("<TABLE>");

                    lines.Add("<TR class=heading>");
                    lines.Add("<TD colspan=3>");
                    lines.Add("<B>Powers Per Category</B>");
                    lines.Add("</TD>");
                    lines.Add("</TR>");

                    foreach (string category in category_breakdown.Keys)
                    {
                        double pc = category_breakdown[category];

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>");
                        lines.Add(category);
                        lines.Add("</TD>");
                        lines.Add("<TD align=right>");
                        lines.Add(pc.ToString("P0"));
                        lines.Add("</TD>");
                        lines.Add("</TR>");
                    }

                    lines.Add("</TABLE>");
                    lines.Add("</P>");
                }
            }

            #endregion

            #region Damage expressions

            if (fPowers.Count != 0)
            {
                lines.Add("<P class=table>");
                lines.Add("<TABLE>");

                // Frequency of damage expressions
                Dictionary <string, int> damage_breakdown = get_damage_expression_breakdown();
                if (damage_breakdown.Count != 0)
                {
                    lines.Add("<TR class=heading>");
                    lines.Add("<TD colspan=3>");
                    lines.Add("<B>Damage</B>");
                    lines.Add("</TD>");
                    lines.Add("</TR>");

                    List <Pair <string, int> > list = sort_breakdown(damage_breakdown);
                    foreach (Pair <string, int> dmg in list)
                    {
                        int    count = dmg.Second;
                        double pc    = (double)count / fPowers.Count;

                        DiceExpression exp = DiceExpression.Parse(dmg.First);

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>");
                        lines.Add(dmg.First + " (avg " + exp.Average + ", max " + exp.Maximum + ")");
                        lines.Add("</TD>");
                        lines.Add("<TD align=right>");
                        lines.Add(count + " (" + pc.ToString("P0") + ")");
                        lines.Add("</TD>");
                        lines.Add("</TR>");
                    }
                }

                lines.Add("</TABLE>");
                lines.Add("</P>");
            }

            #endregion

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            Browser.DocumentText = HTML.Concatenate(lines);
        }
        private void set_options()
        {
            List <string> strs = new List <string>()
            {
                "<HTML>"
            };

            strs.AddRange(HTML.GetHead("Masterplan", "Main Menu", DisplaySize.Small));
            strs.Add("<BODY>");
            strs.Add("<P class=table>");
            strs.Add("<TABLE>");
            strs.Add("<TR class=heading>");
            strs.Add("<TD>");
            strs.Add("<B>Getting Started</B>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            if (this.show_last_file_option())
            {
                string str = FileName.Name(Session.Preferences.LastFile);
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add(string.Concat("<A href=\"masterplan:last\">Reopen <I>", str, "</I></A>"));
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            strs.Add("<TR>");
            strs.Add("<TD>");
            strs.Add("<A href=\"masterplan:new\">Create a new adventure project</A>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            strs.Add("<TR>");
            strs.Add("<TD>");
            strs.Add("<A href=\"masterplan:open\">Open an existing project</A>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            if (this.show_delve_option())
            {
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:delve\">Generate a random dungeon delve</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            strs.Add("<TR>");
            strs.Add("<TD>");
            strs.Add("<A href=\"masterplan:premade\">Download a premade adventure</A>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            strs.Add("</TABLE>");
            strs.Add("</P>");
            if (Program.IsBeta)
            {
                strs.Add("<P class=table>");
                strs.Add("<TABLE>");
                strs.Add("<TR class=heading>");
                strs.Add("<TD>");
                strs.Add("<B>Development Links</B>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:genesis\">Project Genesis</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:exodus\">Project Exodus</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:minos\">Project Minos</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:excalibur\">Project Excalibur</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:indiana\">Project Indiana</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
                strs.Add("</TABLE>");
                strs.Add("</P>");
            }
            strs.Add("<P class=table>");
            strs.Add("<TABLE>");
            strs.Add("<TR class=heading>");
            strs.Add("<TD>");
            strs.Add("<B>More Information</B>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            if (this.show_manual_option())
            {
                strs.Add("<TR>");
                strs.Add("<TD>");
                strs.Add("<A href=\"masterplan:manual\">Read the Masterplan user manual</A>");
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            strs.Add("<TR>");
            strs.Add("<TD>");
            strs.Add("<A href=\"http://www.habitualindolence.net/masterplan/tutorials.htm\" target=_new>Watch a tutorial video</A>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            strs.Add("<TR>");
            strs.Add("<TD>");
            strs.Add("<A href=\"http://www.habitualindolence.net/masterplan/\" target=_new>Visit the Masterplan website</A>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            strs.Add("</TABLE>");
            strs.Add("</P>");
            strs.Add("<P class=table>");
            strs.Add("<TABLE>");
            strs.Add("<TR class=heading>");
            strs.Add("<TD>");
            strs.Add("<B>Latest News</B>");
            strs.Add("</TD>");
            strs.Add("</TR>");
            if (!this.fShowHeadlines)
            {
                strs.Add("<TR>");
                strs.Add("<TD class=dimmed>");
                strs.Add("Headlines are disabled");
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            else if (this.fHeadlines == null)
            {
                strs.Add("<TR>");
                strs.Add("<TD class=dimmed>");
                strs.Add("Retrieving headlines...");
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            else if (this.fHeadlines.Count != 0)
            {
                this.fHeadlines.Sort();
                int num = 0;
                List <WelcomePanel.Headline> .Enumerator enumerator = this.fHeadlines.GetEnumerator();
                try
                {
                    do
                    {
                        if (!enumerator.MoveNext())
                        {
                            break;
                        }
                        WelcomePanel.Headline current = enumerator.Current;
                        strs.Add("<TR>");
                        strs.Add("<TD>");
                        strs.Add(string.Concat(current.Date.ToString("dd MMM"), ":"));
                        string[] uRL = new string[] { "<A href=\"", current.URL, "\" target=_new>", current.Title, "</A>" };
                        strs.Add(string.Concat(uRL));
                        strs.Add("</TD>");
                        strs.Add("</TR>");
                        num++;
                    }while (num != 10);
                }
                finally
                {
                    ((IDisposable)enumerator).Dispose();
                }
            }
            else
            {
                strs.Add("<TR>");
                strs.Add("<TD class=dimmed>");
                strs.Add("Could not download headlines");
                strs.Add("</TD>");
                strs.Add("</TR>");
            }
            strs.Add("</TABLE>");
            strs.Add("</P>");
            strs.Add("</BODY>");
            strs.Add("</HTML>");
            this.MenuBrowser.Document.OpenNew(true);
            this.MenuBrowser.Document.Write(HTML.Concatenate(strs));
        }
Exemple #20
0
        public IssuesForm(Plot plot)
        {
            this.InitializeComponent();
            List <PlotPoint> allPlotPoints = plot.AllPlotPoints;
            List <string>    strs          = new List <string>();

            strs.AddRange(HTML.GetHead("Plot Design Issues", "", DisplaySize.Small));
            strs.Add("<BODY>");
            List <DifficultyIssue> difficultyIssues = new List <DifficultyIssue>();

            foreach (PlotPoint allPlotPoint in allPlotPoints)
            {
                DifficultyIssue difficultyIssue = new DifficultyIssue(allPlotPoint);
                if (difficultyIssue.Reason == "")
                {
                    continue;
                }
                difficultyIssues.Add(difficultyIssue);
            }
            strs.Add("<H4>Difficulty Issues</H4>");
            if (difficultyIssues.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(none)");
                strs.Add("</P>");
            }
            else
            {
                foreach (DifficultyIssue difficultyIssue1 in difficultyIssues)
                {
                    strs.Add("<P>");
                    object[] point = new object[] { "<B>", difficultyIssue1.Point, "</B>: ", difficultyIssue1.Reason };
                    strs.Add(string.Concat(point));
                    strs.Add("</P>");
                }
            }
            strs.Add("<HR>");
            List <CreatureIssue> creatureIssues = new List <CreatureIssue>();

            foreach (PlotPoint plotPoint in allPlotPoints)
            {
                if (!(plotPoint.Element is Encounter))
                {
                    continue;
                }
                CreatureIssue creatureIssue = new CreatureIssue(plotPoint);
                if (creatureIssue.Reason == "")
                {
                    continue;
                }
                creatureIssues.Add(creatureIssue);
            }
            strs.Add("<H4>Creature Choice Issues</H4>");
            if (difficultyIssues.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(none)");
                strs.Add("</P>");
            }
            else
            {
                foreach (CreatureIssue creatureIssue1 in creatureIssues)
                {
                    strs.Add("<P>");
                    object[] objArray = new object[] { "<B>", creatureIssue1.Point, "</B>: ", creatureIssue1.Reason };
                    strs.Add(string.Concat(objArray));
                    strs.Add("</P>");
                }
            }
            strs.Add("<HR>");
            List <SkillIssue> skillIssues = new List <SkillIssue>();

            foreach (PlotPoint allPlotPoint1 in allPlotPoints)
            {
                if (!(allPlotPoint1.Element is SkillChallenge))
                {
                    continue;
                }
                SkillIssue skillIssue = new SkillIssue(allPlotPoint1);
                if (skillIssue.Reason == "")
                {
                    continue;
                }
                skillIssues.Add(skillIssue);
            }
            strs.Add("<H4>Undefined Skill Challenges</H4>");
            if (skillIssues.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(none)");
                strs.Add("</P>");
            }
            else
            {
                foreach (SkillIssue skillIssue1 in skillIssues)
                {
                    strs.Add("<P>");
                    object[] point1 = new object[] { "<B>", skillIssue1.Point, "</B>: ", skillIssue1.Reason };
                    strs.Add(string.Concat(point1));
                    strs.Add("</P>");
                }
            }
            strs.Add("<HR>");
            List <ParcelIssue> parcelIssues = new List <ParcelIssue>();

            foreach (PlotPoint plotPoint1 in allPlotPoints)
            {
                foreach (Parcel parcel in plotPoint1.Parcels)
                {
                    if (parcel.Name != "")
                    {
                        continue;
                    }
                    parcelIssues.Add(new ParcelIssue(parcel, plotPoint1));
                }
            }
            strs.Add("<H4>Undefined Treasure Parcels</H4>");
            if (parcelIssues.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(none)");
                strs.Add("</P>");
            }
            else
            {
                foreach (ParcelIssue parcelIssue in parcelIssues)
                {
                    strs.Add("<P>");
                    object[] objArray1 = new object[] { "<B>", parcelIssue.Point, "</B>: ", parcelIssue.Reason };
                    strs.Add(string.Concat(objArray1));
                    strs.Add("</P>");
                }
            }
            strs.Add("<HR>");
            List <TreasureIssue> treasureIssues = new List <TreasureIssue>();
            PlotPoint            plotPoint2     = Session.Project.FindParent(plot);

            this.add_treasure_issues((plotPoint2 != null ? plotPoint2.Name : Session.Project.Name), plot, treasureIssues);
            strs.Add("<H4>Treasure Allocation Issues</H4>");
            if (treasureIssues.Count == 0)
            {
                strs.Add("<P class=instruction>");
                strs.Add("(none)");
                strs.Add("</P>");
            }
            else
            {
                foreach (TreasureIssue treasureIssue in treasureIssues)
                {
                    strs.Add("<P>");
                    strs.Add(string.Concat("<B>", treasureIssue.PlotName, "</B>: ", treasureIssue.Reason));
                    strs.Add("</P>");
                }
            }
            strs.Add("</BODY>");
            strs.Add("</HTML>");
            this.Browser.DocumentText = HTML.Concatenate(strs);
        }
        void update_powers()
        {
            Cursor.Current = Cursors.WaitCursor;

            List <string> content = new List <string>();

            fPowers = new List <CreaturePower>();

            content.AddRange(HTML.GetHead(null, null, Session.Preferences.TextSize));
            content.Add("<BODY>");

            List <ICreature> creatures = SelectedCreatures;

            if ((creatures != null) && (creatures.Count != 0))
            {
                content.Add("<P class=instruction>");
                if (fShowAll)
                {
                    content.Add("These creatures have the following powers:");
                }
                else
                {
                    content.Add("The selected creatures have the following powers:");
                }
                content.Add("</P>");

                Dictionary <CreaturePowerCategory, List <CreaturePower> > powers = new Dictionary <CreaturePowerCategory, List <CreaturePower> >();

                Array power_categories = Enum.GetValues(typeof(CreaturePowerCategory));
                foreach (CreaturePowerCategory cat in power_categories)
                {
                    powers[cat] = new List <CreaturePower>();
                }

                foreach (ICreature c in creatures)
                {
                    foreach (CreaturePower cp in c.CreaturePowers)
                    {
                        powers[cp.Category].Add(cp);
                        fPowers.Add(cp);
                    }
                }

                content.Add("<P class=table>");
                content.Add("<TABLE>");

                foreach (CreaturePowerCategory cat in power_categories)
                {
                    int count = powers[cat].Count;
                    if (count == 0)
                    {
                        continue;
                    }

                    powers[cat].Sort();

                    string name = "";
                    switch (cat)
                    {
                    case CreaturePowerCategory.Trait:
                        name = "Traits";
                        break;

                    case CreaturePowerCategory.Standard:
                    case CreaturePowerCategory.Move:
                    case CreaturePowerCategory.Minor:
                    case CreaturePowerCategory.Free:
                        name = cat + " Actions";
                        break;

                    case CreaturePowerCategory.Triggered:
                        name = "Triggered Actions";
                        break;

                    case CreaturePowerCategory.Other:
                        name = "Other Actions";
                        break;
                    }

                    content.Add("<TR class=creature>");
                    content.Add("<TD colspan=3>");
                    content.Add("<B>" + name + "</B>");
                    content.Add("</TD>");
                    content.Add("</TR>");

                    foreach (CreaturePower power in powers[cat])
                    {
                        content.AddRange(power.AsHTML(null, CardMode.View, false));

                        content.Add("<TR>");
                        content.Add("<TD colspan=3 align=center>");

                        if ((fName != null) && (fName != ""))
                        {
                            content.Add("<A href=copy:" + power.ID + ">copy this power into " + fName + "</A>");
                        }
                        else
                        {
                            content.Add("<A href=copy:" + power.ID + ">select this power</A>");
                        }

                        content.Add("</TD>");
                        content.Add("</TR>");
                    }
                }

                content.Add("</TABLE>");
                content.Add("</P>");
            }
            else
            {
                content.Add("<P class=instruction>");
                content.Add("(no creatures selected)");
                content.Add("</P>");
            }

            content.Add("</BODY>");
            content.Add("</HTML>");

            PowerDisplay.DocumentText = HTML.Concatenate(content);

            Cursor.Current = Cursors.Default;
        }
Exemple #22
0
        void update_statblock()
        {
            int   level = (fCreature != null) ? fCreature.Level : 0;
            IRole role  = (fCreature != null) ? fCreature.Role : null;

            List <string> lines = HTML.GetHead(null, null, Session.Preferences.TextSize);

            lines.Add("<BODY>");

            lines.Add("<TABLE class=clear>");
            lines.Add("<TR class=clear>");
            lines.Add("<TD class=clear>");

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");
            lines.AddRange(fPower.AsHTML(null, CardMode.Build, fFromFunctionalTemplate));
            lines.Add("</TABLE>");
            lines.Add("</P>");

            lines.Add("</TD>");
            lines.Add("<TD class=clear>");

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");

            lines.Add("<TR class=heading>");
            lines.Add("<TD colspan=2><B>Power Advice</B></TD>");
            lines.Add("</TR>");

            lines.Add("<TR class=shaded>");
            lines.Add("<TD colspan=2><B>Attack Bonus</B></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Attack vs Armour Class</TD>");
            lines.Add("<TD align=center>+" + Statistics.AttackBonus(DefenceType.AC, level, role) + "</TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Attack vs Other Defence</TD>");
            lines.Add("<TD align=center>+" + Statistics.AttackBonus(DefenceType.Fortitude, level, role) + "</TD>");
            lines.Add("</TR>");

            if (role != null)
            {
                lines.Add("<TR class=shaded>");
                lines.Add("<TD colspan=2><B>Damage</B></TD>");
                lines.Add("</TR>");

                if (role is Minion)
                {
                    lines.Add("<TR>");
                    lines.Add("<TD>Minion Damage</TD>");
                    lines.Add("<TD align=center>" + Statistics.Damage(level, DamageExpressionType.Minion) + "</TD>");
                    lines.Add("</TR>");
                }
                else
                {
                    lines.Add("<TR>");
                    lines.Add("<TD>Damage vs Single Targets</TD>");
                    lines.Add("<TD align=center>" + Statistics.Damage(level, DamageExpressionType.Normal) + "</TD>");
                    lines.Add("</TR>");

                    lines.Add("<TR>");
                    lines.Add("<TD>Damage vs Multiple Targets</TD>");
                    lines.Add("<TD align=center>" + Statistics.Damage(level, DamageExpressionType.Multiple) + "</TD>");
                    lines.Add("</TR>");
                }

                if (fExamples.Count != 0)
                {
                    lines.Add("<TR class=shaded>");
                    lines.Add("<TD><B>Example Power Details</B></TD>");
                    lines.Add("<TD align=center><A href=details:refresh>(refresh)</A></TD>");
                    lines.Add("</TR>");

                    foreach (string example in fExamples)
                    {
                        int index = fExamples.IndexOf(example);

                        lines.Add("<TR>");
                        lines.Add("<TD colspan=2>" + example + " <A href=details:" + index + ">(use this)</A></TD>");
                        lines.Add("</TR>");
                    }
                }
            }

            lines.Add("</TABLE>");
            lines.Add("</P>");

            lines.Add("</TD>");
            lines.Add("</TR>");
            lines.Add("</TABLE>");

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            StatBlockBrowser.DocumentText = HTML.Concatenate(lines);
        }
Exemple #23
0
        public IssuesForm(Plot plot)
        {
            InitializeComponent();

            List <PlotPoint> points = plot.AllPlotPoints;

            List <string> lines = new List <string>();

            lines.AddRange(HTML.GetHead("Plot Design Issues", "", Session.Preferences.TextSize));
            lines.Add("<BODY>");

            List <DifficultyIssue> difficulty_issues = new List <DifficultyIssue>();

            foreach (PlotPoint pp in points)
            {
                DifficultyIssue di = new DifficultyIssue(pp);
                if (di.Reason != "")
                {
                    difficulty_issues.Add(di);
                }
            }
            lines.Add("<H4>Difficulty Issues</H4>");
            if (difficulty_issues.Count != 0)
            {
                foreach (DifficultyIssue issue in difficulty_issues)
                {
                    lines.Add("<P>");
                    lines.Add("<B>" + issue.Point + "</B>: " + issue.Reason);
                    lines.Add("</P>");
                }
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("(none)");
                lines.Add("</P>");
            }
            lines.Add("<HR>");

            List <CreatureIssue> creature_issues = new List <CreatureIssue>();

            foreach (PlotPoint pp in points)
            {
                if (pp.Element is Encounter)
                {
                    CreatureIssue ci = new CreatureIssue(pp);
                    if (ci.Reason != "")
                    {
                        creature_issues.Add(ci);
                    }
                }
            }
            lines.Add("<H4>Creature Choice Issues</H4>");
            if (difficulty_issues.Count != 0)
            {
                foreach (CreatureIssue issue in creature_issues)
                {
                    lines.Add("<P>");
                    lines.Add("<B>" + issue.Point + "</B>: " + issue.Reason);
                    lines.Add("</P>");
                }
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("(none)");
                lines.Add("</P>");
            }
            lines.Add("<HR>");

            List <SkillIssue> skill_issues = new List <SkillIssue>();

            foreach (PlotPoint pp in points)
            {
                if (pp.Element is SkillChallenge)
                {
                    SkillIssue si = new SkillIssue(pp);
                    if (si.Reason != "")
                    {
                        skill_issues.Add(si);
                    }
                }
            }
            lines.Add("<H4>Undefined Skill Challenges</H4>");
            if (skill_issues.Count != 0)
            {
                foreach (SkillIssue issue in skill_issues)
                {
                    lines.Add("<P>");
                    lines.Add("<B>" + issue.Point + "</B>: " + issue.Reason);
                    lines.Add("</P>");
                }
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("(none)");
                lines.Add("</P>");
            }
            lines.Add("<HR>");

            List <ParcelIssue> parcel_issues = new List <ParcelIssue>();

            foreach (PlotPoint pp in points)
            {
                foreach (Parcel parcel in pp.Parcels)
                {
                    if (parcel.Name == "")
                    {
                        ParcelIssue pi = new ParcelIssue(parcel, pp);
                        parcel_issues.Add(pi);
                    }
                }
            }
            lines.Add("<H4>Undefined Treasure Parcels</H4>");
            if (parcel_issues.Count != 0)
            {
                foreach (ParcelIssue issue in parcel_issues)
                {
                    lines.Add("<P>");
                    lines.Add("<B>" + issue.Point + "</B>: " + issue.Reason);
                    lines.Add("</P>");
                }
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("(none)");
                lines.Add("</P>");
            }
            lines.Add("<HR>");

            List <TreasureIssue> treasure_issues = new List <TreasureIssue>();
            PlotPoint            parent          = Session.Project.FindParent(plot);
            string plot_name = (parent != null) ? parent.Name : Session.Project.Name;

            add_treasure_issues(plot_name, plot, treasure_issues);
            lines.Add("<H4>Treasure Allocation Issues</H4>");
            if (treasure_issues.Count != 0)
            {
                foreach (TreasureIssue issue in treasure_issues)
                {
                    lines.Add("<P>");
                    lines.Add("<B>" + issue.PlotName + "</B>: " + issue.Reason);
                    lines.Add("</P>");
                }
            }
            else
            {
                lines.Add("<P class=instruction>");
                lines.Add("(none)");
                lines.Add("</P>");
            }

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            Browser.DocumentText = HTML.Concatenate(lines);
        }
Exemple #24
0
        string get_element_html()
        {
            List <string> lines = new List <string>();

            lines.Add("<HTML>");
            lines.AddRange(HTML.GetHead("Plot Point", "Plot Point", Session.Preferences.TextSize));
            lines.Add("<BODY>");

            lines.Add("<P>");
            lines.Add("This plot point does not contain a game element (such as an encounter or a skill challenge).");
            lines.Add("The list of available game elements is below.");
            lines.Add("You can add a game element to this plot point by clicking on one of the links.");
            lines.Add("</P>");

            lines.Add("<P class=table>");
            lines.Add("<TABLE>");

            lines.Add("<TR class=heading>");
            lines.Add("<TD><B>Select a Game Element</B></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Add a <A href=\"element:encounter\">combat encounter</A></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Add a <A href=\"element:challenge\">skill challenge</A></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Add a <A href=\"element:trap\">trap or hazard</A></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Add a <A href=\"element:quest\">quest</A></TD>");
            lines.Add("</TR>");

            lines.Add("<TR>");
            lines.Add("<TD>Add a <A href=\"element:map\">tactical map</A></TD>");
            lines.Add("</TR>");

            if (Clipboard.ContainsData(typeof(Encounter).ToString()))
            {
                lines.Add("<TR>");
                lines.Add("<TD><A href=\"element:pasteencounter\">Paste the encounter from the clipboard</A></TD>");
                lines.Add("</TR>");
            }

            if (Clipboard.ContainsData(typeof(SkillChallenge).ToString()))
            {
                lines.Add("<TR>");
                lines.Add("<TD><A href=\"element:pastechallenge\">Paste the skill challenge from the clipboard</A></TD>");
                lines.Add("</TR>");
            }

            if (Clipboard.ContainsData(typeof(TrapElement).ToString()))
            {
                lines.Add("<TR>");
                lines.Add("<TD><A href=\"element:pastetrap\">Paste the trap from the clipboard</A></TD>");
                lines.Add("</TR>");
            }

            if (Clipboard.ContainsData(typeof(Quest).ToString()))
            {
                lines.Add("<TR>");
                lines.Add("<TD><A href=\"element:pastequest\">Paste the quest from the clipboard</A></TD>");
                lines.Add("</TR>");
            }

            if (Clipboard.ContainsData(typeof(MapElement).ToString()))
            {
                lines.Add("<TR>");
                lines.Add("<TD><A href=\"element:pastemap\">Paste the map from the clipboard</A></TD>");
                lines.Add("</TR>");
            }

            lines.Add("</TABLE>");
            lines.Add("</P>");

            lines.Add("</BODY>");
            lines.Add("</HTML>");

            return(HTML.Concatenate(lines));
        }
Exemple #25
0
        private void update_power()
        {
            List <string> strs = new List <string>();

            strs.AddRange(HTML.GetHead(this.fPower.Name, "", DisplaySize.Small));
            strs.Add("<BODY>");
            strs.Add("<P class=table>");
            strs.Add("<TABLE>");
            strs.AddRange(this.fPower.AsHTML(null, CardMode.View, false));
            strs.Add("</TABLE>");
            strs.Add("</P>");
            strs.Add("<P class=instruction align=left>");
            strs.Add("Click to add an attack roll for:");
            string str = "";

            foreach (Hero hero in Session.Project.Heroes)
            {
                CombatData combatData = hero.CombatData;
                if (this.roll_exists(hero.ID) || hero.GetState(combatData.Damage) == CreatureState.Defeated)
                {
                    continue;
                }
                if (str != "")
                {
                    str = string.Concat(str, " | ");
                }
                object   obj = str;
                object[] d   = new object[] { obj, "<A href=hero:", hero.ID, ">", hero.Name, "</A>" };
                str = string.Concat(d);
            }
            if (str != "")
            {
                strs.Add("<BR>");
                strs.Add(str);
            }
            string str1 = "";

            foreach (EncounterSlot slot in this.fEncounter.Slots)
            {
                foreach (CombatData combatDatum in slot.CombatData)
                {
                    if (this.roll_exists(combatDatum.ID) || slot.GetState(combatDatum) == CreatureState.Defeated)
                    {
                        continue;
                    }
                    if (str1 != "")
                    {
                        str1 = string.Concat(str1, " | ");
                    }
                    object   obj1     = str1;
                    object[] objArray = new object[] { obj1, "<A href=opponent:", combatDatum.ID, ">", combatDatum.DisplayName, "</A>" };
                    str1 = string.Concat(objArray);
                }
            }
            if (str1 != "")
            {
                strs.Add("<BR>");
                strs.Add(str1);
            }
            strs.Add("<BR>");
            strs.Add("<A href=target:blank>An unnamed target</A>");
            strs.Add("</P>");
            strs.Add("</BODY>");
            strs.Add("</HTML>");
            this.PowerBrowser.DocumentText = HTML.Concatenate(strs);
        }