コード例 #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                switch (info.ButtonID)
                {
                case 2:     // Previous page
                {
                    if (m_Page > 0)
                    {
                        from.SendGump(new UserAccountSearchGump(from, m_Page - 1, m_SearchResults, m_Market));
                    }

                    break;
                }

                case 3:     // Next page
                {
                    if ((m_Page + 1) * 10 < m_SearchResults.Count)
                    {
                        from.SendGump(new UserAccountSearchGump(from, m_Page + 1, m_SearchResults, m_Market));
                    }

                    break;
                }

                default:
                {
                    int index = info.ButtonID - 5;

                    //Give them more info on item m_SearchResults[index].
                    if (index >= 0 && index < m_SearchResults.Count)
                    {
                        if (from is PlayerMobile)
                        {
                            MarketUserContainer.RemoveUserOrder(m_SearchResults[index]);
                            from.SendGump(new UserAccountSearchGump(from, 0, null, m_Market));
                        }
                    }

                    break;
                }
                }
            }
コード例 #2
0
        public void HandleSpeech(Mobile from, String speech)
        {
            if (speech.Contains("vendor") || speech.Contains(Name.ToLower()))
            {
                if (from is PlayerMobile && speech.Contains("information")) // vendor, *buy*
                {
                    Say("I am a marketeer for the " + m_Market + " market, i manage the buy and sell orders of items or creatures for my customers.");
                    return;
                }

                if (from is PlayerMobile && speech.Contains("buy")) // vendor, *buy*
                {
                    List <MarketDatabase.SellOrder> results = new List <MarketDatabase.SellOrder>();
                    from.SendGump(new MarketItemBuySearchGump(from, "", 0, results, m_Market));
                    Say("Feel free to search the my records of items for sale.");
                    return;
                }

                if (from is PlayerMobile && speech.Contains("sell")) // vendor, *buy*
                {
                    if (from.Target != null)
                    {
                        from.SendMessage("You can't sell something like your target cursor is in use.");
                        return;
                    }
                    Say("What would you like to put up for sale?");

                    from.SendMessage("Select an item in your inventory, bank box or " + m_Market + " market account box, or tamed pet you wish to put for sale.");
                    from.Target = new MarketDatabase.SellOrderTarget(m_Market);
                    return;
                }

                if (from is PlayerMobile && (speech.Contains("claim") || speech.Contains("inventory"))) // vendor, *claim*
                {
                    MarketUserContainer accountBox = MarketDatabase.GetAccountBox(from as PlayerMobile, m_Market);
                    if (accountBox != null)
                    {
                        if (accountBox.Summon(from))
                        {
                            Say("Here you go; your account chest.");
                        }
                    }
                    return;
                }

                if (from is PlayerMobile && speech.Contains("order")) // vendor, *orders*
                {
                    List <MarketDatabase.BuyOrder> results = new List <MarketDatabase.BuyOrder>();
                    from.SendGump(new MarketBuyOrderSearchGump(from, "", 0, results, m_Market));
                    Say("Your welcome to search my records of customer requests.");
                    return;
                }

                if (from is PlayerMobile && (speech.Contains("account") || speech.Contains("my offer"))) // vendor, *account*
                {
                    from.SendGump(new UserAccountSearchGump(from, 0, null, m_Market));
                    Say("Here are your current market records.");
                    return;
                }
            }
        }
コード例 #3
0
            public UserAccountSearchGump(Mobile from, int page, List <MarketUserContainer.OrderRecord> searchResults, String Market)
                : base(50, 50)
            {
                m_SearchResults = (searchResults != null) ? searchResults : MarketUserContainer.GetUserOrders(from, Market);
                m_Page          = page;
                m_Market        = Market;

                CancelAllGumpsAndPrompts.Run(from);

                AddPage(0);

                AddBackground(0, 0, 420, 270, 5054);

                AddLabel(10, 6, 0x480, "Viewing your account for the \"" + m_Market + "\" market.");

                AddImageTiled(10, 30, 400, 200, 2624);
                AddAlphaRegion(10, 30, 400, 200);

                if (m_SearchResults.Count > 0)
                {
                    for (int i = (page * 10); i < ((page + 1) * 10) && i < m_SearchResults.Count; ++i)
                    {
                        int index = i % 10;

                        AddLabel(44, 29 + (index * 20), 0x480, (m_SearchResults[i].m_type == 1) ? "Sell" : "Buy");
                        AddLabel(70, 29 + (index * 20), 0x480, m_SearchResults[i].m_itemType.Name);
                        int amountToShow = (m_SearchResults[i].m_type == 1) ? m_SearchResults[i].m_amountCurrent : (m_SearchResults[i].m_amountStart - m_SearchResults[i].m_amountCurrent);
                        AddLabel(184, 29 + (index * 20), 0x480, m_SearchResults[i].m_unitPrice + "gp, " + amountToShow + "/" + m_SearchResults[i].m_amountStart + " %" + m_SearchResults[i].PercentComplete() + " complete.");
                        //AddLabel(254, 59 + (index * 20), 0x480, "" + searchResults[i].unitPrice + " gold each");

                        AddButton(10, 29 + (index * 20), 4005, 4007, 5 + i, GumpButtonType.Reply, 0);
                    }
                }
                else
                {
                    AddLabel(15, 34, 0x480, "You currently have no buy or sell orders.");
                }

                AddImageTiled(10, 240, 400, 20, 2624);
                AddAlphaRegion(10, 240, 400, 20);

                if (m_Page > 0)
                {
                    AddButton(10, 239, 4014, 4016, 2, GumpButtonType.Reply, 0);
                }
                else
                {
                    AddImage(10, 239, 4014);
                }

                AddHtmlLocalized(44, 240, 170, 20, 1061028, m_Page > 0 ? 0x7FFF : 0x5EF7, false, false); // Previous page

                if (((m_Page + 1) * 10) < m_SearchResults.Count)
                {
                    AddButton(210, 239, 4005, 4007, 3, GumpButtonType.Reply, 0);
                }
                else
                {
                    AddImage(210, 239, 4005);
                }

                AddHtmlLocalized(244, 240, 170, 20, 1061027, ((m_Page + 1) * 10) < m_SearchResults.Count ? 0x7FFF : 0x5EF7, false, false); // Next page
            }