Fix #923 room host achievement

Fixes issue #923
This commit is contained in:
Snaiker 2020-12-27 13:13:26 -05:00 committed by skeletor
parent 8edb5f00fa
commit 4fc5a484ae
3 changed files with 30 additions and 0 deletions

View File

@ -104,6 +104,8 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('subscriptions.hc.payday.m
-- OPTIONAL HC MIGRATION
-- INSERT INTO users_subscriptions SELECT NULL, user_id, 'HABBO_CLUB' as `subscription_type`, UNIX_TIMESTAMP() AS `timestamp_start`, (club_expire_timestamp - UNIX_TIMESTAMP()) AS `duration`, 1 AS `active` FROM users_settings WHERE club_expire_timestamp > UNIX_TIMESTAMP();
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.rooms.deco_hosting', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('easter_eggs.enabled', '1');
ALTER TABLE `bots`

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.bots.VisitorBot;
import com.eu.habbo.habbohotel.commands.CommandHandler;
@ -1221,6 +1222,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) {
//Check if the user isn't the owner id
if (this.ownerId != habbo.getHabboInfo().getId()) {
//Check if the time already have 1 minute (120 / 2 = 60s)
if (habbo.getRoomUnit().getTimeInRoom() >= 120) {
AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"));
habbo.getRoomUnit().resetTimeInRoom();
} else {
habbo.getRoomUnit().increaseTimeInRoom();
}
}
}
if (habbo.getHabboStats().mutedBubbleTracker && habbo.getHabboStats().allowTalk()) {
habbo.getHabboStats().mutedBubbleTracker = false;
this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose());

View File

@ -73,6 +73,7 @@ public class RoomUnit {
private int effectId;
private int effectEndTimestamp;
private ScheduledFuture moveBlockingTask;
private int timeInRoom;
private int idleTimer;
private Room room;
@ -93,6 +94,7 @@ public class RoomUnit {
this.effectId = 0;
this.isKicked = false;
this.overridableTiles = new THashSet<>();
this.timeInRoom = 0;
}
public void clearWalking() {
@ -639,6 +641,18 @@ public class RoomUnit {
this.walkTimeOut = walkTimeOut;
}
public void increaseTimeInRoom() {
this.timeInRoom++;
}
public int getTimeInRoom() {
return this.timeInRoom;
}
public void resetTimeInRoom() {
this.timeInRoom = 0;
}
public void increaseIdleTimer() {
this.idleTimer++;
}