public GBuyGump_InventoryItem(GBuyGump owner, BuyInfo si, int y, bool seperate)
     : base(0x20, y, 0xc3, 0)
 {
     this.m_Owner = owner;
     this.m_yBase = y;
     this.m_Info = si;
     IFont uniFont = Engine.GetUniFont(3);
     IHue hue = Hues.Load(0x288);
     this.m_Image = new GItemArt(0, 0, si.ItemID, si.Hue);
     this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", si.Name, si.Price), uniFont, hue, 0x3a, 0, 0x69);
     this.m_Available = new GLabel(si.Amount.ToString(), uniFont, hue, 0xc3, 0);
     int num = (this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1;
     base.m_Height = num;
     num = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1;
     if (num > base.m_Height)
     {
         base.m_Height = num;
     }
     num = (this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1;
     if (num > base.m_Height)
     {
         base.m_Height = num;
     }
     this.m_Image.X += (0x38 - ((this.m_Image.Image.xMax - this.m_Image.Image.xMin) + 1)) / 2;
     this.m_Image.Y += (base.m_Height - ((this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1)) / 2;
     this.m_Image.X -= this.m_Image.Image.xMin;
     this.m_Image.Y -= this.m_Image.Image.yMin;
     this.m_Description.X -= this.m_Description.Image.xMin;
     this.m_Description.Y += (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2;
     this.m_Description.Y -= this.m_Description.Image.yMin;
     this.m_Available.X -= this.m_Available.Image.xMax + 1;
     this.m_Available.Y += (base.m_Height - ((this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1)) / 2;
     this.m_Available.Y -= this.m_Available.Image.yMin;
     base.m_Children.Add(this.m_Image);
     base.m_Children.Add(this.m_Description);
     base.m_Children.Add(this.m_Available);
     this.m_xAvailable = si.Amount;
     if (seperate)
     {
         GImage image;
         this.m_Separator = new GImage[11];
         this.m_Separator[0] = image = new GImage(0x39, 0, base.m_Height);
         base.m_Children.Add(image);
         for (int i = 0; i < 9; i++)
         {
             this.m_Separator[i + 1] = image = new GImage(0x3a, 30 + (i * 0x10), base.m_Height);
             base.m_Children.Add(image);
         }
         this.m_Separator[10] = image = new GImage(0x3b, 0xa5, base.m_Height);
         base.m_Children.Add(image);
     }
     else
     {
         this.m_Separator = new GImage[0];
     }
     if (Engine.Features.AOS)
     {
         base.Tooltip = new ItemTooltip(si.Item);
     }
 }
Exemple #2
0
 public GBuyGump_AmountButton(GBuyGump owner, BuyInfo info, int offset, int gumpID, int x) : base(gumpID, x, 0)
 {
     this.m_Owner         = owner;
     this.m_Info          = info;
     this.m_InitialOffset = offset;
     this.m_Offset        = offset;
     this.m_Last          = -1234.56;
 }
 public GBuyGump_AmountButton(GBuyGump owner, BuyInfo info, int offset, int gumpID, int x)
     : base(gumpID, x, 0)
 {
     this.m_Owner = owner;
     this.m_Info = info;
     this.m_InitialOffset = offset;
     this.m_Offset = offset;
     this.m_Last = -1234.56;
 }
        public GBuyGump_OfferedItem(GBuyGump owner, BuyInfo bi) : base(0x20, 0x43, 0xc4, 0)
        {
            this.m_OfferMenu = owner.OfferMenu;
            IFont uniFont = Engine.GetUniFont(3);
            IHue  hue     = Hues.Load(0x288);

            this.m_xAmount     = bi.ToBuy;
            this.m_Amount      = new GLabel(bi.ToBuy.ToString(), uniFont, hue, 0, 0);
            this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", bi.Name, bi.Price), uniFont, hue, 0x29, 0, 0x69);
            this.m_More        = new GBuyGump_AmountButton(owner, bi, 5, 0x37, 0x9b);
            this.m_Less        = new GBuyGump_AmountButton(owner, bi, -5, 0x38, 0xad);
            int height = (this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1;

            base.m_Height = height;
            height        = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1;
            if (height > base.m_Height)
            {
                base.m_Height = height;
            }
            height = this.m_More.Height;
            if (height > base.m_Height)
            {
                base.m_Height = height;
            }
            height = this.m_Less.Height;
            if (height > base.m_Height)
            {
                base.m_Height = height;
            }
            this.m_Amount.X      -= this.m_Amount.Image.xMin;
            this.m_Amount.Y       = (base.m_Height - ((this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1)) / 2;
            this.m_Description.X -= this.m_Description.Image.xMin;
            this.m_Description.Y  = (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2;
            if (this.m_Amount.Y > this.m_Description.Y)
            {
                this.m_Amount.Y = this.m_Description.Y;
            }
            this.m_Amount.Y      -= this.m_Amount.Image.yMin;
            this.m_Description.Y -= this.m_Description.Image.yMin;
            this.m_More.Y         = (base.m_Height - this.m_More.Height) / 2;
            this.m_Less.Y         = (base.m_Height - this.m_Less.Height) / 2;
            base.m_Children.Add(this.m_Amount);
            base.m_Children.Add(this.m_Description);
            base.m_Children.Add(this.m_More);
            base.m_Children.Add(this.m_Less);
            this.Clipper = this.m_OfferMenu.ContentClipper;
            if (Engine.Features.AOS)
            {
                base.Tooltip = new ItemTooltip(bi.Item);
            }
        }
Exemple #5
0
 public void Clear()
 {
     for (int i = 0; i < this.m_Info.Length; i++)
     {
         BuyInfo info = this.m_Info[i];
         if (info.ToBuy > 0)
         {
             info.ToBuy = 0;
             info.InventoryGump.Available = info.Amount;
             Gumps.Destroy(info.OfferedGump);
             info.OfferedGump = null;
         }
     }
 }
 public GBuyGump_OfferedItem(GBuyGump owner, BuyInfo bi)
     : base(0x20, 0x43, 0xc4, 0)
 {
     this.m_OfferMenu = owner.OfferMenu;
     IFont uniFont = Engine.GetUniFont(3);
     IHue hue = Hues.Load(0x288);
     this.m_xAmount = bi.ToBuy;
     this.m_Amount = new GLabel(bi.ToBuy.ToString(), uniFont, hue, 0, 0);
     this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", bi.Name, bi.Price), uniFont, hue, 0x29, 0, 0x69);
     this.m_More = new GBuyGump_AmountButton(owner, bi, 5, 0x37, 0x9b);
     this.m_Less = new GBuyGump_AmountButton(owner, bi, -5, 0x38, 0xad);
     int height = (this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1;
     base.m_Height = height;
     height = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1;
     if (height > base.m_Height)
     {
         base.m_Height = height;
     }
     height = this.m_More.Height;
     if (height > base.m_Height)
     {
         base.m_Height = height;
     }
     height = this.m_Less.Height;
     if (height > base.m_Height)
     {
         base.m_Height = height;
     }
     this.m_Amount.X -= this.m_Amount.Image.xMin;
     this.m_Amount.Y = (base.m_Height - ((this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1)) / 2;
     this.m_Description.X -= this.m_Description.Image.xMin;
     this.m_Description.Y = (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2;
     if (this.m_Amount.Y > this.m_Description.Y)
     {
         this.m_Amount.Y = this.m_Description.Y;
     }
     this.m_Amount.Y -= this.m_Amount.Image.yMin;
     this.m_Description.Y -= this.m_Description.Image.yMin;
     this.m_More.Y = (base.m_Height - this.m_More.Height) / 2;
     this.m_Less.Y = (base.m_Height - this.m_Less.Height) / 2;
     base.m_Children.Add(this.m_Amount);
     base.m_Children.Add(this.m_Description);
     base.m_Children.Add(this.m_More);
     base.m_Children.Add(this.m_Less);
     this.Clipper = this.m_OfferMenu.ContentClipper;
     if (Engine.Features.AOS)
     {
         base.Tooltip = new ItemTooltip(bi.Item);
     }
 }
Exemple #7
0
 public PBuyItems(int serial, BuyInfo[] info)
     : base(0x3b, "Buy Items")
 {
     base.m_Stream.Write(serial);
     base.m_Stream.Write((byte) 2);
     for (int i = 0; i < info.Length; i++)
     {
         if (info[i].ToBuy > 0)
         {
             base.m_Stream.Write((byte) 0x1a);
             base.m_Stream.Write(info[i].Item.Serial);
             base.m_Stream.Write((short) info[i].ToBuy);
         }
     }
 }
Exemple #8
0
        public GBuyGump(int serial, BuyInfo[] info) : base(0x870, 15, 15)
        {
            base.m_GUID   = string.Format("GBuyGump-{0}", serial);
            this.m_Serial = serial;
            this.m_Info   = info;
            UnicodeFont uniFont = Engine.GetUniFont(3);
            IHue        hue     = Hues.Load(0x288);

            Array.Sort(info);
            int y = 0x42;

            for (int i = 0; i < info.Length; i++)
            {
                bool    seperate             = i != (info.Length - 1);
                BuyInfo si                   = info[i];
                GBuyGump_InventoryItem toAdd = new GBuyGump_InventoryItem(this, si, y, seperate);
                base.m_Children.Add(toAdd);
                si.InventoryGump = toAdd;
                y += toAdd.Height;
                if (seperate)
                {
                    y += 0x10;
                }
            }
            if (y > 230)
            {
                GVSlider slider = new GVSlider(0x828, 0xed, 0x51, 0x22, 0x5c, 0.0, 0.0, (double)(y - 230), 1.0)
                {
                    OnValueChange = new OnValueChange(this.Slider_OnValueChange)
                };
                base.m_Children.Add(slider);
                base.m_Children.Add(new GHotspot(0xed, 0x42, 0x22, 0x7a, slider));
            }
            base.m_NonRestrictivePicking = true;
            this.m_OfferMenu             = new GBuyGump_OfferMenu(this);
            base.m_Children.Add(this.m_OfferMenu);
            base.m_X = (Engine.ScreenWidth - (this.m_OfferMenu.X + this.m_OfferMenu.Width)) / 2;
            base.m_Y = (Engine.ScreenHeight - (this.m_OfferMenu.Y + this.m_OfferMenu.Height)) / 2;
        }
Exemple #9
0
 public GBuyGump(int serial, BuyInfo[] info)
     : base(0x870, 15, 15)
 {
     base.m_GUID = string.Format("GBuyGump-{0}", serial);
     this.m_Serial = serial;
     this.m_Info = info;
     UnicodeFont uniFont = Engine.GetUniFont(3);
     IHue hue = Hues.Load(0x288);
     Array.Sort(info);
     int y = 0x42;
     for (int i = 0; i < info.Length; i++)
     {
         bool seperate = i != (info.Length - 1);
         BuyInfo si = info[i];
         GBuyGump_InventoryItem toAdd = new GBuyGump_InventoryItem(this, si, y, seperate);
         base.m_Children.Add(toAdd);
         si.InventoryGump = toAdd;
         y += toAdd.Height;
         if (seperate)
         {
             y += 0x10;
         }
     }
     if (y > 230)
     {
         GVSlider slider = new GVSlider(0x828, 0xed, 0x51, 0x22, 0x5c, 0.0, 0.0, (double) (y - 230), 1.0) {
             OnValueChange = new OnValueChange(this.Slider_OnValueChange)
         };
         base.m_Children.Add(slider);
         base.m_Children.Add(new GHotspot(0xed, 0x42, 0x22, 0x7a, slider));
     }
     base.m_NonRestrictivePicking = true;
     this.m_OfferMenu = new GBuyGump_OfferMenu(this);
     base.m_Children.Add(this.m_OfferMenu);
     base.m_X = (Engine.ScreenWidth - (this.m_OfferMenu.X + this.m_OfferMenu.Width)) / 2;
     base.m_Y = (Engine.ScreenHeight - (this.m_OfferMenu.Y + this.m_OfferMenu.Height)) / 2;
 }
Exemple #10
0
        int IComparable.CompareTo(object x)
        {
            if (x == null)
            {
                return(1);
            }
            BuyInfo info = x as BuyInfo;

            if (info == null)
            {
                throw new ArgumentException();
            }
            int num = Map.GetQuality(this.m_Item.ID).CompareTo(Map.GetQuality(info.m_Item.ID));

            if (num == 0)
            {
                num = this.m_Item.ID.CompareTo(info.m_Item.ID);
                if (num == 0)
                {
                    num = this.m_Item.Serial.CompareTo(info.m_Item.Serial);
                }
            }
            return(num);
        }
Exemple #11
0
        private static void Container_Open(PacketReader pvSrc)
        {
            int serial = pvSrc.ReadInt32();
            int gumpID = pvSrc.ReadInt16();
            int num3 = 0;
            if (gumpID == 0x30)
            {
                num3 = serial;
                serial = m_BuyMenuSerial;
            }
            Item item = World.WantItem(serial);
            int num4 = 10 + ((Engine.m_OpenedGumps++ % 20) * 10);
            if (item.Container != null)
            {
                item.Container.Close();
            }
            switch (gumpID)
            {
                case -1:
                    item.QueueOpenSB = true;
                    break;

                case 8:
                {
                    Mobile mobile = World.FindMobile(serial);
                    mobile.BigStatus = true;
                    mobile.OpenStatus(false);
                    break;
                }
                case 0x30:
                    if ((m_BuyMenuPrices != null) && (m_BuyMenuNames != null))
                    {
                        ArrayList items = item.Items;
                        int count = items.Count;
                        if (count > m_BuyMenuPrices.Length)
                        {
                            count = m_BuyMenuPrices.Length;
                        }
                        if (count > m_BuyMenuNames.Length)
                        {
                            count = m_BuyMenuNames.Length;
                        }
                        BuyInfo[] infoArray = new BuyInfo[count];
                        BuyInfo info = null;
                        for (int i = 0; i < count; i++)
                        {
                            infoArray[i] = new BuyInfo((Item) items[i], m_BuyMenuPrices[i], m_BuyMenuNames[i]);
                            if (((infoArray[i].ItemID == 0x2124) && (Engine.m_BuyHorse != null)) && (Engine.m_BuyHorse.Serial == num3))
                            {
                                info = infoArray[i];
                                info.dToBuy = 1.0;
                                info.ToBuy = 1;
                                Engine.m_BuyHorse = null;
                            }
                        }
                        if (info == null)
                        {
                            Gumps.Desktop.Children.Add(new GBuyGump(num3, infoArray));
                        }
                        else
                        {
                            Engine.AddTextMessage("Purchasing items.");
                            Network.Send(new PBuyItems(num3, infoArray));
                        }
                        m_BuyMenuPrices = null;
                        m_BuyMenuNames = null;
                    }
                    break;

                default:
                    IContainer container;
                    Engine.Sounds.PlayContainerOpen(gumpID);
                    if (((gumpID == 9) && (item.LastTextHue != null)) && ((item.LastTextHue.HueID() & 0x7fff) == 0x59))
                    {
                        container = new GContainer(item, gumpID, Hues.GetNotoriety(Notoriety.Innocent));
                    }
                    else
                    {
                        container = new GContainer(item, gumpID);
                    }
                    Gumps.Desktop.Children.Add(container.Gump);
                    item.Container = container;
                    break;
            }
        }
        public GBuyGump_InventoryItem(GBuyGump owner, BuyInfo si, int y, bool seperate) : base(0x20, y, 0xc3, 0)
        {
            this.m_Owner = owner;
            this.m_yBase = y;
            this.m_Info  = si;
            IFont uniFont = Engine.GetUniFont(3);
            IHue  hue     = Hues.Load(0x288);

            this.m_Image       = new GItemArt(0, 0, si.ItemID, si.Hue);
            this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", si.Name, si.Price), uniFont, hue, 0x3a, 0, 0x69);
            this.m_Available   = new GLabel(si.Amount.ToString(), uniFont, hue, 0xc3, 0);
            int num = (this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1;

            base.m_Height = num;
            num           = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1;
            if (num > base.m_Height)
            {
                base.m_Height = num;
            }
            num = (this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1;
            if (num > base.m_Height)
            {
                base.m_Height = num;
            }
            this.m_Image.X       += (0x38 - ((this.m_Image.Image.xMax - this.m_Image.Image.xMin) + 1)) / 2;
            this.m_Image.Y       += (base.m_Height - ((this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1)) / 2;
            this.m_Image.X       -= this.m_Image.Image.xMin;
            this.m_Image.Y       -= this.m_Image.Image.yMin;
            this.m_Description.X -= this.m_Description.Image.xMin;
            this.m_Description.Y += (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2;
            this.m_Description.Y -= this.m_Description.Image.yMin;
            this.m_Available.X   -= this.m_Available.Image.xMax + 1;
            this.m_Available.Y   += (base.m_Height - ((this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1)) / 2;
            this.m_Available.Y   -= this.m_Available.Image.yMin;
            base.m_Children.Add(this.m_Image);
            base.m_Children.Add(this.m_Description);
            base.m_Children.Add(this.m_Available);
            this.m_xAvailable = si.Amount;
            if (seperate)
            {
                GImage image;
                this.m_Separator    = new GImage[11];
                this.m_Separator[0] = image = new GImage(0x39, 0, base.m_Height);
                base.m_Children.Add(image);
                for (int i = 0; i < 9; i++)
                {
                    this.m_Separator[i + 1] = image = new GImage(0x3a, 30 + (i * 0x10), base.m_Height);
                    base.m_Children.Add(image);
                }
                this.m_Separator[10] = image = new GImage(0x3b, 0xa5, base.m_Height);
                base.m_Children.Add(image);
            }
            else
            {
                this.m_Separator = new GImage[0];
            }
            if (Engine.Features.AOS)
            {
                base.Tooltip = new ItemTooltip(si.Item);
            }
        }