Merge branch 'fix-room-decohosting' into 'dev'

Fix the Cycle on RoomDeco Hosting

See merge request morningstar/Arcturus-Community!107
This commit is contained in:
ArpyAge 2024-11-18 21:26:27 +00:00
commit c2e5424122
2 changed files with 15 additions and 27 deletions

View File

@ -203,6 +203,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
private volatile boolean loaded;
private volatile boolean preLoaded;
private int idleCycles;
private int idleHostingCycles;
private volatile int unitCounter;
private volatile int rollerSpeed;
private final int muteTime = Emulator.getConfig().getInt("hotel.flood.mute.time", 30);
@ -368,6 +369,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
this.idleCycles = 0;
this.idleHostingCycles = 0;
this.loaded = true;
this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS);
@ -1209,6 +1211,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
task.cycle(this);
}
if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) {
if (this.idleHostingCycles < 120) {
this.idleHostingCycles++;
} else {
this.idleHostingCycles = 0;
int amount = (int) this.currentHabbos.values().stream().filter(habbo -> habbo.getHabboInfo().getId() != this.ownerId).count();
if (amount > 0) {
AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"), amount);
}
}
}
if (!this.currentHabbos.isEmpty()) {
this.idleCycles = 0;
@ -1267,19 +1282,6 @@ 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,7 +73,6 @@ public class RoomUnit {
private int effectId;
private int effectEndTimestamp;
private ScheduledFuture moveBlockingTask;
private int timeInRoom;
private int idleTimer;
private Room room;
@ -94,7 +93,6 @@ public class RoomUnit {
this.effectId = 0;
this.isKicked = false;
this.overridableTiles = new THashSet<>();
this.timeInRoom = 0;
}
public void clearWalking() {
@ -645,18 +643,6 @@ 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++;
}