Пример #1
0
        public VendorSellGump(VendorSellListPacket packet)
            : base(0, 0)
        {
            IsMoveable = true;
            // note: original gumplings start at index 0x0870.
            AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false));
            AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>My Inventory"));

            m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this));
            AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar));
            BuildShopContents(packet);

            AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty));
            UpdateCost();

            Button okButton = (Button)AddControl(new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0));
            okButton.GumpOverID = 0x909;
            okButton.MouseClickEvent += okButton_MouseClickEvent;
        }
Пример #2
0
        private void BuildShopContents(VendorSellListPacket packet)
        {
            m_VendorSerial = packet.VendorSerial;

            m_Items = new VendorItemInfo[packet.Items.Length];

            for (int i = 0; i < packet.Items.Length; i++)
            {
                VendorSellListPacket.VendorSellItem item = packet.Items[i];
                if (item.Amount > 0)
                {
                    string cliLocAsString = packet.Items[i].Name;
                    int clilocDescription;
                    string description;
                    if (!(int.TryParse(cliLocAsString, out clilocDescription)))
                    {
                        description = cliLocAsString;
                    }
                    else
                    {
                        // get the resource provider
                        IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
                        description = Utility.CapitalizeAllWords(provider.GetString(clilocDescription));
                    }

                    string html = string.Format(c_Format, description, item.Price.ToString(), item.ItemID, item.Amount, i);
                    m_ShopContents.AddEntry(html);

                    m_Items[i] = new VendorItemInfo(item.ItemSerial, item.ItemID, item.Hue, description, item.Price, item.Amount);
                }
            }

            // list starts displaying first item.
            m_ScrollBar.Value = 0;
        }