Пример #1
0
        /// <summary>
        /// Records the creation of a new auction item
        /// </summary>
        /// <param name="auction">The new auction</param>
        public static void WriteNewAuction(AuctionItem auction)
        {
            if (!m_Enabled || m_Writer == null)
            {
                return;
            }

            try
            {
                m_Writer.WriteLine("## New Auction : {0}", auction.ID);
                m_Writer.WriteLine("# {0}", auction.ItemName);
                m_Writer.WriteLine("# Created on {0} at {1}", DateTime.UtcNow.ToShortDateString(), DateTime.UtcNow.ToShortTimeString());
                m_Writer.WriteLine("# Owner : {0} [{1}] Account: {2}", auction.Owner.Name, auction.Owner.Serial.ToString(), auction.Account.Username);
                m_Writer.WriteLine("# Expires on {0} at {1}", auction.EndTime.ToShortDateString(), auction.EndTime.ToShortTimeString());
                m_Writer.WriteLine("# Starting Bid: {0}. Reserve: {1}. Buy Now: {2}",
                                   auction.MinBid, auction.Reserve, auction.AllowBuyNow ? auction.BuyNow.ToString() : "Disabled");
                m_Writer.WriteLine("# Owner Description : {0}", auction.Description);
                m_Writer.WriteLine("# Web Link : {0}", auction.WebLink != null ? auction.WebLink : "N/A");

                if (auction.Creature)
                {
                    // Selling a pet
                    m_Writer.WriteLine("#### Selling 1 Creature");
                    m_Writer.WriteLine("# Type : {0}. Serial : {1}. Name : {2} Hue : {3}", auction.Pet.GetType().Name, auction.Pet.Serial.ToString(), auction.Pet.Name != null ? auction.Pet.Name : "Unnamed", auction.Pet.Hue);
                    m_Writer.WriteLine("# Statuette Serial : {0}", auction.Item.Serial.ToString());
                    m_Writer.WriteLine("# Properties: {0}", auction.Items[0].Properties);
                }
                else
                {
                    // Selling items
                    m_Writer.WriteLine("#### Selling {0} Items", auction.ItemCount);

                    for (int i = 0; i < auction.ItemCount; i++)
                    {
                        AuctionItem.ItemInfo info = auction.Items[i];
                        m_Writer.WriteLine("# {0}. {1} [{2}] Type {3} Hue {4}", i, info.Name, info.Item.Serial, info.Item.GetType().Name, info.Item.Hue);
                        m_Writer.WriteLine("Properties: {0}", info.Properties);
                    }
                }

                m_Writer.WriteLine();
            }
            catch {}
        }
Пример #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()
        {
            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]);
        }