public static void RemoveUserOrder(OrderRecord order)
 {
     if (order.m_type == 1)
     {
         MarketDatabase.CancelSellOrder(order.m_uniqueID, order.m_itemType, order.m_market);
     }
     else
     {
         MarketDatabase.CancelBuyOrder(order.m_uniqueID, order.m_itemType, order.m_market);
     }
 }
        public static void ChangeAmountUserOrder(MarketDatabase.Order order, String market)
        {
            MarketUserContainer authorBox  = MarketDatabase.GetAccountBox(order.author as PlayerMobile, market);
            List <OrderRecord>  UserOrders = authorBox.UserOrders;

            for (int i = 0; i < UserOrders.Count; ++i)
            {
                if (UserOrders[i].m_uniqueID == order.uniqueID && UserOrders[i].m_market == market)
                {
                    UserOrders[i].m_amountCurrent = order.amount;
                    return;
                }
            }
        }
Beispiel #3
0
            public static List <MarketDatabase.BuyOrder> SearchForObjectTypes(List <Type> types, String Market)
            {
                List <MarketDatabase.BuyOrder> results = new List <MarketDatabase.BuyOrder>();

                for (int i = 0; i < types.Count; ++i)
                {
                    String Name = types[i].Name;

                    Hashtable BuyOrders = MarketDatabase.GetBuyOrders(Market);
                    if (BuyOrders.ContainsKey(Name))
                    {
                        results.AddRange((List <MarketDatabase.BuyOrder>)BuyOrders[Name]);
                    }
                }
                return(results);
            }
Beispiel #4
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                switch (info.ButtonID)
                {
                case 1:     // continue
                {
                    MarketDatabase.FulfillBuyOrder(m_From, m_Order, m_Market, m_Target);
                    break;
                }

                case 2:     // cancel
                {
                    m_From.SendMessage("Sale aborted.");
                    break;
                }
                }
            }
Beispiel #5
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                switch (info.ButtonID)
                {
                case 1:     // continue
                {
                    MarketDatabase.BuySellOrder(m_From, m_Order, m_Market, m_amountToBuy);
                    break;
                }

                case 2:     // cancel
                {
                    m_From.SendMessage("Purchase aborted.");
                    break;
                }
                }
            }
        public static List <OrderRecord> GetUserOrders(Mobile from, String Market)
        {
            MarketUserContainer userContainer = MarketDatabase.GetAccountBox(from as PlayerMobile, Market);

            return(userContainer.UserOrders);
        }
        public static void AddUserOrder(MarketDatabase.Order order, String market)
        {
            MarketUserContainer authorBox = MarketDatabase.GetAccountBox(order.author as PlayerMobile, market);

            authorBox.UserOrders.Add(new OrderRecord((order is MarketDatabase.SellOrder) ? 1 : 2, market, order));
        }
        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;
                }
            }
        }
Beispiel #9
0
            public MarketItemBuySearchGump(Mobile from, string searchString, int page, List <MarketDatabase.SellOrder> searchResults, String Market)
                : base(50, 50)
            {
                m_SearchString  = searchString;
                m_SearchResults = searchResults;
                m_Page          = page;
                m_Market        = Market;

                if (m_SearchString == "" && m_Page == 0 && m_SearchResults.Count == 0)
                {
                    m_SearchResults = SearchForObjectTypes(MarketDatabase.GetAllSellOrderTypes(m_Market), m_Market);
                }

                CancelAllGumpsAndPrompts.Run(from);

                AddPage(0);

                AddBackground(0, 0, 420, 330 /*310/*280*/, 5054);

                AddLabel(10, 6, 0x480, "Viewing the \"" + m_Market + "\" market's orders of sale.");

                AddImageTiled(10, 30, 400, 20, 2624);
                AddAlphaRegion(10, 30, 400, 20);
                AddImageTiled(41, 31, 184, 18, 0xBBC);
                AddImageTiled(42, 32, 182, 16, 2624);
                AddAlphaRegion(42, 32, 182, 16);

                AddButton(10, 29, 4011, 4013, 1, GumpButtonType.Reply, 0);
                AddTextEntry(44, 30, 180, 20, 0x480, 0, m_SearchString);

                AddHtmlLocalized(230, 30, 100, 20, 3010005, 0x7FFF, false, false);

                AddButton(110, 300, 4011, 4013, 4, GumpButtonType.Reply, 0);
                AddLabel(140, 300, 0x480, "Click here to sell something!");

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

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

                        AddLabel(44, 59 + (index * 20), 0x480, m_SearchResults[i].itemType.Name);
                        AddLabel(184, 59 + (index * 20), 0x480, "x" + m_SearchResults[i].amount);
                        AddLabel(254, 59 + (index * 20), 0x480, "" + m_SearchResults[i].unitPrice + " gold each");

                        AddButton(10, 59 + (index * 20), 4005, 4007, 5 + i, GumpButtonType.Reply, 0);
                    }
                }
                else
                {
                    if (m_SearchString == "")
                    {
                        AddLabel(15, 64, 0x480, "Enter a name of an item or animal to search for.");
                    }
                    else
                    {
                        Type t = ScriptCompiler.FindTypeByName(String.Join("", m_SearchString.Split(' ')));

                        if (t == null)
                        {
                            AddLabel(15, 64, 0x480, "No item or animal with that name was found.");
                        }
                        else
                        {
                            AddLabel(15, 64, 0x480, "Searched for " + t.Name + " and found none.");
                        }
                    }
                }

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

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

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

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

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