private static ArrayList GetVendors(Mobile m)
        {
            ArrayList list = new ArrayList();

            foreach (Mobile wm in World.Mobiles.Values)
            {
                if (wm is PlayerVendor)
                {
                    PlayerVendor pv = wm as PlayerVendor;
                    if (pv != null)
                    {
                        if (pv.Owner == m)
                        {
                            list.Add(pv);
                        }
                    }
                }
            }

            return(list);
        }
示例#2
0
        public static void UpdatePlayerVendors(WorldSaveEventArgs e)
        {
            m_VendorItems.Clear();
            int count = 0;

            foreach (Mobile mob in World.Mobiles.Values)
            {
                if (mob is PlayerVendor)
                {
                    PlayerVendor vendor = mob as PlayerVendor;
                    if (vendor.Owner != null)
                    {
                        processContainer(vendor, vendor.Backpack);
                        count++;
                    }
                }
            }
            m_LastVendorUpdate = DateTime.Now;
            m_NextVendorUpdate = m_LastVendorUpdate + m_WorldSaveInterval;
            Console.WriteLine("Caching " + count + " Player Vendors");
        }
示例#3
0
 protected override void OnTarget(Mobile from, object target)           // Override the protected OnTarget() for our feature
 {
     if (target is PlayerVendor)
     {
         PlayerVendor vendor = (PlayerVendor)target;
         if (vendor.IsOwner(from))
         {
             vendor.Body = new Body(17);
             vendor.Name = NameList.RandomName("orc");
             m_Deed.Delete();
         }
         else
         {
             from.SendMessage("That vendor does not work for you.");
         }
     }
     else
     {
         from.SendMessage("That is not a player vendor");
     }
 }
示例#4
0
        public PlayerVendor FindPlayerVendor()
        {
            Region r = m_Region;

            if (r == null)
            {
                return(null);
            }

            List <Mobile> list = r.GetMobiles();

            for (int i = 0; i < list.Count; ++i)
            {
                PlayerVendor pv = list[i] as PlayerVendor;

                if (pv != null && Contains(pv))
                {
                    return(pv);
                }
            }

            return(null);
        }
示例#5
0
        public PlayerVendorBuyGump(Item i, PlayerVendor vend, VendorItem vi)
            : base(100, 200)
        {
            m_Item   = i;
            m_Vendor = vend;
            m_VI     = vi;

            string desc = m_VI.Description;

            if (desc != null && (desc = desc.Trim()).Length == 0)
            {
                desc = null;
            }

            AddPage(0);

            AddBackground(100, 10, 300, 150, 5054);

            AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false);             // You have agreed to purchase:

            if (desc != null)
            {
                AddLabel(125, 45, 0, desc);
            }
            else
            {
                AddHtmlLocalized(125, 45, 250, 24, 1019072, false, false);         // an item without a description
            }
            AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false);             // for the amount of:
            AddLabel(125, 95, 0, m_VI.Price.ToString());

            AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false);             // CANCEL

            AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false);             // OKAY
        }
示例#6
0
        public PlayerVendorOwnerGump(PlayerVendor vendor)
            : base(50, 200)
        {
            this.m_Vendor = vendor;

            // int perDay = this.m_Vendor.ChargePerDay;

            this.AddPage(0);
            this.AddBackground(25, 10, 530, 140, 5054);

            this.AddHtmlLocalized(425, 25, 120, 20, 1019068, false, false); // See goods
            this.AddButton(390, 25, 4005, 4007, 1, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(425, 48, 120, 20, 1019069, false, false); // Customize
            this.AddButton(390, 48, 4005, 4007, 2, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(425, 72, 120, 20, 1011012, false, false); // CANCEL
            this.AddButton(390, 71, 4005, 4007, 0, GumpButtonType.Reply, 0);

            this.AddHtmlLocalized(40, 72, 260, 20, 1038321, false, false); // Gold held for you:
            this.AddLabel(300, 72, 0, this.m_Vendor.HoldGold.ToString());
            this.AddHtmlLocalized(40, 96, 260, 20, 1038322, false, false); // Gold held in my account:
            this.AddLabel(300, 96, 0, this.m_Vendor.BankAccount.ToString());

            this.AddHtml(40, 120, 260, 20, String.Format("<basefont color=#FFFFFF>My charge per transaction is: {0}%<br><small>There is no per day charge.", m_Vendor.ChargePerTransaction * 100), false, false);

            //AddHtmlLocalized( 40, 120, 260, 20, 1038324, false, false ); // My charge per day is:
            // Localization has changed, we must use a string here
            // this.AddHtml(40, 120, 260, 20, "My charge per day is:", false, false);

            // this.AddLabel(300, 120, 0, perDay.ToString());

            // double days = (this.m_Vendor.HoldGold + this.m_Vendor.BankAccount) / ((double)perDay);

            // this.AddHtmlLocalized(40, 25, 260, 20, 1038318, false, false); // Amount of days I can work:
            // this.AddLabel(300, 25, 0, ((int)days).ToString());
            // this.AddHtmlLocalized(40, 48, 260, 20, 1038319, false, false); // Earth days:
            // this.AddLabel(300, 48, 0, ((int)(days / 12.0)).ToString());
        }
        public PlayerVendorBuyGump(PlayerVendor vendor, VendorItem vi) : base(100, 200)
        {
            m_Vendor = vendor;
            m_VI     = vi;

            AddBackground(100, 10, 300, 150, 9270);

            AddHtml(125, 20, 250, 24, "Voce está comprando este item:", false, false); // You have agreed to purchase:

            //if ( !String.IsNullOrEmpty( vi.Description ) )
            //    AddLabel( 125, 45, 0, vi.Description );
            //else
            AddHtml(125, 45, 250, 24, vi.Item.Name, false, false);                  // an item without a description

            AddHtml(125, 70, 250, 24, "pela quantia de:", false, false);            // for the amount of:
            AddHtml(125, 95, 250, 24, vi.Price.ToString() + " Gold", false, false); // for the amount of:
            //AddLabel( 125, 95, 0, vi.Price.ToString() );

            AddButton(250, 130, 4005, 4007, 0, GumpButtonType.Reply, 0);
            AddHtml(282, 130, 100, 24, "Cancelar", false, false); // CANCEL

            AddButton(120, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtml(152, 130, 100, 24, "Confirmar", false, false); // OKAY
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else if (from.Region.Name == "Magincia")
            {
                //from.SendLocalizedMessage( 503248 ); // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, 503246);                   // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                from.SendLocalizedMessage(1062677);                   // You cannot place a vendor or barkeep at this location.
            }
        }
示例#9
0
        public BOBGump(PlayerMobile from, BulkOrderBook book, int page = 0, List <IBOBEntry> list = null) : base(12, 24)
        {
            from.CloseGump <BOBGump>();
            from.CloseGump <BOBFilterGump>();

            m_From = from;
            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new List <IBOBEntry>(book.Entries.Count);

                for (int i = 0; i < book.Entries.Count; ++i)
                {
                    IBOBEntry entry = book.Entries[i];

                    if (CheckFilter(entry))
                    {
                        list.Add(entry);
                    }
                }
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canDrop  = book.IsChildOf(from.Backpack);
            bool canBuy   = pv != null;
            bool canPrice = canDrop || canBuy;

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = vi?.IsForSale == false;
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            AddImageTiled(231, 64, 80, 352, 200);
            AddImageTiled(313, 64, 100, 352, 1416);
            AddImageTiled(415, 64, 76, 352, 200);

            for (int i = index; i < index + count && i >= 0 && i < list.Count; ++i)
            {
                IBOBEntry entry = list[i];

                if (!CheckFilter(entry))
                {
                    continue;
                }

                AddImageTiled(24, 94 + tableIndex * 32, canPrice ? 573 : 489, 2, 2624);
                tableIndex += entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(5, 5, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(5, 424, 10460);
            AddImage(width - 15, 424, 10460);

            AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor); // Bulk Order Book
            AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor);                   // Type
            AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor);                  // Item
            AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor);                  // Quality
            AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor);                  // Material
            AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor);                  // Amount

            AddButton(35, 32, 4005, 4007, 1);
            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor); // Set Filter

            BOBFilter f = from.UseOwnFilter ? from.BOBFilter : book.Filter;

            if (f.IsDefault)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
            }
            else if (from.UseOwnFilter)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
            }
            else
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
            }
            AddButton(375, 416, 4017, 4018, 0);
            AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT

            if (canDrop)
            {
                AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
            }
            if (canPrice)
            {
                AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor); // Price

                if (canBuy)
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor); // Buy
                }
                else
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor); // Set

                    AddButton(450, 416, 4005, 4007, 4);
                    AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>");
                }
            }

            tableIndex = 0;

            if (page > 0)
            {
                AddButton(75, 416, 4014, 4016, 2);
                AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor); // Previous page
            }

            if (GetIndexForPage(page + 1) < list.Count)
            {
                AddButton(225, 416, 4005, 4007, 3);
                AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor); // Next page
            }

            for (int i = index; i < index + count && i >= 0 && i < list.Count; ++i)
            {
                IBOBEntry entry = list[i];

                if (!CheckFilter(entry))
                {
                    continue;
                }

                if (entry is BOBLargeEntry largeEntry)
                {
                    int y = 96 + tableIndex * 32;

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
                    }

                    if (canDrop || (canBuy && entry.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
                        AddLabel(495, y, 1152, entry.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor); // Large

                    for (int j = 0; j < largeEntry.Entries.Length; ++j)
                    {
                        BOBLargeSubEntry sub = largeEntry.Entries[j];

                        AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);

                        if (entry.RequireExceptional)
                        {
                            AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
                        }
                        else
                        {
                            AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
                        }
                        TextDefinition name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);

                        if (name.Number > 0)
                        {
                            AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
                        }
                        else
                        {
                            AddLabel(316, y, 1152, name);
                        }

                        AddLabel(421, y, 1152, $"{sub.AmountCur} / {entry.AmountMax}");

                        ++tableIndex;
                        y += 32;
                    }
                }
                else
                {
                    BOBSmallEntry smallEntry = (BOBSmallEntry)entry;

                    int y = 96 + tableIndex++ *32;

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
                    }

                    if (canDrop || (canBuy && smallEntry.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
                        AddLabel(495, y, 1152, smallEntry.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor); // Small

                    AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);

                    if (smallEntry.RequireExceptional)
                    {
                        AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
                    }
                    else
                    {
                        AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
                    }
                    TextDefinition name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);

                    if (name.Number > 0)
                    {
                        AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
                    }
                    else
                    {
                        AddLabel(316, y, 1152, name);
                    }

                    AddLabel(421, y, 1152, $"{smallEntry.AmountCur} / {smallEntry.AmountMax}");
                }
            }
        }
示例#10
0
        public NewPlayerVendorOwnerGump(PlayerVendor vendor) : base(50, 200)
        {
            m_Vendor = vendor;

            int perRealWorldDay = vendor.ChargePerRealWorldDay;
            int goldHeld        = vendor.HoldGold;

            AddBackground(25, 10, 530, 180, 0x13BE);

            AddImageTiled(35, 20, 510, 160, 0xA40);
            AddAlphaRegion(35, 20, 510, 160);

            AddImage(10, 0, 0x28DC);
            AddImage(537, 175, 0x28DC);
            AddImage(10, 175, 0x28DC);
            AddImage(537, 0, 0x28DC);

            if (goldHeld < perRealWorldDay)
            {
                int goldNeeded = perRealWorldDay - goldHeld;

                AddHtmlLocalized(40, 35, 260, 20, 1038320, 0x7FFF, false, false);                   // Gold needed for 1 day of vendor salary:
                AddLabel(300, 35, 0x1F, goldNeeded.ToString());
            }
            else
            {
                int days = goldHeld / perRealWorldDay;

                AddHtmlLocalized(40, 35, 260, 20, 1038318, 0x7FFF, false, false);                   // # of days Vendor salary is paid for:
                AddLabel(300, 35, 0x480, days.ToString());
            }

            AddHtmlLocalized(40, 58, 260, 20, 1038324, 0x7FFF, false, false);               // My charge per real world day is:
            AddLabel(300, 58, 0x480, perRealWorldDay.ToString());

            AddHtmlLocalized(40, 82, 260, 20, 1038322, 0x7FFF, false, false);               // Gold held in my account:
            AddLabel(300, 82, 0x480, goldHeld.ToString());

            AddHtmlLocalized(40, 108, 260, 20, 1062509, 0x7FFF, false, false);               // Shop Name:

            AddButton(390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 21, 120, 20, 1019068, 0x7FFF, false, false);               // See goods

            AddButton(390, 44, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 41, 120, 20, 1019069, 0x7FFF, false, false);               // Customize

            AddButton(390, 64, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 61, 120, 20, 1062434, 0x7FFF, false, false);               // Rename Shop

            AddButton(390, 84, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 81, 120, 20, 3006217, 0x7FFF, false, false);               // Rename Vendor

            AddButton(390, 104, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 101, 120, 20, 3006123, 0x7FFF, false, false);               // Open Paperdoll

            AddButton(390, 124, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
            AddLabel(408, 121, 0x480, "Collect Gold");

            AddButton(390, 144, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0);
            AddLabel(408, 141, 0x480, "Dismiss Vendor");

            AddButton(390, 162, 0x15E1, 0x15E5, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 161, 120, 20, 1011012, 0x7FFF, false, false);               // CANCEL
        }
示例#11
0
        public NewPlayerVendorOwnerGump(PlayerVendor vendor) : base(50, 200)
        {
            m_Vendor = vendor;

            var perRealWorldDay = vendor.ChargePerRealWorldDay;
            var goldHeld        = vendor.HoldGold;

            AddBackground(25, 10, 530, 180, 0x13BE);

            AddImageTiled(35, 20, 510, 160, 0xA40);
            AddAlphaRegion(35, 20, 510, 160);

            AddImage(10, 0, 0x28DC);
            AddImage(537, 175, 0x28DC);
            AddImage(10, 175, 0x28DC);
            AddImage(537, 0, 0x28DC);

            if (goldHeld < perRealWorldDay)
            {
                var goldNeeded = perRealWorldDay - goldHeld;

                AddHtmlLocalized(40, 35, 260, 20, 1038320, 0x7FFF); // Gold needed for 1 day of vendor salary:
                AddLabel(300, 35, 0x1F, goldNeeded.ToString());
            }
            else
            {
                var days = goldHeld / perRealWorldDay;

                AddHtmlLocalized(40, 35, 260, 20, 1038318, 0x7FFF); // # of days Vendor salary is paid for:
                AddLabel(300, 35, 0x480, days.ToString());
            }

            AddHtmlLocalized(40, 58, 260, 20, 1038324, 0x7FFF); // My charge per real world day is:
            AddLabel(300, 58, 0x480, perRealWorldDay.ToString());

            AddHtmlLocalized(40, 82, 260, 20, 1038322, 0x7FFF); // Gold held in my account:
            AddLabel(300, 82, 0x480, goldHeld.ToString());

            AddHtmlLocalized(40, 108, 260, 20, 1062509, 0x7FFF); // Shop Name:
            AddLabel(140, 106, 0x66D, vendor.ShopName);

            if (vendor is RentedVendor rentedVendor)
            {
                rentedVendor.ComputeRentalExpireDelay(out var days, out var hours);

                AddLabel(
                    38,
                    132,
                    0x480,
                    $"Location rental will expire in {days} day{(days != 1 ? "s" : "")} and {hours} hour{(hours != 1 ? "s" : "")}."
                    );
            }

            AddButton(390, 24, 0x15E1, 0x15E5, 1);
            AddHtmlLocalized(408, 21, 120, 20, 1019068, 0x7FFF); // See goods

            AddButton(390, 44, 0x15E1, 0x15E5, 2);
            AddHtmlLocalized(408, 41, 120, 20, 1019069, 0x7FFF); // Customize

            AddButton(390, 64, 0x15E1, 0x15E5, 3);
            AddHtmlLocalized(408, 61, 120, 20, 1062434, 0x7FFF); // Rename Shop

            AddButton(390, 84, 0x15E1, 0x15E5, 4);
            AddHtmlLocalized(408, 81, 120, 20, 3006217, 0x7FFF); // Rename Vendor

            AddButton(390, 104, 0x15E1, 0x15E5, 5);
            AddHtmlLocalized(408, 101, 120, 20, 3006123, 0x7FFF); // Open Paperdoll

            AddButton(390, 124, 0x15E1, 0x15E5, 6);
            AddLabel(408, 121, 0x480, "Collect Gold");

            AddButton(390, 144, 0x15E1, 0x15E5, 7);
            AddLabel(408, 141, 0x480, "Dismiss Vendor");

            AddButton(390, 162, 0x15E1, 0x15E5, 0);
            AddHtmlLocalized(408, 161, 120, 20, 1011012, 0x7FFF); // CANCEL
        }
示例#12
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            int index = info.ButtonID;

            switch (index)
            {
            case 0:                     // EXIT
            {
                break;
            }

            case 1:                     // Set Filter
            {
                m_From.SendGump(new BOBFilterGump(m_From, m_Book));

                break;
            }

            case 2:                     // Previous page
            {
                if (m_Page > 0)
                {
                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
                }

                return;
            }

            case 3:                     // Next page
            {
                if (GetIndexForPage(m_Page + 1) < m_List.Count)
                {
                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
                }

                break;
            }

            default:
            {
                bool canDrop  = m_Book.IsChildOf(m_From.Backpack);
                bool canPrice = canDrop || (m_Book.RootParent is PlayerVendor);

                index -= 4;

                int type = index % 2;
                index /= 2;

                if (index < 0 || index >= m_List.Count)
                {
                    break;
                }

                object obj = m_List[index];

                if (!m_Book.Entries.Contains(obj))
                {
                    m_From.SendLocalizedMessage(1062382);                               // The deed selected is not available.
                    break;
                }

                if (type == 0)                           // Drop
                {
                    if (m_Book.IsChildOf(m_From.Backpack))
                    {
                        Item item = Reconstruct(obj);

                        if (item != null)
                        {
                            m_From.AddToBackpack(item);
                            m_From.SendLocalizedMessage(1045152);                                       // The bulk order deed has been placed in your backpack.

                            m_Book.Entries.Remove(obj);
                            m_Book.InvalidateProperties();

                            if (m_Book.Entries.Count > 0)
                            {
                                m_From.SendGump(new BOBGump(m_From, m_Book, 0, null));
                            }
                            else
                            {
                                m_From.SendLocalizedMessage(1062381);                                           // The book is empty.
                            }
                        }
                        else
                        {
                            m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
                        }
                    }
                }
                else                         // Set Price | Buy
                {
                    if (m_Book.IsChildOf(m_From.Backpack))
                    {
                        m_From.Prompt = new SetPricePrompt(m_Book, obj, m_Page, m_List);
                        m_From.SendLocalizedMessage(1062383);                                   // Type in a price for the deed:
                    }
                    else if (m_Book.RootParent is PlayerVendor)
                    {
                        PlayerVendor pv = (PlayerVendor)m_Book.RootParent;

                        VendorItem vi = pv.GetVendorItem(m_Book);

                        int price = 0;

                        if (vi != null && !vi.IsForSale)
                        {
                            if (obj is BOBLargeEntry)
                            {
                                price = ((BOBLargeEntry)obj).Price;
                            }
                            else if (obj is BOBSmallEntry)
                            {
                                price = ((BOBSmallEntry)obj).Price;
                            }
                        }

                        if (price == 0)
                        {
                            m_From.SendLocalizedMessage(1062382);                                       // The deed selected is not available.
                        }
                        else
                        {
                            m_From.SendGump(new BODBuyGump(m_From, m_Book, obj, price));
                        }
                    }
                }

                break;
            }
            }
        }
示例#13
0
        public NewPlayerVendorOwnerGump(PlayerVendor vendor)
            : base(50, 200)
        {
            m_Vendor = vendor;

            int goldHeld = vendor.HoldGold;

            AddBackground(25, 10, 530, 220, 0x13BE);

            AddImageTiled(35, 20, 510, 200, 0xA40);
            AddAlphaRegion(35, 20, 510, 200);

            AddImage(10, 0, 0x28DC);
            AddImage(537, 215, 0x28DC);
            AddImage(10, 215, 0x28DC);
            AddImage(537, 0, 0x28DC);

            if (!vendor.IsCommission)
            {
                int perRealWorldDay = vendor.ChargePerRealWorldDay;

                if (goldHeld < perRealWorldDay)
                {
                    int goldNeeded = perRealWorldDay - goldHeld;

                    AddHtmlLocalized(40, 35, 260, 20, 1038320, 0x7FFF, false, false); // Gold needed for 1 day of vendor salary:
                    AddLabel(300, 35, 0x1F, goldNeeded.ToString());
                }
                else
                {
                    int days = goldHeld / perRealWorldDay;

                    AddHtmlLocalized(40, 35, 260, 20, 1038318, 0x7FFF, false, false); // # of days Vendor salary is paid for:
                    AddLabel(300, 35, 0x480, days.ToString());
                }

                AddHtmlLocalized(40, 78, 260, 20, 1038324, 0x7FFF, false, false); // My charge per real world day is:
                AddLabel(300, 78, 0x480, perRealWorldDay.ToString());
            }
            else
            {
                AddHtmlLocalized(40, 78, 260, 20, 1159157, 0x7FFF, false, false); // My commission per sale:
                AddLabel(300, 78, 0x480, string.Format("{0}%", vendor.CommissionPerc));
            }

            AddHtmlLocalized(40, 181, 260, 20, vendor.VendorSearch ? 1154633 : 1154634, 0x7FFF, false, false); // Vendor Search Enabled / Disable

            AddHtmlLocalized(40, 102, 260, 20, 1038322, 0x7FFF, false, false);                                 // Gold held in my account:
            AddLabel(300, 102, 0x480, goldHeld.ToString());

            AddHtmlLocalized(40, 128, 260, 20, 1062509, 0x7FFF, false, false); // Shop Name:
            AddLabel(140, 128, 0x66D, vendor.ShopName);

            if (vendor is RentedVendor)
            {
                int days, hours;
                ((RentedVendor)vendor).ComputeRentalExpireDelay(out days, out hours);

                AddLabel(40, 154, 0x480, string.Format("Location rental will expire in {0} day{1} and {2} hour{3}.", days, days != 1 ? "s" : "", hours, hours != 1 ? "s" : ""));
            }

            AddButton(390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 21, 120, 20, 1019068, 0x7FFF, false, false); // See goods

            AddButton(390, 44, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 41, 120, 20, 1019069, 0x7FFF, false, false); // Customize

            AddButton(390, 64, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 61, 120, 20, 1062434, 0x7FFF, false, false); // Rename Shop

            AddButton(390, 84, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 81, 120, 20, 3006217, 0x7FFF, false, false); // Rename Vendor

            AddButton(390, 104, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 101, 120, 20, 3006123, 0x7FFF, false, false); // Open Paperdoll

            AddButton(390, 124, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 121, 120, 20, 1071988, 0x7FFF, false, false); // Collect Gold

            if (!vendor.IsCommission)
            {
                AddButton(390, 144, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(408, 141, 120, 20, 1156104, 0x7FFF, false, false); // Deposit Gold

            AddButton(390, 162, 0x15E1, 0x15E5, 8, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 161, 120, 20, 1071987, 0x7FFF, false, false); // Dismiss Vendor

            AddButton(390, 182, 0x15E1, 0x15E5, 9, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 181, 120, 20, 1154631, 0x7FFF, false, false); // Opt Out of Search

            AddButton(390, 202, 0x15E1, 0x15E5, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 201, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (m_Book.Entries.Contains(m_Object) && pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        if (m_Object is PowerScrollBookEntry)
                        {
                            price = ((PowerScrollBookEntry)m_Object).Price;
                        }
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
                    }
                    else if (price == 0)
                    {
                        pv.SayTo(m_From, 1062382);
                    }
                    else
                    {
                        Item item = null;

                        if (m_Object is PowerScrollBookEntry)
                        {
                            item = ((PowerScrollBookEntry)m_Object).Reconstruct();
                        }

                        if (item == null)
                        {
                            m_From.SendMessage("Internal error. The power scroll could not be reconstructed.");
                        }
                        else
                        {
                            pv.Say(m_From.Name);

                            Container pack = m_From.Backpack;

                            if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                            {
                                m_Book.Entries.Remove(m_Object);
                                m_Book.InvalidateProperties();

                                pv.HoldGold += price;

                                if (m_From.AddToBackpack(item))
                                {
                                    m_From.SendMessage("The power scroll has been placed in your backpack.");
                                }
                                else
                                {
                                    pv.SayTo(m_From, 503204);
                                }

                                if (m_Book.Entries.Count > 0)
                                {
                                    m_From.SendGump(new PowerScrollBookGump(m_From, m_Book));
                                }
                                else
                                {
                                    m_From.SendLocalizedMessage(1062381);
                                }
                            }
                            else
                            {
                                pv.SayTo(m_From, 503205);
                                item.Delete();
                            }
                        }
                    }
                }
                else
                {
                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1062382);
                    }
                    else
                    {
                        pv.SayTo(m_From, 1062382);
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(503207);
            }
        }
示例#15
0
        public TamingBOBGump(PlayerMobile from, TamingBulkOrderBook book, int page, ArrayList list) : base(12, 24)
        {
            from.CloseGump(typeof(TamingBOBGump));
            from.CloseGump(typeof(TamingBOBFilterGump));

            m_From = from;
            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new ArrayList(book.Entries.Count);

                for (int i = 0; i < book.Entries.Count; ++i)
                {
                    object obj = book.Entries[i];

                    if (CheckFilter(obj))
                    {
                        list.Add(obj);
                    }
                }
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canDrop  = book.IsChildOf(from.Backpack);
            bool canBuy   = (pv != null);
            bool canPrice = (canDrop || canBuy);

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = (vi != null && !vi.IsForSale);
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            //AddImage( 231, 100, 5549 );
            AddImageTiled(415, 64, 76, 352, 200);

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                object obj = list[i];

                if (!CheckFilter(obj))
                {
                    continue;
                }

                AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);

                if (obj is TamingBOBLargeEntry)
                {
                    tableIndex += ((TamingBOBLargeEntry)obj).Entries.Length;
                }
                else if (obj is TamingBOBSmallEntry)
                {
                    ++tableIndex;
                }
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(5, 5, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(5, 424, 10460);
            AddImage(width - 15, 424, 10460);

            AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
            AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false);                   // Type
            AddLabel(147, 64, 1149, @"Animal");
            AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false);                  // Amount

            AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false);               // Set Filter

            // TamingBOBFilter f = ( from.UseOwnFilter ? from.TamingBOBFilter : book.Filter );

            // if ( f.IsDefault )
            // AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false ); // Using No Filter
            // else if ( from.UseOwnFilter )
            // AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false ); // Using Your Filter
            // else
            // AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false ); // Using Book Filter

            // AddButton( 375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0 );
            // AddHtmlLocalized( 410, 416, 120, 20, 1011441, LabelColor, false, false ); // EXIT

            // if ( canDrop )
            // AddHtmlLocalized( 26, 64, 50, 32, 1062212, LabelColor, false, false ); // Drop

            // if ( canPrice )
            // {
            // AddHtmlLocalized( 516, 64, 200, 32, 1062218, LabelColor, false, false ); // Price

            // if ( canBuy )
            // AddHtmlLocalized( 576, 64, 200, 32, 1062219, LabelColor, false, false ); // Buy
            // else
            // AddHtmlLocalized( 576, 64, 200, 32, 1062227, LabelColor, false, false ); // Set
            // }

            // tableIndex = 0;

            // if ( page > 0 )
            // {
            // AddButton( 75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0 );
            // AddHtmlLocalized( 110, 416, 150, 20, 1011067, LabelColor, false, false ); // Previous page
            // }

            // if ( GetIndexForPage( page + 1 ) < list.Count )
            // {
            // AddButton( 225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0 );
            // AddHtmlLocalized( 260, 416, 150, 20, 1011066, LabelColor, false, false ); // Next page
            // }

            // for ( int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i )
            // {
            // object obj = list[i];

            // if ( !CheckFilter( obj ) )
            // continue;

            // if ( obj is TamingBOBLargeEntry )
            // {
            // TamingBOBLargeEntry e = (TamingBOBLargeEntry)obj;

            // int y = 96 + (tableIndex * 32);

            // if ( canDrop )
            // AddButton( 35, y + 2, 5602, 5606, 4 + (i * 2), GumpButtonType.Reply, 0 );

            // if ( canDrop || (canBuy && e.Price > 0) )
            // {
            // AddButton( 579, y + 2, 2117, 2118, 5 + (i * 2), GumpButtonType.Reply, 0 );
            // AddLabel( 495, y, 1152, e.Price.ToString() );
            // }

            // AddHtmlLocalized( 61, y, 50, 32, 1062225, LabelColor, false, false ); // Large

            // for ( int j = 0; j < e.Entries.Length; ++j )
            // {
            // TamingBOBLargeSubEntry sub = e.Entries[j];

            // string s = sub.AnimalName;

            // int capsbreak = s.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(),1);

            // if( capsbreak > -1 )
            // {
            // string secondhalf = s.Substring( capsbreak );
            // string firsthalf = s.Substring(0, capsbreak );

            // string newname = firsthalf + " " + secondhalf;

            // AddLabel( 103, y, 1149, newname.ToString() );
            // }
            // else
            // {
            // AddLabel( 103, y, 1149, sub.AnimalName.ToString() );
            // }

            // object name = GetMaterialName( sub.Type );

            // if ( name is int )
            // AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
            // else if ( name is string )
            // AddLabel( 316, y, 1152, (string)name );

            // AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, e.AmountMax ) );

            // ++tableIndex;
            // y += 32;
            // }
            // }
            // else if ( obj is TamingBOBSmallEntry )
            // {
            // TamingBOBSmallEntry e = (TamingBOBSmallEntry)obj;

            // int y = 96 + (tableIndex++ * 32);

            // if ( canDrop )
            // AddButton( 35, y + 2, 5602, 5606, 4 + (i * 2), GumpButtonType.Reply, 0 );

            // if ( canDrop || (canBuy && e.Price > 0) )
            // {
            // AddButton( 579, y + 2, 2117, 2118, 5 + (i * 2), GumpButtonType.Reply, 0 );
            // AddLabel( 495, y, 1152, e.Price.ToString() );
            // }

            // AddHtmlLocalized( 61, y, 50, 32, 1062224, LabelColor, false, false ); // Small

            // string s = e.AnimalName;

            // int capsbreak = s.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(),1);

            // if( capsbreak > -1 )
            // {
            // string secondhalf = s.Substring( capsbreak );
            // string firsthalf = s.Substring(0, capsbreak );

            // string newname = firsthalf + " " + secondhalf;

            // AddLabel( 103, y, 1149, newname.ToString() );
            // }
            // else
            // {
            // AddLabel( 103, y, 1149, e.AnimalName.ToString() );
            // }

            // object name = GetMaterialName( e.Type );

            // if ( name is int )
            // AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
            // else if ( name is string )
            // AddLabel( 316, y, 1152, (string)name );

            // AddLabel( 421, y, 1152, String.Format( "{0} / {1}", e.AmountCur, e.AmountMax ) );
            // }
            // }
        }
示例#16
0
文件: BOBGump.cs 项目: avatar21/runuo
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            int index = info.ButtonID;

            switch (index)
            {
            case 0:                     // EXIT
            {
                break;
            }

            case 1:                     // Set Filter
            {
                m_From.SendGump(new BOBFilterGump(m_From, m_Book));

                break;
            }

            case 2:                     // Previous page
            {
                if (m_Page > 0)
                {
                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
                }

                return;
            }

            case 3:                     // Next page
            {
                if (GetIndexForPage(m_Page + 1) < m_List.Count)
                {
                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
                }

                break;
            }

            case 4:                     // Price all
            {
                if (m_Book.IsChildOf(m_From.Backpack))
                {
                    m_From.Prompt = new SetPricePrompt(m_Book, null, m_Page, m_List);
                    m_From.SendMessage("Type in a price for all deeds in the book:");
                }

                break;
            }

            default:
            {
                bool canDrop  = m_Book.IsChildOf(m_From.Backpack);
                bool canPrice = canDrop || (m_Book.RootParent is PlayerVendor);

                index -= 5;

                int type = index % 2;
                index /= 2;

                if (index < 0 || index >= m_List.Count)
                {
                    break;
                }

                object obj = m_List[index];

                if (!m_Book.Entries.Contains(obj))
                {
                    m_From.SendLocalizedMessage(1062382);                               // The deed selected is not available.
                    break;
                }

                if (type == 0)                           // Drop
                {
                    if (m_Book.IsChildOf(m_From.Backpack))
                    {
                        Item item = Reconstruct(obj);

                        if (item != null)
                        {
                            Container pack = m_From.Backpack;
                            if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
                            {
                                m_From.SendLocalizedMessage(503204);                                         // You do not have room in your backpack for this
                                m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                            }
                            else
                            {
                                if (m_Book.IsChildOf(m_From.Backpack))
                                {
                                    int sizeOfDroppedBod;
                                    if (obj is BOBLargeEntry)
                                    {
                                        sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
                                    }
                                    else
                                    {
                                        sizeOfDroppedBod = 1;
                                    }

                                    m_From.AddToBackpack(item);
                                    m_From.SendLocalizedMessage(1045152);                                             // The bulk order deed has been placed in your backpack.
                                    m_Book.Entries.Remove(obj);
                                    m_Book.InvalidateProperties();

                                    if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
                                    {
                                        m_Book.ItemCount--;
                                        m_Book.InvalidateItems();
                                    }

                                    if (m_Book.Entries.Count > 0)
                                    {
                                        m_Page = GetPageForIndex(index, sizeOfDroppedBod);
                                        m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                                    }
                                    else
                                    {
                                        m_From.SendLocalizedMessage(1062381);                                                 // The book is empty.
                                    }
                                }
                            }
                        }
                        else
                        {
                            m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
                        }
                    }
                }
                else                         // Set Price | Buy
                {
                    if (m_Book.IsChildOf(m_From.Backpack))
                    {
                        m_From.Prompt = new SetPricePrompt(m_Book, obj, m_Page, m_List);
                        m_From.SendLocalizedMessage(1062383);                                   // Type in a price for the deed:
                    }
                    else if (m_Book.RootParent is PlayerVendor)
                    {
                        PlayerVendor pv = (PlayerVendor)m_Book.RootParent;
                        VendorItem   vi = pv.GetVendorItem(m_Book);

                        if (vi != null && !vi.IsForSale)
                        {
                            int sizeOfDroppedBod;
                            int price = 0;
                            if (obj is BOBLargeEntry)
                            {
                                price            = ((BOBLargeEntry)obj).Price;
                                sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
                            }
                            else
                            {
                                price            = ((BOBSmallEntry)obj).Price;
                                sizeOfDroppedBod = 1;
                            }
                            if (price == 0)
                            {
                                m_From.SendLocalizedMessage(1062382);                                         // The deed selected is not available.
                            }
                            else
                            {
                                if (m_Book.Entries.Count > 0)
                                {
                                    m_Page = GetPageForIndex(index, sizeOfDroppedBod);
                                    m_From.SendGump(new BODBuyGump(m_From, m_Book, obj, m_Page, price));
                                }
                                else
                                {
                                    m_From.SendLocalizedMessage(1062381);                                             // The book is emptz
                                }
                            }
                        }
                    }
                }
                break;
            }
            }
        }
示例#17
0
        public NewPlayerVendorCustomizeGump(PlayerVendor vendor)
            : base(50, 50)
        {
            m_Vendor = vendor;

            AddBackground(0, 0, 370, 370, 0x13BE);

            AddImageTiled(10, 10, 350, 20, 0xA40);
            AddImageTiled(10, 40, 350, 20, 0xA40);
            AddImageTiled(10, 70, 350, 260, 0xA40);
            AddImageTiled(10, 340, 350, 20, 0xA40);

            AddAlphaRegion(10, 10, 350, 350);

            AddHtmlLocalized(10, 12, 350, 18, 1011356, 0x7FFF, false, false);             // <center>VENDOR CUSTOMIZATION MENU</center>

            AddHtmlLocalized(10, 42, 150, 18, 1062459, 0x421F, false, false);             // <CENTER>HAIR</CENTER>

            for (int i = 0; i < m_HairStyles.Length; i++)
            {
                HairOrBeard hair = m_HairStyles[i];

                AddButton(10, 70 + i * 20, 0xFA5, 0xFA7, 0x100 | i, GumpButtonType.Reply, 0);
                AddHtmlLocalized(45, 72 + i * 20, 110, 18, hair.Name, 0x7FFF, false, false);
            }

            AddButton(10, 70 + m_HairStyles.Length * 20, 0xFB1, 0xFB3, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 72 + m_HairStyles.Length * 20, 110, 18, 1011403, 0x7FFF, false, false);             // Remove

            AddButton(10, 70 + (m_HairStyles.Length + 1) * 20, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 72 + (m_HairStyles.Length + 1) * 20, 110, 18, 1011402, 0x7FFF, false, false);             // Color

            if (vendor.Female)
            {
                AddButton(160, 290, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(195, 292, 160, 18, 1015327, 0x7FFF, false, false);                 // Male

                AddHtmlLocalized(195, 312, 160, 18, 1015328, 0x421F, false, false);                 // Female
            }
            else
            {
                AddHtmlLocalized(160, 42, 210, 18, 1062460, 0x421F, false, false);                 // <CENTER>BEARD</CENTER>

                for (int i = 0; i < m_BeardStyles.Length; i++)
                {
                    HairOrBeard beard = m_BeardStyles[i];

                    AddButton(160, 70 + i * 20, 0xFA5, 0xFA7, 0x200 | i, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(195, 72 + i * 20, 160, 18, beard.Name, 0x7FFF, false, false);
                }

                AddButton(160, 70 + m_BeardStyles.Length * 20, 0xFB1, 0xFB3, 4, GumpButtonType.Reply, 0);
                AddHtmlLocalized(195, 72 + m_BeardStyles.Length * 20, 160, 18, 1011403, 0x7FFF, false, false);                 // Remove

                AddButton(160, 70 + (m_BeardStyles.Length + 1) * 20, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
                AddHtmlLocalized(195, 72 + (m_BeardStyles.Length + 1) * 20, 160, 18, 1011402, 0x7FFF, false, false); // Color

                AddHtmlLocalized(195, 292, 160, 18, 1015327, 0x421F, false, false);                                  // Male

                AddButton(160, 310, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(195, 312, 160, 18, 1015328, 0x7FFF, false, false);                 // Female
            }

            AddButton(10, 340, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 342, 305, 18, 1060675, 0x7FFF, false, false);             // CLOSE
        }
        public static void CPI_Worker(out string s1, out string s2)
        {
            s1 = s2 = "no data";
            try
            {
                //////////////////////////////////////////////
                // Calculate the percentage of players carrying > force magic weapons

                double players       = 0;
                double players_magic = 0;
                foreach (Mobile m in World.Mobiles.Values)
                {
                    if (m is PlayerMobile == false)
                    {
                        continue;
                    }
                    Container backpack = m.Backpack;
                    if (backpack != null)
                    {                       // get players account
                        Server.Accounting.Account ax = m.Account as Server.Accounting.Account;
                        if (ax == null)
                        {
                            continue;
                        }

                        // have they logged in within the last 90 days?
                        TimeSpan delta = DateTime.Now - ax.LastLogin;
                        if (delta.TotalDays > 90)
                        {
                            continue;
                        }

                        // filter for dexxers - get highest weapon skill
                        double sk1   = Math.Max(m.Skills[SkillName.Archery].Base, m.Skills[SkillName.Fencing].Base);
                        double sk2   = Math.Max(m.Skills[SkillName.Macing].Base, m.Skills[SkillName.Swords].Base);
                        double skill = Math.Max(sk1, sk2);
                        if (skill < 100)
                        {
                            continue;
                        }

                        // record all players that have a weapon on them
                        players++;
                        ArrayList stuff     = backpack.FindAllItems();
                        Item      oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                        Item      twoHanded = m.FindItemOnLayer(Layer.TwoHanded);
                        if (oneHanded is BaseWeapon && (oneHanded as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                        {
                            stuff.Add(oneHanded);
                        }
                        if (twoHanded is BaseWeapon && (twoHanded as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                        {
                            stuff.Add(twoHanded);
                        }

                        // record all the players that have a high end magic weapon on them
                        foreach (Item ix in stuff)
                        {
                            if (ix is BaseWeapon && (ix as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                            {                                   // we only count one high end weapon per player
                                players_magic++;
                                break;
                            }
                        }
                    }
                }

                if (players > 0)
                {
                    s1 = String.Format("Of {0} GM dexxers, {1}% are equipping Power or higher.", (int)players, (int)((players_magic / players) * 100));
                }

                //////////////////////////////////////////////
                // Calculate the average cost of > force weapons

                int total_magic = 0;
                int total_value = 0;
                foreach (Mobile m in World.Mobiles.Values)
                {
                    if (m is PlayerVendor)
                    {
                        PlayerVendor pv  = m as PlayerVendor;
                        Hashtable    tab = pv.SellItems;
                        foreach (DictionaryEntry de in tab)
                        {
                            if (de.Value is VendorItem)
                            {
                                if (de.Key is Item)
                                {
                                    Item ix = (de.Key as Item);
                                    if (ix is BaseWeapon && (ix as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                                    {
                                        total_magic++;
                                        total_value += (de.Value as VendorItem).Price;
                                    }
                                }
                            }
                        }
                    }
                }

                if (total_magic > 0)
                {
                    s2 = String.Format("Of {0} high end magic weapons, {1} is the average vendor cost.", total_magic, total_value / total_magic);
                }
            }
            catch (Exception err)
            {
                s1 = "Exception: " + err.Message;
            }
        }
示例#19
0
 public PVHuePicker(PlayerVendor vendor, bool facialHair, Mobile from) : base(0xFAB)
 {
     m_Vendor     = vendor;
     m_FacialHair = facialHair;
     m_From       = from;
 }
        public NewPlayerVendorOwnerGump(PlayerVendor vendor) : base(50, 200)
        {
            m_Vendor = vendor;

            int perRealWorldDay = vendor.ChargePerRealWorldDay;
            int goldHeld        = vendor.HoldGold;

            AddBackground(25, 10, 530, 180, 9270); //AddBackground( 25, 10, 530, 180, 0x13BE );

            AddImageTiled(35, 20, 510, 160, 0xA40);
            //AddAlphaRegion( 35, 20, 510, 160 );

            AddImage(10, 0, 0x28DC);
            AddImage(537, 175, 0x28DC);
            AddImage(10, 175, 0x28DC);
            AddImage(537, 0, 0x28DC);

            //if ( goldHeld < perRealWorldDay )
            {
                int goldNeeded = perRealWorldDay - goldHeld;

                AddHtml(40, 35, 260, 20, "Gold necessário para cada dia de salário:", false, false);
                //AddHtmlLocalized( 40, 35, 260, 20, 1038320, 0x7FFF, false, false ); // Gold needed for 1 day of vendor salary:
                AddLabel(300, 35, 0x1F, goldNeeded.ToString());
            }
            //else
            //{
            //    int days = goldHeld / perRealWorldDay;

            //    AddHtmlLocalized( 40, 35, 260, 20, 1038318, 0x7FFF, false, false ); // # of days Vendor salary is paid for:
            //    AddLabel( 300, 35, 0x480, days.ToString() );
            //}

            AddHtml(40, 58, 260, 20, "Meu salário por dia de trabalho é:", false, false); // My charge per real world day is:
            //AddHtmlLocalized( 40, 58, 260, 20, 1038324, 0x7FFF, false, false ); // My charge per real world day is:
            AddLabel(300, 58, 0x480, perRealWorldDay.ToString());

            AddHtml(40, 82, 260, 20, "Gold acumulado em minha conta:", false, false); // Gold held in my account:
            //AddHtmlLocalized( 40, 82, 260, 20, 1038322, 0x7FFF, false, false ); // Gold held in my account:
            AddLabel(300, 82, 0x480, goldHeld.ToString());

            AddHtml(40, 108, 260, 20, "Nome do Shop:", false, false); // Shop Name:
            //AddHtmlLocalized( 40, 108, 260, 20, 1062509, 0x7FFF, false, false ); // Shop Name:
            AddLabel(140, 106, 0x66D, vendor.ShopName);

            if (vendor is RentedVendor)
            {
                int days, hours;
                ((RentedVendor)vendor).ComputeRentalExpireDelay(out days, out hours);

                AddLabel(38, 132, 0x480, String.Format("Location rental will expire in {0} day{1} and {2} hour{3}.", days, days != 1 ? "s" : "", hours, hours != 1 ? "s" : ""));
            }

            AddButton(390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            AddHtml(408, 21, 120, 20, "Ver Itens", false, false); // See goods

            AddButton(390, 44, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
            AddHtml(408, 41, 120, 20, "Customizar", false, false); // Customize

            AddButton(390, 64, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
            AddHtml(408, 61, 120, 20, "Renomear Shop", false, false); // Rename Shop

            AddButton(390, 84, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
            AddHtml(408, 81, 120, 20, "Renomear Vendedor", false, false); // Rename Vendor

            AddButton(390, 104, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
            AddHtml(408, 101, 120, 20, "Abrir Paperdoll", false, false); // Open Paperdoll

            AddButton(390, 124, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
            AddLabel(408, 121, 0x480, "Coletar Gold");

            AddButton(390, 144, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0);
            AddLabel(408, 141, 0x480, "Despedir Vendedor");

            AddButton(390, 162, 0x15E1, 0x15E5, 0, GumpButtonType.Reply, 0);
            AddHtml(408, 161, 120, 20, "Cancelar", false, false); // CANCEL
        }
示例#21
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        price = m_Recipe.Price;
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, 1150158); // The price of the selected item has been changed from the value you confirmed. You must select and confirm the purchase again at the new price in order to buy it.
                        m_Book.Using = false;
                    }
                    else if (m_Recipe.Amount == 0 || price == 0)
                    {
                        pv.SayTo(m_From, 1158821); // The recipe selected is not available.
                        m_Book.Using = false;
                    }
                    else
                    {
                        Item item = new RecipeScroll(m_Recipe.RecipeID);

                        pv.Say(m_From.Name);

                        Container pack = m_From.Backpack;

                        if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                        {
                            m_Book.Recipes.ForEach(x =>
                            {
                                if (x.RecipeID == m_Recipe.RecipeID)
                                {
                                    x.Amount = x.Amount - 1;
                                }
                            });

                            m_Book.InvalidateProperties();

                            pv.HoldGold += price;

                            if (m_From.AddToBackpack(item))
                            {
                                m_From.SendLocalizedMessage(1158820); // The recipe has been placed in your backpack.
                            }
                            else
                            {
                                pv.SayTo(m_From, 503204); // You do not have room in your backpack for this.
                            }
                            m_From.SendGump(new RecipeBookGump(m_From, m_Book));
                        }
                        else
                        {
                            pv.SayTo(m_From, 503205); // You cannot afford this item.
                            item.Delete();
                            m_Book.Using = false;
                        }
                    }
                }
                else
                {
                    m_Book.Using = false;

                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1158821); // The recipe selected is not available.
                    }
                    else
                    {
                        pv.SayTo(m_From, 1158821); // The recipe selected is not available.
                    }
                }
            }
            else
            {
                m_Book.Using = false;
                m_From.SendLocalizedMessage(503207); // Cancelled purchase.
            }
        }
示例#22
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            int buttonID = info.ButtonID;


            if (buttonID == 2)
            {
                m_Page++;
                from.CloseGump(typeof(PlayersVendorsGump));
                from.SendGump(new PlayersVendorsGump(from, m_alPv, m_Page, m_alVi));
            }
            if (buttonID == 1)
            {
                m_Page--;
                from.CloseGump(typeof(PlayersVendorsGump));
                from.SendGump(new PlayersVendorsGump(from, m_alPv, m_Page, m_alVi));
            }
            if (buttonID > 100 && buttonID < 200)
            {
                int          index = buttonID - 101;
                PlayerVendor pv    = m_alPv[index] as PlayerVendor;
                Point3D      xyz   = pv.Location;
                int          x     = xyz.X;
                int          y     = xyz.Y;
                int          z     = xyz.Z;
                Point3D      dest  = new Point3D(x, y, z);

                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));

                int flags = (int)(from.NetState == null ? 0 : from.NetState.Flags);

                if (Factions.Sigil.ExistsOn(from))
                {
                    from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
                }

                else if (from.Spell != null)
                {
                    from.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                }
                //from.Backpack.ConsumeTotal(typeof(Gold), 500) ||
                else if (from.Backpack.ConsumeTotal(typeof(Gold), 500) || from.BankBox.ConsumeTotal(typeof(Gold), 500))
                {
                    if (pv.House != null)
                    {
                        from.MoveToWorld(pv.House.Sign.Location, pv.Map);
                    }
                    else
                    {
                        from.MoveToWorld(dest, pv.Map);
                    }

                    {
                        from.SendMessage("As a payment 500gp has been taken from your bag or bank.");
                    }
                }
                else
                {
                    from.SendMessage("You dont have enough gold to travel that vendor.");
                }
            }
        }
示例#23
0
        public VendorToolGump(Mobile from, PlayerVendor pv, int page)
            : base(50, 40)
        {
            // make sure we don't crash shit..
            try
            {
                from.CloseGump(typeof(VendorToolGump));

                m_Vendor = pv;
                m_Page   = page;
                ArrayList values = new ArrayList(m_Vendor.SellItems.Values);

                AddPage(0);

                AddImageTiled(0, 0, 430, 508, 0xA40);
                AddAlphaRegion(1, 1, 428, 506);

                AddHtml(0, 0, 428, 22, "<basefont color=#FFFFFF><center>Vendor Inventory</center></basefont>", false, false);
                AddHtml(2, 22, 200, 16, "<basefont color=#ffffff>Description</basefont>", false, false);
                AddHtml(203, 22, 50, 16, "<basefont color=#ffffff>Price</basefont>", false, false);
                AddHtml(254, 22, 110, 16, "<basefont color=#ffffff>Item</basefont>", false, false);
                for (int i = page * 20; i < page * 20 + 20 && i < m_Vendor.SellItems.Count; i++)
                {
                    VendorItem vi = values[i] as VendorItem;
                    if (vi == null)
                    {
                        continue;
                    }
                    AddHtml(2, 44 + 22 * (i % 20), 200, 16, String.Format("<basefont color=#ffffff>{0}</basefont>", vi.Description), false, false);
                    AddHtml(203, 44 + 22 * (i % 20), 50, 16, String.Format("<basefont color=#ffffff>{0}</basefont>", (vi.IsForSale ? vi.Price.ToString() : "NFS")), false, false);
                    string typename;
                    if (vi.Item == null)
                    {
                        typename = "null";
                    }
                    else
                    {
                        typename = vi.Item.GetType().ToString();
                        typename = typename.Substring(typename.LastIndexOf(".") + 1);
                    }
                    AddHtml(254, 44 + 22 * (i % 20), 110, 16, String.Format("<basefont color=#ffffff>{0}</basefont>", typename), false, false);
                    AddButton(369, 44 + 22 * (i % 20), 0xFB1, 0xFB3, 4 + 2 * i, GumpButtonType.Reply, 0);
                    AddButton(399, 44 + 22 * (i % 20), 0xFA5, 0xFA7, 5 + 2 * i, GumpButtonType.Reply, 0);
                }
                AddButton(1, 485, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0);
                AddHtml(35, 485, 100, 22, "<basefont color=#ffffff>Clear Vendor</basefont>", false, false);
                AddButton(200, 485, 0xFB7, 0xFB9, 0, GumpButtonType.Reply, 0);                 // ok
                if (m_Page > 0)
                {
                    AddButton(339, 485, 0xFAE, 0xFB0, 1, GumpButtonType.Reply, 0);                     // back
                }
                if (m_Vendor.SellItems.Count >= 20 * m_Page)
                {
                    AddButton(369, 485, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);                     // next
                }
            }
            catch
            {
                from.SendMessage("An error occurred while listing the vendor contents.");
            }
        }
示例#24
0
        public NewPlayerVendorOwnerGump(PlayerVendor vendor)
            : base(50, 200)
        {
            m_Vendor = vendor;

            int perRealWorldDay = vendor.ChargePerRealWorldDay;
            int goldHeld        = vendor.HoldCurrency;

            AddBackground(25, 10, 530, 180, 0x13BE);

            AddImageTiled(35, 20, 510, 160, 0xA40);
            AddAlphaRegion(35, 20, 510, 160);

            AddImage(10, 0, 0x28DC);
            AddImage(537, 175, 0x28DC);
            AddImage(10, 175, 0x28DC);
            AddImage(537, 0, 0x28DC);

            if (goldHeld < perRealWorldDay)
            {
                int goldNeeded = perRealWorldDay - goldHeld;

                AddHtml(
                    40,
                    35,
                    260,
                    20,
                    (m_Vendor.TypeOfCurrency.Name + " needed for 1 day of vendor salary:").WrapUOHtmlColor(0x7FFF),
                    false,
                    false);
                AddLabel(300, 35, 0x1F, goldNeeded.ToString("#,0"));
            }
            else
            {
                int days = goldHeld / perRealWorldDay;

                AddHtmlLocalized(40, 35, 260, 20, 1038318, 0x7FFF, false, false);                 // # of days Vendor salary is paid for:
                AddLabel(300, 35, 0x480, days.ToString("#,0"));
            }

            AddHtmlLocalized(40, 58, 260, 20, 1038324, 0x7FFF, false, false);             // My charge per real world day is:
            AddLabel(300, 58, 0x480, perRealWorldDay.ToString("#,0"));

            AddHtml(
                40, 82, 260, 20, (m_Vendor.TypeOfCurrency.Name + " held in my account:").WrapUOHtmlColor(0x7FFF), false, false);
            AddLabel(300, 82, 0x480, goldHeld.ToString("#,0"));

            AddHtmlLocalized(40, 108, 260, 20, 1062509, 0x7FFF, false, false);             // Shop Name:
            AddLabel(140, 106, 0x66D, vendor.ShopName);

            if (vendor is RentedVendor)
            {
                int days, hours;
                ((RentedVendor)vendor).ComputeRentalExpireDelay(out days, out hours);

                AddLabel(
                    38,
                    132,
                    0x480,
                    String.Format(
                        "Location rental will expire in {0} day{1} and {2} hour{3}.",
                        days,
                        days != 1 ? "s" : "",
                        hours,
                        hours != 1 ? "s" : ""));
            }

            AddButton(390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 21, 120, 20, 1019068, 0x7FFF, false, false);             // See goods

            AddButton(390, 44, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 41, 120, 20, 1019069, 0x7FFF, false, false);             // Customize

            AddButton(390, 64, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 61, 120, 20, 1062434, 0x7FFF, false, false);             // Rename Shop

            AddButton(390, 84, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 81, 120, 20, 3006217, 0x7FFF, false, false);             // Rename Vendor

            AddButton(390, 104, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 101, 120, 20, 3006123, 0x7FFF, false, false);             // Open Paperdoll

            AddButton(390, 124, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
            AddLabel(408, 121, 0x480, "Collect " + m_Vendor.TypeOfCurrency.Name);

            AddButton(390, 144, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0);
            AddLabel(408, 141, 0x480, "Dismiss Vendor");

            AddButton(390, 162, 0x15E1, 0x15E5, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(408, 161, 120, 20, 1011012, 0x7FFF, false, false);             // CANCEL
        }
示例#25
0
        public NewPlayerVendorCustomizeGump(PlayerVendor vendor)
            : base(50, 50)
        {
            m_Vendor = vendor;

            AddPage(0);

            if (!(vendor.Race == Race.Elf && vendor.Female))
            {
                AddKRHtmlLocalized(0, 0, 0, 0, vendor.Race != Race.Elf ? vendor.Female ? -2 : -1 : -3, false, false);
            }

            AddBackground(0, 0, 370, 370, 0x13BE);

            if (vendor.Race == Race.Elf && vendor.Female)
            {
                AddKRHtmlLocalized(0, 0, 0, 0, -4, false, false);
            }

            AddImageTiled(10, 10, 350, 20, 0xA40);
            AddImageTiled(10, 40, 350, 20, 0xA40);
            AddImageTiled(10, 70, 350, 260, 0xA40);
            AddImageTiled(10, 340, 350, 20, 0xA40);

            AddAlphaRegion(10, 10, 350, 350);

            AddHtmlLocalized(10, 12, 350, 18, 1011356, 0x7FFF, false, false); // <center>VENDOR CUSTOMIZATION MENU</center>

            AddButton(10, 340, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 342, 305, 18, 1060675, 0x7FFF, false, false); // CLOSE

            AddHtmlLocalized(10, 42, 150, 18, 1062459, 0x421F, false, false);  // <CENTER>HAIR</CENTER>

            HairOrBeard[] hairstyles;

            if (m_Vendor.Race != Race.Elf)
            {
                hairstyles = m_HairStyles;
            }
            else
            {
                hairstyles = m_Vendor.Female ? m_ElvenFemaleStyles : m_ElvenHairStyles;
            }

            for (int i = 0; i < hairstyles.Length; i++)
            {
                HairOrBeard hair = hairstyles[i];

                AddHtmlLocalized(45, 72 + i * 20, 110, 18, hair.Name, 0x7FFF, false, false);
                AddButton(10, 70 + i * 20, 0xFA5, 0xFA7, 0x100 | i, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(45, 252, 110, 18, 1011403, 0x7FFF, false, false); // Remove
            AddButton(10, 250, 0xFB1, 0xFB3, 11, GumpButtonType.Reply, 0);

            AddHtmlLocalized(45, 272, 110, 18, 1011402, 0x7FFF, false, false); // Color
            AddButton(10, 270, 0xFA5, 0xFA7, 101, GumpButtonType.Reply, 0);

            if (!vendor.Female && m_Vendor.Race != Race.Elf)
            {
                AddHtmlLocalized(160, 42, 210, 18, 1062460, 0x421F, false, false); // <CENTER>BEARD</CENTER>

                for (int i = 0; i < m_BeardStyles.Length; i++)
                {
                    HairOrBeard beard = m_BeardStyles[i];

                    AddHtmlLocalized(195, 72 + i * 20, 160, 18, beard.Name, 0x7FFF, false, false);
                    AddButton(160, 70 + i * 20, 0xFA5, 0xFA7, 0x200 | i, GumpButtonType.Reply, 0);
                }

                AddHtmlLocalized(195, 72 + m_BeardStyles.Length * 20, 160, 18, 1011403, 0x7FFF, false, false); // Remove
                AddButton(160, 70 + m_BeardStyles.Length * 20, 0xFB1, 0xFB3, 12, GumpButtonType.Reply, 0);

                AddHtmlLocalized(195, 72 + (m_BeardStyles.Length + 1) * 20, 160, 18, 1011402, 0x7FFF, false, false); // Color
                AddButton(160, 70 + (m_BeardStyles.Length + 1) * 20, 0xFA5, 0xFA7, 102, GumpButtonType.Reply, 0);
            }

            if (vendor.Female)
            {
                AddHtmlLocalized(195, 292, 160, 18, 1015327, 0x7FFF, false, false); // Male
                AddButton(160, 290, 0xFA5, 0xFA7, 201, GumpButtonType.Reply, 0);

                AddHtmlLocalized(195, 312, 160, 18, 1015328, 0x421F, false, false); // Female
            }
            else
            {
                AddHtmlLocalized(195, 292, 160, 18, 1015327, 0x421F, false, false); // Male
                AddHtmlLocalized(195, 312, 160, 18, 1015328, 0x7FFF, false, false); // Female

                AddButton(160, 310, 0xFA5, 0xFA7, 202, GumpButtonType.Reply, 0);
            }

            if (vendor.Race == Race.Elf)
            {
                AddHtmlLocalized(275, 292, 160, 18, 1072255, 0x7FFF, false, false); // Human
                AddButton(245, 290, 0xFA5, 0xFA7, 203, GumpButtonType.Reply, 0);
                AddHtmlLocalized(275, 312, 160, 18, 1072256, 0x421F, false, false); // Elf
            }
            else
            {
                AddHtmlLocalized(275, 292, 160, 18, 1072255, 0x421F, false, false); // Human
                AddHtmlLocalized(275, 312, 160, 18, 1072256, 0x7FFF, false, false); // Elf

                AddButton(245, 310, 0xFA5, 0xFA7, 204, GumpButtonType.Reply, 0);
            }
        }
示例#26
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, 503246); // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house == null)
                {
                    from.SendLocalizedMessage(503240); // Vendors can only be placed in houses.
                }
                else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from))
                {
                    from.SendLocalizedMessage(503242); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here.
                }
                else if (BaseHouse.NewVendorSystem && !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062423); // Only the house owner can directly place vendors.  Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.
                }
                else if (!house.Public || !house.CanPlaceNewVendor())
                {
                    from.SendLocalizedMessage(503241); // You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available.
                }
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract!
                    }
                    else
                    {
                        Mobile v = new PlayerVendor(from, house);

                        v.Direction = from.Direction & Direction.Mask;
                        v.MoveToWorld(from.Location, from.Map);

                        v.SayTo(from, 503246); // Ah! it feels good to be working again.

                        this.Delete();
                    }
                }
            }
        }
示例#27
0
        public NewPlayerVendorOwnerGump(PlayerVendor vendor)
            : base(50, 200)
        {
            m_Vendor = vendor;

            int perRealWorldDay = vendor.ChargePerRealWorldDay;
            int goldHeld        = vendor.HoldGold;

            int days       = 0;
            int goldNeeded = 0;

            if (goldHeld < perRealWorldDay)
            {
                goldNeeded = perRealWorldDay - goldHeld;
            }
            else
            {
                days = goldHeld / perRealWorldDay;
            }

            /*0*/
            Intern(days.ToString());
            /*1*/
            Intern("");
            /*2*/
            Intern(goldNeeded.ToString());
            /*3*/
            Intern(goldHeld.ToString());
            /*4*/
            Intern("");
            /*5*/
            Intern(perRealWorldDay.ToString());
            /*6*/
            Intern("");

            if (vendor is RentedVendor)
            {
                int dayz, hours;
                ((RentedVendor)vendor).ComputeRentalExpireDelay(out dayz, out hours);

                /*7*/
                Intern(String.Format("Location rental will expire in {0} day{1} and {2} hour{3}.", dayz, dayz != 1 ? "s" : "", hours, hours != 1 ? "s" : ""));
            }
            else
            {
                /*7*/
                Intern("");
            }

            /*8*/
            Intern(vendor.ShopName);
            /*9*/
            Intern(vendor.Name);
            /*10*/
            Intern("Collect Gold");
            /*11*/
            Intern("Dismiss Vendor");

            ///////////////

            AddPage(0);

            AddBackground(25, 10, 530, 180, 0x13BE);

            AddImageTiled(35, 20, 510, 160, 0xA40);
            AddAlphaRegion(35, 20, 510, 160);

            AddImage(10, 0, 0x28DC);
            AddImage(537, 175, 0x28DC);
            AddImage(10, 175, 0x28DC);
            AddImage(537, 0, 0x28DC);

            AddHtmlLocalized(408, 21, 120, 20, 1019068, 0x7FFF, false, false);  // See goods
            AddHtmlLocalized(408, 41, 120, 20, 1019069, 0x7FFF, false, false);  // Customize
            AddHtmlLocalized(408, 61, 120, 20, 1062434, 0x7FFF, false, false);  // Rename Shop
            AddHtmlLocalized(408, 81, 120, 20, 3006217, 0x7FFF, false, false);  // Rename Vendor
            AddHtmlLocalized(408, 101, 120, 20, 3006123, 0x7FFF, false, false); // Open Paperdoll
            AddLabelIntern(408, 121, 0x480, 10);
            AddLabelIntern(408, 141, 0x480, 11);
            AddHtmlLocalized(408, 161, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL

            AddHtmlLocalized(40, 82, 260, 20, 1038322, 0x7FFF, false, false);   // Gold held in my account:
            AddHtmlLocalized(40, 58, 260, 20, 1038324, 0x7FFF, false, false);   // My charge per real world day is:
            AddHtmlLocalized(40, 108, 260, 20, 1062509, 0x7FFF, false, false);  // Shop Name:

            AddLabelIntern(300, 82, 0x480, 3);
            AddLabelIntern(300, 58, 0x480, 5);

            AddButton(390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            AddButton(390, 44, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
            AddButton(390, 64, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
            AddButton(390, 84, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
            AddButton(390, 104, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
            AddButton(390, 124, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0);
            AddButton(390, 144, 0x15E1, 0x15E5, 8, GumpButtonType.Reply, 0);
            AddButton(390, 162, 0x15E1, 0x15E5, 0, GumpButtonType.Reply, 0);

            if (vendor is RentedVendor)
            {
                AddLabelIntern(38, 132, 0x480, 7);
            }

            AddLabelIntern(140, 106, 0x66D, 8);

            if (goldHeld < perRealWorldDay)
            {
                AddHtmlLocalized(40, 35, 260, 20, 1038320, 0x7FFF, false, false); // Gold needed for 1 day of vendor salary:
                AddLabelIntern(300, 35, 0x1F, 2);
            }
            else
            {
                AddHtmlLocalized(40, 35, 260, 20, 1038318, 0x7FFF, false, false); // # of days Vendor salary is paid for:
                AddLabelIntern(300, 35, 0x480, 0);
            }
        }
示例#28
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (m_Book.Entries.Contains(m_Object) && pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        if (m_Object is BOBLargeEntry)
                        {
                            price = ((BOBLargeEntry)m_Object).Price;
                        }
                        else if (m_Object is BOBSmallEntry)
                        {
                            price = ((BOBSmallEntry)m_Object).Price;
                        }
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
                    }
                    else if (price == 0)
                    {
                        pv.SayTo(m_From, 1062382); // The deed selected is not available.
                    }
                    else
                    {
                        Item item = null;

                        if (m_Object is BOBLargeEntry)
                        {
                            item = ((BOBLargeEntry)m_Object).Reconstruct();
                        }
                        else if (m_Object is BOBSmallEntry)
                        {
                            item = ((BOBSmallEntry)m_Object).Reconstruct();
                        }

                        if (item == null)
                        {
                            m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
                        }
                        else
                        {
                            pv.Say(m_From.Name);

                            Container pack = m_From.Backpack;

                            if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
                            {
                                pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
                                m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                            }
                            else
                            {
                                if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                                {
                                    m_Book.Entries.Remove(m_Object);
                                    m_Book.InvalidateProperties();
                                    pv.HoldGold += price;
                                    m_From.AddToBackpack(item);
                                    m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.

                                    if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
                                    {
                                        m_Book.ItemCount--;
                                        m_Book.InvalidateItems();
                                    }

                                    if (m_Book.Entries.Count > 0)
                                    {
                                        m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                                    }
                                    else
                                    {
                                        m_From.SendLocalizedMessage(1062381); // The book is empty.
                                    }
                                }
                                else
                                {
                                    pv.SayTo(m_From, 503205); // You cannot afford this item.
                                    item.Delete();
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
                    }
                    else
                    {
                        pv.SayTo(m_From, 1062382); // The deed selected is not available.
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(503207); // Cancelled purchase.
            }
        }
示例#29
0
 public VendorPricePrompt( PlayerVendor vendor, Item item, Item target, VendorItem vi )
 {
     m_Vendor = vendor;
     m_Item = item;
     m_Cont = target;
     m_VI = vi;
 }
示例#30
0
文件: BOBGump.cs 项目: avatar21/runuo
        public BOBGump(PlayerMobile from, BulkOrderBook book, int page, ArrayList list) : base(12, 24)
        {
            from.CloseGump(typeof(BOBGump));
            from.CloseGump(typeof(BOBFilterGump));

            m_From = from;
            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new ArrayList(book.Entries.Count);

                for (int i = 0; i < book.Entries.Count; ++i)
                {
                    object obj = book.Entries[i];

                    if (CheckFilter(obj))
                    {
                        list.Add(obj);
                    }
                }
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canDrop  = book.IsChildOf(from.Backpack);
            bool canBuy   = (pv != null);
            bool canPrice = (canDrop || canBuy);

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = (vi != null && !vi.IsForSale);
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            AddImageTiled(231, 64, 80, 352, 200);
            AddImageTiled(313, 64, 100, 352, 1416);
            AddImageTiled(415, 64, 76, 352, 200);

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                object obj = list[i];

                if (!CheckFilter(obj))
                {
                    continue;
                }

                AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);

                if (obj is BOBLargeEntry)
                {
                    tableIndex += ((BOBLargeEntry)obj).Entries.Length;
                }
                else if (obj is BOBSmallEntry)
                {
                    ++tableIndex;
                }
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(5, 5, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(5, 424, 10460);
            AddImage(width - 15, 424, 10460);

            AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
            AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false);                   // Type
            AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false);                  // Item
            AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor, false, false);                  // Quality
            AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor, false, false);                  // Material
            AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false);                  // Amount

            AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false);               // Set Filter

            BOBFilter f = (from.UseOwnFilter ? from.BOBFilter : book.Filter);

            if (f.IsDefault)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false);                   // Using No Filter
            }
            else if (from.UseOwnFilter)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false);                   // Using Your Filter
            }
            else
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false);                   // Using Book Filter
            }
            AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false);               // EXIT

            if (canDrop)
            {
                AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false);                   // Drop
            }
            if (canPrice)
            {
                AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false);                   // Price

                if (canBuy)
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false);                       // Buy
                }
                else
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false);                       // Set

                    AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
                    AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
                }
            }

            tableIndex = 0;

            if (page > 0)
            {
                AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false);                   // Previous page
            }

            if (GetIndexForPage(page + 1) < list.Count)
            {
                AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false);                   // Next page
            }

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                object obj = list[i];

                if (!CheckFilter(obj))
                {
                    continue;
                }

                if (obj is BOBLargeEntry)
                {
                    BOBLargeEntry e = (BOBLargeEntry)obj;

                    int y = 96 + (tableIndex * 32);

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
                    }

                    if (canDrop || (canBuy && e.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
                        AddLabel(495, y, 1152, e.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false);                       // Large

                    for (int j = 0; j < e.Entries.Length; ++j)
                    {
                        BOBLargeSubEntry sub = e.Entries[j];

                        AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);

                        if (e.RequireExceptional)
                        {
                            AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false);                               // exceptional
                        }
                        else
                        {
                            AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false);                               // normal
                        }
                        object name = GetMaterialName(e.Material, e.DeedType, sub.ItemType);

                        if (name is int)
                        {
                            AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
                        }
                        else if (name is string)
                        {
                            AddLabel(316, y, 1152, (string)name);
                        }

                        AddLabel(421, y, 1152, String.Format("{0} / {1}", sub.AmountCur, e.AmountMax));

                        ++tableIndex;
                        y += 32;
                    }
                }
                else if (obj is BOBSmallEntry)
                {
                    BOBSmallEntry e = (BOBSmallEntry)obj;

                    int y = 96 + (tableIndex++ *32);

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
                    }

                    if (canDrop || (canBuy && e.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
                        AddLabel(495, y, 1152, e.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false);                       // Small

                    AddHtmlLocalized(103, y, 130, 32, e.Number, LabelColor, false, false);

                    if (e.RequireExceptional)
                    {
                        AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false);                           // exceptional
                    }
                    else
                    {
                        AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false);                           // normal
                    }
                    object name = GetMaterialName(e.Material, e.DeedType, e.ItemType);

                    if (name is int)
                    {
                        AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
                    }
                    else if (name is string)
                    {
                        AddLabel(316, y, 1152, (string)name);
                    }

                    AddLabel(421, y, 1152, String.Format("{0} / {1}", e.AmountCur, e.AmountMax));
                }
            }
        }
示例#31
0
        public RecipeBookGump(Mobile from, RecipeBook book, int page, List <RecipeScrollDefinition> list)
            : base(12, 24)
        {
            from.CloseGump(typeof(RecipeBookGump));
            from.CloseGump(typeof(RecipeScrollFilterGump));

            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new List <RecipeScrollDefinition>();

                m_Book.Recipes.ForEach(x =>
                {
                    if (CheckFilter(x))
                    {
                        list.Add(x);
                    }
                });
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canLocked = book.IsLockedDown;
            bool canDrop   = book.IsChildOf(from.Backpack);
            bool canBuy    = (pv != null);
            bool canPrice  = (canDrop || canBuy || canLocked);

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = (vi != null && !vi.IsForSale);
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            AddImageTiled(231, 64, 80, 352, 200);
            AddImageTiled(313, 64, 100, 352, 1416);
            AddImageTiled(415, 64, 76, 352, 200);

            list = list.OrderBy(x => x.ID).ToList();

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                var recipe = list[i];

                if (!CheckFilter(recipe))
                {
                    continue;
                }

                AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);

                ++tableIndex;
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(0, 0, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(0, 429, 10460);
            AddImage(width - 15, 429, 10460);

            AddHtmlLocalized(266, 32, 200, 32, 1158810, LabelColor, false, false); // Recipe Book

            AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false); // Item
            AddHtmlLocalized(246, 64, 200, 32, 1158814, LabelColor, false, false); // Expansion
            AddHtmlLocalized(336, 64, 200, 32, 1158816, LabelColor, false, false); // Crafting
            AddHtmlLocalized(429, 64, 100, 32, 1062217, LabelColor, false, false); // Amount

            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false);  // Set Filter
            AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);

            RecipeScrollFilter f = book.Filter;

            if (f.IsDefault)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
            }
            else if (((PlayerMobile)from).UseOwnFilter)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
            }
            else
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
            }
            AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT

            if (canDrop)
            {
                AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
            }
            if (canPrice)
            {
                AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price

                if (canBuy)
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
                }
                else
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
                }
            }

            tableIndex = 0;

            if (page > 0)
            {
                AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
            }

            if (GetIndexForPage(page + 1) < list.Count)
            {
                AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
            }

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                var recipe = list[i];

                if (!CheckFilter(recipe) || !Recipe.Recipes.ContainsKey(recipe.RecipeID))
                {
                    continue;
                }

                int y = 96 + (tableIndex++ *32);

                if (recipe.Amount > 0 && (canDrop || canLocked))
                {
                    AddButton(35, y + 2, 5602, 5606, 4 + (i * 2), GumpButtonType.Reply, 0);
                }

                AddLabel(61, y, 0x480, string.Format("{0}", recipe.ID));
                AddHtmlLocalized(103, y, 130, 32, Recipe.Recipes[recipe.RecipeID].TextDefinition.Number, "#103221", 0xFFFFFF, false, false); // ~1_val~
                AddLabel(235, y, 0x480, GetExpansion(recipe.Expansion));
                AddHtmlLocalized(316, y, 100, 20, GetSkillName(recipe.Skill), "#104409", 0xFFFFFF, false, false);                            // ~1_val~
                AddLabel(421, y, 0x480, recipe.Amount.ToString());

                if (canDrop || (canBuy && recipe.Price > 0))
                {
                    AddButton(579, y + 2, 2117, 2118, 5 + (i * 2), GumpButtonType.Reply, 0);
                    AddLabel(495, y, 1152, recipe.Price.ToString("N0"));
                }
            }
        }