fixed multiple bots on one tile and refactored code

This commit is contained in:
necmi 2020-07-11 06:02:21 +02:00 committed by necm1
parent 3b50122d74
commit f67c03df8e
3 changed files with 7 additions and 1 deletions

View File

@ -122,6 +122,11 @@ public class BotManager {
if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY))
return;
if (room.hasBotsAt(location.x, location.y)) {
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE));
return;
}
RoomUnit roomUnit = new RoomUnit();
roomUnit.setRotation(RoomUserRotation.SOUTH);
roomUnit.setLocation(location);

View File

@ -559,7 +559,7 @@ public class RoomManager {
if (room.getPassword().equalsIgnoreCase(password))
this.openRoom(habbo, room, doorLocation);
else {
habbo.getClient().sendResponse(new GenericErrorMessagesComposer(-100002));
habbo.getClient().sendResponse(new GenericErrorMessagesComposer(GenericErrorMessagesComposer.WRONG_PASSWORD_USED));
habbo.getClient().sendResponse(new HotelViewComposer());
habbo.getHabboInfo().setLoadingRoom(0);
}

View File

@ -11,6 +11,7 @@ public class GenericErrorMessagesComposer extends MessageComposer {
public static final int NEED_TO_BE_VIP = 4009;
public static final int ROOM_NAME_UNACCEPTABLE = 4010;
public static final int CANNOT_BAN_GROUP_MEMBER = 4011;
public static final int WRONG_PASSWORD_USED = -100002;
private final int errorCode;