Beispiel #1
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (!m_Buttons.Contains(info.ButtonID))
            {
                Console.WriteLine(@"The auction system located a potential exploit. 
					Player {0} (Acc. {1}) tried to press an unregistered button in a gump of type: {2}"                    ,
                                  sender.Mobile != null ? sender.Mobile.ToString() : "Unkown",
                                  sender.Mobile != null && sender.Mobile.Account != null ? (sender.Mobile.Account as Server.Accounting.Account).Username : "******",
                                  this.GetType().Name);

                return;
            }

            if (!AuctionSystem.Running)
            {
                sender.Mobile.SendMessage(AuctionSystem.MessageHue, AuctionSystem.ST[15]);
                return;
            }

            if (info.ButtonID == 0)
            {
                // Cancel
                sender.Mobile.SendGump(new AuctionListing(sender.Mobile, m_List, true, m_ReturnToAuction));
                return;
            }

            bool      searchExisting = false;
            bool      artifacts      = false;
            bool      commodity      = false;
            ArrayList types          = new ArrayList();
            string    text           = null;

            if (info.TextEntries[0].Text != null && info.TextEntries[0].Text.Length > 0)
            {
                text = info.TextEntries[0].Text;
            }

            foreach (int check in info.Switches)
            {
                switch (check)
                {
                case 0: searchExisting = true;
                    break;

                case 1: types.Add(typeof(MapItem));
                    break;

                case 2: types.Add(typeof(BaseReagent));
                    break;

                case 3: commodity = true;
                    break;

                case 4:
                    types.Add(typeof(StatCapScroll));
                    types.Add(typeof(PowerScroll));
                    break;

                case 5: types.Add(typeof(BaseJewel));
                    break;

                case 6: types.Add(typeof(BaseWeapon));
                    break;

                case 7: types.Add(typeof(BaseArmor));
                    break;

                case 8: types.Add(typeof(BaseShield));
                    break;

                case 9: artifacts = true;
                    break;

                case 10: types.Add(typeof(Server.Engines.BulkOrders.SmallBOD));
                    break;

                case 11: types.Add(typeof(Server.Engines.BulkOrders.LargeBOD));
                    break;

                case 12:
                    types.Add(typeof(BasePotion));
                    types.Add(typeof(PotionKeg));
                    break;
                }
            }

            ArrayList source = null;

            if (searchExisting)
            {
                source = new ArrayList(m_List);
            }
            else
            {
                source = new ArrayList(AuctionSystem.Auctions);
            }

            ArrayList typeSearch      = null;
            ArrayList commoditySearch = null;
            ArrayList artifactsSearch = null;

            if (types.Count > 0)
            {
                typeSearch = AuctionSearch.ForTypes(source, types);
            }

            if (commodity)
            {
                commoditySearch = AuctionSearch.ForCommodities(source);
            }

            if (artifacts)
            {
                artifactsSearch = AuctionSearch.ForArtifacts(source);
            }

            ArrayList results = new ArrayList();

            if (typeSearch == null && artifactsSearch == null && commoditySearch == null)
            {
                results.AddRange(source);
            }
            else
            {
                if (typeSearch != null)
                {
                    results.AddRange(typeSearch);
                }

                if (commoditySearch != null)
                {
                    results = AuctionSearch.Merge(results, commoditySearch);
                }

                if (artifactsSearch != null)
                {
                    results = AuctionSearch.Merge(results, artifactsSearch);
                }
            }

            // Perform search
            if (text != null)
            {
                results = AuctionSearch.SearchForText(results, text);
            }

            sender.Mobile.SendGump(new AuctionListing(
                                       sender.Mobile,
                                       results,
                                       true,
                                       m_ReturnToAuction));
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (!AuctionSystem.Running)
            {
                sender.Mobile.SendMessage(AuctionConfig.MessageHue, AuctionSystem.ST[15]);
                return;
            }

            if (info.ButtonID == 0)
            {
                // Cancel
                sender.Mobile.SendGump(new AuctionListing(sender.Mobile, m_List, true, m_ReturnToAuction));
                return;
            }

            bool      searchExisting = false;
            bool      artifacts      = false;
            bool      commodity      = false;
            ArrayList types          = new ArrayList();
            string    text           = null;

            if (info.TextEntries[0].Text != null && info.TextEntries[0].Text.Length > 0)
            {
                text = info.TextEntries[0].Text;
            }

            foreach (int check in info.Switches)
            {
                switch (check)
                {
                case 0: searchExisting = true;
                    break;

                case 1: types.Add(typeof(MapItem));
                    break;

                case 2: types.Add(typeof(BaseReagent));
                    break;

                case 3: commodity = true;
                    break;

                case 4:
                    types.Add(typeof(StatCapScroll));
                    types.Add(typeof(PowerScroll));
                    break;

                case 5: types.Add(typeof(BaseJewel));
                    break;

                case 6: types.Add(typeof(BaseWeapon));
                    break;

                case 7: types.Add(typeof(BaseArmor));
                    break;

                case 8: types.Add(typeof(BaseShield));
                    break;

                case 9: artifacts = true;
                    break;

                case 10: types.Add(typeof(Server.Engines.BulkOrders.SmallBOD));
                    break;

                case 11: types.Add(typeof(Server.Engines.BulkOrders.LargeBOD));
                    break;

                case 12:
                    types.Add(typeof(BasePotion));
                    types.Add(typeof(PotionKeg));
                    break;
                }
            }

            ArrayList source = null;

            if (searchExisting)
            {
                source = new ArrayList(m_List);
            }
            else
            {
                source = new ArrayList(AuctionSystem.Auctions);
            }

            ArrayList typeSearch      = null;
            ArrayList commoditySearch = null;
            ArrayList artifactsSearch = null;

            if (types.Count > 0)
            {
                typeSearch = AuctionSearch.ForTypes(source, types);
            }

            if (commodity)
            {
                commoditySearch = AuctionSearch.ForCommodities(source);
            }

            if (artifacts)
            {
                artifactsSearch = AuctionSearch.ForArtifacts(source);
            }

            ArrayList results = new ArrayList();

            if (typeSearch == null && artifactsSearch == null && commoditySearch == null)
            {
                results.AddRange(source);
            }
            else
            {
                if (typeSearch != null)
                {
                    results.AddRange(typeSearch);
                }

                if (commoditySearch != null)
                {
                    results = AuctionSearch.Merge(results, commoditySearch);
                }

                if (artifactsSearch != null)
                {
                    results = AuctionSearch.Merge(results, artifactsSearch);
                }
            }

            // Perform search
            if (text != null)
            {
                results = AuctionSearch.SearchForText(results, text);
            }

            sender.Mobile.SendGump(new AuctionListing(sender.Mobile, results, true, m_ReturnToAuction));
        }