Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Beny 2019-05-27 22:18:29 +01:00
commit 11ebb5a239
10 changed files with 56 additions and 4 deletions

View File

@ -5,3 +5,6 @@ CREATE TABLE `users_saved_searches` (
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE `users_settings`
ADD COLUMN `ui_flags` int(11) NOT NULL DEFAULT 1 AFTER `forums_post_count`;

View File

@ -153,6 +153,9 @@ public class NavigatorManager {
case "categories":
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted();
break;
case "with_friends":
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithFriendsIn(habbo, 25);
break;
default:
return null;
}

View File

@ -42,6 +42,12 @@ public class NavigatorUserFilter extends NavigatorFilter {
i++;
}
List<Room> friendRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("with_friends", habbo);
if (!friendRooms.isEmpty()) {
resultLists.add(new SearchResultList(i, "with_friends", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_friends"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_friends"), friendRooms, true, true, DisplayOrder.ORDER_NUM, i));
i++;
}
List<Room> rightRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("with_rights", habbo);
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));

View File

@ -54,6 +54,7 @@ import gnu.trove.set.hash.THashSet;
import java.sql.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class RoomManager {
private static final int page = 0;
@ -1271,6 +1272,25 @@ public class RoomManager {
return rooms;
}
public ArrayList<Room> getRoomsWithFriendsIn(Habbo habbo, int limit) {
final ArrayList<Room> rooms = new ArrayList<>();
for (MessengerBuddy buddy : habbo.getMessenger().getFriends().values()) {
Habbo friend = Emulator.getGameEnvironment().getHabboManager().getHabbo(buddy.getId());
if (friend == null || friend.getHabboInfo() == null) continue;
Room room = friend.getHabboInfo().getCurrentRoom();
if (room != null) rooms.add(room);
if (rooms.size() >= limit) break;
}
Collections.sort(rooms);
return rooms;
}
public ArrayList<Room> getRoomsWithAdminRights(Habbo habbo) {
ArrayList<Room> rooms = new ArrayList<>();

View File

@ -80,6 +80,7 @@ public class HabboStats implements Runnable {
public long lastTradeTimestamp = Emulator.getIntUnixTimestamp();
public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
public long lastGiftTimestamp = Emulator.getIntUnixTimestamp();
public int uiFlags;
private HabboInfo habboInfo;
private boolean allowTrade;
private int clubExpireTimestamp;
@ -131,6 +132,7 @@ public class HabboStats implements Runnable {
this.allowNameChange = set.getString("allow_name_change").equalsIgnoreCase("1");
this.perkTrade = set.getString("perk_trade").equalsIgnoreCase("1");
this.forumPostsCount = set.getInt("forums_post_count");
this.uiFlags = set.getInt("ui_flags");
this.nuxReward = this.nux;
try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) {
@ -290,7 +292,7 @@ public class HabboStats implements Runnable {
@Override
public void run() {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ? WHERE user_id = ? LIMIT 1")) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ? WHERE user_id = ? LIMIT 1")) {
statement.setInt(1, this.achievementScore);
statement.setInt(2, this.respectPointsReceived);
statement.setInt(3, this.respectPointsGiven);
@ -323,7 +325,9 @@ public class HabboStats implements Runnable {
statement.setString(30, this.perkTrade ? "1" : "0");
statement.setString(31, this.allowTrade ? "1" : "0");
statement.setInt(32, this.forumPostsCount);
statement.setInt(33, this.habboInfo.getId());
statement.setInt(33, this.uiFlags);
statement.setInt(34, this.habboInfo.getId());
statement.executeUpdate();
}

View File

@ -288,6 +288,7 @@ public class PacketManager {
this.registerHandler(Incoming.ChangeNameCheckUsernameEvent, ChangeNameCheckUsernameEvent.class);
this.registerHandler(Incoming.ConfirmChangeNameEvent, ConfirmChangeNameEvent.class);
this.registerHandler(Incoming.ChangeChatBubbleEvent, ChangeChatBubbleEvent.class);
this.registerHandler(Incoming.UpdateUIFlagsEvent, UpdateUIFlagsEvent.class);
}
private void registerNavigator() throws Exception {

View File

@ -289,6 +289,7 @@ public class Incoming {
public static final int DeleteSavedSearchEvent = 1954;
public static final int SaveWindowSettingsEvent = 3159;
public static final int GetHabboGuildBadgesMessageEvent = 21;
public static final int UpdateUIFlagsEvent = 2313;
public static final int RequestCraftingRecipesEvent = 1173;
public static final int RequestCraftingRecipesAvailableEvent = 3086;

View File

@ -18,6 +18,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
String query = this.packet.readString();
if (view.equals("query")) view = "hotel_view";
if (view.equals("groups")) view = "hotel_view";
NavigatorFilter filter = Emulator.getGameEnvironment().getNavigatorManager().filters.get(view);
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategoryBySafeCaption(view);

View File

@ -0,0 +1,13 @@
package com.eu.habbo.messages.incoming.users;
import com.eu.habbo.messages.incoming.MessageHandler;
public class UpdateUIFlagsEvent extends MessageHandler {
@Override
public void handle() throws Exception {
int flags = this.packet.readInt();
this.client.getHabbo().getHabboStats().uiFlags = flags;
this.client.getHabbo().getHabboStats().run();
}
}

View File

@ -21,7 +21,7 @@ public class MeMenuSettingsComposer extends MessageComposer {
this.response.appendBoolean(this.habbo.getHabboStats().preferOldChat);
this.response.appendBoolean(this.habbo.getHabboStats().blockRoomInvites);
this.response.appendBoolean(this.habbo.getHabboStats().blockCameraFollow);
this.response.appendInt(1);
this.response.appendInt(this.habbo.getHabboStats().uiFlags);
this.response.appendInt(this.habbo.getHabboStats().chatColor.getType());
return this.response;
}