diff --git a/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql b/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql index 78ce8842..4e5a5206 100644 --- a/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql +++ b/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql @@ -1,2 +1,2 @@ -- Recycler value fix -INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('recycler.value', '8'); \ No newline at end of file +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('recycler.value', '8'); diff --git a/sqlupdates/2_4_0_TO_2_4_5.sql b/sqlupdates/2_4_0_TO_2_4_5.sql new file mode 100644 index 00000000..97cedc4f --- /dev/null +++ b/sqlupdates/2_4_0_TO_2_4_5.sql @@ -0,0 +1,3 @@ +-- Permissions to see tent chat +ALTER TABLE `permissions` ADD `acc_see_tentchat` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_see_whispers`; +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.room.tent.prefix', 'Tent'); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java index 01257bea..6a26e6cb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java @@ -81,7 +81,6 @@ public class InteractionOneWayGate extends HabboItem { if (unit == null) return; - if (tileInfront.x == unit.getX() && tileInfront.y == unit.getY()) { if (!currentLocation.hasUnits()) { List onSuccess = new ArrayList(); diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java index 5dfdd12f..469f9072 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java @@ -6,6 +6,7 @@ public class Permission { public static String ACC_EMPTY_OTHERS = "acc_empty_others"; public static String ACC_ENABLE_OTHERS = "acc_enable_others"; public static String ACC_SEE_WHISPERS = "acc_see_whispers"; + public static String ACC_SEE_TENTCHAT = "acc_see_tentchat"; public static String ACC_SUPERWIRED = "acc_superwired"; public static String ACC_SUPPORTTOOL = "acc_supporttool"; public static String ACC_UNKICKABLE = "acc_unkickable"; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 1840a150..842142c8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3193,7 +3193,7 @@ public class Room implements Comparable, ISerialize, Runnable { } ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null; - Rectangle show = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation()); + Rectangle tentRectangle = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation()); String trimmedMessage = roomChatMessage.getMessage().replaceAll("\\s+$",""); @@ -3239,7 +3239,7 @@ public class Room implements Comparable, ISerialize, Runnable { if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || h.equals(habbo) || this.hasRights(h) || - noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + noChatLimit) && (tentRectangle == null || RoomLayout.tileInSquare(tentRectangle, h.getRoomUnit().getCurrentLocation()))) { if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { if (prefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(prefixMessage); @@ -3249,13 +3249,19 @@ public class Room implements Comparable, ISerialize, Runnable { h.getClient().sendResponse(clearPrefixMessage); } } + continue; } + // Staff should be able to see the tent chat anyhow + showTentChatMessageOutsideTentIfPermitted(h, roomChatMessage, tentRectangle); } } else if (chatType == RoomChatType.SHOUT) { ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); for (Habbo h : this.getHabbos()) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + // Show the message + // If the receiving Habbo has not ignored the sending Habbo + // AND the sending Habbo is NOT in a tent OR the receiving Habbo is in the same tent as the sending Habbo + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (tentRectangle == null || RoomLayout.tileInSquare(tentRectangle, h.getRoomUnit().getCurrentLocation()))) { if (prefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(prefixMessage); } @@ -3263,7 +3269,10 @@ public class Room implements Comparable, ISerialize, Runnable { if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(clearPrefixMessage); } + continue; } + // Staff should be able to see the tent chat anyhow, even when not in the same tent + showTentChatMessageOutsideTentIfPermitted(h, roomChatMessage, tentRectangle); } } @@ -3315,11 +3324,25 @@ public class Room implements Comparable, ISerialize, Runnable { } } } - } } } + /** + * Sends the given message to the receiving Habbo if the Habbo has the ACC_SEE_TENTCHAT permission and is not within the tent + * @param receivingHabbo The receiving Habbo + * @param roomChatMessage The message to receive + * @param tentRectangle The whole tent area from where the sending Habbo is saying something + */ + private void showTentChatMessageOutsideTentIfPermitted(Habbo receivingHabbo, RoomChatMessage roomChatMessage, Rectangle tentRectangle) { + if (receivingHabbo != null && receivingHabbo.hasPermission(Permission.ACC_SEE_TENTCHAT) && tentRectangle != null && !RoomLayout.tileInSquare(tentRectangle, receivingHabbo.getRoomUnit().getCurrentLocation())) { + RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); + staffChatMessage.setMessage("[" + Emulator.getTexts().getValue("hotel.room.tent.prefix") + "] " + staffChatMessage.getMessage()); + final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); + receivingHabbo.getClient().sendResponse(staffMessage); + } + } + public THashSet getLockedTiles() { THashSet lockedTiles = new THashSet<>();