Exemple #1
0
        void PrintProfileLong(Rectangle bounds, PrintPageEventArgs args)
        {
            SolidBrush   solidBrush = new SolidBrush(Color.Black);
            int          vPos       = bounds.Top;
            StringFormat format     = new StringFormat(StringFormatFlags.NoClip)
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Near
            };

            if (this._pageNumber == 1)
            {
                int  num  = Print.PpInfo(bounds, args) + 6;
                Font font = new Font("Arial", 12f, FontStyle.Bold | FontStyle.Underline, GraphicsUnit.Pixel);
                args.Graphics.DrawString("Extended " + MidsContext.Character.Alignment.ToString() + " Profile", font, solidBrush, new RectangleF(bounds.Left + 15, num, bounds.Width, 15f), format);
                vPos = num + 15;
            }
            Font font1 = new Font("Arial", 12f, FontStyle.Bold, GraphicsUnit.Pixel);

            if (this._sectionCompleted == Print.PrintWhat.None)
            {
                this._endOfPage = false;
                // mutates vPos
                int num = this.BuildPowerListLong(ref vPos, bounds, 12, Print.PrintWhat.Powers, args);
                if (this._endOfPage)
                {
                    return;
                }
                string s = "------------";
                args.Graphics.DrawString(s, font1, solidBrush, new RectangleF(bounds.Left + 15, num, bounds.Width, 15f), format);
                vPos = num + 15;
                this._sectionCompleted = Print.PrintWhat.Powers;
            }
            if (this._sectionCompleted == Print.PrintWhat.Powers)
            {
                this._endOfPage = false;
                vPos            = this.BuildPowerListLong(ref vPos, bounds, 12, Print.PrintWhat.Inherent, args);
                if (this._endOfPage)
                {
                    return;
                }
                this._sectionCompleted = Print.PrintWhat.Inherent;
                if (MidsContext.Character.Archetype.Epic)
                {
                    string s = "------------";
                    args.Graphics.DrawString(s, font1, solidBrush, new RectangleF((bounds.Left + 15), vPos, bounds.Width, 15f), format);
                    vPos += 15;
                }
            }
            if (this._sectionCompleted == Print.PrintWhat.Inherent && MidsContext.Character.Archetype.Epic)
            {
                this._endOfPage = false;
                this.BuildPowerListLong(ref vPos, bounds, 12, Print.PrintWhat.EpicInherent, args);
                if (this._endOfPage)
                {
                    return;
                }
            }
            this._printingProfile = false;
        }
 void PrintBegin(object sender, PrintEventArgs e)
 {
     this._pageNumber       = 0;
     this._pIndex           = 0;
     this._printingProfile  = MidsContext.Config.PrintProfile != ConfigData.PrintOptionProfile.None;
     this._printingHistory  = MidsContext.Config.PrintHistory;
     this._sectionCompleted = Print.PrintWhat.None;
 }
        int BuildPowerListLong(

            ref int vPos,
            RectangleF bounds,
            int fontSize,
            Print.PrintWhat selection,
            PrintPageEventArgs args)
        {
            int num1;

            if (this._pIndex < 0)
            {
                this._endOfPage       = true;
                this._printingProfile = false;
                num1 = vPos;
            }
            else
            {
                StringFormat format     = new StringFormat(StringFormatFlags.NoWrap | StringFormatFlags.NoClip);
                SolidBrush   solidBrush = new SolidBrush(Color.Black);
                int          num2       = -1;
                Font         font       = new Font("Arial", (float)fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
                bool         flag1      = false;
                for (int pIndex = this._pIndex; pIndex <= MidsContext.Character.CurrentBuild.Powers.Count - 1; ++pIndex)
                {
                    bool flag2 = false;
                    switch (selection)
                    {
                    case Print.PrintWhat.Powers:
                        if (MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen)
                        {
                            flag2 = true;
                            break;
                        }
                        break;

                    case Print.PrintWhat.Inherent:
                        if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null)
                        {
                            flag2 = !MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic;
                            if (flag2 && MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length < 1)
                            {
                                flag2 = false;
                            }
                            break;
                        }
                        break;

                    case Print.PrintWhat.EpicInherent:
                        if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null)
                        {
                            flag2 = MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic;
                            break;
                        }
                        break;
                    }
                    if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen & MidsContext.Character.CurrentBuild.Powers[pIndex].SubPowers.Length > 0)
                    {
                        flag2 = false;
                    }
                    if (flag2)
                    {
                        string s1 = "Level " + MidsContext.Character.CurrentBuild.Powers[pIndex].Level + 1 + ":";
                        string s2 = MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null ? MidsContext.Character.CurrentBuild.Powers[pIndex].Power.DisplayName : "[No Power]";
                        string s3 = "";
                        if ((double)vPos - (double)bounds.Top + (double)((MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length + 1) * fontSize) * 1.25 > (double)bounds.Height)
                        {
                            num2  = pIndex;
                            flag1 = true;
                            break;
                        }
                        for (int index = 0; index <= MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1; ++index)
                        {
                            if (!string.IsNullOrEmpty(s3))
                            {
                                s3 += '\n';
                            }
                            string str1;
                            if (index == 0)
                            {
                                str1 = s3 + "(A) ";
                            }
                            else
                            {
                                str1 = s3 + "(" + MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Level + 1 + ") ";
                            }
                            if (MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh > -1)
                            {
                                IEnhancement enhancement = DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh];
                                switch (enhancement.TypeID)
                                {
                                case Enums.eType.Normal:
                                    string relativeString1 = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false);
                                    string str2;
                                    if (!string.IsNullOrEmpty(relativeString1) & relativeString1 != "X")
                                    {
                                        str2 = str1 + relativeString1 + " " + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - ";
                                    }
                                    else
                                    {
                                        str2 = !(relativeString1 == "X") ? str1 + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - " : str1 + "Disabled " + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - ";
                                    }
                                    str1 = str2 + " ";
                                    break;

                                case Enums.eType.SpecialO:
                                    string relativeString2 = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false);
                                    string str3;
                                    if (!string.IsNullOrEmpty(relativeString2) & relativeString2 != "X")
                                    {
                                        str3 = str1 + relativeString2 + " " + enhancement.GetSpecialName() + " - ";
                                    }
                                    else
                                    {
                                        str3 = !(relativeString2 == "X") ? str1 + enhancement.GetSpecialName() + " - " : str1 + "Disabled " + enhancement.GetSpecialName() + " - ";
                                    }
                                    str1 = str3 + " ";
                                    break;
                                }
                                s3 = str1 + enhancement.LongName;
                                switch (enhancement.TypeID)
                                {
                                case Enums.eType.InventO:
                                    s3 = s3 + " - IO:" + MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel + 1;
                                    continue;

                                case Enums.eType.SetO:
                                    s3 = s3 + " - IO:" + MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel + 1;
                                    continue;

                                default:
                                    continue;
                                }
                            }
                            else
                            {
                                s3 = str1 + "[Empty]";
                            }
                        }
                        if (!string.IsNullOrEmpty(s1) || !string.IsNullOrEmpty(s2) || !string.IsNullOrEmpty(s3))
                        {
                            RectangleF layoutRectangle = new RectangleF(bounds.Left + 15f, (float)vPos, bounds.Width, (float)fontSize * 1.25f);
                            args.Graphics.DrawString(s1, font, (Brush)solidBrush, layoutRectangle, format);
                            layoutRectangle = new RectangleF(bounds.Left + 80f, (float)vPos, bounds.Width, (float)fontSize * 1.25f);
                            args.Graphics.DrawString(s2, font, (Brush)solidBrush, layoutRectangle, format);
                            vPos           += (int)((double)fontSize * 1.25);
                            layoutRectangle = new RectangleF(bounds.Left + 90f, (float)vPos, bounds.Width, (float)(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length * fontSize) * 1.25f);
                            args.Graphics.DrawString(s3, font, (Brush)solidBrush, layoutRectangle, format);
                            vPos += (int)((double)fontSize * 1.25 * 1.1 + (double)fontSize * 1.25 * (double)(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1));
                        }
                    }
                }
                this._pIndex = num2;
                if (flag1)
                {
                    this._endOfPage = true;
                }
                else
                {
                    this._pIndex = 0;
                }
                num1 = vPos;
            }
            return(num1);
        }
        int BuildPowerListLong(ref int vPos, RectangleF bounds, int fontSize, Print.PrintWhat selection, PrintPageEventArgs args)
        {
            int num;

            if (this._pIndex < 0)
            {
                this._endOfPage       = true;
                this._printingProfile = false;
                num = vPos;
            }
            else
            {
                StringFormat format     = new StringFormat(StringFormatFlags.NoWrap | StringFormatFlags.NoClip);
                SolidBrush   solidBrush = new SolidBrush(Color.Black);
                int          num2       = -1;
                Font         font       = new Font("Arial", (float)fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
                bool         flag       = false;
                for (int pIndex = this._pIndex; pIndex <= MidsContext.Character.CurrentBuild.Powers.Count - 1; pIndex++)
                {
                    bool flag2 = false;
                    switch (selection)
                    {
                    case Print.PrintWhat.Powers:
                        if (MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen)
                        {
                            flag2 = true;
                        }
                        break;

                    case Print.PrintWhat.Inherent:
                        if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null)
                        {
                            flag2 = !MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic;
                            if (flag2 && MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length < 1)
                            {
                                flag2 = false;
                            }
                        }
                        break;

                    case Print.PrintWhat.EpicInherent:
                        if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null)
                        {
                            flag2 = MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic;
                        }
                        break;
                    }
                    if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen & MidsContext.Character.CurrentBuild.Powers[pIndex].SubPowers.Length > 0)
                    {
                        flag2 = false;
                    }
                    if (flag2)
                    {
                        string s = string.Concat(new object[]
                        {
                            "Level ",
                            MidsContext.Character.CurrentBuild.Powers[pIndex].Level,
                            1,
                            ":"
                        });
                        string s2 = (MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null) ? MidsContext.Character.CurrentBuild.Powers[pIndex].Power.DisplayName : "[No Power]";
                        string s3 = "";
                        if ((float)vPos - bounds.Top + (float)((MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length + 1) * fontSize) * 1.25f > bounds.Height)
                        {
                            num2 = pIndex;
                            flag = true;
                            break;
                        }
                        for (int index = 0; index <= MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1; index++)
                        {
                            if (!string.IsNullOrEmpty(s3))
                            {
                                s3 += '\n';
                            }
                            if (index == 0)
                            {
                                s3 += "(A) ";
                            }
                            else
                            {
                                object obj = s3;
                                s3 = string.Concat(new object[]
                                {
                                    obj,
                                    "(",
                                    MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Level,
                                    1,
                                    ") "
                                });
                            }
                            if (MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh > -1)
                            {
                                IEnhancement enhancement = DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh];
                                switch (enhancement.TypeID)
                                {
                                case Enums.eType.Normal:
                                {
                                    string relativeString = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false);
                                    if (!string.IsNullOrEmpty(relativeString) & relativeString != "X")
                                    {
                                        string text = s3;
                                        s3 = string.Concat(new string[]
                                            {
                                                text,
                                                relativeString,
                                                " ",
                                                DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade],
                                                " - "
                                            });
                                    }
                                    else if (relativeString == "X")
                                    {
                                        s3 = s3 + "Disabled " + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - ";
                                    }
                                    else
                                    {
                                        s3 = s3 + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - ";
                                    }
                                    s3 += " ";
                                    break;
                                }

                                case Enums.eType.SpecialO:
                                {
                                    string relativeString2 = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false);
                                    if (!string.IsNullOrEmpty(relativeString2) & relativeString2 != "X")
                                    {
                                        string text2 = s3;
                                        s3 = string.Concat(new string[]
                                            {
                                                text2,
                                                relativeString2,
                                                " ",
                                                enhancement.GetSpecialName(),
                                                " - "
                                            });
                                    }
                                    else if (relativeString2 == "X")
                                    {
                                        s3 = s3 + "Disabled " + enhancement.GetSpecialName() + " - ";
                                    }
                                    else
                                    {
                                        s3 = s3 + enhancement.GetSpecialName() + " - ";
                                    }
                                    s3 += " ";
                                    break;
                                }
                                }
                                s3 += enhancement.LongName;
                                switch (enhancement.TypeID)
                                {
                                case Enums.eType.InventO:
                                {
                                    object obj2 = s3;
                                    s3 = string.Concat(new object[]
                                        {
                                            obj2,
                                            " - IO:",
                                            MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel,
                                            1
                                        });
                                    break;
                                }

                                case Enums.eType.SetO:
                                {
                                    object obj3 = s3;
                                    s3 = string.Concat(new object[]
                                        {
                                            obj3,
                                            " - IO:",
                                            MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel,
                                            1
                                        });
                                    break;
                                }
                                }
                            }
                            else
                            {
                                s3 += "[Empty]";
                            }
                        }
                        if (!string.IsNullOrEmpty(s) || !string.IsNullOrEmpty(s2) || !string.IsNullOrEmpty(s3))
                        {
                            RectangleF layoutRectangle = new RectangleF(bounds.Left + 15f, (float)vPos, bounds.Width, (float)fontSize * 1.25f);
                            args.Graphics.DrawString(s, font, solidBrush, layoutRectangle, format);
                            layoutRectangle = new RectangleF(bounds.Left + 80f, (float)vPos, bounds.Width, (float)fontSize * 1.25f);
                            args.Graphics.DrawString(s2, font, solidBrush, layoutRectangle, format);
                            vPos           += (int)((float)fontSize * 1.25f);
                            layoutRectangle = new RectangleF(bounds.Left + 90f, (float)vPos, bounds.Width, (float)(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length * fontSize) * 1.25f);
                            args.Graphics.DrawString(s3, font, solidBrush, layoutRectangle, format);
                            vPos += (int)((double)((float)fontSize * 1.25f) * 1.1 + (double)((float)fontSize * 1.25f * (float)(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1)));
                        }
                    }
                }
                this._pIndex = num2;
                if (flag)
                {
                    this._endOfPage = true;
                }
                else
                {
                    this._pIndex = 0;
                }
                num = vPos;
            }
            return(num);
        }