mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Fix saved searches
This commit is contained in:
parent
00408eeaaf
commit
860e20ce12
@ -18,8 +18,7 @@ public class NavigatorFavoriteFilter extends NavigatorFilter {
|
|||||||
@Override
|
@Override
|
||||||
public List<SearchResultList> getResult(Habbo habbo) {
|
public List<SearchResultList> getResult(Habbo habbo) {
|
||||||
List<SearchResultList> resultLists = new ArrayList<>();
|
List<SearchResultList> resultLists = new ArrayList<>();
|
||||||
List<Room> rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo);
|
List<Room> rooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("favorites", habbo);
|
||||||
Collections.sort(rooms);
|
|
||||||
resultLists.add(new SearchResultList(0, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular", DisplayMode.VISIBLE), rooms, true, true, DisplayOrder.ACTIVITY, -1));
|
resultLists.add(new SearchResultList(0, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular", DisplayMode.VISIBLE), rooms, true, true, DisplayOrder.ACTIVITY, -1));
|
||||||
return resultLists;
|
return resultLists;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class NavigatorFilter {
|
public abstract class NavigatorFilter {
|
||||||
|
@ -21,8 +21,9 @@ public class NavigatorHotelFilter extends NavigatorFilter {
|
|||||||
public List<SearchResultList> getResult(Habbo habbo) {
|
public List<SearchResultList> getResult(Habbo habbo) {
|
||||||
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
||||||
List<SearchResultList> resultLists = new ArrayList<>();
|
List<SearchResultList> resultLists = new ArrayList<>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
resultLists.add(new SearchResultList(i, "popular", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("popular", ListMode.fromType(Emulator.getConfig().getInt("hotel.navigator.popular.listtype"))), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular"), Emulator.getGameEnvironment().getRoomManager().getPopularRooms(Emulator.getConfig().getInt("hotel.navigator.popular.amount")), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
|
resultLists.add(new SearchResultList(i, "popular", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("popular", ListMode.fromType(Emulator.getConfig().getInt("hotel.navigator.popular.listtype"))), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular"), Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("popular", habbo), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
for (Map.Entry<Integer, List<Room>> set : Emulator.getGameEnvironment().getRoomManager().getPopularRoomsByCategory(Emulator.getConfig().getInt("hotel.navigator.popular.category.maxresults")).entrySet()) {
|
for (Map.Entry<Integer, List<Room>> set : Emulator.getGameEnvironment().getRoomManager().getPopularRoomsByCategory(Emulator.getConfig().getInt("hotel.navigator.popular.category.maxresults")).entrySet()) {
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.navigation;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -9,6 +10,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -121,4 +124,41 @@ public class NavigatorManager {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Room> getRoomsForCategory(String category, Habbo habbo) {
|
||||||
|
List<Room> rooms = new ArrayList<>();
|
||||||
|
|
||||||
|
switch (category) {
|
||||||
|
case "my":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(habbo);
|
||||||
|
break;
|
||||||
|
case "favorites":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo);
|
||||||
|
break;
|
||||||
|
case "history_freq":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsVisited(habbo, false, 10);
|
||||||
|
break;
|
||||||
|
case "my_groups":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getGroupRooms(habbo, 25);
|
||||||
|
break;
|
||||||
|
case "with_rights":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithRights(habbo);
|
||||||
|
break;
|
||||||
|
case "official-root":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getPublicRooms();
|
||||||
|
break;
|
||||||
|
case "popular":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getPopularRooms(Emulator.getConfig().getInt("hotel.navigator.popular.amount"));
|
||||||
|
break;
|
||||||
|
case "categories":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(rooms);
|
||||||
|
|
||||||
|
return rooms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,11 @@ public class NavigatorPublicFilter extends NavigatorFilter {
|
|||||||
public List<SearchResultList> getResult(Habbo habbo) {
|
public List<SearchResultList> getResult(Habbo habbo) {
|
||||||
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
||||||
List<SearchResultList> resultLists = new ArrayList<>();
|
List<SearchResultList> resultLists = new ArrayList<>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
resultLists.add(new SearchResultList(i, "official-root", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("official-root", ListMode.THUMBNAILS), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root"), Emulator.getGameEnvironment().getRoomManager().getPublicRooms(), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
|
resultLists.add(new SearchResultList(i, "official-root", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("official-root", ListMode.THUMBNAILS), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root"), Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("official-root", habbo), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
for (NavigatorPublicCategory category : Emulator.getGameEnvironment().getNavigatorManager().publicCategories.values()) {
|
for (NavigatorPublicCategory category : Emulator.getGameEnvironment().getNavigatorManager().publicCategories.values()) {
|
||||||
if (!category.rooms.isEmpty()) {
|
if (!category.rooms.isEmpty()) {
|
||||||
resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible, DisplayOrder.ACTIVITY, category.order));
|
resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible, DisplayOrder.ACTIVITY, category.order));
|
||||||
|
@ -18,7 +18,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter {
|
|||||||
public List<SearchResultList> getResult(Habbo habbo) {
|
public List<SearchResultList> getResult(Habbo habbo) {
|
||||||
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
|
||||||
List<SearchResultList> resultList = new ArrayList<>();
|
List<SearchResultList> resultList = new ArrayList<>();
|
||||||
resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted(), false, showInvisible, DisplayOrder.ACTIVITY, 0));
|
resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("categories", habbo), false, showInvisible, DisplayOrder.ACTIVITY, 0));
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,32 +19,30 @@ public class NavigatorUserFilter extends NavigatorFilter {
|
|||||||
public List<SearchResultList> getResult(Habbo habbo) {
|
public List<SearchResultList> getResult(Habbo habbo) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List<SearchResultList> resultLists = new ArrayList<>();
|
List<SearchResultList> resultLists = new ArrayList<>();
|
||||||
List<Room> rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(habbo);
|
|
||||||
Collections.sort(rooms);
|
List<Room> rooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("my", habbo);
|
||||||
resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true, DisplayOrder.ORDER_NUM, i));
|
resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true, DisplayOrder.ORDER_NUM, i));
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
List<Room> favoriteRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo);
|
List<Room> favoriteRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("favorites", habbo);
|
||||||
|
|
||||||
if (!favoriteRooms.isEmpty()) {
|
if (!favoriteRooms.isEmpty()) {
|
||||||
Collections.sort(favoriteRooms);
|
|
||||||
resultLists.add(new SearchResultList(i, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
resultLists.add(new SearchResultList(i, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Room> frequentlyVisited = Emulator.getGameEnvironment().getRoomManager().getRoomsVisited(habbo, false, 10);
|
List<Room> frequentlyVisited = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("history_freq", habbo);
|
||||||
if (!frequentlyVisited.isEmpty()) {
|
if (!frequentlyVisited.isEmpty()) {
|
||||||
resultLists.add(new SearchResultList(i, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true, DisplayOrder.ORDER_NUM, i));
|
resultLists.add(new SearchResultList(i, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true, DisplayOrder.ORDER_NUM, i));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Room> groupRooms = Emulator.getGameEnvironment().getRoomManager().getGroupRooms(habbo, 25);
|
List<Room> groupRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("my_groups", habbo);
|
||||||
if (!groupRooms.isEmpty()) {
|
if (!groupRooms.isEmpty()) {
|
||||||
resultLists.add(new SearchResultList(i, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
resultLists.add(new SearchResultList(i, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Room> rightRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithRights(habbo);
|
List<Room> rightRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("with_rights", habbo);
|
||||||
if (!rightRooms.isEmpty()) {
|
if (!rightRooms.isEmpty()) {
|
||||||
resultLists.add(new SearchResultList(i, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
resultLists.add(new SearchResultList(i, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ORDER_NUM, i));
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,22 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
|
|||||||
String view = this.packet.readString();
|
String view = this.packet.readString();
|
||||||
String query = this.packet.readString();
|
String query = this.packet.readString();
|
||||||
|
|
||||||
|
if (view.equals("query")) view = "hotel_view";
|
||||||
|
|
||||||
NavigatorFilter filter = Emulator.getGameEnvironment().getNavigatorManager().filters.get(view);
|
NavigatorFilter filter = Emulator.getGameEnvironment().getNavigatorManager().filters.get(view);
|
||||||
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategoryBySafeCaption(view);
|
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategoryBySafeCaption(view);
|
||||||
|
|
||||||
|
if (filter == null) {
|
||||||
|
List<Room> rooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory(view, this.client.getHabbo());
|
||||||
|
|
||||||
|
if (rooms != null) {
|
||||||
|
List<SearchResultList> resultLists = new ArrayList<>();
|
||||||
|
resultLists.add(new SearchResultList(0, view, query, SearchAction.NONE, this.client.getHabbo().getHabboStats().navigatorWindowSettings.getListModeForCategory(view, ListMode.LIST), this.client.getHabbo().getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(view, DisplayMode.VISIBLE), rooms, true, true, DisplayOrder.ACTIVITY, -1));
|
||||||
|
this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String filterField = "anything";
|
String filterField = "anything";
|
||||||
String part = query;
|
String part = query;
|
||||||
NavigatorFilterField field = Emulator.getGameEnvironment().getNavigatorManager().filterSettings.get(filterField);
|
NavigatorFilterField field = Emulator.getGameEnvironment().getNavigatorManager().filterSettings.get(filterField);
|
||||||
|
Loading…
Reference in New Issue
Block a user