diff --git a/Database Updates/000_all_database_updates.sql b/Database Updates/000_all_database_updates.sql index 38f3dc93..1795a9bb 100644 --- a/Database Updates/000_all_database_updates.sql +++ b/Database Updates/000_all_database_updates.sql @@ -1,37 +1,3 @@ --- ============================================================================= --- Consolidated Database Updates - All-in-One --- ============================================================================= --- This file combines ALL individual update scripts from SQL/Database Updates/ --- into a single idempotent migration. Every statement is safe to re-run: --- - ALTER TABLE ADD COLUMN IF NOT EXISTS (MariaDB 10.0+) --- - ALTER TABLE CHANGE/MODIFY COLUMN IF EXISTS --- - CREATE TABLE IF NOT EXISTS --- - INSERT IGNORE / ON DUPLICATE KEY UPDATE for settings --- - TRUNCATE + re-insert for reference data (breeding) --- --- Run order: This file FIRST, then 001_optimize_gameserver.sql --- --- Source files (in applied order): --- 1. UpdateDatabase_Allow_diagonale.sql --- 2. UpdateDatabase_BOT.sql --- 3. UpdateDatabase_Banners.sql --- 4. UpdateDatabase_DanceCMD.sql --- 5. UpdateDatabase_Happiness.sql --- 6. UpdateDatabase_Websocket.sql --- 7. UpdateDatabase_unignorable.sql --- 8. Default_Camera.sql --- 9. 07012026_UpdateDatabase_to_4-0-1.sql --- 10. 09012026_UpdateDatabase_to_4-0-2.sql --- 11. 12012026_Battle Banzai.sql (same as #10, deduplicated) --- 12. 12012026_Breeding Fixes.sql --- 13. 12012026_ChatBubbles.sql --- 14. 16032026_updateall_command.sql --- 15. 17032026_allow_underpass.sql --- 16. 19032026_hotel_timezone.sql --- 17. 21022026_user_prefixes.sql --- 18. 06042026_builders_club_catalog_offers.sql --- ============================================================================= - SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; SET @OLD_SQL_MODE = @@SQL_MODE; @@ -512,8 +478,13 @@ ALTER TABLE `users_settings` ADD COLUMN IF NOT EXISTS `builders_club_bonus_furni` INT(11) NOT NULL DEFAULT 0 AFTER `hc_gifts_claimed`; +INSERT INTO `permission_definitions` (`permission_key`, `max_value`, `comment`) +VALUES ( 'acc_staff_chat', 1, 'Grants access to the in-game Staff Chat group buddy: receives broadcasts from other staff and can broadcast to anyone holding this permission.' ) +ON DUPLICATE KEY UPDATE `max_value` = VALUES(`max_value`), `comment` = VALUES(`comment`); + -- ============================================================================= --- Done +-- Done. -- ============================================================================= + SET FOREIGN_KEY_CHECKS = 1; SET SQL_MODE = @OLD_SQL_MODE; diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java index fa4603cf..f60c1b49 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java @@ -219,6 +219,10 @@ public class Messenger { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + + if (habbo.hasPermission(StaffChatBuddy.PERMISSION_KEY)) { + this.friends.putIfAbsent(StaffChatBuddy.BUDDY_ID, new StaffChatBuddy(habbo.getHabboInfo().getId())); + } } public MessengerBuddy loadFriend(Habbo habbo, int userId) { diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/StaffChatBuddy.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/StaffChatBuddy.java new file mode 100644 index 00000000..65140faa --- /dev/null +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/StaffChatBuddy.java @@ -0,0 +1,57 @@ +package com.eu.habbo.habbohotel.messenger; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.commands.CommandHandler; +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer; + +public class StaffChatBuddy extends MessengerBuddy { + public static final int BUDDY_ID = -1; + public static final String PERMISSION_KEY = "acc_staff_chat"; + public static final String DISPLAY_NAME = "Staff Chat"; + public static final String DEFAULT_LOOK = "ADM"; + + public StaffChatBuddy(int userOne) { + super(BUDDY_ID, DISPLAY_NAME, DEFAULT_LOOK, (short) 0, userOne); + this.setOnline(true); + } + + @Override + public void onMessageReceived(Habbo from, String message) { + if (from == null || message == null || message.isEmpty()) return; + // Re-check permission so a staff member who was demoted mid-session + // can no longer broadcast to the staff channel. + if (!from.hasPermission(PERMISSION_KEY)) return; + + if (message.charAt(0) == ':') { + CommandHandler.handleCommand(from.getClient(), message); + return; + } + + Message chatMessage = new Message(from.getHabboInfo().getId(), BUDDY_ID, message); + Emulator.getGameServer().getGameClientManager().sendBroadcastResponse( + new FriendChatMessageComposer(chatMessage, BUDDY_ID, from.getHabboInfo().getId()).compose(), + PERMISSION_KEY, + from.getClient()); + } + + @Override + public void serialize(ServerMessage message) { + message.appendInt(this.getId()); + message.appendString(this.getUsername()); + message.appendInt(this.getGender().equals(HabboGender.M) ? 0 : 1); + message.appendBoolean(true); // online + message.appendBoolean(false); // not in room + message.appendString(this.getLook()); + message.appendInt(0); // category + message.appendString(""); // motto + message.appendString(""); // last seen + message.appendString(""); // realname + message.appendBoolean(true); // offline messaging supported + message.appendBoolean(false); + message.appendBoolean(false); + message.appendShort(0); // relation + } +} diff --git a/Latest_Compiled_Version/Habbo-4.1.2-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-4.1.2-jar-with-dependencies.jar index e1f2b3dd..bfab6f45 100644 Binary files a/Latest_Compiled_Version/Habbo-4.1.2-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-4.1.2-jar-with-dependencies.jar differ