Fixed rollers causing dead tiles and wired recognizing user on roller

This commit is contained in:
Yordi 2024-10-16 10:30:31 +02:00
parent 0a6355996a
commit 71aa4d8676

View File

@ -1269,7 +1269,7 @@ 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)
//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();
@ -1498,11 +1498,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (unit.hasStatus(RoomUnitStatus.MOVE))
continue;
RoomTile tile = tileInFront.copy();
tile.setStackHeight(unit.getZ() + zOffset);
double newZ = unit.getZ() + zOffset;
if (roomUserRolledEvent != null && unit.getRoomUnitType() == RoomUnitType.USER) {
roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tile);
roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tileInFront);
Emulator.getPluginManager().fireEvent(roomUserRolledEvent);
if (roomUserRolledEvent.isCancelled())
@ -1517,10 +1516,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
RideablePet riding = rollingHabbo.getHabboInfo().getRiding();
if (riding != null) {
RoomUnit ridingUnit = riding.getRoomUnit();
tile.setStackHeight(ridingUnit.getZ() + zOffset);
newZ = ridingUnit.getZ() + zOffset;
rolledUnitIds.add(ridingUnit.getId());
updatedUnit.remove(ridingUnit);
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight(), room));
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tileInFront, newZ, room));
isRiding = true;
}
}
@ -1529,7 +1528,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
usersRolledThisTile.add(unit.getId());
rolledUnitIds.add(unit.getId());
updatedUnit.remove(unit);
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0), room));
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), room));
if (itemsOnRoller.isEmpty()) {
HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y);
@ -2091,7 +2090,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
for (Pet pet : toRemovePets) {
removedPets.add(pet);
pet.removeFromRoom();
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId());
@ -3697,7 +3696,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (x < 0 || y < 0 || this.layout == null)
return calculateHeightmap ? Short.MAX_VALUE : 0.0;
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
if(event.hasPluginHelper()) {
@ -4022,7 +4021,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return;
this.sendComposer(new RoomRemoveRightsListComposer(this, userId).compose());
if (this.rights.remove(userId)) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ? AND user_id = ?")) {
statement.setInt(1, this.id);
@ -4533,7 +4532,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (tile == null || tile.state == RoomTileState.INVALID) {
return FurnitureMovementError.INVALID_MOVE;
}
rotation %= 8;
if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
return FurnitureMovementError.NONE;
@ -4553,7 +4552,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) {
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
return FurnitureMovementError.NONE;
return FurnitureMovementError.NONE;
}
}
@ -4933,4 +4932,4 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
THashSet<RoomUnit> roomUnits = getRoomUnits();
return roomUnits.stream().filter(unit -> unit.getCurrentLocation() == tile).collect(Collectors.toSet());
}
}
}