Merge branch 'patch-fix-ach-room-entry' into 'dev'

Fix achievement Room Entry

See merge request morningstar/Arcturus-Community!353
This commit is contained in:
skeletor 2020-12-27 13:07:16 -05:00
commit d015adcf20
2 changed files with 19 additions and 1 deletions

View File

@ -672,7 +672,7 @@ public class RoomManager {
habbo.getClient().sendResponse(new RoomPromotionMessageComposer(null, null));
}
if (room.getOwnerId() != habbo.getHabboInfo().getId()) {
if (room.getOwnerId() != habbo.getHabboInfo().getId() && !habbo.getHabboStats().visitedRoom(room.getId())) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomEntry"));
}
}
@ -916,6 +916,9 @@ public class RoomManager {
statement.setInt(2, habbo.getHabboInfo().getId());
statement.setInt(3, (int) (habbo.getHabboStats().roomEnterTimestamp));
statement.execute();
if (!habbo.getHabboStats().visitedRoom(room.getId()))
habbo.getHabboStats().addVisitRoom(room.getId());
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}

View File

@ -41,6 +41,7 @@ public class HabboStats implements Runnable {
private final THashMap<Integer, CatalogItem> recentPurchases;
private final TIntArrayList favoriteRooms;
private final TIntArrayList ignoredUsers;
private TIntArrayList roomsVists;
public int achievementScore;
public int respectPointsReceived;
public int respectPointsGiven;
@ -106,6 +107,7 @@ public class HabboStats implements Runnable {
this.recentPurchases = new THashMap<>(0);
this.favoriteRooms = new TIntArrayList(0);
this.ignoredUsers = new TIntArrayList(0);
this.roomsVists = new TIntArrayList(0);
this.secretRecipes = new TIntArrayList(0);
this.calendarRewardsClaimed = new TIntArrayList(0);
@ -236,6 +238,15 @@ public class HabboStats implements Runnable {
}
}
}
try (PreparedStatement loadRoomsVisit = set.getStatement().getConnection().prepareStatement("SELECT DISTINCT room_id FROM room_enter_log WHERE user_id = ?")) {
loadRoomsVisit.setInt(1, this.habboInfo.getId());
try (ResultSet roomSet = loadRoomsVisit.executeQuery()) {
while (roomSet.next()) {
this.roomsVists.add(roomSet.getInt("room_id"));
}
}
}
}
private static HabboStats createNewStats(HabboInfo habboInfo) {
@ -622,6 +633,10 @@ public class HabboStats implements Runnable {
return this.favoriteRooms.contains(roomId);
}
public boolean visitedRoom(int roomId) { return this.roomsVists.contains(roomId); }
public void addVisitRoom(int roomId) { this.roomsVists.add(roomId); }
public TIntArrayList getFavoriteRooms() {
return this.favoriteRooms;
}