Add default saved searches

This commit is contained in:
Alejandro 2019-05-30 19:18:48 +03:00
parent d603a9cae6
commit e2f67a53ad
2 changed files with 17 additions and 2 deletions

View File

@ -81,6 +81,7 @@ public class HabboStats implements Runnable {
public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
public long lastGiftTimestamp = Emulator.getIntUnixTimestamp(); public long lastGiftTimestamp = Emulator.getIntUnixTimestamp();
public int uiFlags; public int uiFlags;
public boolean hasGottenDefaultSavedSearches;
private HabboInfo habboInfo; private HabboInfo habboInfo;
private boolean allowTrade; private boolean allowTrade;
private int clubExpireTimestamp; private int clubExpireTimestamp;
@ -133,6 +134,7 @@ public class HabboStats implements Runnable {
this.perkTrade = set.getString("perk_trade").equalsIgnoreCase("1"); this.perkTrade = set.getString("perk_trade").equalsIgnoreCase("1");
this.forumPostsCount = set.getInt("forums_post_count"); this.forumPostsCount = set.getInt("forums_post_count");
this.uiFlags = set.getInt("ui_flags"); this.uiFlags = set.getInt("ui_flags");
this.hasGottenDefaultSavedSearches = set.getInt("has_gotten_default_saved_searches") == 1;
this.nuxReward = this.nux; this.nuxReward = this.nux;
try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) { try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) {
@ -292,7 +294,7 @@ public class HabboStats implements Runnable {
@Override @Override
public void run() { public void run() {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { 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` = ?, ui_flags = ? 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 = ?, has_gotten_default_saved_searches = ? WHERE user_id = ? LIMIT 1")) {
statement.setInt(1, this.achievementScore); statement.setInt(1, this.achievementScore);
statement.setInt(2, this.respectPointsReceived); statement.setInt(2, this.respectPointsReceived);
statement.setInt(3, this.respectPointsGiven); statement.setInt(3, this.respectPointsGiven);
@ -326,8 +328,9 @@ public class HabboStats implements Runnable {
statement.setString(31, this.allowTrade ? "1" : "0"); statement.setString(31, this.allowTrade ? "1" : "0");
statement.setInt(32, this.forumPostsCount); statement.setInt(32, this.forumPostsCount);
statement.setInt(33, this.uiFlags); statement.setInt(33, this.uiFlags);
statement.setInt(34, this.hasGottenDefaultSavedSearches ? 1 : 0);
statement.setInt(34, this.habboInfo.getId()); statement.setInt(35, this.habboInfo.getId());
statement.executeUpdate(); statement.executeUpdate();
} }

View File

@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.handshake;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.messenger.Messenger; import com.eu.habbo.habbohotel.messenger.Messenger;
import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboManager;
@ -148,6 +149,17 @@ public class SecureLoginEvent extends MessageHandler {
} }
Messenger.checkFriendSizeProgress(habbo); Messenger.checkFriendSizeProgress(habbo);
if (!habbo.getHabboStats().hasGottenDefaultSavedSearches) {
habbo.getHabboStats().hasGottenDefaultSavedSearches = true;
Emulator.getThreading().run(habbo.getHabboStats());
habbo.getHabboInfo().addSavedSearch(new NavigatorSavedSearch("official-root", ""));
habbo.getHabboInfo().addSavedSearch(new NavigatorSavedSearch("my", ""));
habbo.getHabboInfo().addSavedSearch(new NavigatorSavedSearch("favorites", ""));
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
}
} else { } else {
Emulator.getGameServer().getGameClientManager().disposeClient(this.client); Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
} }