From 5dd5b26bbe4f4f347ce7869bfc29665a5282cb63 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sun, 24 May 2026 11:52:41 +0200 Subject: [PATCH] feat(communication): housekeeping hotel alert + dashboard + audit log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Outgoing 9127-9129: send-hotel-alert (message string), get-dashboard (no args), list-action-log (limit int). Incoming 9206 HousekeepingDashboardEvent + 9207 ActionLogEvent with matching parsers and data classes. Dashboard is a flat one-shot parse — no count prefix; action log uses the standard "count + N entries" list pattern. Closes the HK packet surface — yarn compile:fast clean. --- packages/communication/src/NitroMessages.ts | 7 ++- .../src/messages/incoming/IncomingHeader.ts | 2 + .../HousekeepingActionLogEvent.ts | 16 +++++ .../HousekeepingDashboardEvent.ts | 16 +++++ .../messages/incoming/housekeeping/index.ts | 2 + .../src/messages/outgoing/OutgoingHeader.ts | 3 + .../HousekeepingGetDashboardComposer.ts | 7 +++ .../HousekeepingListActionLogComposer.ts | 11 ++++ .../HousekeepingSendHotelAlertComposer.ts | 11 ++++ .../messages/outgoing/housekeeping/index.ts | 9 ++- .../HousekeepingActionLogEntryData.ts | 42 +++++++++++++ .../HousekeepingActionLogParser.ts | 27 +++++++++ .../HousekeepingDashboardParser.ts | 60 +++++++++++++++++++ .../src/messages/parser/housekeeping/index.ts | 3 + 14 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 packages/communication/src/messages/incoming/housekeeping/HousekeepingActionLogEvent.ts create mode 100644 packages/communication/src/messages/incoming/housekeeping/HousekeepingDashboardEvent.ts create mode 100644 packages/communication/src/messages/outgoing/housekeeping/HousekeepingGetDashboardComposer.ts create mode 100644 packages/communication/src/messages/outgoing/housekeeping/HousekeepingListActionLogComposer.ts create mode 100644 packages/communication/src/messages/outgoing/housekeeping/HousekeepingSendHotelAlertComposer.ts create mode 100644 packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogEntryData.ts create mode 100644 packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogParser.ts create mode 100644 packages/communication/src/messages/parser/housekeeping/HousekeepingDashboardParser.ts diff --git a/packages/communication/src/NitroMessages.ts b/packages/communication/src/NitroMessages.ts index bab22d9..845b7d3 100644 --- a/packages/communication/src/NitroMessages.ts +++ b/packages/communication/src/NitroMessages.ts @@ -7,7 +7,7 @@ import { ConfInvisStateMessageEvent } from './messages'; import { HanditemBlockStateMessageEvent } from './messages'; import { TranslationLanguagesEvent, TranslationLanguagesRequestComposer, TranslationResultEvent, TranslationTextRequestComposer } from './messages'; import { YouTubeRoomBroadcastEvent, YouTubeRoomPlayComposer, YouTubeRoomSettingsComposer, YouTubeRoomSettingsEvent, YouTubeRoomWatchersEvent, YouTubeRoomWatchingComposer } from './messages'; -import { HousekeepingActionResultEvent, HousekeepingBanUserComposer, HousekeepingDeleteRoomComposer, HousekeepingFindRoomByIdComposer, HousekeepingFindUserByIdComposer, HousekeepingFindUserByNameComposer, HousekeepingForceDisconnectUserComposer, HousekeepingGiveCreditsComposer, HousekeepingGiveCurrencyComposer, HousekeepingGrantItemComposer, HousekeepingKickAllFromRoomComposer, HousekeepingKickUserComposer, HousekeepingMuteRoomComposer, HousekeepingMuteUserComposer, HousekeepingResetUserPasswordComposer, HousekeepingRoomDetailEvent, HousekeepingRoomListEvent, HousekeepingRoomStateComposer, HousekeepingSearchRoomsComposer, HousekeepingSetHcSubscriptionComposer, HousekeepingSetUserRankComposer, HousekeepingTradeLockUserComposer, HousekeepingTransferRoomOwnershipComposer, HousekeepingUnbanUserComposer, HousekeepingUserDetailEvent } from './messages'; +import { HousekeepingActionLogEvent, HousekeepingActionResultEvent, HousekeepingBanUserComposer, HousekeepingDashboardEvent, HousekeepingDeleteRoomComposer, HousekeepingFindRoomByIdComposer, HousekeepingFindUserByIdComposer, HousekeepingFindUserByNameComposer, HousekeepingForceDisconnectUserComposer, HousekeepingGetDashboardComposer, HousekeepingGiveCreditsComposer, HousekeepingGiveCurrencyComposer, HousekeepingGrantItemComposer, HousekeepingKickAllFromRoomComposer, HousekeepingKickUserComposer, HousekeepingListActionLogComposer, HousekeepingMuteRoomComposer, HousekeepingMuteUserComposer, HousekeepingResetUserPasswordComposer, HousekeepingRoomDetailEvent, HousekeepingRoomListEvent, HousekeepingRoomStateComposer, HousekeepingSearchRoomsComposer, HousekeepingSendHotelAlertComposer, HousekeepingSetHcSubscriptionComposer, HousekeepingSetUserRankComposer, HousekeepingTradeLockUserComposer, HousekeepingTransferRoomOwnershipComposer, HousekeepingUnbanUserComposer, HousekeepingUserDetailEvent } from './messages'; export class NitroMessages implements IMessageConfiguration { private _events: Map; @@ -512,6 +512,8 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.HOUSEKEEPING_ACTION_RESULT, HousekeepingActionResultEvent); this._events.set(IncomingHeader.HOUSEKEEPING_ROOM_DETAIL, HousekeepingRoomDetailEvent); this._events.set(IncomingHeader.HOUSEKEEPING_ROOM_LIST, HousekeepingRoomListEvent); + this._events.set(IncomingHeader.HOUSEKEEPING_DASHBOARD, HousekeepingDashboardEvent); + this._events.set(IncomingHeader.HOUSEKEEPING_ACTION_LOG, HousekeepingActionLogEvent); this._events.set(IncomingHeader.WIRED_REWARD, WiredRewardResultMessageEvent); this._events.set(IncomingHeader.WIRED_SAVE, WiredSaveSuccessEvent); this._events.set(IncomingHeader.WIRED_ERROR, WiredValidationErrorEvent); @@ -1285,6 +1287,9 @@ export class NitroMessages implements IMessageConfiguration this._composers.set(OutgoingHeader.HOUSEKEEPING_GIVE_CURRENCY, HousekeepingGiveCurrencyComposer); this._composers.set(OutgoingHeader.HOUSEKEEPING_GRANT_ITEM, HousekeepingGrantItemComposer); this._composers.set(OutgoingHeader.HOUSEKEEPING_SET_HC_SUBSCRIPTION, HousekeepingSetHcSubscriptionComposer); + this._composers.set(OutgoingHeader.HOUSEKEEPING_SEND_HOTEL_ALERT, HousekeepingSendHotelAlertComposer); + this._composers.set(OutgoingHeader.HOUSEKEEPING_GET_DASHBOARD, HousekeepingGetDashboardComposer); + this._composers.set(OutgoingHeader.HOUSEKEEPING_LIST_ACTION_LOG, HousekeepingListActionLogComposer); } public get events(): Map diff --git a/packages/communication/src/messages/incoming/IncomingHeader.ts b/packages/communication/src/messages/incoming/IncomingHeader.ts index 9b25958..bd60165 100644 --- a/packages/communication/src/messages/incoming/IncomingHeader.ts +++ b/packages/communication/src/messages/incoming/IncomingHeader.ts @@ -509,4 +509,6 @@ export class IncomingHeader public static HOUSEKEEPING_ACTION_RESULT = 9201; public static HOUSEKEEPING_ROOM_DETAIL = 9202; public static HOUSEKEEPING_ROOM_LIST = 9203; + public static HOUSEKEEPING_DASHBOARD = 9204; + public static HOUSEKEEPING_ACTION_LOG = 9205; } diff --git a/packages/communication/src/messages/incoming/housekeeping/HousekeepingActionLogEvent.ts b/packages/communication/src/messages/incoming/housekeeping/HousekeepingActionLogEvent.ts new file mode 100644 index 0000000..72a5517 --- /dev/null +++ b/packages/communication/src/messages/incoming/housekeeping/HousekeepingActionLogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '@nitrots/api'; +import { MessageEvent } from '@nitrots/events'; +import { HousekeepingActionLogParser } from '../../parser'; + +export class HousekeepingActionLogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HousekeepingActionLogParser); + } + + public getParser(): HousekeepingActionLogParser + { + return this.parser as HousekeepingActionLogParser; + } +} diff --git a/packages/communication/src/messages/incoming/housekeeping/HousekeepingDashboardEvent.ts b/packages/communication/src/messages/incoming/housekeeping/HousekeepingDashboardEvent.ts new file mode 100644 index 0000000..61f2c6e --- /dev/null +++ b/packages/communication/src/messages/incoming/housekeeping/HousekeepingDashboardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '@nitrots/api'; +import { MessageEvent } from '@nitrots/events'; +import { HousekeepingDashboardParser } from '../../parser'; + +export class HousekeepingDashboardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HousekeepingDashboardParser); + } + + public getParser(): HousekeepingDashboardParser + { + return this.parser as HousekeepingDashboardParser; + } +} diff --git a/packages/communication/src/messages/incoming/housekeeping/index.ts b/packages/communication/src/messages/incoming/housekeeping/index.ts index 9d293d5..16d9727 100644 --- a/packages/communication/src/messages/incoming/housekeeping/index.ts +++ b/packages/communication/src/messages/incoming/housekeeping/index.ts @@ -1,4 +1,6 @@ +export * from './HousekeepingActionLogEvent'; export * from './HousekeepingActionResultEvent'; +export * from './HousekeepingDashboardEvent'; export * from './HousekeepingRoomDetailEvent'; export * from './HousekeepingRoomListEvent'; export * from './HousekeepingUserDetailEvent'; diff --git a/packages/communication/src/messages/outgoing/OutgoingHeader.ts b/packages/communication/src/messages/outgoing/OutgoingHeader.ts index c9a220e..532c562 100644 --- a/packages/communication/src/messages/outgoing/OutgoingHeader.ts +++ b/packages/communication/src/messages/outgoing/OutgoingHeader.ts @@ -545,4 +545,7 @@ export class OutgoingHeader public static HOUSEKEEPING_GIVE_CURRENCY = 9118; public static HOUSEKEEPING_GRANT_ITEM = 9119; public static HOUSEKEEPING_SET_HC_SUBSCRIPTION = 9120; + public static HOUSEKEEPING_SEND_HOTEL_ALERT = 9121; + public static HOUSEKEEPING_GET_DASHBOARD = 9122; + public static HOUSEKEEPING_LIST_ACTION_LOG = 9123; } diff --git a/packages/communication/src/messages/outgoing/housekeeping/HousekeepingGetDashboardComposer.ts b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingGetDashboardComposer.ts new file mode 100644 index 0000000..4158604 --- /dev/null +++ b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingGetDashboardComposer.ts @@ -0,0 +1,7 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class HousekeepingGetDashboardComposer implements IMessageComposer<[]> +{ + public getMessageArray(): [] { return []; } + public dispose(): void { return; } +} diff --git a/packages/communication/src/messages/outgoing/housekeeping/HousekeepingListActionLogComposer.ts b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingListActionLogComposer.ts new file mode 100644 index 0000000..476f1eb --- /dev/null +++ b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingListActionLogComposer.ts @@ -0,0 +1,11 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class HousekeepingListActionLogComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(limit: number) { this._data = [limit]; } + + public getMessageArray() { return this._data; } + public dispose(): void { return; } +} diff --git a/packages/communication/src/messages/outgoing/housekeeping/HousekeepingSendHotelAlertComposer.ts b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingSendHotelAlertComposer.ts new file mode 100644 index 0000000..9e400ad --- /dev/null +++ b/packages/communication/src/messages/outgoing/housekeeping/HousekeepingSendHotelAlertComposer.ts @@ -0,0 +1,11 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class HousekeepingSendHotelAlertComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(message: string) { this._data = [message]; } + + public getMessageArray() { return this._data; } + public dispose(): void { return; } +} diff --git a/packages/communication/src/messages/outgoing/housekeeping/index.ts b/packages/communication/src/messages/outgoing/housekeeping/index.ts index 7e71234..04262b4 100644 --- a/packages/communication/src/messages/outgoing/housekeeping/index.ts +++ b/packages/communication/src/messages/outgoing/housekeeping/index.ts @@ -1,19 +1,22 @@ export * from './HousekeepingBanUserComposer'; export * from './HousekeepingDeleteRoomComposer'; export * from './HousekeepingFindRoomByIdComposer'; -export * from './HousekeepingGiveCreditsComposer'; -export * from './HousekeepingGiveCurrencyComposer'; -export * from './HousekeepingGrantItemComposer'; export * from './HousekeepingFindUserByIdComposer'; export * from './HousekeepingFindUserByNameComposer'; export * from './HousekeepingForceDisconnectUserComposer'; +export * from './HousekeepingGetDashboardComposer'; +export * from './HousekeepingGiveCreditsComposer'; +export * from './HousekeepingGiveCurrencyComposer'; +export * from './HousekeepingGrantItemComposer'; export * from './HousekeepingKickAllFromRoomComposer'; export * from './HousekeepingKickUserComposer'; +export * from './HousekeepingListActionLogComposer'; export * from './HousekeepingMuteRoomComposer'; export * from './HousekeepingMuteUserComposer'; export * from './HousekeepingResetUserPasswordComposer'; export * from './HousekeepingRoomStateComposer'; export * from './HousekeepingSearchRoomsComposer'; +export * from './HousekeepingSendHotelAlertComposer'; export * from './HousekeepingSetHcSubscriptionComposer'; export * from './HousekeepingSetUserRankComposer'; export * from './HousekeepingTradeLockUserComposer'; diff --git a/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogEntryData.ts b/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogEntryData.ts new file mode 100644 index 0000000..7d8028e --- /dev/null +++ b/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogEntryData.ts @@ -0,0 +1,42 @@ +import { IMessageDataWrapper } from '@nitrots/api'; + +export class HousekeepingActionLogEntryData +{ + private _id: number = 0; + private _timestamp: number = 0; + private _actorId: number = 0; + private _actorName: string = ''; + private _targetType: string = 'user'; + private _targetId: number = 0; + private _targetLabel: string = ''; + private _action: string = ''; + private _detail: string = ''; + private _success: boolean = true; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._id = wrapper.readInt(); + this._timestamp = wrapper.readInt(); + this._actorId = wrapper.readInt(); + this._actorName = wrapper.readString(); + this._targetType = wrapper.readString(); + this._targetId = wrapper.readInt(); + this._targetLabel = wrapper.readString(); + this._action = wrapper.readString(); + this._detail = wrapper.readString(); + this._success = wrapper.readBoolean(); + } + + public get id(): number { return this._id; } + public get timestamp(): number { return this._timestamp; } + public get actorId(): number { return this._actorId; } + public get actorName(): string { return this._actorName; } + public get targetType(): string { return this._targetType; } + public get targetId(): number { return this._targetId; } + public get targetLabel(): string { return this._targetLabel; } + public get action(): string { return this._action; } + public get detail(): string { return this._detail; } + public get success(): boolean { return this._success; } +} diff --git a/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogParser.ts b/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogParser.ts new file mode 100644 index 0000000..cec0201 --- /dev/null +++ b/packages/communication/src/messages/parser/housekeeping/HousekeepingActionLogParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '@nitrots/api'; +import { HousekeepingActionLogEntryData } from './HousekeepingActionLogEntryData'; + +export class HousekeepingActionLogParser implements IMessageParser +{ + private _entries: HousekeepingActionLogEntryData[] = []; + + public flush(): boolean + { + this._entries = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) this._entries.push(new HousekeepingActionLogEntryData(wrapper)); + + return true; + } + + public get entries(): HousekeepingActionLogEntryData[] { return this._entries; } +} diff --git a/packages/communication/src/messages/parser/housekeeping/HousekeepingDashboardParser.ts b/packages/communication/src/messages/parser/housekeeping/HousekeepingDashboardParser.ts new file mode 100644 index 0000000..cec54c2 --- /dev/null +++ b/packages/communication/src/messages/parser/housekeeping/HousekeepingDashboardParser.ts @@ -0,0 +1,60 @@ +import { IMessageDataWrapper, IMessageParser } from '@nitrots/api'; + +export class HousekeepingDashboardParser implements IMessageParser +{ + private _onlineUsers: number = 0; + private _totalUsers: number = 0; + private _activeRooms: number = 0; + private _totalRooms: number = 0; + private _peakOnlineToday: number = 0; + private _peakOnlineAllTime: number = 0; + private _pendingTickets: number = 0; + private _sanctionsLast24h: number = 0; + private _serverUptimeSeconds: number = 0; + private _serverVersion: string = ''; + + public flush(): boolean + { + this._onlineUsers = 0; + this._totalUsers = 0; + this._activeRooms = 0; + this._totalRooms = 0; + this._peakOnlineToday = 0; + this._peakOnlineAllTime = 0; + this._pendingTickets = 0; + this._sanctionsLast24h = 0; + this._serverUptimeSeconds = 0; + this._serverVersion = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._onlineUsers = wrapper.readInt(); + this._totalUsers = wrapper.readInt(); + this._activeRooms = wrapper.readInt(); + this._totalRooms = wrapper.readInt(); + this._peakOnlineToday = wrapper.readInt(); + this._peakOnlineAllTime = wrapper.readInt(); + this._pendingTickets = wrapper.readInt(); + this._sanctionsLast24h = wrapper.readInt(); + this._serverUptimeSeconds = wrapper.readInt(); + this._serverVersion = wrapper.readString(); + + return true; + } + + public get onlineUsers(): number { return this._onlineUsers; } + public get totalUsers(): number { return this._totalUsers; } + public get activeRooms(): number { return this._activeRooms; } + public get totalRooms(): number { return this._totalRooms; } + public get peakOnlineToday(): number { return this._peakOnlineToday; } + public get peakOnlineAllTime(): number { return this._peakOnlineAllTime; } + public get pendingTickets(): number { return this._pendingTickets; } + public get sanctionsLast24h(): number { return this._sanctionsLast24h; } + public get serverUptimeSeconds(): number { return this._serverUptimeSeconds; } + public get serverVersion(): string { return this._serverVersion; } +} diff --git a/packages/communication/src/messages/parser/housekeeping/index.ts b/packages/communication/src/messages/parser/housekeeping/index.ts index 8767e59..4e1acd7 100644 --- a/packages/communication/src/messages/parser/housekeeping/index.ts +++ b/packages/communication/src/messages/parser/housekeeping/index.ts @@ -1,4 +1,7 @@ +export * from './HousekeepingActionLogEntryData'; +export * from './HousekeepingActionLogParser'; export * from './HousekeepingActionResultParser'; +export * from './HousekeepingDashboardParser'; export * from './HousekeepingRoomData'; export * from './HousekeepingRoomDetailParser'; export * from './HousekeepingRoomListParser';