[FIX]Marketplace minCost [SWIFT / GENERATING LOGS]

Results 1 to 3 of 3
  1. #1
    C# Developer neto737 is offline
    MemberRank
    Oct 2010 Join Date
    Environment.csLocation
    274Posts

    thumbs up [FIX]Marketplace minCost [SWIFT / GENERATING LOGS]

    Hello guys,

    Today I will teach you how to get rid of that annoying log that talks about "minCost".

    So here we go,
    First go to -> HabboHotel/Catalogs/Marketplace.cs and search for: internal static ServerMessage SerializeOffers

    Replace all void by:

    Code:
            internal static ServerMessage SerializeOffers(int MinCost, int MaxCost, string SearchQuery, int FilterMode)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("WHERE state = '1' AND timestamp >= " + FormatTimestampString());
                if (MinCost >= 0)
                {
                    builder.Append(" AND total_price > @minCost");
                }
                if (MaxCost >= 0)
                {
                    builder.Append(" AND total_price < @maxCost");
                }
                if (SearchQuery.Length >= 1)
                {
                    builder.Append(" AND public_name LIKE @query");
                }
                switch (FilterMode)
                {
                    case 1:
                        builder.Append(" ORDER BY asking_price DESC");
                        break;
    
                    case 2:
                        builder.Append(" ORDER BY asking_price ASC");
                        break;
                }
                using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    adapter.setQuery("SELECT * FROM catalog_marketplace_offers " + builder.ToString());
    
                    if (MinCost >= 0)
                    {
                        adapter.addParameter("minCost", MinCost);
                    }
                    if (MaxCost >= 0)
                    {
                        adapter.addParameter("maxCost", MaxCost);
                    }
                    if (SearchQuery.Length >= 1)
                    {
                        adapter.addParameter("query", "%" + SearchQuery + "%");
                    }
    
                    DataTable table = adapter.getTable();
                    adapter.setQuery("SELECT COUNT(DISTINCT sprite_id) FROM catalog_marketplace_offers " + builder.ToString() + " LIMIT 250");
                    int i = adapter.getInteger();
                    int num2 = 0;
                    List<int> list = new List<int>();
                    ServerMessage message = new ServerMessage(Outgoing.GetOffers);
                    message.AppendInt32(i);
                    foreach (DataRow row in table.Rows)
                    {
                        if (!list.Contains((int)row["sprite_id"]))
                        {
                            list.Add((int)row["sprite_id"]);
                            int[] avarage = GetAvarage((int)row["sprite_id"]);
                            message.AppendInt32(int.Parse(row["offer_id"].ToString()));
                            message.AppendInt32(1);
                            message.AppendInt32(1);
                            message.AppendInt32((int)row["sprite_id"]);
                            message.AppendInt32(0);
                            message.AppendString("");
                            message.AppendInt32((int)row["total_price"]);
                            message.AppendInt32(0);
                            message.AppendInt32(avarage[0]);
                            message.AppendInt32(avarage[1]);
                            num2 += avarage[1];
                        }
                    }
                    message.AppendInt32(num2);
                    return message;
                }
            }
    Okay, now will no longer generate that log boring. And it is free from exploits.

    PS.: This fix will avoid that when you open the Marketplace generate logs related to 'minCost'.

    Regards,
    neto737
    Last edited by neto737; 03-11-13 at 10:33 PM.


  2. #2
    Run, but I'll find you. Ddos Attack is offline
    MemberRank
    Jan 2011 Join Date
    AustraliaLocation
    908Posts

    Re: [FIX]Marketplace minCost [SWIFT / GENERATING LOGS]

    Nice job. Do you think you could find the packets for showing the more info (chart) and showing the "market sell" button in inventory packets?

  3. #3
    C# Developer neto737 is offline
    MemberRank
    Oct 2010 Join Date
    Environment.csLocation
    274Posts

    Re: [FIX]Marketplace minCost [SWIFT / GENERATING LOGS]

    Quote Originally Posted by Ddos Attack View Post
    Nice job. Do you think you could find the packets for showing the more info (chart) and showing the "market sell" button in inventory packets?
    I do not know, now I'm just fixing bugs Swift .. If you can arrange the packets maybe we try to encode together .. :)



Advertisement