From 8d7d5264e591b84e204e2733fe8fb8447c69bb8c Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Thu, 16 May 2019 19:46:37 +0300 Subject: [PATCH 1/2] Closes #28 --- sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql | 3 +++ src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql index f6e347dd..6769fd62 100644 --- a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql +++ b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql @@ -8,4 +8,7 @@ ADD COLUMN `build_hash` varchar(64) NOT NULL AFTER `version`; INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('scripter.modtool.tickets', '1'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('invisible.prevent.chat', '0'); +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('invisible.prevent.chat.error', 'While being invisible you cannot talk.'); + #END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 \ No newline at end of file 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 6e0243ed..66a347e5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3711,6 +3711,14 @@ public class Room implements Comparable, ISerialize, Runnable if (!habbo.getHabboStats().allowTalk()) return; + if (habbo.getRoomUnit().isInvisible() && Emulator.getConfig().getBoolean("invisible.prevent.chat", false)) { + if (!CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) { + habbo.whisper(Emulator.getTexts().getValue("invisible.prevent.chat.error")); + } + + return; + } + habbo.getHabboStats().chatCounter += 2; if (habbo.getHabboInfo().getCurrentRoom() != this) From 2b02012ecd5b7305404f70335f7f6e015f058302 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Thu, 16 May 2019 20:11:11 +0300 Subject: [PATCH 2/2] Make invisible command toggleable --- sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql | 2 ++ .../habbohotel/commands/InvisibleCommand.java | 30 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql index 6769fd62..693b0804 100644 --- a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql +++ b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql @@ -11,4 +11,6 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('scripter.modtool.ticket INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('invisible.prevent.chat', '0'); INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('invisible.prevent.chat.error', 'While being invisible you cannot talk.'); +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('commands.succes.cmd_invisible.updated.back', 'You are now visible again.'); + #END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java index 464f33b3..8be82b99 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java @@ -2,8 +2,14 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.rooms.RoomUserRotation; +import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer; public class InvisibleCommand extends Command { @@ -17,10 +23,30 @@ public class InvisibleCommand extends Command { RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit(); + if (roomUnit.isInvisible()) { + RoomLayout roomLayout = roomUnit.getRoom().getLayout(); + + roomUnit.setLocation(roomLayout.getDoorTile()); + roomUnit.clearStatus(); + roomUnit.clearWalking(); + roomUnit.setBodyRotation(RoomUserRotation.values()[roomLayout.getDoorDirection()]); + roomUnit.setHeadRotation(RoomUserRotation.values()[roomLayout.getDoorDirection()]); + roomUnit.setInvisible(false); + roomUnit.setInRoom(true); + + roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose()); + roomUnit.getRoom().sendComposer(new RoomUserStatusComposer(roomUnit).compose()); + + WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null); + roomUnit.getRoom().habboEntered(gameClient.getHabbo()); + + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated.back")); + + return true; + } + roomUnit.setInvisible(true); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated")); - gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRemoveComposer(roomUnit).compose()); return true;