예제 #1
0
        private void MakeGump()
        {
            m_Buttons = new ArrayList();

            AuctionItem.ItemInfo item = m_Auction[m_Page];

            if (item == null)
            {
                return;
            }

            this.Closable = true;
            m_Buttons.Add(0);

            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;

            this.AddPage(0);
            this.AddBackground(0, 0, 501, 370, 9270);
            this.AddImageTiled(4, 4, 492, 362, 2524);
            this.AddImageTiled(5, 5, 490, 360, 2624);
            this.AddAlphaRegion(5, 5, 490, 360);

            // Item image goes here
            if (item.Item != null)
            {
                this.AddItem(15, 15, item.Item.ItemID, 0);
            }

            this.AddImageTiled(5, 169, 255, 20, 2524);
            this.AddImageTiled(5, 170, 155, 195, 2624);
            this.AddImageTiled(159, 5, 20, 184, 2524);
            this.AddImageTiled(160, 5, 335, 360, 2624);

            this.AddAlphaRegion(160, 5, 335, 360);
            this.AddAlphaRegion(5, 170, 155, 195);
            this.AddLabel(170, 10, GreenHue, m_Auction.ItemName);
            this.AddImageTiled(169, 29, 317, 142, 2524);
            this.AddImageTiled(170, 30, 315, 140, 2624);
            this.AddAlphaRegion(170, 30, 315, 140);
            this.AddLabel(210, 30, LabelHue, string.Format(AuctionSystem.ST[67], m_Auction.ItemCount));
            this.AddImageTiled(209, 49, 237, 122, 2524);

            // Prev Item button: 1
            if (m_Page > 0)
            {
                this.AddButton(175, 35, 4014, 4015, 1, GumpButtonType.Reply, 0);
                m_Buttons.Add(1);
            }

            // Next Item button: 2
            if (m_Page < m_Auction.ItemCount - 1)
            {
                this.AddButton(450, 35, 4005, 4006, 2, GumpButtonType.Reply, 0);
                m_Buttons.Add(2);
            }

            this.AddImageTiled(210, 50, 235, 120, 2624);
            this.AddAlphaRegion(210, 50, 235, 120);

            // Properties html
            this.AddHtml(210, 50, 235, 120, m_Auction[m_Page].Properties, (bool)false, (bool)true);
            this.AddImageTiled(4, 169, 156, 197, 2524);
            this.AddImageTiled(5, 170, 154, 195, 2624);
            this.AddAlphaRegion(5, 170, 154, 195);

            // Auction info
            this.AddLabel(10, 175, LabelHue, AuctionSystem.ST[68]);
            this.AddLabel(45, 190, GreenHue, m_Auction.MinBid.ToString());

            this.AddLabel(10, 280, LabelHue, AuctionSystem.ST[69]);
            this.AddLabel(75, 280, m_Auction.ReserveMet ? GreenHue : RedHue, m_Auction.ReserveMet ? "Met" : "Not Met");

            this.AddLabel(10, 210, LabelHue, AuctionSystem.ST[70]);

            if (m_Auction.HasBids)
            {
                this.AddLabel(45, 225, m_Auction.ReserveMet ? GreenHue : RedHue, m_Auction.HighestBid.Amount.ToString());
            }
            else
            {
                this.AddLabel(45, 225, RedHue, AuctionSystem.ST[71]);
            }

            // Web link button: 3
            if (m_Auction.WebLink != null && m_Auction.WebLink.Length > 0)
            {
                this.AddLabel(10, 300, LabelHue, AuctionSystem.ST[72]);
                this.AddButton(75, 302, 5601, 5605, 3, GumpButtonType.Reply, 0);
                m_Buttons.Add(3);
            }

            this.AddLabel(10, 245, LabelHue, AuctionSystem.ST[56]);
            string timeleft = null;

            if (!m_Auction.Expired)
            {
                if (m_Auction.TimeLeft >= TimeSpan.FromDays(1))
                {
                    timeleft = string.Format(AuctionSystem.ST[73], m_Auction.TimeLeft.Days, m_Auction.TimeLeft.Hours);
                }
                else if (m_Auction.TimeLeft >= TimeSpan.FromMinutes(60))
                {
                    timeleft = string.Format(AuctionSystem.ST[74], m_Auction.TimeLeft.Hours);
                }
                else if (m_Auction.TimeLeft >= TimeSpan.FromSeconds(60))
                {
                    timeleft = string.Format(AuctionSystem.ST[75], m_Auction.TimeLeft.Minutes);
                }
                else
                {
                    timeleft = string.Format(AuctionSystem.ST[76], m_Auction.TimeLeft.Seconds);
                }
            }
            else if (m_Auction.Pending)
            {
                timeleft = AuctionSystem.ST[77];
            }
            else
            {
                timeleft = AuctionSystem.ST[78];
            }

            this.AddLabel(45, 260, GreenHue, timeleft);

            if (m_Auction.CanBid(m_User) && !m_Auction.Expired)
            {
                this.AddLabel(10, 320, LabelHue, AuctionSystem.ST[79]);
                this.AddImageTiled(9, 339, 112, 22, 2524);
                this.AddImageTiled(10, 340, 110, 20, 2624);
                this.AddAlphaRegion(10, 340, 110, 20);

                // Bid text: 0
                this.AddTextEntry(10, 340, 110, 20, GreenHue, 0, @"");

                // Bid button: 4
                this.AddButton(125, 340, 4011, 4012, 4, GumpButtonType.Reply, 0);
                m_Buttons.Add(4);
            }
            else if (m_Auction.IsOwner(m_User))
            {
                // View bids: button 5
                this.AddLabel(10, 340, LabelHue, AuctionSystem.ST[80]);
                this.AddButton(125, 340, 4011, 4012, 5, GumpButtonType.Reply, 0);
                m_Buttons.Add(5);
            }

            // Owner description
            this.AddImageTiled(169, 194, 317, 112, 2524);
            this.AddLabel(210, 175, LabelHue, AuctionSystem.ST[81]);
            this.AddImageTiled(170, 195, 315, 110, 2624);
            this.AddAlphaRegion(170, 195, 315, 110);
            this.AddHtml(170, 195, 315, 110, string.Format("<basefont color=#FFFFFF>{0}", m_Auction.Description), (bool)false, (bool)true);

            // Buy now : Button 8
            if (m_Auction.AllowBuyNow && m_Auction.CanBid(m_User) && !m_Auction.Expired)
            {
                this.AddButton(170, 310, 4029, 4030, 8, GumpButtonType.Reply, 0);
                m_Buttons.Add(8);
                this.AddLabel(205, 312, GreenHue, string.Format(AuctionSystem.ST[210], m_Auction.BuyNow));
            }

            // Hue preview image
            if (item.Item != null)
            {
                this.AddImageTiled(40, 145, 100, 20, 3004);
                this.AddImageTiled(41, 146, 98, 18, 2624);
                this.AddAlphaRegion(41, 146, 98, 18);
                this.AddLabel(55, 145, LabelHue, AuctionSystem.ST[82]);

                int hue = 0;

                switch (item.Item.Hue)
                {
                case 0: hue = 0;
                    break;

                case 1: hue = AuctionSystem.BlackHue - 1;
                    break;

                default: hue = item.Item.Hue - 1;
                    break;
                }

                // Some hues are | 0x8000 for some reason, but it leads to the same hue
                if (hue >= 3000)
                {
                    hue -= 32768;
                }

                // Validate in case the hue was shifted by some other value
                if (hue < 0 || hue >= 3000)
                {
                    hue = 0;
                }

                // For some reason gumps hues are offset by one
                this.AddImage(115, 60, 5536, hue);
            }

            if (m_User.AccessLevel < AuctionSystem.AuctionAdminAcessLevel)
            {
                // 3D clients SUCK!
                this.AddLabel(170, 342, GreenHue, AuctionSystem.ST[83]);
            }
            else
            {
                // Button 6 : Auction Panel
                this.AddButton(170, 340, 4011, 4012, 6, GumpButtonType.Reply, 0);
                m_Buttons.Add(6);
                this.AddLabel(205, 342, LabelHue, AuctionSystem.ST[227]);
            }

            // Close button: 0
            this.AddButton(455, 340, 4017, 4018, 0, GumpButtonType.Reply, 0);
            this.AddLabel(415, 342, LabelHue, AuctionSystem.ST[7]);
        }
예제 #2
0
        private void MakeGump()
        {
            AuctionItem.ItemInfo item = m_Auction[m_Page];

            if (item == null)
            {
                return;
            }

            int itemHue = GetItemHue(item.Item);

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            // The page and background
            AddBackground(0, 0, 502, 370, 9270);
            AddImageTiled(4, 4, 492, 362, kBeigeBorderOuter);
            AddImageTiled(5, 5, 490, 360, kBeigeBorderInner);
            AddAlphaRegion(5, 5, 490, 360);

            //
            // The item display area
            //
            AddImageTiled(4, 4, 156, 170, kBeigeBorderOuter);
            AddImageTiled(5, 5, 154, 168, kBeigeBorderInner);
            AddAlphaRegion(5, 5, 154, 168);

            // Item image goes here
            if (item.Item != null)
            {
                NewAuctionGump.AddItemCentered(5, 5, 155, 140, item.Item.ItemID, item.Item.Hue, this);
                AddItemProperty(item.Item.Serial);
            }
            // Hue preview image goes here if the item has a hue
            if (item.Item != null && 0 != itemHue)
            {
                AddImageTiled(30, 140, 107, 24, 3004);
                AddImageTiled(31, 141, 105, 22, kBeigeBorderInner);
                AddAlphaRegion(31, 141, 105, 22);
                AddLabel(37, 142, AuctionLabelHue.kLabelHue, AuctionSystem.ST[82]);
                AddItem(90, 141, kHueExampleID, itemHue);
            }

            //
            // The Auction info area
            //
            AddImageTiled(4, 169, 156, 196, kBeigeBorderOuter);
            AddImageTiled(5, 170, 154, 195, kBeigeBorderInner);
            AddAlphaRegion(5, 170, 154, 195);

            // Reserve and bids
            AddLabel(10, 175, AuctionLabelHue.kLabelHue, AuctionSystem.ST[68]);
            AddLabel(45, 190, AuctionLabelHue.kGreenHue, m_Auction.MinBid.ToString("#,0"));

            AddLabel(10, 280, AuctionLabelHue.kLabelHue, AuctionSystem.ST[69]);
            AddLabel(45, 295, m_Auction.ReserveMet ? AuctionLabelHue.kGreenHue : AuctionLabelHue.kRedHue, m_Auction.ReserveMet ? "Met" : "Not Met");

            AddLabel(10, 210, AuctionLabelHue.kLabelHue, AuctionSystem.ST[70]);

            if (m_Auction.HasBids)
            {
                AddLabel(45, 225, m_Auction.ReserveMet ? AuctionLabelHue.kGreenHue : AuctionLabelHue.kRedHue, m_Auction.HighestBid.Amount.ToString("#,0"));
            }
            else
            {
                AddLabel(45, 225, AuctionLabelHue.kRedHue, AuctionSystem.ST[71]);
            }

            // Time remaining
            string timeleft = null;

            AddLabel(10, 245, AuctionLabelHue.kLabelHue, AuctionSystem.ST[56]);

            if (!m_Auction.Expired)
            {
                if (m_Auction.TimeLeft >= TimeSpan.FromDays(1))
                {
                    timeleft = string.Format(AuctionSystem.ST[73], m_Auction.TimeLeft.Days, m_Auction.TimeLeft.Hours);
                }
                else if (m_Auction.TimeLeft >= TimeSpan.FromMinutes(60))
                {
                    timeleft = string.Format(AuctionSystem.ST[74], m_Auction.TimeLeft.Hours);
                }
                else if (m_Auction.TimeLeft >= TimeSpan.FromSeconds(60))
                {
                    timeleft = string.Format(AuctionSystem.ST[75], m_Auction.TimeLeft.Minutes);
                }
                else
                {
                    timeleft = string.Format(AuctionSystem.ST[76], m_Auction.TimeLeft.Seconds);
                }
            }
            else if (m_Auction.Pending)
            {
                timeleft = AuctionSystem.ST[77];
            }
            else
            {
                timeleft = AuctionSystem.ST[78];
            }
            AddLabel(45, 260, AuctionLabelHue.kGreenHue, timeleft);

            // Bidding
            if (m_Auction.CanBid(m_User) && !m_Auction.Expired)
            {
                AddLabel(10, 318, AuctionLabelHue.kLabelHue, AuctionSystem.ST[79]);
                AddImageTiled(9, 338, 112, 22, kBeigeBorderOuter);
                AddImageTiled(10, 339, 110, 20, kBeigeBorderInner);
                AddAlphaRegion(10, 339, 110, 20);

                // Bid text: 0
                AddTextEntry(10, 339, 110, 20, AuctionLabelHue.kGreenHue, 0, @"");

                // Bid button: 4
                AddButton(125, 338, 4011, 4012, 4, GumpButtonType.Reply, 0);
            }
            else if (m_Auction.IsOwner(m_User))
            {
                // View bids: button 5
                AddLabel(10, 338, AuctionLabelHue.kLabelHue, AuctionSystem.ST[80]);
                AddButton(125, 338, 4011, 4012, 5, GumpButtonType.Reply, 0);
            }

            //
            // Item properties area
            //
            AddImageTiled(169, 29, 317, 142, kBeigeBorderOuter);
            AddImageTiled(170, 30, 315, 140, kBeigeBorderInner);
            AddAlphaRegion(170, 30, 315, 140);

            // If it is a container make room for the arrows to navigate to each of the items
            if (m_Auction.ItemCount > 1)
            {
                AddLabel(170, 10, AuctionLabelHue.kGreenHue, string.Format(AuctionSystem.ST[231], m_Auction.ItemName));

                AddImageTiled(169, 29, 317, 27, kBeigeBorderOuter);
                AddImageTiled(170, 30, 315, 25, kBeigeBorderInner);
                AddAlphaRegion(170, 30, 315, 25);
                AddLabel(185, 35, AuctionLabelHue.kGreenHue, string.Format(AuctionSystem.ST[67], m_Page + 1, m_Auction.ItemCount));

                // Prev Item button: 1
                if (m_Page > 0)
                {
                    AddButton(415, 31, 4014, 4015, 1, GumpButtonType.Reply, 0);
                }

                // Next Item button: 2
                if (m_Page < m_Auction.ItemCount - 1)
                {
                    AddButton(450, 31, 4005, 4006, 2, GumpButtonType.Reply, 0);
                }

                //AddHtml( 173, 56, 312, 114, m_Auction[ m_Page ].Properties, (bool)false, (bool)true );
                AddHtml(173, 56, 312, 114, "Hover your mouse over the item to the left to see this item's properties.", (bool)false, (bool)true);
            }
            else
            {
                AddLabel(170, 10, AuctionLabelHue.kGreenHue, m_Auction.ItemName);
                //AddHtml( 173, 30, 312, 140, m_Auction[ m_Page ].Properties, (bool)false, (bool)true );
                AddHtml(173, 30, 312, 140, "Hover your mouse over the item to the left to see this item's properties.", (bool)false, (bool)true);
            }

            //
            // Owner description area
            //
            AddImageTiled(169, 194, 317, 112, kBeigeBorderOuter);
            AddLabel(170, 175, AuctionLabelHue.kLabelHue, AuctionSystem.ST[81]);
            AddImageTiled(170, 195, 315, 110, kBeigeBorderInner);
            AddAlphaRegion(170, 195, 315, 110);
            AddHtml(173, 195, 312, 110, string.Format("<basefont color=#FFFFFF>{0}", m_Auction.Description), (bool)false, (bool)true);

            // Web link button: 3
            if (m_Auction.WebLink != null && m_Auction.WebLink.Length > 0)
            {
                AddLabel(350, 175, AuctionLabelHue.kLabelHue, AuctionSystem.ST[72]);
                AddButton(415, 177, 5601, 5605, 3, GumpButtonType.Reply, 0);
            }

            //
            // Auction controls
            //

            // Buy now : Button 8
            if (m_Auction.AllowBuyNow && m_Auction.CanBid(m_User) && !m_Auction.Expired)
            {
                AddButton(170, 310, 4029, 4030, 8, GumpButtonType.Reply, 0);
                AddLabel(205, 312, AuctionLabelHue.kGreenHue, string.Format(AuctionSystem.ST[210], m_Auction.BuyNow.ToString("#,0")));
            }

            // Button 6 : Admin Auction Panel
            if (m_User.AccessLevel >= AuctionConfig.AuctionAdminAcessLevel)
            {
                AddButton(170, 338, 4011, 4012, 6, GumpButtonType.Reply, 0);
                AddLabel(205, 340, AuctionLabelHue.kLabelHue, AuctionSystem.ST[227]);
            }

            // Close button: 0
            AddButton(455, 338, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddLabel(415, 340, AuctionLabelHue.kLabelHue, AuctionSystem.ST[7]);
        }
예제 #3
0
        private void MakeGump(Mobile m)
        {
            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            Mobile from = m;

            AddPage(0);

            AddImageTiled(49, 39, 402, 352, 3004);
            AddImageTiled(50, 40, 400, 350, 2624);
            AddAlphaRegion(50, 40, 400, 350);
            AddImage(165, 65, 10452);
            AddImage(0, 20, 10400);
            AddImage(0, 330, 10402);
            AddImage(35, 20, 10420);
            AddImage(421, 20, 10410);
            AddImage(410, 20, 10430);
            AddImageTiled(90, 32, 323, 16, 10254);
            AddLabel(160, 45, 273, AuctionSystem.ST[8]);
            AddImage(420, 330, 10412);
            AddImage(420, 175, 10411);
            AddImage(0, 175, 10401);

            // Search: BUTTON 1
            if (m_EnableSearch)
            {
                AddLabel(305, 120, 88, AuctionSystem.ST[16]);
                AddButton(270, 120, 4005, 4006, 1, GumpButtonType.Reply, 0);
            }

            // Sort: BUTTON 2
            AddLabel(395, 120, 88, AuctionSystem.ST[17]);
            AddButton(360, 120, 4005, 4006, 2, GumpButtonType.Reply, 0);

            while (m_Page * 10 >= m_List.Count)
            {
                m_Page--;
            }

            if (m_List.Count > 0)
            {
                // Display the page number
                AddLabel(360, 95, 33, string.Format(AuctionSystem.ST[18], m_Page + 1, (m_List.Count - 1) / 10 + 1));
                AddLabel(70, 120, 33, string.Format(AuctionSystem.ST[19], m_List.Count));
            }
            else
            {
                AddLabel(70, 120, 33, AuctionSystem.ST[20]);
            }

            // Display items: BUTTONS 10 + i

            int lower = m_Page * 10;

            if (m_List.Count > 0)
            {
                for (int i = 0; i < 10 && (m_Page * 10 + i) < m_List.Count; i++)
                {
                    AuctionItem item = m_List[m_Page * 10 + i] as AuctionItem;
                    AddButton(75, 153 + i * 20, 5601, 5605, 10 + i, GumpButtonType.Reply, 0);

                    AddLabelCropped(100, 150 + i * 20, 260, 20, 88, "$" + item.MinNewBid);
                    AddLabelCropped(175, 150 + i * 20, 260, 20, 88, item.ItemName);
                    try
                    {
                        if (item.HighestBid.Mobile != null)
                        {
                            if (from == item.HighestBid.Mobile)
                            {
                                AddLabelCropped(100, 150 + i * 20, 260, 20, 273, "$" + item.MinNewBid);
                                AddLabelCropped(175, 150 + i * 20, 260, 20, 273, item.ItemName);
                            }
                        }
                    }
                    catch { }
                    try
                    {
                        if (item.IsOwner(from))
                        {
                            AddLabelCropped(100, 150 + i * 20, 260, 20, 143, "$" + item.MinNewBid);
                            AddLabelCropped(175, 150 + i * 20, 260, 20, 143, item.ItemName);
                        }
                    }
                    catch { }
                }
            }

            // Next page: BUTTON 3  if (m_Auction.IsOwner(m_User))
            if ((m_Page + 1) * 10 < m_List.Count)
            {
                AddLabel(355, 360, 88, AuctionSystem.ST[22]);
                AddButton(315, 360, 4005, 4006, 3, GumpButtonType.Reply, 0);
            }

            // Previous page: BUTTON 4
            if (m_Page > 0)
            {
                AddLabel(180, 360, 88, AuctionSystem.ST[21]);
                AddButton(280, 360, 4014, 4015, 4, GumpButtonType.Reply, 0);
            }

            // Close: BUTTON 0
            AddLabel(115, 360, 88, AuctionSystem.ST[7]);
            AddButton(75, 360, 4017, 4018, 0, GumpButtonType.Reply, 0);
        }