Add game-related achievements

This commit is contained in:
Alejandro 2019-05-27 00:28:35 +03:00
parent 1d8b82c4ec
commit 12d03bebc9

View File

@ -142,6 +142,13 @@ public abstract class Game implements Runnable {
this.saveScores(); 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; GameTeam winningTeam = null;
for (GameTeam team : this.teams.values()) { for (GameTeam team : this.teams.values()) {
if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) {
@ -152,6 +159,11 @@ public abstract class Game implements Runnable {
if (winningTeam != null) { if (winningTeam != null) {
for (GamePlayer player : winningTeam.getMembers()) { for (GamePlayer player : winningTeam.getMembers()) {
WiredHandler.handleCustomTrigger(WiredTriggerTeamWins.class, player.getHabbo().getRoomUnit(), this.room, new Object[]{this}); 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()) { for (GameTeam team : this.teams.values()) {