diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 462af849..4d2c8ed1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -782,6 +782,9 @@ public class HabboStats implements Runnable { } } + public TIntArrayList getIgnoredUsers() { + return this.ignoredUsers; + } public boolean userIgnored(int userId) { return this.ignoredUsers.contains(userId); } diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index ee0c8965..d8b2db1f 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -62,7 +62,7 @@ import com.eu.habbo.messages.incoming.rooms.promotions.UpdateRoomPromotionEvent; import com.eu.habbo.messages.incoming.rooms.users.*; import com.eu.habbo.messages.incoming.trading.*; import com.eu.habbo.messages.incoming.unknown.RequestResolutionEvent; -import com.eu.habbo.messages.incoming.unknown.UnknownEvent1; +import com.eu.habbo.messages.incoming.inventory.GetBadgePointLimitsEvent; import com.eu.habbo.messages.incoming.users.*; import com.eu.habbo.messages.incoming.wired.WiredApplySetConditionsEvent; import com.eu.habbo.messages.incoming.wired.WiredConditionSaveDataEvent; @@ -273,7 +273,7 @@ public class PacketManager { this.registerHandler(Incoming.CompleteDiffieHandshake, CompleteDiffieHandshakeEvent.class); this.registerHandler(Incoming.SecureLoginEvent, SecureLoginEvent.class); this.registerHandler(Incoming.MachineIDEvent, MachineIDEvent.class); - this.registerHandler(Incoming.UsernameEvent, UsernameEvent.class); + this.registerHandler(Incoming.GetIgnoredUsersEvent, GetIgnoredUsersEvent.class); this.registerHandler(Incoming.PingEvent, PingEvent.class); } @@ -586,7 +586,7 @@ public class PacketManager { void registerUnknown() throws Exception { this.registerHandler(Incoming.RequestResolutionEvent, RequestResolutionEvent.class); this.registerHandler(Incoming.RequestTalenTrackEvent, RequestTalentTrackEvent.class); - this.registerHandler(Incoming.UnknownEvent1, UnknownEvent1.class); + this.registerHandler(Incoming.BadgePointLimitsEvent, GetBadgePointLimitsEvent.class); this.registerHandler(Incoming.MySanctionStatusEvent, MySanctionStatusEvent.class); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java index 75223e4c..2f67fa8c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java +++ b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java @@ -210,7 +210,7 @@ public class Incoming { public static final int FloorPlanEditorSaveEvent = 875; public static final int FloorPlanEditorRequestDoorSettingsEvent = 3559; public static final int FloorPlanEditorRequestBlockedTilesEvent = 1687; - public static final int UnknownEvent1 = 1371; + public static final int BadgePointLimitsEvent = 1371; public static final int RequestTalenTrackEvent = 196; public static final int RequestNewNavigatorDataEvent = 2110; public static final int RequestNewNavigatorRoomsEvent = 249; @@ -227,7 +227,7 @@ public class Incoming { public static final int MoodLightSaveSettingsEvent = 1648; public static final int ModToolRequestIssueChatlogEvent = 211; public static final int ModToolRequestRoomUserChatlogEvent = -1; - public static final int UsernameEvent = 3878; + public static final int GetIgnoredUsersEvent = 3878; public static final int RequestClubGiftsEvent = 487; public static final int RentSpaceEvent = 2946; public static final int RentSpaceCancelEvent = 1667; diff --git a/src/main/java/com/eu/habbo/messages/incoming/achievements/RequestAchievementConfigurationEvent.java b/src/main/java/com/eu/habbo/messages/incoming/achievements/RequestAchievementConfigurationEvent.java index ff1d31c4..07d329ee 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/achievements/RequestAchievementConfigurationEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/achievements/RequestAchievementConfigurationEvent.java @@ -1,11 +1,11 @@ package com.eu.habbo.messages.incoming.achievements; import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.inventory.InventoryAchievementsComposer; +import com.eu.habbo.messages.outgoing.inventory.BadgePointLimitsComposer; public class RequestAchievementConfigurationEvent extends MessageHandler { @Override public void handle() throws Exception { - this.client.sendResponse(new InventoryAchievementsComposer()); + this.client.sendResponse(new BadgePointLimitsComposer()); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java deleted file mode 100644 index c217e946..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.eu.habbo.messages.incoming.handshake; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.achievements.AchievementManager; -import com.eu.habbo.habbohotel.campaign.calendar.CalendarCampaign; -import com.eu.habbo.habbohotel.catalog.TargetOffer; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer; -import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer; -import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Timestamp; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.Calendar; -import java.util.Date; -import java.util.concurrent.TimeUnit; - -import static java.time.temporal.ChronoUnit.DAYS; - -public class UsernameEvent extends MessageHandler { - @Override - public void handle() throws Exception { - boolean calendar = false; - if (!this.client.getHabbo().getHabboStats().getAchievementProgress().containsKey(Emulator.getGameEnvironment().getAchievementManager().getAchievement("Login"))) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Login")); - calendar = true; - } else { - - long daysBetween = DAYS.between(new Date((long) this.client.getHabbo().getHabboInfo().getLastOnline() * 1000L).toInstant(), new Date().toInstant()); - - - Date lastLogin = new Date(this.client.getHabbo().getHabboInfo().getLastOnline()); - Calendar c1 = Calendar.getInstance(); - c1.add(Calendar.DAY_OF_YEAR, -1); - - Calendar c2 = Calendar.getInstance(); - c2.setTime(lastLogin); - - if (daysBetween == 1) { - if (this.client.getHabbo().getHabboStats().getAchievementProgress().get(Emulator.getGameEnvironment().getAchievementManager().getAchievement("Login")) == this.client.getHabbo().getHabboStats().loginStreak) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Login")); - } - this.client.getHabbo().getHabboStats().loginStreak++; - calendar = true; - } else if (daysBetween >= 1) { - calendar = true; - } else { - if (((lastLogin.getTime() / 1000) - Emulator.getIntUnixTimestamp()) > 86400) { - this.client.getHabbo().getHabboStats().loginStreak = 0; - } - } - } - - if (!this.client.getHabbo().getHabboStats().getAchievementProgress().containsKey(Emulator.getGameEnvironment().getAchievementManager().getAchievement("RegistrationDuration"))) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RegistrationDuration"), 0); - } else { - int daysRegistered = ((Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboInfo().getAccountCreated()) / 86400); - - int days = this.client.getHabbo().getHabboStats().getAchievementProgress( - Emulator.getGameEnvironment().getAchievementManager().getAchievement("RegistrationDuration") - ); - - if (daysRegistered - days > 0) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RegistrationDuration"), daysRegistered - days); - } - } - - if (!this.client.getHabbo().getHabboStats().getAchievementProgress().containsKey(Emulator.getGameEnvironment().getAchievementManager().getAchievement("TraderPass"))) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("TraderPass")); - } - - - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement achievementQueueStatement = connection.prepareStatement("SELECT * FROM users_achievements_queue WHERE user_id = ?")) { - achievementQueueStatement.setInt(1, this.client.getHabbo().getHabboInfo().getId()); - - try (ResultSet achievementSet = achievementQueueStatement.executeQuery()) { - while (achievementSet.next()) { - AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement(achievementSet.getInt("achievement_id")), achievementSet.getInt("amount")); - } - } - - try (PreparedStatement deleteStatement = connection.prepareStatement("DELETE FROM users_achievements_queue WHERE user_id = ?")) { - deleteStatement.setInt(1, this.client.getHabbo().getHabboInfo().getId()); - deleteStatement.execute(); - } - } - if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) { - CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(Emulator.getConfig().getValue("hotel.calendar.default")); - if(campaign != null){ - long daysBetween = DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant()); - if(daysBetween >= 0) { - this.client.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), (int) daysBetween, this.client.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired())); - this.client.sendResponse(new NuxAlertComposer("openView/calendar")); - } - }; - } - - if (TargetOffer.ACTIVE_TARGET_OFFER_ID > 0) { - TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(TargetOffer.ACTIVE_TARGET_OFFER_ID); - - if (offer != null) { - this.client.sendResponse(new TargetedOfferComposer(this.client.getHabbo(), offer)); - } - } - - this.client.getHabbo().getHabboInfo().setLastOnline(Emulator.getIntUnixTimestamp()); - } -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java b/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java deleted file mode 100644 index 442406fb..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.eu.habbo.messages.incoming.unknown; - -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.unknown.IgnoredUsersComposer; - -public class UnknownEvent1 extends MessageHandler { - @Override - public void handle() throws Exception { - this.client.sendResponse(new IgnoredUsersComposer()); - } -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java index 02e50f12..b3cd69c6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java @@ -48,8 +48,8 @@ public class Outgoing { public final static int InventoryBadgesComposer = 717; public final static int UserTypingMessageComposer = 1717; public final static int GuildJoinErrorComposer = 762; - public final static int UserFlatCatsComposer = 1562; - public final static int InventoryAchievementsComposer = 2501; + public final static int RoomCategoriesComposer = 1562; + public final static int BadgePointLimitsComposer = 2501; public final static int MarketplaceItemInfoComposer = 725; public final static int RoomRelativeMapComposer = 2753; public final static int ModeratorActionResultMessageComposer = 2335; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java index a61fdfd0..6d8f3b73 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java @@ -4,10 +4,21 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import java.util.ArrayList; + public class IgnoredUsersComposer extends MessageComposer { + + ArrayList ignoredUsers; + + public IgnoredUsersComposer(ArrayList ignoredUsers) { + this.ignoredUsers = ignoredUsers; + } + @Override protected ServerMessage composeInternal() { - this.response.init(Outgoing.IgnoredUsersMessageComposer); + + } + this.response.init(Outgoing.IgnoredUsersComposer); this.response.appendInt(0); return this.response; }