Пример #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                int available = Vendor.MaxAmount - MiningCooperative.PurchaseAmount(from);
                int payment   = Vendor.Quantity * Vendor.Price;

                if (info.ButtonID == 1)
                {
                    if (available > 0)
                    {
                        if (Banker.Withdraw(from, payment, true))
                        {
                            CommodityDeed deed = new CommodityDeed();
                            deed.SetCommodity(new EtherealSand(Vendor.Quantity));
                            from.AddToBackpack(deed);

                            MiningCooperative.AddPurchase(from, Vendor.Quantity);
                            from.SendGump(new MiningCooperativeGump(Vendor, from));
                        }
                        else
                        {
                            Vendor.Say(500192); // Begging thy pardon, but thou canst not afford that.
                        }
                    }
                    else
                    {
                        Vendor.Say(1159195); // Begging thy pardon, but your family has purchased the maximum amount of that commodity.  I cannot sell you more until a new shipment arrives!
                    }
                }
            }
Пример #2
0
            public MiningCooperativeGump(MiningCooperativeMerchant vendor, Mobile from)
                : base(100, 100)
            {
                Vendor = vendor;

                AddPage(0);

                int available = vendor.MaxAmount - MiningCooperative.PurchaseAmount(from);

                AddBackground(0, 0, 310, 350, 0x6DB);
                AddImage(54, 0, 0x6E4);
                AddHtmlLocalized(10, 10, 290, 18, 1114513, "#1154040", 0x0, false, false);                                                                             // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
                AddItem(20, 80, 0xA3E8);
                AddHtmlLocalized(120, 73, 180, 18, 1159190, 0x43FF, false, false);                                                                                     // Ethereal Sand
                AddHtmlLocalized(120, 100, 180, 18, 1159191, vendor.Price.ToString(), 0x43FF, false, false);                                                           // GP: ~1_VALUE~
                AddItem(20, 140, 0x14F0);
                AddHtmlLocalized(120, 143, 180, 18, 1159193, string.Format("{0}@{1}", vendor.Quantity, vendor.Quantity * vendor.Price), 0x5FF0, false, false);         // x~1_QUANT~ GP: ~2_COST~
                AddHtmlLocalized(25, 203, 275, 18, 1159192, string.Format("{0}@{1}", available, vendor.MaxAmount), 0x7FF0, false, false);                              // Available For Purchase: ~1_PART~ / ~2_WHOLE~
                AddHtmlLocalized(20, 243, 160, 72, 1159194, string.Format("{0}@#1159190@{1}", vendor.Quantity, vendor.Quantity * vendor.Price), 0x7FFF, false, false); // Purchase a Commodity Deed filled with ~1_QUANT~ ~2_NAME~ for ~3_COST~ GP?
                AddButton(220, 260, 0x81C, 0x81B, 1, GumpButtonType.Reply, 0);
            }