Exemplo n.º 1
0
        private void DisplayAllSpells(string _class, List <KeyValuePair <int, int> > _known)
        {
            List <Other.Spell> allspells = spells.AllSpells(0);


            int    levelKnown = 0;
            int    increaser  = 32;
            bool   addspace   = false;
            string res        = "";

            foreach (Other.Spell known in allspells)
            {
                foreach (KeyValuePair <int, string> levelclass in known.LevelAndClass)
                {
                    foreach (KeyValuePair <int, int> item in _known)
                    {
                        if (item.Key == levelclass.Key)
                        {
                            if (levelclass.Value.Equals(_class))
                            {
                                int seperator = (levelKnown * increaser);

                                uni.LabelSpellsKnownCreatorRepeater(known.Name, "lblN" + levelKnown, pSpellsKnown, 4, 35, false, 0, BorderStyle.None, 32, 115, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(known.ShortDescription, "lblD" + levelKnown, pSpellsKnown, 119, 35, false, 0, BorderStyle.None, 32, 180, seperator, ContentAlignment.TopLeft, true, false);
                                foreach (string component in known.Components)
                                {
                                    if (addspace)
                                    {
                                        res += ", ";
                                    }
                                    res += uni.ComponentGetter(component);

                                    addspace = true;
                                }

                                uni.LabelSpellsKnownCreatorRepeater(res, "lblC" + levelKnown, pSpellsKnown, 302, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(known.Range, "lblR" + levelKnown, pSpellsKnown, 393, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(known.TarEffAer, "lblTAE" + levelKnown, pSpellsKnown, 471, 35, false, 0, BorderStyle.None, 32, 133, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(known.Duration, "lblDu" + levelKnown, pSpellsKnown, 603, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(known.SavingThrow, "lblS" + levelKnown, pSpellsKnown, 680, 35, false, 0, BorderStyle.None, 32, 56, seperator, ContentAlignment.TopLeft, true, false);
                                uni.LabelSpellsKnownCreatorRepeater(uni.SpellResistanceConverter(known.SpellResistance), "lblSR" + levelKnown, pSpellsKnown, 739, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uni.ImagedButtonCreatorRepeater(758, 35, seperator, 20, 20, "btnInfo" + known.Name, "", pSpellsKnown, new EventHandler(this.SpellInfo), false, true);
                                uni.ImagedButtonCreatorRepeater(780, 35, seperator, 20, 20, "btnAdd" + known.Name, "", pSpellsKnown, new EventHandler(this.AddToSpellsKnown), false, true);
                                levelKnown++;
                                res      = "";
                                addspace = false;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void AddCasterTap(SpellCaster _spc, string _class)
        {
            #region test
            SpellsKnown = new List <KeyValuePair <int, List <Other.Spell> > >();
            Other.Spell temps = new Other.Spell();
            temps = spells.AcidSplash(1);
            List <Other.Spell> listspell  = new List <Other.Spell>();
            List <Other.Spell> listspellN = new List <Other.Spell>();
            listspell.Add(temps);
            temps = spells.Aid(1);
            listspell.Add(temps);
            temps = spells.Atonement(10);
            listspellN.Add(temps);
            temps = spells.BalefulPolymorph(10);
            listspellN.Add(temps);
            SpellsKnown.Insert(0, new KeyValuePair <int, List <Other.Spell> >(0, listspell));
            SpellsKnown.Insert(1, new KeyValuePair <int, List <Other.Spell> >(1, listspellN));
            #endregion

            bool       original = true;
            TabControl tbc      = tabControl1;
            foreach (TabPage item in tbc.Controls)
            {
                if (item.Text.Equals(_class + " Spells"))
                {
                    original = false;
                }
            }
            if (original)
            {
                TabPage tbp = new TabPage();
                tbp.Text      = _class + " Spells";
                tbp.BackColor = Color.Transparent;
                tbp.Size      = new Size(840, 468);
                tbp.UseVisualStyleBackColor = true;



                tbc.TabPages.Add(tbp);
                Panel casterPanel = new Panel();
                casterPanel.Name      = "CasterTab" + _class;
                casterPanel.Location  = new Point(0, 0);
                casterPanel.BackColor = Color.Transparent;
                casterPanel.Size      = new Size(825, 430);

                Panel pSpellsKnown = new Panel();
                pSpellsKnown.BackColor   = Color.Transparent;
                pSpellsKnown.AutoSize    = false;
                pSpellsKnown.Name        = "pSpellsKnown" + _class;
                pSpellsKnown.BorderStyle = BorderStyle.Fixed3D;
                pSpellsKnown.Location    = new Point(0, 175);
                pSpellsKnown.Size        = new Size(825, 258);
                pSpellsKnown.AutoScroll  = true;

                uniMet.LabelSpellsKnownCreator("Spells for " + _class, "lblCasterClass" + _class, casterPanel, 4, 4, true, 14, BorderStyle.None, 0, 0);
                uniMet.LabelSpellsKnownCreator("Ranges", "lblRanges" + _class, casterPanel, 455, 14, true, 12, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator("Close", "lblCloseText" + _class, casterPanel, 409, 45, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator(_spc.SpellRangeCloseStr, "lblCloseCal" + _class, casterPanel, 409, 70, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator("Medium", "lblMediumText" + _class, casterPanel, 471, 45, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator(_spc.SpellRangeMediumStr, "lblMediumCal" + _class, casterPanel, 471, 70, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator("Long", "lblLongText" + _class, casterPanel, 533, 45, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator(_spc.SpellRangeLongStr, "lblLongCal" + _class, casterPanel, 533, 70, true, 0, BorderStyle.FixedSingle, 0, 0);
                uniMet.LabelSpellsKnownCreator("Spells pr day", "lblSpellsPrDay" + _class, casterPanel, 5, 45, true, 12, BorderStyle.None, 0, 0);
                uniMet.LabelSpellsKnownCreator("Spell level", "lblSpellLevel" + _class, casterPanel, 8, 74, true, 0, BorderStyle.None, 0, 0);
                uniMet.LabelSpellsKnownCreator("Pr day", "lblAmount" + _class, casterPanel, 8, 97, true, 0, BorderStyle.None, 0, 0);
                uniMet.LabelSpellsKnownCreator("Save DC", "lblSave" + _class, casterPanel, 8, 119, true, 0, BorderStyle.None, 0, 0);
                uniMet.ButtonSpellsKnownCreator(8, 144, 110, 23, "btnSpellsKnown" + _class, "Select Spells Known", casterPanel, new EventHandler(this.SpellsKnownAdd));
                uniMet.ButtonSpellsKnownCreator(726, 4, 75, 23, "btnRest" + _class, "Rest", casterPanel, null);
                uniMet.ButtonSpellsKnownCreator(726, 34, 75, 23, "btnOtherSheet" + _class, "Other Sheet", casterPanel, null);
                uniMet.ButtonSpellsKnownCreator(726, 64, 75, 23, "btnNewSheet" + _class, "New Sheet", casterPanel, null);

                SendMaxLevel = _spc.SpellsKnown;
                int highest = _spc.HighestLevel + 1;
                int start   = 0;
                if (!_spc.StartZero)
                {
                    start = 1;
                }

                int stat = 0;
                switch (_spc.CasterStat)
                {
                case "Int": stat = uniMet.StatCalculator(TempInt); break;

                case "Wis": stat = uniMet.StatCalculator(TempWis); break;

                case "Cha": stat = uniMet.StatCalculator(TempCha); break;

                default:
                    break;
                }


                int    levelKnown = 0;
                int    levelPos   = 0;
                int    increaser  = 32;
                bool   addspace   = false;
                string res        = "";
                for (int i = start; i < highest; i++)
                {
                    int dc = 10 + i + stat;
                    uniMet.LabelSpellsKnownCreatorRepeater("" + i, "lblSLevel" + i + _class, casterPanel, 65, 70, false, 0, BorderStyle.FixedSingle, 21, 21, (i * 22), ContentAlignment.MiddleCenter, false, true);
                    uniMet.LabelSpellsKnownCreatorRepeater("" + dc, "lblSaveLevel" + i + _class, casterPanel, 65, 114, false, 0, BorderStyle.FixedSingle, 21, 21, (i * 22), ContentAlignment.MiddleCenter, false, true);

                    foreach (KeyValuePair <int, int> item in _spc.SpellsPrDay)
                    {
                        if (item.Key == i)
                        {
                            uniMet.LabelSpellsKnownCreatorRepeater("" + item.Value, "lblAmountLevel" + i + _class, casterPanel, 65, 92, false, 0, BorderStyle.FixedSingle, 21, 21, (i * 22), ContentAlignment.MiddleCenter, false, true);
                        }
                    }

                    foreach (KeyValuePair <int, List <Other.Spell> > item in SpellsKnown)
                    {
                        if (item.Key == i)
                        {
                            uniMet.LabelSpellsKnownCreator("Level " + i, "lblSLK" + i + _class, pSpellsKnown, 12, levelPos, true, 14, BorderStyle.None, 0, 0);
                            foreach (Other.Spell known in item.Value)
                            {
                                int seperator = (levelKnown * increaser) + levelPos;

                                uniMet.LabelSpellsKnownCreatorRepeater(known.Name, "lblN" + i + levelKnown + _class, pSpellsKnown, 30, 35, false, 0, BorderStyle.None, 32, 115, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(known.ShortDescription, "lblD" + i + levelKnown + _class, pSpellsKnown, 145, 35, false, 0, BorderStyle.None, 32, 180, seperator, ContentAlignment.TopLeft, true, false);
                                foreach (string component in known.Components)
                                {
                                    if (addspace)
                                    {
                                        res += ", ";
                                    }
                                    res += uniMet.ComponentGetter(component);

                                    addspace = true;
                                }
                                uniMet.ImagedButtonCreatorRepeater(5, 35, seperator, 20, 20, "btnPlus" + i + _class, "AddAnother", pSpellsKnown, new EventHandler(this.SpellUsage), false, true);
                                uniMet.LabelSpellsKnownCreatorRepeater(res, "lblC" + i + _class, pSpellsKnown, 324, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(known.Range, "lblR" + i + _class, pSpellsKnown, 415, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(known.TarEffAer, "lblTAE" + i + _class, pSpellsKnown, 493, 35, false, 0, BorderStyle.None, 32, 133, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(known.Duration, "lblDu" + i + _class, pSpellsKnown, 625, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(known.SavingThrow, "lblS" + i + _class, pSpellsKnown, 702, 35, false, 0, BorderStyle.None, 32, 56, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.LabelSpellsKnownCreatorRepeater(uniMet.SpellResistanceConverter(known.SpellResistance), "lblSR" + i + _class, pSpellsKnown, 761, 35, true, 0, BorderStyle.None, 0, 0, seperator, ContentAlignment.TopLeft, true, false);
                                uniMet.ImagedButtonCreatorRepeater(780, 35, seperator, 20, 20, "btnInfo" + i + _class + "/" + known.Name, "AddAnother", pSpellsKnown, new EventHandler(this.SpellInfo), false, true);
                                levelKnown++;
                                res      = "";
                                addspace = false;
                            }
                            levelPos  += (35 * levelKnown) + 40;
                            levelKnown = 0;
                        }
                    }
                }



                casterPanel.Controls.Add(pSpellsKnown);
                tbp.Controls.Add(casterPanel);
            }
        }