From 12d03bebc92a03c99db8d48a91c38ecc19ee7084 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 27 May 2019 00:28:35 +0300 Subject: [PATCH] Add game-related achievements --- .../java/com/eu/habbo/habbohotel/games/Game.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index 1b22ff67..072060e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -142,6 +142,13 @@ public abstract class Game implements Runnable { this.saveScores(); + int totalPointsGained = this.teams.values().stream().mapToInt(GameTeam::getTotalScore).sum(); + + Habbo roomOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.room.getOwnerId()); + if (roomOwner != null) { + AchievementManager.progressAchievement(roomOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GameAuthorExperience"), totalPointsGained); + } + GameTeam winningTeam = null; for (GameTeam team : this.teams.values()) { if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { @@ -152,6 +159,11 @@ public abstract class Game implements Runnable { if (winningTeam != null) { for (GamePlayer player : winningTeam.getMembers()) { WiredHandler.handleCustomTrigger(WiredTriggerTeamWins.class, player.getHabbo().getRoomUnit(), this.room, new Object[]{this}); + + Habbo winner = player.getHabbo(); + if (winner != null) { + AchievementManager.progressAchievement(roomOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GamePlayerExperience")); + } } for (GameTeam team : this.teams.values()) {