diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 25b84c9e..e48fb8d9 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -96,6 +96,7 @@ import { MarketPlaceOffersEvent } from './messages/incoming/marketplace/Marketpl import { MarketplaceOwnOffersEvent } from './messages/incoming/marketplace/MarketplaceOwnOffersEvent'; import { CfhChatlogEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorMessageEvent, ModeratorRoomInfoEvent, ModeratorToolPreferencesEvent, ModeratorUserInfoEvent, RoomChatlogEvent, RoomVisitsEvent, UserBannedMessageEvent, UserChatlogEvent } from './messages/incoming/moderation'; import { ModeratorCautionEvent } from './messages/incoming/moderation/ModeratorCautionEvent'; +import { CanCreateRoomEventEvent } from './messages/incoming/navigator/CanCreateRoomEventEvent'; import { NavigatorCategoriesEvent } from './messages/incoming/navigator/NavigatorCategoriesEvent'; import { NavigatorCollapsedEvent } from './messages/incoming/navigator/NavigatorCollapsedEvent'; import { NavigatorEventCategoriesEvent } from './messages/incoming/navigator/NavigatorEventCategoriesEvent'; @@ -136,7 +137,6 @@ import { RoomEnterEvent } from './messages/incoming/room/access/RoomEnterEvent'; import { RoomForwardEvent } from './messages/incoming/room/access/RoomForwardEvent'; import { BotCommandConfigurationEvent } from './messages/incoming/room/bots/BotCommandConfigurationEvent'; import { GetGuestRoomResultEvent } from './messages/incoming/room/data/GetGuestRoomResultEvent'; -import { RoomBannedUsersEvent } from './messages/incoming/room/data/RoomBannedUsersEvent'; import { RoomChatSettingsEvent } from './messages/incoming/room/data/RoomChatSettingsEvent'; import { RoomEntryInfoMessageEvent } from './messages/incoming/room/data/RoomEntryInfoMessageEvent'; import { RoomScoreEvent } from './messages/incoming/room/data/RoomScoreEvent'; @@ -144,7 +144,6 @@ import { RoomSettingsErrorEvent } from './messages/incoming/room/data/RoomSettin import { RoomSettingsEvent } from './messages/incoming/room/data/RoomSettingsEvent'; import { RoomSettingsSavedEvent } from './messages/incoming/room/data/RoomSettingsSavedEvent'; import { RoomSettingsUpdatedEvent } from './messages/incoming/room/data/RoomSettingsUpdatedEvent'; -import { RoomUsersWithRightsEvent } from './messages/incoming/room/data/RoomUsersWithRightsEvent'; import { ObjectsDataUpdateEvent } from './messages/incoming/room/engine/ObjectsDataUpdateEvent'; import { ObjectsRollingEvent } from './messages/incoming/room/engine/ObjectsRollingEvent'; import { RoomCreatedEvent } from './messages/incoming/room/engine/RoomCreatedEvent'; @@ -208,6 +207,10 @@ import { WiredOpenEvent } from './messages/incoming/roomevents/WiredOpenEvent'; import { WiredRewardResultMessageEvent } from './messages/incoming/roomevents/WiredRewardResultMessageEvent'; import { WiredSaveSuccessEvent } from './messages/incoming/roomevents/WiredSaveSuccessEvent'; import { WiredValidationErrorEvent } from './messages/incoming/roomevents/WiredValidationErrorEvent'; +import { BannedUsersFromRoomEvent } from './messages/incoming/roomsettings/BannedUsersFromRoomEvent'; +import { FlatControllerAddedEvent } from './messages/incoming/roomsettings/FlatControllerAddedEvent'; +import { FlatControllerRemovedEvent } from './messages/incoming/roomsettings/FlatControllerRemovedEvent'; +import { FlatControllersEvent } from './messages/incoming/roomsettings/FlatControllersEvent'; import { AuthenticatedEvent } from './messages/incoming/security/AuthenticatedEvent'; import { UserPermissionsEvent } from './messages/incoming/user/access/UserPermissionsEvent'; import { RelationshipStatusInfoEvent } from './messages/incoming/user/data/RelationshipStatusInfoEvent'; @@ -724,6 +727,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.NAVIGATOR_SEARCHES, NavigatorSearchesEvent); this._events.set(IncomingHeader.NAVIGATOR_SEARCH, NavigatorSearchEvent); this._events.set(IncomingHeader.NAVIGATOR_SETTINGS, NavigatorSettingsEvent); + this._events.set(IncomingHeader.CAN_CREATE_ROOM_EVENT, CanCreateRoomEventEvent); // NOTIFICATIONS this._events.set(IncomingHeader.GENERIC_ALERT, HabboBroadcastMessageEvent); @@ -780,8 +784,6 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.ROOM_SETTINGS, RoomSettingsEvent); this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE, RoomSettingsSavedEvent); this._events.set(IncomingHeader.ROOM_SETTINGS_UPDATED, RoomSettingsUpdatedEvent); - this._events.set(IncomingHeader.ROOM_RIGHTS_LIST, RoomUsersWithRightsEvent); - this._events.set(IncomingHeader.ROOM_BAN_LIST, RoomBannedUsersEvent); this._events.set(IncomingHeader.ROOM_ROLLING, ObjectsRollingEvent); this._events.set(IncomingHeader.ROOM_CREATED, RoomCreatedEvent); this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent); @@ -806,6 +808,12 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.FURNITURE_GROUP_CONTEXT_MENU_INFO, GroupFurniContextMenuInfoMessageEvent); this._events.set(IncomingHeader.FURNITURE_POSTIT_STICKY_POLE_OPEN, FurniturePostItStickyPoleOpenEvent); + // ROOM SETTINGS + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST, FlatControllersEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST_ADD, FlatControllerAddedEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST_REMOVE, FlatControllerRemovedEvent); + this._events.set(IncomingHeader.ROOM_BAN_LIST, BannedUsersFromRoomEvent); + // MAPPING this._events.set(IncomingHeader.ROOM_MODEL_DOOR, RoomEntryTileMessageEvent); this._events.set(IncomingHeader.ROOM_HEIGHT_MAP, RoomHeightMapEvent); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 5577aafa..c88eed4b 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -368,4 +368,5 @@ export class IncomingHeader public static PET_RESPECTED = 2788; public static PET_SUPPLEMENT = 3441; public static NOOBNESS_LEVEL = 3738; + public static CAN_CREATE_ROOM_EVENT = 2599; } diff --git a/src/nitro/communication/messages/incoming/index.ts b/src/nitro/communication/messages/incoming/index.ts index 2b47824c..6c9e606c 100644 --- a/src/nitro/communication/messages/incoming/index.ts +++ b/src/nitro/communication/messages/incoming/index.ts @@ -50,6 +50,7 @@ export * from './room/session'; export * from './room/unit'; export * from './room/unit/chat'; export * from './roomevents'; +export * from './roomsettings'; export * from './security'; export * from './sound'; export * from './talent'; diff --git a/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts b/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts new file mode 100644 index 00000000..8ba7b352 --- /dev/null +++ b/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { CanCreateRoomEventParser } from '../../parser/navigator/CanCreateRoomEventParser'; + +export class CanCreateRoomEventEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CanCreateRoomEventParser); + } + + public getParser(): CanCreateRoomEventParser + { + return this.parser as CanCreateRoomEventParser; + } +} diff --git a/src/nitro/communication/messages/incoming/navigator/index.ts b/src/nitro/communication/messages/incoming/navigator/index.ts index 4254e6e9..a1f27087 100644 --- a/src/nitro/communication/messages/incoming/navigator/index.ts +++ b/src/nitro/communication/messages/incoming/navigator/index.ts @@ -1,3 +1,4 @@ +export * from './CanCreateRoomEventEvent'; export * from './NavigatorCategoriesEvent'; export * from './NavigatorCollapsedEvent'; export * from './NavigatorEventCategoriesEvent'; diff --git a/src/nitro/communication/messages/incoming/room/data/RoomBannedUsersEvent.ts b/src/nitro/communication/messages/incoming/room/data/RoomBannedUsersEvent.ts deleted file mode 100644 index 50108838..00000000 --- a/src/nitro/communication/messages/incoming/room/data/RoomBannedUsersEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsUsersListParser } from '../../../parser/room/data/RoomSettingsUsersListParser'; - -export class RoomBannedUsersEvent extends MessageEvent implements IMessageEvent -{ - constructor(callBack: Function) - { - super(callBack, RoomSettingsUsersListParser); - } - - public getParser(): RoomSettingsUsersListParser - { - return this.parser as RoomSettingsUsersListParser; - } -} diff --git a/src/nitro/communication/messages/incoming/room/data/RoomUsersWithRightsEvent.ts b/src/nitro/communication/messages/incoming/room/data/RoomUsersWithRightsEvent.ts deleted file mode 100644 index 2b4f9b9a..00000000 --- a/src/nitro/communication/messages/incoming/room/data/RoomUsersWithRightsEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsUsersListParser } from '../../../parser/room/data/RoomSettingsUsersListParser'; - -export class RoomUsersWithRightsEvent extends MessageEvent implements IMessageEvent -{ - constructor(callBack: Function) - { - super(callBack, RoomSettingsUsersListParser); - } - - public getParser(): RoomSettingsUsersListParser - { - return this.parser as RoomSettingsUsersListParser; - } -} diff --git a/src/nitro/communication/messages/incoming/room/data/index.ts b/src/nitro/communication/messages/incoming/room/data/index.ts index 5f0345e5..10db64b0 100644 --- a/src/nitro/communication/messages/incoming/room/data/index.ts +++ b/src/nitro/communication/messages/incoming/room/data/index.ts @@ -1,5 +1,4 @@ export * from './GetGuestRoomResultEvent'; -export * from './RoomBannedUsersEvent'; export * from './RoomChatSettingsEvent'; export * from './RoomEntryInfoMessageEvent'; export * from './RoomScoreEvent'; @@ -7,4 +6,3 @@ export * from './RoomSettingsErrorEvent'; export * from './RoomSettingsEvent'; export * from './RoomSettingsSavedEvent'; export * from './RoomSettingsUpdatedEvent'; -export * from './RoomUsersWithRightsEvent'; diff --git a/src/nitro/communication/messages/incoming/roomsettings/BannedUserData.ts b/src/nitro/communication/messages/incoming/roomsettings/BannedUserData.ts new file mode 100644 index 00000000..3edac276 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/BannedUserData.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IFlatUser } from './IFlatUser'; + +export class BannedUserData implements IFlatUser +{ + private _userId: number; + private _userName: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts new file mode 100644 index 00000000..b71da6c2 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { BannedUsersFromRoomParser } from '../../parser/roomsettings/BannedUsersFromRoomParser'; + +export class BannedUsersFromRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BannedUsersFromRoomParser); + } + + public getParser(): BannedUsersFromRoomParser + { + return this.parser as BannedUsersFromRoomParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts new file mode 100644 index 00000000..2d44c0b1 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { FlatControllerAddedParser } from '../../parser/roomsettings/FlatControllerAddedParser'; + +export class FlatControllerAddedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllerAddedParser); + } + + public getParser(): FlatControllerAddedParser + { + return this.parser as FlatControllerAddedParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/FlatControllerData.ts b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerData.ts new file mode 100644 index 00000000..f8555693 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerData.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IFlatUser } from './IFlatUser'; + +export class FlatControllerData implements IFlatUser +{ + private _userId: number; + private _userName: string; + private _selected: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get selected(): boolean + { + return this._selected; + } + + public set selected(selected: boolean) + { + this._selected = selected; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts new file mode 100644 index 00000000..359bd0f6 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { FlatControllerRemovedParser } from '../../parser/roomsettings/FlatControllerRemovedParser'; + +export class FlatControllerRemovedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllerRemovedParser); + } + + public getParser(): FlatControllerRemovedParser + { + return this.parser as FlatControllerRemovedParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts new file mode 100644 index 00000000..d557e6ef --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { FlatControllersParser } from '../../parser/roomsettings/FlatControllersParser'; + +export class FlatControllersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllersParser); + } + + public getParser(): FlatControllersParser + { + return this.parser as FlatControllersParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/IFlatUser.ts b/src/nitro/communication/messages/incoming/roomsettings/IFlatUser.ts new file mode 100644 index 00000000..60c133dd --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/IFlatUser.ts @@ -0,0 +1,5 @@ +export interface IFlatUser +{ + userId: number; + userName: string; +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/index.ts b/src/nitro/communication/messages/incoming/roomsettings/index.ts new file mode 100644 index 00000000..23be8bde --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/index.ts @@ -0,0 +1,7 @@ +export * from './BannedUserData'; +export * from './BannedUsersFromRoomEvent'; +export * from './FlatControllerAddedEvent'; +export * from './FlatControllerData'; +export * from './FlatControllerRemovedEvent'; +export * from './FlatControllersEvent'; +export * from './IFlatUser'; diff --git a/src/nitro/communication/messages/parser/index.ts b/src/nitro/communication/messages/parser/index.ts index 3c3fcf66..4fa447b0 100644 --- a/src/nitro/communication/messages/parser/index.ts +++ b/src/nitro/communication/messages/parser/index.ts @@ -28,6 +28,7 @@ export * from './poll'; export * from './quest'; export * from './room'; export * from './roomevents'; +export * from './roomsettings'; export * from './security'; export * from './sound'; export * from './talent'; diff --git a/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts b/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts new file mode 100644 index 00000000..5d7c478b --- /dev/null +++ b/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class CanCreateRoomEventParser implements IMessageParser +{ + private _canCreate: boolean; + private _errorCode: number; + + public flush(): boolean + { + this._canCreate = false; + this._errorCode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._canCreate = wrapper.readBoolean(); + this._errorCode = wrapper.readInt(); + + return true; + } + + public get canCreate(): boolean + { + return this._canCreate; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/src/nitro/communication/messages/parser/navigator/index.ts b/src/nitro/communication/messages/parser/navigator/index.ts index 73c2631d..006abc82 100644 --- a/src/nitro/communication/messages/parser/navigator/index.ts +++ b/src/nitro/communication/messages/parser/navigator/index.ts @@ -1,3 +1,4 @@ +export * from './CanCreateRoomEventParser'; export * from './NavigatorCategoriesParser'; export * from './NavigatorCategoryDataParser'; export * from './NavigatorCollapsedParser'; diff --git a/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts b/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts index 5a649fb2..40d1db54 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../../core'; +import { IMessageDataWrapper } from '../../../../../../core/communication/messages'; export class RoomDataParser { @@ -12,7 +12,8 @@ export class RoomDataParser public static OPEN_STATE = 0; public static DOORBELL_STATE = 1; public static PASSWORD_STATE = 2; - public static INVISIBLE_STATE = 4; + public static INVISIBLE_STATE = 3; + public static NOOB_STATE = 4; private _roomId: number; private _roomName: string; @@ -41,7 +42,7 @@ export class RoomDataParser private _adExpiresIn: number; private _allInRoomMuted: boolean; private _canMute: boolean; - private _roomPicker: boolean; + private _officialRoomPicRef: string; constructor(wrapper: IMessageDataWrapper) @@ -81,7 +82,6 @@ export class RoomDataParser this._adExpiresIn = 0; this._allInRoomMuted = false; this._canMute = false; - this._roomPicker = false; this._officialRoomPicRef = null; return true; @@ -279,16 +279,6 @@ export class RoomDataParser return this._displayAd; } - public get roomPicker(): boolean - { - return this._roomPicker; - } - - public set roomPicker(k: boolean) - { - this._roomPicker = k; - } - public get canMute(): boolean { return this._canMute; diff --git a/src/nitro/communication/messages/parser/room/data/index.ts b/src/nitro/communication/messages/parser/room/data/index.ts index 648d08bd..d003c377 100644 --- a/src/nitro/communication/messages/parser/room/data/index.ts +++ b/src/nitro/communication/messages/parser/room/data/index.ts @@ -9,4 +9,3 @@ export * from './RoomSettingsErrorParser'; export * from './RoomSettingsParser'; export * from './RoomSettingsSavedParser'; export * from './RoomSettingsUpdatedParser'; -export * from './RoomSettingsUsersListParser'; diff --git a/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts b/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts new file mode 100644 index 00000000..d3b1ea71 --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; +import { BannedUserData } from '../../incoming/roomsettings/BannedUserData'; + +export class BannedUsersFromRoomParser implements IMessageParser +{ + private _roomId: number; + private _bannedUsers: BannedUserData[]; + + public flush(): boolean + { + this._roomId = 0; + this._bannedUsers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + let totalBans = wrapper.readInt(); + + while(totalBans > 0) + { + this._bannedUsers.push(new BannedUserData(wrapper)); + + totalBans--; + } + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get bannedUsers(): BannedUserData[] + { + return this._bannedUsers; + } +} diff --git a/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts new file mode 100644 index 00000000..d7904dfc --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; +import { FlatControllerData } from '../../incoming/roomsettings/FlatControllerData'; + +export class FlatControllerAddedParser implements IMessageParser +{ + private _roomId: number; + private _data: FlatControllerData; + + public flush(): boolean + { + this._roomId = 0; + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._data = new FlatControllerData(wrapper); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get data(): FlatControllerData + { + return this._data; + } +} diff --git a/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts new file mode 100644 index 00000000..ffc3cf71 --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class FlatControllerRemovedParser implements IMessageParser +{ + private _roomId: number; + private _userId: number; + + public flush(): boolean + { + this._roomId = 0; + this._userId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._userId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get userId(): number + { + return this._userId; + } +} diff --git a/src/nitro/communication/messages/parser/room/data/RoomSettingsUsersListParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts similarity index 75% rename from src/nitro/communication/messages/parser/room/data/RoomSettingsUsersListParser.ts rename to src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts index 694458ce..eb60bf2e 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomSettingsUsersListParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts @@ -1,6 +1,7 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; -export class RoomSettingsUsersListParser implements IMessageParser +export class FlatControllersParser implements IMessageParser { private _roomId: number; private _users: Map; @@ -27,6 +28,7 @@ export class RoomSettingsUsersListParser implements IMessageParser const name = wrapper.readString(); this._users.set(id, name); + usersCount--; } diff --git a/src/nitro/communication/messages/parser/roomsettings/index.ts b/src/nitro/communication/messages/parser/roomsettings/index.ts new file mode 100644 index 00000000..b38e5f28 --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/index.ts @@ -0,0 +1,4 @@ +export * from './BannedUsersFromRoomParser'; +export * from './FlatControllerAddedParser'; +export * from './FlatControllerRemovedParser'; +export * from './FlatControllersParser';