Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[RELEASE] Navigator SavedSearches
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="AssLikeThat" data-source="post: 434809" data-attributes="member: 27476"><p>Hi, good work with this <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> I decided to clean up the thread as it's hard to read.</p><p></p><p>[SPOILER="Cleaned up"]</p><p>Communication/Packets/Incoming/Navigator/New</p><p></p><p>Create file name: <strong>NavigatorSavedSearchEvent.cs</strong></p><p></p><p>[CODE]using Plus.Communication.Packets.Outgoing.Navigator.New;</p><p>using Plus.Database.Interfaces;</p><p>using Plus.HabboHotel.Users.Navigator.SavedSearches;</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p></p><p>namespace Plus.Communication.Packets.Incoming.Navigator.New</p><p>{</p><p> class NavigatorSavedSearchEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> String Filter = Packet.PopString();</p><p> String SearchCode = Packet.PopString();</p><p></p><p> Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());</p><p></p><p> if (Session.GetHabbo().GetNavigatorSearches().Searches.Count >= 15)</p><p> {</p><p> Session.SendSimple(1, "Limited");</p><p> return;</p><p> }</p><p> </p><p> ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches;</p><p></p><p> SavedSearch.OnSave(Session, Filter, SearchCode, true);</p><p></p><p> Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>And this <strong>DeleteNavigatorSavedSearchEvent.cs </strong></p><p></p><p>[CODE]using Plus.Communication.Packets.Outgoing.Navigator.New;</p><p>using Plus.Database.Interfaces;</p><p>using Plus.HabboHotel.Users.Navigator.SavedSearches;</p><p>using System;</p><p>using System.Collections.Generic;</p><p></p><p>namespace Plus.Communication.Packets.Incoming.Navigator.New</p><p>{</p><p> class DeleteNavigatorSavedSearchEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> Int32 searchId = Packet.PopInt();</p><p></p><p> Session.GetHabbo().GetNavigatorSearches().Init(Session.GetHabbo());</p><p> var ListSaved = new SavedSearch(0, "", "");</p><p></p><p> SavedSearch.OnDelete(Session, true);</p><p></p><p> ICollection<SavedSearch> ListSearch = Session.GetHabbo().GetNavigatorSearches().Searches</p><p> Session.SendMessage(new NavigatorSavedSearchComposer(ListSearch));</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>Next go to: HabboHotel/Users/Navigator/SavedSearches</p><p>after</p><p> </p><p>[CODE]public string Search</p><p> {</p><p> get { return this._search; }</p><p> set { this._search = value; }</p><p> }[/CODE]</p><p></p><p>Add these:</p><p></p><p>[CODE]public static bool OnSave(GameClients.GameClient Session, string Filter, string SearchCode, bool asSave)</p><p> {</p><p> using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> db.SetQuery("INSERT INTO `user_saved_searches` (`id`,`user_id`,`filter`,`search_code`) VALUES (@id, @habboid, @filter, @Code)");</p><p> db.AddParameter("id", null);</p><p> db.AddParameter("habboid", Session.GetHabbo().Id);</p><p> db.AddParameter("filter", Filter);</p><p> db.AddParameter("code", SearchCode);</p><p> db.RunQuery();</p><p> }</p><p> return asSave;</p><p> }</p><p></p><p> public static bool OnDelete(GameClients.GameClient Session, bool asDelete)</p><p> {</p><p> using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> db.SetQuery("DELETE FROM `user_saved_searches` WHERE `user_id` = @id LIMIT 1;");</p><p> db.AddParameter("id", Session.GetHabbo().Id);</p><p> db.RunQuery();</p><p> }</p><p> return asDelete;</p><p> }[/CODE]</p><p></p><p>Communication/Packets/Incoming</p><p></p><p>add:</p><p> </p><p>[CODE]public const int DeleteNavigatorSavedSearchMessageEvent = 448;</p><p> public const int NavigatorSavedSearchMessageEvent = 117;[/CODE]</p><p></p><p>Communication/Packets/Outgoing/Navigator/New</p><p></p><p>Create: <strong>NavigatorSavedSearchComposer.cs</strong></p><p></p><p>[CODE]using Plus.HabboHotel.Users.Navigator.SavedSearches;</p><p>using System.Collections.Generic;</p><p></p><p>namespace Plus.Communication.Packets.Outgoing.Navigator.New</p><p>{</p><p> class NavigatorSavedSearchComposer : ServerPacket</p><p> {</p><p> public NavigatorSavedSearchComposer(ICollection<SavedSearch> Saved)</p><p> : base(ServerPacketHeader.NavigatorSavedSearchMessageComposer)</p><p> {</p><p> //</p><p> /*</p><p> * _SafeStr_20180[117] = _SafeStr_2636; // add event</p><p> * _SafeStr_20180[448] = _SafeStr_2640; // delete event</p><p> _SafeStr_24860["popular"] = _SafeStr_6076;</p><p> _SafeStr_24860["official"] = _SafeStr_6085;</p><p> _SafeStr_24860["me"] = _SafeStr_6086;</p><p> _SafeStr_24860["events"] = _SafeStr_6087;</p><p> _SafeStr_24860["search"] = _SafeStr_6088;</p><p> _SafeStr_24860["categories"] = _SafeStr_9419;</p><p> */</p><p> base.WriteInteger(Saved.Count);</p><p> foreach (SavedSearch Save in Saved)</p><p> {</p><p> base.WriteInteger(Save.Id);</p><p> base.WriteString(Save.Filter);</p><p> base.WriteString(Save.Search);</p><p> base.WriteString("");</p><p> }</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>[/SPOILER]</p></blockquote><p></p>
[QUOTE="AssLikeThat, post: 434809, member: 27476"] Hi, good work with this :) I decided to clean up the thread as it's hard to read. [SPOILER="Cleaned up"] Communication/Packets/Incoming/Navigator/New Create file name: [B]NavigatorSavedSearchEvent.cs[/B] [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)); } } }[/CODE] And this [B]DeleteNavigatorSavedSearchEvent.cs [/B] [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)); } } }[/CODE] Next go to: HabboHotel/Users/Navigator/SavedSearches after [CODE]public string Search { get { return this._search; } set { this._search = value; } }[/CODE] 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; }[/CODE] Communication/Packets/Incoming add: [CODE]public const int DeleteNavigatorSavedSearchMessageEvent = 448; public const int NavigatorSavedSearchMessageEvent = 117;[/CODE] Communication/Packets/Outgoing/Navigator/New Create: [B]NavigatorSavedSearchComposer.cs[/B] [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(""); } } } }[/CODE] [/SPOILER] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[RELEASE] Navigator SavedSearches
Top