Exemplo n.º 1
0
        protected virtual void CompileTreeLayout(SuperGumpLayout layout)
        {
            layout.Add(
                "tree/scrollbar",
                () =>
            {
                AddBackground(15, 115, 25, 312, 9270);

                AddScrollbarV(
                    15,
                    115,
                    PageCount,
                    Page,
                    PreviousPage,
                    NextPage,
                    new Rectangle2D(6, 40, 13, 234),
                    new Rectangle2D(6, 5, 13, 28),
                    new Rectangle2D(6, 280, 13, 28),
                    // track, handle
                    Tuple.Create(10740, 10742),
                    // normal, pressed, inactive
                    Tuple.Create(10701, 10702, 10700),
                    // normal, pressed, inactive
                    Tuple.Create(10721, 10722, 10720));
            });

            var range  = GetListRange();
            var cIndex = 0;

            foreach (var c in range.Values)
            {
                var node  = c;
                var index = cIndex++;
                var depth = node.Depth;

                layout.AddBefore(
                    "panel/left",
                    "tree/button/" + index,
                    () => AddButton(55, 125 + (21 * index), 1122, 1124, btn => SelectNode(index, node)));

                layout.Add(
                    "tree/node/" + index,
                    () =>
                {
                    var offset = Math.Min(150, depth * 10);

                    //AddBackground(60 + offset, 125 + (21 * index), 174 - offset, 20, 9200);

                    AddLabelCropped(
                        65 + offset,
                        125 + (21 * index),
                        165 - offset,
                        20,
                        SelectedNode == node || SelectedNode.IsChildOf(node) ? HighlightHue : TextHue,
                        String.IsNullOrWhiteSpace(node.Name) ? "..." : node.Name);
                });
            }
        }
Exemplo n.º 2
0
        protected virtual void CompileEntryLayout(SuperGumpLayout layout, int x, int y, int index, DungeonLootEntry entry)
        {
            var title = String.Empty;

            if (entry.Item == null)
            {
                return;
            }

#if NEWPARENT
            var parent = entry.Item.RootParent;
#else
            var parent = entry.Item.RootParentEntity;
#endif

            if (parent != null && !parent.Deleted)
            {
                if (parent is Corpse)
                {
                    var c = (Corpse)parent;

                    if (c.Owner != null)
                    {
                        title = c.Owner.RawName;
                    }
                }
                else if (parent is Item)
                {
                    title = ((Item)parent).Name;
                }
            }

            x *= 365;
            y *= 175;

            layout.Add(
                "entry/bg/" + index,
                () =>
            {
                AddItem(x + 85, y + 0, 14020);                         //Fire1
                AddItem(x + 105, y + 0, 14020);                        //Fire2
                AddItem(x + 141, y + 15, 14007);                       //Fire3

                AddImage(x + 6, y + 4, 10400, 1258);                   //DragonHighlight

                AddBackground(x + 50, y + 60, 300, 100, 5120);         //MainBG

                AddImage(x + 3, y + 5, 10400);                         //Dragon
                AddImageTiled(x + 50, y + 105, 10, 50, 5123);          // Dragon3DFix

                AddBackground(x + 65, y + 70, 55, 55, 5120);           //ItemBG
                AddLabelCropped(x + 65, y + 70, 55, 55, 0, " ");
                AddProperties(entry.Item);

                AddBackground(x + 125, y + 70, 150, 55, 5120);                         //ItemNameBG
                AddLabelCropped(x + 125, y + 70, 150, 55, 0, " ");
                AddProperties(entry.Item);

                AddBackground(x + 65, y + 130, 275, 20, 5120);                         //TimeBarBG

                if (!String.IsNullOrWhiteSpace(title))
                {
                    AddBackground(x + 95, y + 25, 255, 30, 5120);                             //TitleBG
                }

                AddItem(x + 85, y + 30, 4655);                         //Blood1
                AddItem(x + 124, y + 20, 4655);                        //Blood2

                var id = entry.Item.Parent is Corpse ? 9804 : 9803;

                AddImage(x + 98, y + 13, id, 1258);                    //SkullHighlight
                AddImage(x + 100, y + 15, id);                         //Skull

                AddItem(x + 65, y + 0, 14017);                         //Fire4
            });

            layout.Add(
                "entry/content/" + index,
                () =>
            {
                if (!String.IsNullOrWhiteSpace(title))
                {
                    AddHtml(
                        x + 170,
                        y + 30,
                        175,
                        40,
                        title.WrapUOHtmlTag("CENTER").WrapUOHtmlColor(Color.OrangeRed, false),
                        false,
                        false);
                    // Title
                }

                var o = ArtExtUtility.GetImageOffset(entry.Item.ItemID);

                //Item (Loot)
                if (entry.Item.Hue > 0 && entry.Item.Hue <= 3000)
                {
                    AddItem(x + 70 + o.X, y + 75 + o.Y, entry.Item.ItemID, entry.Item.Hue - 1);
                }
                else
                {
                    AddItem(x + 70 + o.X, y + 75 + o.Y, entry.Item.ItemID);
                }

                AddProperties(entry.Item);

                var name = entry.Item.ResolveName(User);
                name     = name.ToUpperWords().WrapUOHtmlColor(Color.Yellow, false);

                //ItemName
                AddHtml(x + 135, y + 75, 135, 45, name, false, false);

                AddButton(x + 287, y + 73, 22153, 22154, b => OnHelp(entry)); //Help
                AddTooltip(1061037);                                          //Help

                AddButton(x + 317, y + 73, 22150, 22151, b => OnPass(entry)); //Pass
                AddTooltip(1014123);                                          //Please, keep it. I don't want it.

                //AddButton(x + 285, y + 101, 11281, 11280, b => OnNeed(entry)); //Need
                AddItem(x + 277, y + 98, Utility.RandomMinMax(19384, 19397)); //Dice
                AddTooltip(1014113);                                          //I've been needing one of these.

                //AddButton(x + 315, y + 101, 11280, 11280, b => OnGreed(entry)); //Greed
                AddItem(x + 307, y + 98, 19400);             //Chips
                AddTooltip(1062441);                         //I've given enough to charity, lately!

                var elapsed  = DateTime.UtcNow - entry.Created;
                var duration = entry.Expire - entry.Created;

                string time;

                if (elapsed <= duration && duration > TimeSpan.Zero)
                {
                    var length = 270 * (1.0 - (elapsed.TotalSeconds / duration.TotalSeconds));

                    AddBackground(x + 66, y + 132, (int)Math.Ceiling(length), 16, 5100);                             //TimeBar

                    time = (duration - elapsed).ToSimpleString("h:m:s");
                }
                else
                {
                    time = "EXPIRED";
                }

                if (String.IsNullOrWhiteSpace(time))
                {
                    return;
                }

                AddHtml(x + 65, y + 130, 275, 40, time.WrapUOHtmlTag("CENTER").WrapUOHtmlColor(Color.Yellow, false), false, false);
                AddTooltip(1115782);
            });

            layout.AddBefore(
                "entry/bg/" + index,
                "entry/content/deferred/" + index,
                () =>
            {
                AddButton(x + 285, y + 101, 11281, 11280, b => OnNeed(entry));                         //Need
                AddButton(x + 315, y + 101, 11280, 11280, b => OnGreed(entry));                        //Greed
            });
        }
Exemplo n.º 3
0
        protected override void CompileLayout(SuperGumpLayout layout)
        {
            base.CompileLayout(layout);

            layout.Add("header/bg", () => AddBackground(0, 0, 400, 30, 5120));

            layout.Add(
                "header/button/view",
                () =>
            {
                AddButton(10, 5, CompactView ? 9906 : 9900, CompactView ? 9908 : 9902, ToggleView);
                AddTooltip(CompactView ? 3002086 : 3002085);
            });

            layout.Add(
                "header/title",
                () =>
            {
                AddBackground(35, 5, 150, 20, 5120);
                AddTooltip(1075159);

                var title = Dungeon.Name;

                title = title.WrapUOHtmlSmall().WrapUOHtmlCenter().WrapUOHtmlColor(Color.PaleGoldenrod, false);

                AddHtml(35, 5, 150, 40, title, false, false);
                AddTooltip(1075159);
            });

            layout.Add(
                "header/time",
                () =>
            {
                AddImage(195, 1, 30223);
                AddTooltip(1115782);

                AddBackground(225, 5, 65, 20, 5120);
                AddTooltip(1115782);

                var now    = DateTime.UtcNow;
                var time   = Dungeon.Deadline > now ? (Dungeon.Deadline - now) : TimeSpan.Zero;
                var dtText = time.ToSimpleString("d:h:m:s");

                dtText = dtText.WrapUOHtmlSmall().WrapUOHtmlCenter().WrapUOHtmlColor(Color.Yellow, false);

                AddHtml(225, 5, 65, 40, dtText, false, false);
                AddTooltip(1115782);
            });

            layout.Add(
                "header/group",
                () =>
            {
                AddImage(300, 1, 30098);
                AddTooltip(3000332);

                AddBackground(330, 5, 65, 20, 5120);
                AddTooltip(3000332);

                var dgText = String.Format(
                    "{0:#,0} / {1:#,0}",
                    List.Count(m => InstanceMaps.Instances.GetDungeon(m) == Dungeon),
                    Dungeon.GroupMax);

                dgText = dgText.WrapUOHtmlSmall().WrapUOHtmlCenter().WrapUOHtmlColor(Color.LawnGreen, false);

                AddHtml(330, 5, 65, 40, dgText, false, false);
                AddTooltip(3000332);
            });

            if (CompactView)
            {
                return;
            }

            layout.AddBefore(
                "header/bg",
                "body/bg",
                () =>
            {
                var h = Math.Max(220, 45 + (35 * Math.Min(EntriesPerPage, List.Count)));

                AddBackground(0, 0, 400, h, 5120);

                if (AlphaBG)
                {
                    AddAlphaRegion(0, 0, 400, h);
                }
            });

            layout.Add(
                "body/desc",
                () =>
            {
                AddBackground(10, 40, 175, 80, 5120);

                if (AlphaBG)
                {
                    AddAlphaRegion(10, 40, 175, 80);
                }

                AddTooltip(1079449);

                var desc = Dungeon.Desc.WrapUOHtmlSmall().WrapUOHtmlColor(Color.PaleGoldenrod, false);

                AddHtml(20, 45, 160, 70, desc, false, true);
                AddTooltip(1079449);
            });

            //DungeonCP?
            layout.Add(
                "body/panel",
                () =>
            {
                AddBackground(10, 130, 175, 80, 5120);

                if (AlphaBG)
                {
                    AddAlphaRegion(10, 130, 175, 80);
                }

                if (User != Dungeon.ActiveLeader)
                {
                    //AddHtml(20, 135, 160, 70, "?", false, true);
                    return;
                }

                AddButton(
                    20,
                    135,
                    4005,
                    4007,
                    b =>
                {
                    switch (Dungeon.LootMode)
                    {
                    case DungeonLootMode.Standard:
                        Dungeon.LootMode = DungeonLootMode.Advanced;
                        break;

                    case DungeonLootMode.Advanced:
                        Dungeon.LootMode = DungeonLootMode.Standard;
                        break;
                    }

                    Refresh(true);
                });

                var lootMode = "Loot: ";

                switch (Dungeon.LootMode)
                {
                case DungeonLootMode.Advanced:
                    lootMode += "Need or Greed";
                    break;

                default:
                    lootMode += Dungeon.LootMode.ToString().SpaceWords();
                    break;
                }

                AddHtml(55, 137, 125, 40, lootMode.WrapUOHtmlColor(Color.Gold, false), false, false);
            });

            layout.Add(
                "body/list",
                () =>
            {
                const int x = 195;
                const int y = 40;

                var range = GetListRange();

                var index = 0;

                foreach (var m in range.Values)
                {
                    var o = 35 * index;

                    var online    = m.IsOnline();
                    var inDungeon = InstanceMaps.Instances.GetDungeon(m) == Dungeon;

                    int icon, tooltip;

                    if (inDungeon)
                    {
                        if (!online)
                        {
                            icon    = 30224;
                            tooltip = 1153036;
                        }
                        else if (!m.Alive)
                        {
                            icon    = 30215;
                            tooltip = 1078368;
                        }
                        else if (m.InCombat())
                        {
                            icon    = 30233;
                            tooltip = 1078592;
                        }
                        else
                        {
                            icon    = 30210;
                            tooltip = 1112231;
                        }
                    }
                    else if (!online)
                    {
                        icon    = 30224;
                        tooltip = 1153036;
                    }
                    else
                    {
                        icon    = 30039;
                        tooltip = 1112231;
                    }

                    AddImage(x, y + o, icon);
                    AddTooltip(tooltip);

                    AddBackground(x + 30, y + o, 150, 20, 5120);

                    if (AlphaBG)
                    {
                        AddAlphaRegion(x + 30, y + o, 150, 20);
                    }

                    AddProperties(m);

                    var name = m.RawName.WrapUOHtmlCenter().WrapUOHtmlColor(Color.LawnGreen, false);

                    AddHtml(x + 30, y + o, 150, 40, name, false, false);
                    AddProperties(m);

                    AddImageTiled(x, y + 25 + o, 180, 3, online ? 30074 : 30072);
                    AddTooltip(1053042);

                    var bLength = (int)Math.Floor(180 * (m.Hits / (double)m.HitsMax));

                    if (bLength > 0)
                    {
                        AddImageTiled(x, y + 25 + o, bLength, 3, 30073);
                        AddTooltip(1053042);
                    }

                    ++index;
                }

                range.Clear();
            });

            layout.Add(
                "body/list/scroll",
                () =>
            {
                var h = Math.Max(170, 35 * Math.Min(EntriesPerPage, List.Count));

                AddBackground(378, 40, 16, h, 5120);

                if (AlphaBG)
                {
                    AddAlphaRegion(378, 40, 16, h);
                }

                AddScrollbarV(
                    379,
                    40,
                    PageCount,
                    Page,
                    PreviousPage,
                    NextPage,
                    new Rectangle(3, 15, 10, 140),
                    new Rectangle(0, 0, 16, 16),
                    new Rectangle(0, 155, 16, 16),
                    Tuple.Create(5124, 5104),
                    Tuple.Create(9760, 9761, 9760),
                    Tuple.Create(9764, 9765, 9764));
            });
        }
Exemplo n.º 4
0
        private void CompileCategoryLayout(SuperGumpLayout layout)
        {
            int cIndex = 0;

            layout.Add(
                "category/scrollbar",
                () =>
            {
                AddBackground(70, 140, 20, 360, 9200);

                AddScrollbarV(
                    70,
                    140,
                    CategoryScrollMax,
                    CategoryScroll,
                    b =>
                {
                    --CategoryScroll;
                    Refresh(true);
                },
                    b =>
                {
                    ++CategoryScroll;
                    Refresh(true);
                },
                    new Rectangle2D(3, 25, 13, 310),
                    new Rectangle2D(2, 5, 16, 16),
                    new Rectangle2D(2, 340, 16, 16),
                    Tuple.Create(9354, 9304),                             // track, handle
                    Tuple.Create(5600, 5604, 5604),                       // normal, pressed, inactive
                    Tuple.Create(5602, 5606, 5606));                      // normal, pressed, inactive
            });

            var range = Categories.Skip(CategoryScroll).Take(15);

            const int catSpacing = 24;

            foreach (ConquestCategory c in range)
            {
                int index   = cIndex;
                var parents = c.GetParents().ToArray();

                // Insert the button before the backgrounds that were added earlier
                layout.AddBefore(
                    "frame/inner",
                    "category/button/" + cIndex,
                    () => AddButton(
                        90,
                        142 + (catSpacing * index),
                        1122,
                        1124,
                        btn =>
                {
                    Category = Category != c ? c : Category.HasParent ? Category.Parent : RootCategory;
                    Refresh(true);
                }));

                layout.Add(
                    "category/entry/" + cIndex,
                    () =>
                {
                    int offset = parents.Length * 10;

                    AddBackground(95 + offset, 140 + (catSpacing * index), 195 - offset, 20, 9200);

                    AddLabelCropped(
                        100 + offset,
                        140 + (catSpacing * index),
                        190 - offset,
                        20,
                        Category == c || Category.IsChildOf(c) ? 1258 : 2049,
                        c == RootCategory ? "Recently Completed" : c.Name);
                });

                ++cIndex;
            }
        }