[RELEASE] Navigator SavedSearches

oStrs

New Member
May 19, 2018
10
3
Hey Devbest!
so i decided to share navigator saved search completly.
coded myself in Plus Emulator.

Release: RODUCTION-201802201205-141713395

Big thanks to : AssLikeThat for cleaning my thread.

Communication/Packets/Incoming/Navigator/New

Create file name: NavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            String Filter = Packet.PopString();
            String SearchCode = Packet.PopString();

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }
 
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;

            SavedSearch.OnSave(Session, Filter, SearchCode, true);

            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

And this DeleteNavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Int32 searchId = Packet.PopInt();
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true);

            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Next go to: HabboHotel/Users/Navigator/SavedSearches
after

Code:
public string Search
        {
            get { return this._search; }
            set { this._search = value; }
        }

Add these:

Code:
public static bool OnSave(GameClients.GameClient Session, string Filter, string SearchCode, bool asSave)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("INSERT INTO `user_saved_searches` (`id`,`user_id`,`filter`,`search_code`) VALUES (@id, @habboid, @filter, @Code)");
                db.AddParameter("id", null);
                db.AddParameter("habboid", Session.GetHabbo().Id);
                db.AddParameter("filter", Filter);
                db.AddParameter("code", SearchCode);
                db.RunQuery();
            }
            return asSave;
        }

        public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
                db.AddParameter("id", Session.GetHabbo().Id);
                db.RunQuery();
            }
            return asDelete;
        }

Communication/Packets/Incoming

add:

Code:
public const int DeleteNavigatorSavedSearchMessageEvent = 448;
        public const int NavigatorSavedSearchMessageEvent = 117;

Communication/Packets/Outgoing/Navigator/New

Create: NavigatorSavedSearchComposer.cs

Code:
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Outgoing.Navigator.New
{
    class NavigatorSavedSearchComposer : ServerPacket
    {
        public NavigatorSavedSearchComposer(ICollection<SavedSearch> Saved)
            : base(ServerPacketHeader.NavigatorSavedSearchMessageComposer)
        {
            //
            /*
             * _SafeStr_20180[117] = _SafeStr_2636; // add event
             * _SafeStr_20180[448] = _SafeStr_2640; // delete event
            _SafeStr_24860["popular"] = _SafeStr_6076;
            _SafeStr_24860["official"] = _SafeStr_6085;
            _SafeStr_24860["me"] = _SafeStr_6086;
            _SafeStr_24860["events"] = _SafeStr_6087;
            _SafeStr_24860["search"] = _SafeStr_6088;
            _SafeStr_24860["categories"] = _SafeStr_9419;
             */
            base.WriteInteger(Saved.Count);
            foreach (SavedSearch Save in Saved)
            {
                base.WriteInteger(Save.Id);
                base.WriteString(Save.Filter);
                base.WriteString(Save.Search);
                base.WriteString("");
            }
        }
    }
}
missing somethings..
Next go to: Communication/Packets/Incoming/Navigator/New

After:
Code:
ICollection<SearchResultList> SearchResultLists = PlusEnvironment.GetGame().GetNavigator().GetSearchResultLists();
Add:
Code:
ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
Add after
Code:
Session.SendMessage(new NavigatorPreferencesComposer());
Code:
Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
Header ID:
Code:
 public const int NavigatorSavedSearchMessageComposer = 1818;

Updates:

Notification: goto /Communication/Packets/Outgoing/Moderation

search ModeratorSupportTicketResponseComposer.cs

Code:
namespace Plus.Communication.Packets.Outgoing.Moderation
{
    class ModeratorSupportTicketResponseComposer : ServerPacket
    {
        public ModeratorSupportTicketResponseComposer(int Result)
            : base(ServerPacketHeader.ModeratorSupportTicketResponseMessageComposer)
        {
            base.WriteInteger(Result);
            base.WriteString("");
        }

        public ModeratorSupportTicketResponseComposer(int Result, string message)
            : base(ServerPacketHeader.ModeratorSupportTicketResponseMessageComposer)
        {
            base.WriteInteger(Result);
            base.WriteString(message);
        }
    }
}

go search GameClient.cs
Code:
_habbo.InitProcess();
add
Code:
_habbo.InitSearches();
Code:
after
public void SendMessage(IServerPacket Message)
        {
            byte[] bytes = Message.GetBytes();

            if (Message == null)
                return;

            if (GetConnection() == null)
                return;

            GetConnection().SendData(bytes);
        }
add:
        public void SendSimple(int result, string message)
        {
            SendMessage(new ModeratorSupportTicketResponseComposer(result, message));
        }
 
Last edited:

AssLikeThat

Posting Freak
Jan 27, 2013
765
154
Hi, good work with this :) I decided to clean up the thread as it's hard to read.

Communication/Packets/Incoming/Navigator/New

Create file name: NavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            String Filter = Packet.PopString();
            String SearchCode = Packet.PopString();

            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }
      
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;

            SavedSearch.OnSave(Session, Filter, SearchCode, true);

            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

And this DeleteNavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Int32 searchId = Packet.PopInt();

            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true);

            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Next go to: HabboHotel/Users/Navigator/SavedSearches
after

Code:
public string Search
        {
            get { return this._search; }
            set { this._search = value; }
        }

Add these:

Code:
public static bool OnSave(GameClients.GameClient Session, string Filter, string SearchCode, bool asSave)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("INSERT INTO `user_saved_searches` (`id`,`user_id`,`filter`,`search_code`) VALUES (@id, @habboid, @filter, @Code)");
                db.AddParameter("id", null);
                db.AddParameter("habboid", Session.GetHabbo().Id);
                db.AddParameter("filter", Filter);
                db.AddParameter("code", SearchCode);
                db.RunQuery();
            }
            return asSave;
        }

        public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
                db.AddParameter("id", Session.GetHabbo().Id);
                db.RunQuery();
            }
            return asDelete;
        }

Communication/Packets/Incoming

add:

Code:
public const int DeleteNavigatorSavedSearchMessageEvent = 448;
        public const int NavigatorSavedSearchMessageEvent = 117;

Communication/Packets/Outgoing/Navigator/New

Create: NavigatorSavedSearchComposer.cs

Code:
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Outgoing.Navigator.New
{
    class NavigatorSavedSearchComposer : ServerPacket
    {
        public NavigatorSavedSearchComposer(ICollection<SavedSearch> Saved)
            : base(ServerPacketHeader.NavigatorSavedSearchMessageComposer)
        {
            //
            /*
             * _SafeStr_20180[117] = _SafeStr_2636; // add event
             * _SafeStr_20180[448] = _SafeStr_2640; // delete event
            _SafeStr_24860["popular"] = _SafeStr_6076;
            _SafeStr_24860["official"] = _SafeStr_6085;
            _SafeStr_24860["me"] = _SafeStr_6086;
            _SafeStr_24860["events"] = _SafeStr_6087;
            _SafeStr_24860["search"] = _SafeStr_6088;
            _SafeStr_24860["categories"] = _SafeStr_9419;
             */
            base.WriteInteger(Saved.Count);
            foreach (SavedSearch Save in Saved)
            {
                base.WriteInteger(Save.Id);
                base.WriteString(Save.Filter);
                base.WriteString(Save.Search);
                base.WriteString("");
            }
        }
    }
}
 

oStrs

New Member
May 19, 2018
10
3
Hi, good work with this :) I decided to clean up the thread as it's hard to read.

Communication/Packets/Incoming/Navigator/New

Create file name: NavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            String Filter = Packet.PopString();
            String SearchCode = Packet.PopString();

            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }
     
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;

            SavedSearch.OnSave(Session, Filter, SearchCode, true);

            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

And this DeleteNavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Int32 searchId = Packet.PopInt();

            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true);

            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Next go to: HabboHotel/Users/Navigator/SavedSearches
after

Code:
public string Search
        {
            get { return this._search; }
            set { this._search = value; }
        }

Add these:

Code:
public static bool OnSave(GameClients.GameClient Session, string Filter, string SearchCode, bool asSave)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("INSERT INTO `user_saved_searches` (`id`,`user_id`,`filter`,`search_code`) VALUES (@id, @habboid, @filter, @Code)");
                db.AddParameter("id", null);
                db.AddParameter("habboid", Session.GetHabbo().Id);
                db.AddParameter("filter", Filter);
                db.AddParameter("code", SearchCode);
                db.RunQuery();
            }
            return asSave;
        }

        public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
                db.AddParameter("id", Session.GetHabbo().Id);
                db.RunQuery();
            }
            return asDelete;
        }

Communication/Packets/Incoming

add:

Code:
public const int DeleteNavigatorSavedSearchMessageEvent = 448;
        public const int NavigatorSavedSearchMessageEvent = 117;

Communication/Packets/Outgoing/Navigator/New

Create: NavigatorSavedSearchComposer.cs

Code:
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Outgoing.Navigator.New
{
    class NavigatorSavedSearchComposer : ServerPacket
    {
        public NavigatorSavedSearchComposer(ICollection<SavedSearch> Saved)
            : base(ServerPacketHeader.NavigatorSavedSearchMessageComposer)
        {
            //
            /*
             * _SafeStr_20180[117] = _SafeStr_2636; // add event
             * _SafeStr_20180[448] = _SafeStr_2640; // delete event
            _SafeStr_24860["popular"] = _SafeStr_6076;
            _SafeStr_24860["official"] = _SafeStr_6085;
            _SafeStr_24860["me"] = _SafeStr_6086;
            _SafeStr_24860["events"] = _SafeStr_6087;
            _SafeStr_24860["search"] = _SafeStr_6088;
            _SafeStr_24860["categories"] = _SafeStr_9419;
             */
            base.WriteInteger(Saved.Count);
            foreach (SavedSearch Save in Saved)
            {
                base.WriteInteger(Save.Id);
                base.WriteString(Save.Filter);
                base.WriteString(Save.Search);
                base.WriteString("");
            }
        }
    }
}


thanks mate! i update this thread :D
 

JarnoHSTR

New Member
Jan 19, 2018
8
0
It is not complete yet,
I'm missing the SendSimple function
and I can't find the
Code:
ICollection<SearchResultList> SearchResultLists = PlusEnvironment.GetGame().GetNavigator().GetSearchResultLists();
 

DJGOMEZV

New Member
Jan 23, 2014
17
0
I found an error, and that is that when adding or deleting the browser search, or the package "NavigatorSavedSearchComposer" is not updated as such because it does not load the recently added or deleted searches to the database, modify the 2 files: NavigatorSavedSearchEvent.cs and DeleteNavigatorSavedSearchEvent.cs

Communication/Packets/Incoming/Navigator/New/NavigatorSavedSearchEvent.cs:
Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            string Filter = Packet.PopString();
            string SearchCode = Packet.PopString();

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }

            SavedSearch.OnSave(Session, Filter, SearchCode, true);
            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Communication/Packets/Incoming/Navigator/New/DeleteNavigatorSavedSearchEvent.cs:
Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int searchId = Packet.PopInt();
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true, searchId);
            //Console.WriteLine("SearchId: " + searchId);
            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Replace in: HabboHotel/Users/Navigator/SavedSearches/SavedSearch.cs:
Code:
 public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
       {
           using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
           {
               db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
               db.AddParameter("id", Session.GetHabbo().Id);
               db.RunQuery();
           }
           return asDelete;
       }
to:
Code:
 public static bool OnDelete(GameClients.GameClient Session, bool asDelete, int SearchId)
       {
           using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
           {
               db.SetQuery("DELETE FROM `user_saved_searches` WHERE `id` = @id LIMIT 1;");
               db.AddParameter("id", SearchId);
               db.RunQuery();
           }
           return asDelete;
       }
 

oStrs

New Member
May 19, 2018
10
3
I found an error, and that is that when adding or deleting the browser search, or the package "NavigatorSavedSearchComposer" is not updated as such because it does not load the recently added or deleted searches to the database, modify the 2 files: NavigatorSavedSearchEvent.cs and DeleteNavigatorSavedSearchEvent.cs

Communication/Packets/Incoming/Navigator/New/NavigatorSavedSearchEvent.cs:
Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            string Filter = Packet.PopString();
            string SearchCode = Packet.PopString();

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }

            SavedSearch.OnSave(Session, Filter, SearchCode, true);
            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Communication/Packets/Incoming/Navigator/New/DeleteNavigatorSavedSearchEvent.cs:
Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int searchId = Packet.PopInt();
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true, searchId);
            //Console.WriteLine("SearchId: " + searchId);
            Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Replace in: HabboHotel/Users/Navigator/SavedSearches/SavedSearch.cs:
Code:
 public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
       {
           using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
           {
               db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
               db.AddParameter("id", Session.GetHabbo().Id);
               db.RunQuery();
           }
           return asDelete;
       }
to:
Code:
 public static bool OnDelete(GameClients.GameClient Session, bool asDelete, int SearchId)
       {
           using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
           {
               db.SetQuery("DELETE FROM `user_saved_searches` WHERE `id` = @id LIMIT 1;");
               db.AddParameter("id", SearchId);
               db.RunQuery();
           }
           return asDelete;
       }

thanks m8.
 
Packets for production 201609 ??
give me ur habbo.swf, i found id for you.
 

DJGOMEZV

New Member
Jan 23, 2014
17
0
Packets for production 201609 ??
ClientPacketHeader.cs
Code:
public const int DeleteNavigatorSavedSearchMessageEvent = 3071; // PRODUCTION-201609061203-935497134
public const int NavigatorSavedSearchMessageEvent = 835; // PRODUCTION-201609061203-935497134
ServerPacketHeader.cs
Code:
public const int NavigatorSavedSearchMessageComposer = 3250; // PRODUCTION-201609061203-935497134
 

angleiito

New Member
Jan 31, 2013
6
0
//NAVEGADOR
public const int DeleteNavigatorSavedSearchMessageEvent = 1905; // PRODUCTION-201802131208-148583513
public const int NavigatorSavedSearchMessageEvent = 3289; // PRODUCTION-201802131208-148583513

//NAVEGADOR
public const int NavigatorSavedSearchMessageComposer = 3785; // PRODUCTION-201802131208-148583513
 

JAysz0nJA

New Member
Jan 21, 2017
10
6
Thank you for giving me an inside in how it works. But I'm definitely going to rewrite it since Plus Emulator already contains most of the code. You should have a look at the SearchesComponent instead of adding a static void inside the SavedSearch class.
 

oStrs

New Member
May 19, 2018
10
3
Thank you for giving me an inside in how it works. But I'm definitely going to rewrite it since Plus Emulator already contains most of the code. You should have a look at the SearchesComponent instead of adding a static void inside the SavedSearch class.
no problem ;) good luck, yea.
 

JAysz0nJA

New Member
Jan 21, 2017
10
6
no problem ;) good luck, yea.
For those interested I've created an public repo for the emulator. Keep in mind that this is release 3 and unstable. I've made some changes to the code above and added it to the emulator, some bug fixes and WIRED does not work as far as I've tested it but I'll have a look at it sometime.
download.png

Here's the link:
It's running on: PRODUCTION-201701242205-837386173
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Hey Devbest!
so i decided to share navigator saved search completly.
coded myself in Plus Emulator.

Release: RODUCTION-201802201205-141713395

Big thanks to : AssLikeThat for cleaning my thread.

Communication/Packets/Incoming/Navigator/New

Create file name: NavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class NavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            String Filter = Packet.PopString();
            String SearchCode = Packet.PopString();

            if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)
            {
                Session.SendSimple(1, "Limited");
                return;
            }
 
            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;

            SavedSearch.OnSave(Session, Filter, SearchCode, true);

            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

And this DeleteNavigatorSavedSearchEvent.cs

Code:
using Plus.Communication.Packets.Outgoing.Navigator.New;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Incoming.Navigator.New
{
    class DeleteNavigatorSavedSearchEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Int32 searchId = Packet.PopInt();
            var ListSaved = new SavedSearch(0, "", "");

            SavedSearch.OnDelete(Session, true);

            ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches
            Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
        }
    }
}

Next go to: HabboHotel/Users/Navigator/SavedSearches
after

Code:
public string Search
        {
            get { return this._search; }
            set { this._search = value; }
        }

Add these:

Code:
public static bool OnSave(GameClients.GameClient Session, string Filter, string SearchCode, bool asSave)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("INSERT INTO `user_saved_searches` (`id`,`user_id`,`filter`,`search_code`) VALUES (@id, @habboid, @filter, @Code)");
                db.AddParameter("id", null);
                db.AddParameter("habboid", Session.GetHabbo().Id);
                db.AddParameter("filter", Filter);
                db.AddParameter("code", SearchCode);
                db.RunQuery();
            }
            return asSave;
        }

        public static bool OnDelete(GameClients.GameClient Session, bool asDelete)
        {
            using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");
                db.AddParameter("id", Session.GetHabbo().Id);
                db.RunQuery();
            }
            return asDelete;
        }

Communication/Packets/Incoming

add:

Code:
public const int DeleteNavigatorSavedSearchMessageEvent = 448;
        public const int NavigatorSavedSearchMessageEvent = 117;

Communication/Packets/Outgoing/Navigator/New

Create: NavigatorSavedSearchComposer.cs

Code:
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Outgoing.Navigator.New
{
    class NavigatorSavedSearchComposer : ServerPacket
    {
        public NavigatorSavedSearchComposer(ICollection<SavedSearch> Saved)
            : base(ServerPacketHeader.NavigatorSavedSearchMessageComposer)
        {
            //
            /*
             * _SafeStr_20180[117] = _SafeStr_2636; // add event
             * _SafeStr_20180[448] = _SafeStr_2640; // delete event
            _SafeStr_24860["popular"] = _SafeStr_6076;
            _SafeStr_24860["official"] = _SafeStr_6085;
            _SafeStr_24860["me"] = _SafeStr_6086;
            _SafeStr_24860["events"] = _SafeStr_6087;
            _SafeStr_24860["search"] = _SafeStr_6088;
            _SafeStr_24860["categories"] = _SafeStr_9419;
             */
            base.WriteInteger(Saved.Count);
            foreach (SavedSearch Save in Saved)
            {
                base.WriteInteger(Save.Id);
                base.WriteString(Save.Filter);
                base.WriteString(Save.Search);
                base.WriteString("");
            }
        }
    }
}
missing somethings..
Next go to: Communication/Packets/Incoming/Navigator/New

After:
Code:
ICollection<SearchResultList> SearchResultLists = PlusEnvironment.GetGame().GetNavigator().GetSearchResultLists();
Add:
Code:
ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;
Add after
Code:
Session.SendMessage(new NavigatorPreferencesComposer());
Code:
Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));
Header ID:
Code:
 public const int NavigatorSavedSearchMessageComposer = 1818;

Updates:

Notification: goto /Communication/Packets/Outgoing/Moderation

search ModeratorSupportTicketResponseComposer.cs

Code:
namespace Plus.Communication.Packets.Outgoing.Moderation
{
    class ModeratorSupportTicketResponseComposer : ServerPacket
    {
        public ModeratorSupportTicketResponseComposer(int Result)
            : base(ServerPacketHeader.ModeratorSupportTicketResponseMessageComposer)
        {
            base.WriteInteger(Result);
            base.WriteString("");
        }

        public ModeratorSupportTicketResponseComposer(int Result, string message)
            : base(ServerPacketHeader.ModeratorSupportTicketResponseMessageComposer)
        {
            base.WriteInteger(Result);
            base.WriteString(message);
        }
    }
}

go search GameClient.cs
Code:
_habbo.InitProcess();
add
Code:
_habbo.InitSearches();
Code:
after
public void SendMessage(IServerPacket Message)
        {
            byte[] bytes = Message.GetBytes();

            if (Message == null)
                return;

            if (GetConnection() == null)
                return;

            GetConnection().SendData(bytes);
        }
add:
        public void SendSimple(int result, string message)
        {
            SendMessage(new ModeratorSupportTicketResponseComposer(result, message));
        }

Very very confusionary guide and wrong parts.
 

Users who are viewing this thread

Top