Example #1
0
        public GItemList(int serial, int menuID, string question, AnswerEntry[] answers)
            : base(2320, 25, 25)
        {
            this.m_Serial     = serial;
            this.m_MenuID     = menuID;
            this.m_EntryLabel = new GLabel("", (IFont)Engine.GetFont(1), Hues.Load(1887), 39, 106);
            this.m_Children.Add((Gump)this.m_EntryLabel);
            GLabel glabel = new GLabel(question, (IFont)Engine.GetFont(1), Hues.Load(1887), 39, 19);

            glabel.Scissor(0, 0, 218, 11);
            this.m_Children.Add((Gump)glabel);
            int x = 37;

            for (int index = 0; index < answers.Length; ++index)
            {
                GItemListEntry gitemListEntry = new GItemListEntry(x, answers[index], this);
                this.m_Children.Add((Gump)gitemListEntry);
                x += gitemListEntry.Width;
            }
            int num = x - 37;

            if (num < 222)
            {
                return;
            }
            this.m_xOffsetCap = (double)-(num - 222);
            this.m_Left       = (GHitspot) new GItemListScroller(23, this, 150);
            this.m_Right      = (GHitspot) new GItemListScroller(261, this, -150);
            this.m_Children.Add((Gump)this.m_Left);
            this.m_Children.Add((Gump)this.m_Right);
        }
Example #2
0
        private void ProcessLayout(LayoutEntry[] list, string[] text)
        {
            int  num1 = 0;
            int  num2 = 0;
            bool flag = false;

            for (int index = 0; index < list.Length; ++index)
            {
                LayoutEntry le = list[index];
                switch (le.Name)
                {
                case "nodispose":
                case "noresize":
                    goto case "nodispose";

                case "checkertrans":
                    this.Pages(num1).Add((Gump) new GTransparentRegion(this, le[0], le[1], le[2], le[3]));
                    goto case "nodispose";

                case "page":
                    num1 = le[0];
                    if (num1 == 0)
                    {
                        flag = false;
                        num2 = 0;
                        goto case "nodispose";
                    }
                    else if (!flag || num1 < num2)
                    {
                        num2 = num1;
                        flag = true;
                        goto case "nodispose";
                    }
                    else
                    {
                        goto case "nodispose";
                    }

                case "noclose":
                    this.m_CanClose = false;
                    goto case "nodispose";

                case "nomove":
                    this.m_CanMove = false;
                    goto case "nodispose";

                case "resizepic":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[3], le[4], le[2] + 4, true));
                    goto case "nodispose";

                case "gumppictiled":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[2], le[3], le[4], false));
                    goto case "nodispose";

                case "gumppic":
                    string attribute = le.GetAttribute("hue");
                    IHue   hue;
                    if (attribute != null)
                    {
                        try
                        {
                            hue = Hues.Load(Convert.ToInt32(attribute) + 1);
                        }
                        catch
                        {
                            hue = Hues.Default;
                        }
                    }
                    else
                    {
                        hue = Hues.Default;
                    }
                    if (le.GetAttribute("class") == "VirtueGumpItem")
                    {
                        this.Pages(num1).Add((Gump) new GVirtueItem(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }
                    else
                    {
                        this.Pages(num1).Add((Gump) new GServerImage(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }

                case "textentry":
                    this.Pages(num1).Add((Gump) new GServerTextBox(text[le[6]], le));
                    goto case "nodispose";

                case "tilepic":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2]));
                    goto case "nodispose";

                case "tilepichue":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2], Hues.GetItemHue(le[2], le[3] + 1)));
                    goto case "nodispose";

                case "button":
                    this.Pages(num1).Add((Gump) new GServerButton(this, le));
                    goto case "nodispose";

                case "radio":
                    this.Pages(num1).Add((Gump) new GServerRadio(this, le));
                    goto case "nodispose";

                case "checkbox":
                    this.Pages(num1).Add((Gump) new GServerCheckBox(this, le));
                    goto case "nodispose";

                case "text":
                    int num3 = le[2];
                    this.Pages(num1).Add((Gump) new GLabel(text[le[3]], (IFont)Engine.GetUniFont(1), Hues.Load(num3 + 1), le[0] - 1, le[1]));
                    goto case "nodispose";

                case "croppedtext":
                    int    num4   = le[4];
                    string str    = text[le[5]];
                    int    xWidth = le[2];
                    IFont  Font   = (IFont)Engine.GetUniFont(1);
                    if (Font.GetStringWidth(str) > xWidth)
                    {
                        while (str.Length > 0 && Font.GetStringWidth(str + "...") > xWidth)
                        {
                            str = str.Substring(0, str.Length - 1);
                        }
                        str += "...";
                    }
                    GLabel glabel = new GLabel(str, Font, Hues.Load(num4 + 1), le[0] - 1, le[1]);
                    glabel.Scissor(0, 0, xWidth, le[3]);
                    this.Pages(num1).Add((Gump)glabel);
                    goto case "nodispose";

                case "xmfhtmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                case "xmfhtmlgumpcolor":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, Engine.C16232(le[7]));
                    goto case "nodispose";

                case "htmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], text[le[4]], le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                default:
                    Engine.AddTextMessage(le.Name);
                    goto case "nodispose";
                }
            }
            this.Page = num2 == 0 ? 1 : num2;
        }
Example #3
0
        public void SetList(int number, ObjectPropertyList propList)
        {
            this.m_List = propList;
            this.m_Children.Clear();
            int Y    = 5;
            int num1 = 10;

            ObjectProperty[] objectPropertyArray = propList.Properties;
            if (objectPropertyArray.Length == 0 && number != -1)
            {
                objectPropertyArray = new ObjectProperty[1]
                {
                    new ObjectProperty(number, "")
                }
            }
            ;
            int num2   = 0;
            int index1 = -1;
            int num3   = 0;
            int num4   = 0;
            int num5   = 0;
            int num6   = 0;
            int num7   = 0;
            int num8   = 0;
            int num9   = 0;

            for (int index2 = 0; index2 < objectPropertyArray.Length; ++index2)
            {
                if (objectPropertyArray[index2].Number >= 1060445 && objectPropertyArray[index2].Number <= 1060449)
                {
                    int num10 = 0;
                    try
                    {
                        num10 = int.Parse(objectPropertyArray[index2].Arguments.Trim());
                    }
                    catch
                    {
                    }
                    switch (objectPropertyArray[index2].Number)
                    {
                    case 1060445:
                        num5 += num10;
                        break;

                    case 1060446:
                        num7 += num10;
                        break;

                    case 1060447:
                        num4 += num10;
                        break;

                    case 1060448:
                        num3 += num10;
                        break;

                    case 1060449:
                        num6 += num10;
                        break;
                    }
                    if (index1 == -1)
                    {
                        index1 = index2;
                    }
                    num2 += num10;
                }
                else if (objectPropertyArray[index2].Number == 1060486)
                {
                    try
                    {
                        num9 = int.Parse(objectPropertyArray[index2].Arguments.Trim());
                    }
                    catch
                    {
                    }
                }
                else if (objectPropertyArray[index2].Number == 1061167)
                {
                    try
                    {
                        num8 = int.Parse(objectPropertyArray[index2].Arguments.Trim());
                    }
                    catch
                    {
                    }
                }
            }
            if (num8 > 0)
            {
                num8 = num8 * (100 + num9) / 100;
            }
            ResistInfo resistInfo1 = (ResistInfo)null;
            ResistInfo resistInfo2 = (ResistInfo)null;

            if (index1 != -1)
            {
                ArrayList arrayList = new ArrayList((ICollection)objectPropertyArray);
                arrayList.Insert(index1, (object)new ObjectProperty(1042971, string.Format("total resist {0}%", (object)num2)));
                objectPropertyArray = (ObjectProperty[])arrayList.ToArray(typeof(ObjectProperty));
                resistInfo1         = ResistInfo.Find(objectPropertyArray[0].Text, ResistInfo.m_Armor);
                resistInfo2         = ResistInfo.Find(objectPropertyArray[0].Text, ResistInfo.m_Materials);
            }
            int num11 = -1;

            if (this.m_Object is Mobile)
            {
                Mobile mobile = (Mobile)this.m_Object;
                int    num10  = 0;
                int    num12  = 0;
                int    num13  = 0;
                int    num14  = 0;
                int    num15  = 0;
                int    num16  = 0;
                int    num17  = 0;
                foreach (Item obj in mobile.Items)
                {
                    ObjectPropertyList propertyList = obj.PropertyList;
                    if (propertyList == null)
                    {
                        obj.QueryProperties();
                    }
                    else
                    {
                        foreach (ObjectProperty property in propertyList.Properties)
                        {
                            if (property.Number >= 1060445 && property.Number <= 1060449)
                            {
                                int num18 = 0;
                                try
                                {
                                    num18 = int.Parse(property.Arguments.Trim());
                                }
                                catch
                                {
                                }
                                switch (property.Number)
                                {
                                case 1060445:
                                    num13 += num18;
                                    continue;

                                case 1060446:
                                    num15 += num18;
                                    continue;

                                case 1060447:
                                    num12 += num18;
                                    continue;

                                case 1060448:
                                    num10 += num18;
                                    continue;

                                case 1060449:
                                    num14 += num18;
                                    continue;

                                default:
                                    continue;
                                }
                            }
                            else if (property.Number == 1060413)
                            {
                                try
                                {
                                    num16 += int.Parse(property.Arguments.Trim());
                                }
                                catch
                                {
                                }
                            }
                            else if (property.Number == 1060412)
                            {
                                try
                                {
                                    num17 += int.Parse(property.Arguments.Trim());
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                }
                num11 = num10;
                if (num12 < num11)
                {
                    num11 = num12;
                }
                if (num13 < num11)
                {
                    num11 = num13;
                }
                if (num14 < num11)
                {
                    num11 = num14;
                }
                if (num15 < num11)
                {
                    num11 = num15;
                }
                if (num10 != 0 || num12 != 0 || (num13 != 0 || num14 != 0) || (num15 != 0 || num16 != 0 || num17 != 0))
                {
                    ArrayList arrayList = new ArrayList((ICollection)objectPropertyArray);
                    if (num16 != 0 || num17 != 0)
                    {
                        arrayList.Add((object)new ObjectProperty(1042971, string.Format("FC {0}, FCR {1}", (object)num16, (object)num17)));
                    }
                    arrayList.Add((object)new ObjectProperty(1060448, num10.ToString()));
                    arrayList.Add((object)new ObjectProperty(1060447, num12.ToString()));
                    arrayList.Add((object)new ObjectProperty(1060445, num13.ToString()));
                    arrayList.Add((object)new ObjectProperty(1060449, num14.ToString()));
                    arrayList.Add((object)new ObjectProperty(1060446, num15.ToString()));
                    objectPropertyArray = (ObjectProperty[])arrayList.ToArray(typeof(ObjectProperty));
                }
            }
            if (this.m_Object is Item && ((Item)this.m_Object).Container != null && ((Item)this.m_Object).Container.m_TradeContainer)
            {
                ArrayList arrayList = new ArrayList((ICollection)objectPropertyArray);
                if (arrayList.Count > 0)
                {
                    arrayList[0] = (object)new ObjectProperty(1042971, "Their Offer");
                }
                Item   obj    = (Item)this.m_Object;
                Item[] items1 = obj.FindItems((IItemValidator) new ItemIDValidator(new int[3] {
                    3821, 3820, 3822
                }));
                int num10 = 0;
                for (int index2 = 0; index2 < items1.Length; ++index2)
                {
                    num10 += items1[index2].Amount;
                }
                Item[] items2 = obj.FindItems((IItemValidator) new ItemIDValidator(new int[2] {
                    5359, 5360
                }));
                for (int index2 = 0; index2 < items2.Length; ++index2)
                {
                    ObjectPropertyList propertyList = items2[index2].PropertyList;
                    if (propertyList == null)
                    {
                        items2[index2].QueryProperties();
                    }
                    else
                    {
                        bool flag = false;
                        for (int index3 = 0; index3 < propertyList.Properties.Length; ++index3)
                        {
                            if (propertyList.Properties[index3].Number == 1041361)
                            {
                                flag = true;
                            }
                            else if (propertyList.Properties[index3].Number == 1060738)
                            {
                                if (flag)
                                {
                                    try
                                    {
                                        num10 += int.Parse(propertyList.Properties[index3].Arguments.Trim());
                                        break;
                                    }
                                    catch
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                arrayList.Add((object)new ObjectProperty(1042971, string.Format("Total Gold: {0:N0}", (object)num10)));
                objectPropertyArray = (ObjectProperty[])arrayList.ToArray(typeof(ObjectProperty));
            }
            for (int index2 = 0; index2 < objectPropertyArray.Length; ++index2)
            {
                ObjectProperty objectProperty = objectPropertyArray[index2];
                GLabel         glabel         = new GLabel(Engine.MakeProperCase(objectProperty.Text), Engine.DefaultFont, index2 == 0 ? this.GetDefaultHue() : Hues.Bright, 5, Y);
                if (objectProperty.Number == 1061170)
                {
                    int num10 = 0;
                    try
                    {
                        num10 = int.Parse(objectProperty.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    Mobile player = World.Player;
                    if (player != null && num10 > player.Strength)
                    {
                        glabel.Hue = Hues.Load(34);
                    }
                }
                else if (objectProperty.Number == 1061682)
                {
                    glabel.Hue  = Hues.Load(89);
                    glabel.Text = "Insured";
                }
                else if (num11 >= 0 && objectProperty.Number >= 1060445 && objectProperty.Number <= 1060449)
                {
                    int num10 = 0;
                    try
                    {
                        num10 = int.Parse(objectProperty.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    if (num10 == num11)
                    {
                        if (objectProperty.Number == 1060445)
                        {
                            glabel.Hue = Hues.Load(95);
                        }
                        else if (objectProperty.Number == 1060446)
                        {
                            glabel.Hue = Hues.Load(26);
                        }
                        else if (objectProperty.Number == 1060447)
                        {
                            glabel.Hue = Hues.Load(45);
                        }
                        else if (objectProperty.Number == 1060448)
                        {
                            glabel.Hue = Hues.Load(1154);
                        }
                        else if (objectProperty.Number == 1060449)
                        {
                            glabel.Hue = Hues.Load(70);
                        }
                    }
                }
                else if (resistInfo1 != null && objectProperty.Number >= 1060445 && objectProperty.Number <= 1060449)
                {
                    int num10 = 0;
                    try
                    {
                        num10 = int.Parse(objectProperty.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    int num12 = 0;
                    switch (objectProperty.Number)
                    {
                    case 1060445:
                        num12 = resistInfo1.m_Cold + (resistInfo2 == null ? 0 : resistInfo2.m_Cold);
                        break;

                    case 1060446:
                        num12 = resistInfo1.m_Energy + (resistInfo2 == null ? 0 : resistInfo2.m_Energy);
                        break;

                    case 1060447:
                        num12 = resistInfo1.m_Fire + (resistInfo2 == null ? 0 : resistInfo2.m_Fire);
                        break;

                    case 1060448:
                        num12 = resistInfo1.m_Physical + (resistInfo2 == null ? 0 : resistInfo2.m_Physical);
                        break;

                    case 1060449:
                        num12 = resistInfo1.m_Poison + (resistInfo2 == null ? 0 : resistInfo2.m_Poison);
                        break;
                    }
                    int num13 = num10 - num12;
                    if (num13 > 0)
                    {
                        glabel.Text += string.Format(" (+{0}%)", (object)num13);
                    }
                    else if (num13 < 0)
                    {
                        glabel.Text += string.Format(" (-{0}%)", (object)Math.Abs(num13));
                    }
                }
                else if (objectProperty.Number == 1061167)
                {
                    Mobile player = World.Player;
                    if (player != null)
                    {
                        double num10 = Math.Floor(40000.0 / (double)((player.CurrentStamina + 100) * num8)) / 2.0;
                        glabel.Text += string.Format(" ({0:F1}s)", (object)num10);
                    }
                }
                glabel.Y -= glabel.Image.yMin;
                glabel.X -= glabel.Image.xMin;
                Y         = glabel.Y + glabel.Image.yMax + 5;
                if (10 + (glabel.Image.xMax - glabel.Image.xMin + 1) > num1)
                {
                    num1 = 10 + (glabel.Image.xMax - glabel.Image.xMin + 1);
                }
                this.m_Children.Add((Gump)glabel);
                if (index2 == 0)
                {
                    this.m_CompactHeight = Y;
                }
            }
            this.m_TotalWidth  = num1;
            this.m_TotalHeight = Y;
            if (this.m_Timer == null)
            {
                this.Width  = num1;
                this.Height = Y;
            }
            foreach (GLabel glabel in this.m_Children.ToArray())
            {
                glabel.X = (num1 - (glabel.Image.xMax - glabel.Image.xMin + 1)) / 2 - glabel.Image.xMin;
                glabel.Scissor(1 - glabel.X, 1 - glabel.Y, this.Width - 2, this.Height - 2);
            }
        }