コード例 #1
0
ファイル: HueSelector.cs プロジェクト: thehaunted88/Core
        protected virtual void CompileEntry(SuperGumpLayout layout, int x, int y, int gx, int gy, int idx, int hue)
        {
            if (hue <= -1)
            {
                return;
            }

            var sup    = SupportsUltimaStore;
            var ec     = IsEnhancedClient;
            var fillID = ec ? 87 : sup ? 40004 : 2624;

            layout.Add(
                "entry/" + idx,
                () =>
            {
                const int itemID = 4011;

                var s = Selected == hue;

                AddButton(x, y, 2240, 2240, b => SelectEntry(gx, gy, idx, hue));
                AddImageTiled(x, y, 44, 44, fillID);

                var o = ArtExtUtility.GetImageOffset(itemID);

                if (s)
                {
                    AddItem(x + o.X, y + o.Y + 5, itemID, 2050);
                    AddItem(x + o.X, y + o.Y + 2, itemID, 2999);
                }
                else if (sup)
                {
                    AddItem(x + o.X, y + o.Y + 5, itemID, 2999);
                }

                if (hue > 0)
                {
                    AddItem(x + o.X, y + o.Y, itemID, hue);
                }
                else
                {
                    AddItem(x + o.X, y + o.Y, itemID);
                }
            });
        }
コード例 #2
0
        public virtual void AddToGump(Gump g, int x, int y, int hue)
        {
            if (IsEmpty)
            {
                return;
            }

            x += OffsetX;
            y += OffsetY;

            if (hue < 0)
            {
                hue = Hue;
            }

            switch (AssetType)
            {
            case IconType.ItemArt:
            {
                if (ComputeOffset)
                {
                    var o = ArtExtUtility.GetImageOffset(AssetID);

                    if (o != Point.Empty)
                    {
                        x += o.X;
                        y += o.Y;
                    }
                }

                x = Math.Max(0, x);
                y = Math.Max(0, y);

                if (hue > 0)
                {
                    g.AddItem(x, y, AssetID, hue);
                }
                else
                {
                    g.AddItem(x, y, AssetID);
                }
            }
            break;

            case IconType.GumpArt:
            {
                x = Math.Max(0, x);
                y = Math.Max(0, y);

                if (hue > 0)
                {
                    g.AddImage(x, y, AssetID, hue);
                }
                else
                {
                    g.AddImage(x, y, AssetID);
                }
            }
            break;
            }
        }
コード例 #3
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
            });
        }
コード例 #4
0
 public virtual Point GetItemOffset(int itemID)
 {
     return(ArtExtUtility.GetImageOffset(itemID));
 }
コード例 #5
0
            protected virtual void CompileEntryLayout(SuperGumpLayout layout, int x, int y, int index)
            {
                layout.Add(
                    "heads/" + index,
                    () =>
                {
                    var n = Altar.Dungeon.Infos[index].Left;
                    var h = Altar.Dungeon.Infos[index].Right;

                    var o = ArtExtUtility.GetImageOffset(0x2DB4);
                    var s = ArtExtUtility.GetImageSize(0x2DB4);

                    var c = Color.White;

                    switch (index)
                    {
                    case 0:
                        c = Color.RosyBrown;
                        break;

                    case 1:
                        c = Color.OrangeRed;
                        break;

                    case 2:
                        c = Color.SkyBlue;
                        break;

                    case 3:
                        c = Color.GreenYellow;
                        break;

                    case 4:
                        c = Color.MediumPurple;
                        break;
                    }

                    if (Altar.Heads[index])
                    {
                        AddRectangle(x, y, 54, 54, Color.Empty, c, 2);
                        AddItem(x + 5 + o.X, y + (30 - (s.Height / 2)), 11700, h);
                    }
                    else
                    {
                        AddButton(
                            x,
                            y,
                            2183,
                            2183,
                            b =>
                        {
                            if (!Altar.Heads[index])
                            {
                                var head = User.Backpack.FindItemByType(ElementalAspectHead.Types[index]);

                                if (head == null && User.AccessLevel >= AccessLevel.Administrator)
                                {
                                    head = ElementalAspectHead.CreateInstance(index, n, h);

                                    User.GiveItem(head, GiveFlags.Pack, false);
                                }

                                if (head != null && !head.Deleted && head.Amount > 0)
                                {
                                    User.SendMessage(85, "You place {0} in to {1}.", head.ResolveName(User), Altar.ResolveName(User));

                                    Altar.Heads[index] = true;

                                    head.Consume();

                                    if (Altar.HeadCount >= Altar.HeadMax)
                                    {
                                        Altar.DoSummon();

                                        Close(true);
                                        return;
                                    }
                                }
                                else
                                {
                                    User.SendMessage(
                                        34,
                                        "This slot is engraved with '{0}' and it seems the head of a dragon would fit in it.",
                                        n);
                                }
                            }

                            Refresh(true);
                        });
                        AddRectangle(x, y, 54, 54, Color.Empty, c, 2);
                    }

                    var name = n.WrapUOHtmlCenter().WrapUOHtmlColor(c, false);

                    AddHtml(x, index % 2 == 0 ? y + 55 : y - 20, 54, 40, name, false, false);
                });
            }