From d0d949132b26fdbf2fe06221f6dd408bef92b9c2 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 31 May 2022 00:11:57 -0400 Subject: [PATCH] Update roomsettings packets --- src/nitro/communication/NitroMessages.ts | 30 +- .../messages/incoming/IncomingHeader.ts | 5 +- .../RoomSettingsUpdatedEvent.ts | 6 +- .../incoming/room/data/RoomSettingsEvent.ts | 16 - .../messages/incoming/room/data/index.ts | 4 - .../incoming/roomevents/RoomMutedEvent.ts | 16 - .../messages/incoming/roomevents/index.ts | 1 - .../roomsettings/MuteAllInRoomEvent.ts | 16 + .../incoming/roomsettings/NoSuchFlatEvent.ts | 16 + .../roomsettings}/RoomChatSettings.ts | 23 +- .../roomsettings}/RoomModerationSettings.ts | 15 +- .../incoming/roomsettings/RoomSettingsData.ts | 332 ++++++++++++++++++ .../roomsettings/RoomSettingsDataEvent.ts | 16 + .../RoomSettingsErrorEvent.ts | 6 +- .../RoomSettingsSaveErrorEvent.ts | 16 + .../RoomSettingsSavedEvent.ts | 6 +- .../ShowEnforceRoomCategoryDialogEvent.ts | 16 + .../roomsettings/UserUnbannedFromRoomEvent.ts | 16 + .../messages/incoming/roomsettings/index.ts | 8 + .../communication/messages/outgoing/index.ts | 1 + .../roomsettings/SaveableRoomSettingsData.ts | 267 ++++++++++++++ .../messages/outgoing/roomsettings/index.ts | 1 + .../RoomSettingsUpdatedParser.ts | 2 +- .../messages/parser/navigator/index.ts | 1 + .../room/data/RoomChatSettingsParser.ts | 2 +- .../parser/room/data/RoomInfoParser.ts | 4 +- .../parser/room/data/RoomSettingsParser.ts | 162 --------- .../messages/parser/room/data/index.ts | 6 - .../messages/parser/roomevents/index.ts | 1 - .../MuteAllInRoomParser.ts} | 5 +- .../parser/roomsettings/NoSuchFlatParser.ts | 28 ++ .../roomsettings/RoomSettingsDataParser.ts | 60 ++++ .../RoomSettingsErrorParser.ts | 11 +- .../RoomSettingsSaveErrorParser.ts | 58 +++ .../RoomSettingsSavedParser.ts | 2 +- .../ShowEnforceRoomCategoryDialogParser.ts | 27 ++ .../UserUnbannedFromRoomParser.ts | 35 ++ .../messages/parser/roomsettings/index.ts | 6 + src/nitro/session/IRoomSession.ts | 2 +- src/nitro/session/RoomSession.ts | 2 +- 40 files changed, 967 insertions(+), 280 deletions(-) rename src/nitro/communication/messages/incoming/{room/data => navigator}/RoomSettingsUpdatedEvent.ts (52%) delete mode 100644 src/nitro/communication/messages/incoming/room/data/RoomSettingsEvent.ts delete mode 100644 src/nitro/communication/messages/incoming/roomevents/RoomMutedEvent.ts create mode 100644 src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts create mode 100644 src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts rename src/nitro/communication/messages/{parser/room/data => incoming/roomsettings}/RoomChatSettings.ts (77%) rename src/nitro/communication/messages/{parser/room/data => incoming/roomsettings}/RoomModerationSettings.ts (70%) create mode 100644 src/nitro/communication/messages/incoming/roomsettings/RoomSettingsData.ts create mode 100644 src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts rename src/nitro/communication/messages/incoming/{room/data => roomsettings}/RoomSettingsErrorEvent.ts (52%) create mode 100644 src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts rename src/nitro/communication/messages/incoming/{room/data => roomsettings}/RoomSettingsSavedEvent.ts (52%) create mode 100644 src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts create mode 100644 src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts create mode 100644 src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts create mode 100644 src/nitro/communication/messages/outgoing/roomsettings/index.ts rename src/nitro/communication/messages/parser/{room/data => navigator}/RoomSettingsUpdatedParser.ts (97%) delete mode 100644 src/nitro/communication/messages/parser/room/data/RoomSettingsParser.ts rename src/nitro/communication/messages/parser/{roomevents/RoomMutedParser.ts => roomsettings/MuteAllInRoomParser.ts} (57%) create mode 100644 src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts create mode 100644 src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts rename src/nitro/communication/messages/parser/{room/data => roomsettings}/RoomSettingsErrorParser.ts (69%) create mode 100644 src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts rename src/nitro/communication/messages/parser/{room/data => roomsettings}/RoomSettingsSavedParser.ts (97%) create mode 100644 src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts create mode 100644 src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index fc8830ad..ccd6779c 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -108,6 +108,7 @@ import { NavigatorOpenRoomCreatorEvent } from './messages/incoming/navigator/Nav import { NavigatorSearchesEvent } from './messages/incoming/navigator/NavigatorSearchesEvent'; import { NavigatorSearchEvent } from './messages/incoming/navigator/NavigatorSearchEvent'; import { NavigatorSettingsEvent } from './messages/incoming/navigator/NavigatorSettingsEvent'; +import { RoomSettingsUpdatedEvent } from './messages/incoming/navigator/RoomSettingsUpdatedEvent'; import { BotErrorEvent } from './messages/incoming/notifications/BotErrorEvent'; import { HabboBroadcastMessageEvent } from './messages/incoming/notifications/HabboBroadcastMessageEvent'; import { MOTDNotificationEvent } from './messages/incoming/notifications/MOTDNotificationEvent'; @@ -141,10 +142,6 @@ import { GetGuestRoomResultEvent } from './messages/incoming/room/data/GetGuestR import { RoomChatSettingsEvent } from './messages/incoming/room/data/RoomChatSettingsEvent'; import { RoomEntryInfoMessageEvent } from './messages/incoming/room/data/RoomEntryInfoMessageEvent'; import { RoomScoreEvent } from './messages/incoming/room/data/RoomScoreEvent'; -import { RoomSettingsErrorEvent } from './messages/incoming/room/data/RoomSettingsErrorEvent'; -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 { FavoriteMembershipUpdateMessageEvent } from './messages/incoming/room/engine/FavoriteMembershipUpdateMessageEvent'; import { ObjectsDataUpdateEvent } from './messages/incoming/room/engine/ObjectsDataUpdateEvent'; import { ObjectsRollingEvent } from './messages/incoming/room/engine/ObjectsRollingEvent'; @@ -202,7 +199,6 @@ import { RoomUnitInfoEvent } from './messages/incoming/room/unit/RoomUnitInfoEve import { RoomUnitNumberEvent } from './messages/incoming/room/unit/RoomUnitNumberEvent'; import { RoomUnitRemoveEvent } from './messages/incoming/room/unit/RoomUnitRemoveEvent'; import { RoomUnitStatusEvent } from './messages/incoming/room/unit/RoomUnitStatusEvent'; -import { RoomMutedEvent } from './messages/incoming/roomevents/RoomMutedEvent'; import { WiredFurniActionEvent } from './messages/incoming/roomevents/WiredFurniActionEvent'; import { WiredFurniConditionEvent } from './messages/incoming/roomevents/WiredFurniConditionEvent'; import { WiredFurniTriggerEvent } from './messages/incoming/roomevents/WiredFurniTriggerEvent'; @@ -214,6 +210,14 @@ import { BannedUsersFromRoomEvent } from './messages/incoming/roomsettings/Banne import { FlatControllerAddedEvent } from './messages/incoming/roomsettings/FlatControllerAddedEvent'; import { FlatControllerRemovedEvent } from './messages/incoming/roomsettings/FlatControllerRemovedEvent'; import { FlatControllersEvent } from './messages/incoming/roomsettings/FlatControllersEvent'; +import { MuteAllInRoomEvent } from './messages/incoming/roomsettings/MuteAllInRoomEvent'; +import { NoSuchFlatEvent } from './messages/incoming/roomsettings/NoSuchFlatEvent'; +import { RoomSettingsDataEvent } from './messages/incoming/roomsettings/RoomSettingsDataEvent'; +import { RoomSettingsErrorEvent } from './messages/incoming/roomsettings/RoomSettingsErrorEvent'; +import { RoomSettingsSavedEvent } from './messages/incoming/roomsettings/RoomSettingsSavedEvent'; +import { RoomSettingsSaveErrorEvent } from './messages/incoming/roomsettings/RoomSettingsSaveErrorEvent'; +import { ShowEnforceRoomCategoryDialogEvent } from './messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent'; +import { UserUnbannedFromRoomEvent } from './messages/incoming/roomsettings/UserUnbannedFromRoomEvent'; import { AuthenticatedEvent } from './messages/incoming/security/AuthenticatedEvent'; import { UserPermissionsEvent } from './messages/incoming/user/access/UserPermissionsEvent'; import { RelationshipStatusInfoEvent } from './messages/incoming/user/data/RelationshipStatusInfoEvent'; @@ -794,10 +798,6 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.ROOM_INFO, GetGuestRoomResultEvent); this._events.set(IncomingHeader.ROOM_INFO_OWNER, RoomEntryInfoMessageEvent); this._events.set(IncomingHeader.ROOM_SCORE, RoomScoreEvent); - this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE_ERROR, RoomSettingsErrorEvent); - 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_ROLLING, ObjectsRollingEvent); this._events.set(IncomingHeader.ROOM_CREATED, RoomCreatedEvent); this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent); @@ -829,6 +829,17 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.ROOM_RIGHTS_LIST_REMOVE, FlatControllerRemovedEvent); this._events.set(IncomingHeader.ROOM_BAN_LIST, BannedUsersFromRoomEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE_ERROR, RoomSettingsSaveErrorEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS, RoomSettingsDataEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE, RoomSettingsSavedEvent); + this._events.set(IncomingHeader.ROOM_INFO_UPDATED, RoomSettingsUpdatedEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_ERROR, RoomSettingsErrorEvent); + this._events.set(IncomingHeader.SHOW_ENFORCE_ROOM_CATEGORY, ShowEnforceRoomCategoryDialogEvent); + this._events.set(IncomingHeader.ROOM_BAN_REMOVE, UserUnbannedFromRoomEvent); + + this._events.set(IncomingHeader.ROOM_MUTED, MuteAllInRoomEvent); + this._events.set(IncomingHeader.NO_SUCH_FLAT, NoSuchFlatEvent); + this._events.set(IncomingHeader.FAVORITE_GROUP_UDPATE, FavoriteMembershipUpdateMessageEvent); // MAPPING @@ -871,7 +882,6 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.WIRED_REWARD, WiredRewardResultMessageEvent); this._events.set(IncomingHeader.WIRED_SAVE, WiredSaveSuccessEvent); this._events.set(IncomingHeader.WIRED_ERROR, WiredValidationErrorEvent); - this._events.set(IncomingHeader.ROOM_MUTED, RoomMutedEvent); // SECURITY this._events.set(IncomingHeader.AUTHENTICATED, AuthenticatedEvent); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 0ff09894..8570529a 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -137,7 +137,7 @@ export class IncomingHeader public static ROOM_SETTINGS_CHAT = 1191; public static ROOM_SETTINGS_SAVE = 948; public static ROOM_SETTINGS_SAVE_ERROR = 1555; - public static ROOM_SETTINGS_UPDATED = 3297; + public static ROOM_INFO_UPDATED = 3297; public static ROOM_SPECTATOR = 1033; public static ROOM_THICKNESS = 3547; public static INFO_FEED_ENABLE = 3284; @@ -375,4 +375,7 @@ export class IncomingHeader public static NOOBNESS_LEVEL = 3738; public static CAN_CREATE_ROOM_EVENT = 2599; public static FAVORITE_GROUP_UDPATE = 3403; + public static NO_SUCH_FLAT = 84; + public static ROOM_SETTINGS_ERROR = 2897; + public static SHOW_ENFORCE_ROOM_CATEGORY = 3896; } diff --git a/src/nitro/communication/messages/incoming/room/data/RoomSettingsUpdatedEvent.ts b/src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts similarity index 52% rename from src/nitro/communication/messages/incoming/room/data/RoomSettingsUpdatedEvent.ts rename to src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts index d86030b7..4a1dfdb4 100644 --- a/src/nitro/communication/messages/incoming/room/data/RoomSettingsUpdatedEvent.ts +++ b/src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts @@ -1,6 +1,6 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsUpdatedParser } from '../../../parser/room/data/RoomSettingsUpdatedParser'; +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { RoomSettingsUpdatedParser } from '../../parser/navigator/RoomSettingsUpdatedParser'; export class RoomSettingsUpdatedEvent extends MessageEvent implements IMessageEvent { diff --git a/src/nitro/communication/messages/incoming/room/data/RoomSettingsEvent.ts b/src/nitro/communication/messages/incoming/room/data/RoomSettingsEvent.ts deleted file mode 100644 index d3aa520d..00000000 --- a/src/nitro/communication/messages/incoming/room/data/RoomSettingsEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsParser } from '../../../parser/room/data/RoomSettingsParser'; - -export class RoomSettingsEvent extends MessageEvent implements IMessageEvent -{ - constructor(callBack: Function) - { - super(callBack, RoomSettingsParser); - } - - public getParser(): RoomSettingsParser - { - return this.parser as RoomSettingsParser; - } -} diff --git a/src/nitro/communication/messages/incoming/room/data/index.ts b/src/nitro/communication/messages/incoming/room/data/index.ts index 10db64b0..78770514 100644 --- a/src/nitro/communication/messages/incoming/room/data/index.ts +++ b/src/nitro/communication/messages/incoming/room/data/index.ts @@ -2,7 +2,3 @@ export * from './GetGuestRoomResultEvent'; export * from './RoomChatSettingsEvent'; export * from './RoomEntryInfoMessageEvent'; export * from './RoomScoreEvent'; -export * from './RoomSettingsErrorEvent'; -export * from './RoomSettingsEvent'; -export * from './RoomSettingsSavedEvent'; -export * from './RoomSettingsUpdatedEvent'; diff --git a/src/nitro/communication/messages/incoming/roomevents/RoomMutedEvent.ts b/src/nitro/communication/messages/incoming/roomevents/RoomMutedEvent.ts deleted file mode 100644 index a9050297..00000000 --- a/src/nitro/communication/messages/incoming/roomevents/RoomMutedEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; -import { RoomMutedParser } from '../../parser/roomevents/RoomMutedParser'; - -export class RoomMutedEvent extends MessageEvent implements IMessageEvent -{ - constructor(callBack: Function) - { - super(callBack, RoomMutedParser); - } - - public getParser(): RoomMutedParser - { - return this.parser as RoomMutedParser; - } -} diff --git a/src/nitro/communication/messages/incoming/roomevents/index.ts b/src/nitro/communication/messages/incoming/roomevents/index.ts index d3180bd8..fc0b3ca2 100644 --- a/src/nitro/communication/messages/incoming/roomevents/index.ts +++ b/src/nitro/communication/messages/incoming/roomevents/index.ts @@ -1,5 +1,4 @@ export * from './ConditionDefinition'; -export * from './RoomMutedEvent'; export * from './Triggerable'; export * from './TriggerDefinition'; export * from './WiredActionDefinition'; diff --git a/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts new file mode 100644 index 00000000..fe4b1b95 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { MuteAllInRoomParser } from '../../parser/roomsettings/MuteAllInRoomParser'; + +export class MuteAllInRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MuteAllInRoomParser); + } + + public getParser(): MuteAllInRoomParser + { + return this.parser as MuteAllInRoomParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts new file mode 100644 index 00000000..7200dc9f --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { NoSuchFlatParser } from '../../parser/roomsettings/NoSuchFlatParser'; + +export class NoSuchFlatEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NoSuchFlatParser); + } + + public getParser(): NoSuchFlatParser + { + return this.parser as NoSuchFlatParser; + } +} diff --git a/src/nitro/communication/messages/parser/room/data/RoomChatSettings.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomChatSettings.ts similarity index 77% rename from src/nitro/communication/messages/parser/room/data/RoomChatSettings.ts rename to src/nitro/communication/messages/incoming/roomsettings/RoomChatSettings.ts index 4661aabd..7954621b 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomChatSettings.ts +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomChatSettings.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../../core'; +import { IMessageDataWrapper } from '../../../../../core'; export class RoomChatSettings { @@ -24,32 +24,11 @@ export class RoomChatSettings { if(!wrapper) throw new Error('invalid_wrapper'); - this.flush(); - this.parse(wrapper); - } - - public flush(): boolean - { - this._mode = 0; - this._weight = 0; - this._speed = 0; - this._distance = 0; - this._protection = 0; - - return true; - } - - public parse(wrapper: IMessageDataWrapper): boolean - { - if(!wrapper) return false; - this._mode = wrapper.readInt(); this._weight = wrapper.readInt(); this._speed = wrapper.readInt(); this._distance = wrapper.readInt(); this._protection = wrapper.readInt(); - - return true; } public get mode(): number diff --git a/src/nitro/communication/messages/parser/room/data/RoomModerationSettings.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomModerationSettings.ts similarity index 70% rename from src/nitro/communication/messages/parser/room/data/RoomModerationSettings.ts rename to src/nitro/communication/messages/incoming/roomsettings/RoomModerationSettings.ts index f8473f28..e2cde802 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomModerationSettings.ts +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomModerationSettings.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../../core'; +import { IMessageDataWrapper } from '../../../../../core'; export class RoomModerationSettings { @@ -11,19 +11,6 @@ export class RoomModerationSettings private _allowBan: number; constructor(wrapper: IMessageDataWrapper) - { - this.reset(); - this.parse(wrapper); - } - - private reset(): void - { - this._allowMute = 0; - this._allowKick = 0; - this._allowBan = 0; - } - - public parse(wrapper: IMessageDataWrapper): void { this._allowMute = wrapper.readInt(); this._allowKick = wrapper.readInt(); diff --git a/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsData.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsData.ts new file mode 100644 index 00000000..aa7a65c9 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsData.ts @@ -0,0 +1,332 @@ +import { BannedUserData } from './BannedUserData'; +import { FlatControllerData } from './FlatControllerData'; +import { RoomChatSettings } from './RoomChatSettings'; +import { RoomModerationSettings } from './RoomModerationSettings'; + +export class RoomSettingsData +{ + public static DOORMODE_OPEN: number = 0; + public static DOORMODE_CLOSED: number = 1; + public static DOORMODE_PASSWORD: number = 2; + public static DOORMODE_INVISIBLE: number = 3; + public static DOORMODE_NOOBS_ONLY: number = 4; + public static TRADEMODE_NOT_ALLOWED: number = 0; + public static TRADEMODE_WITH_CONTROLLER: number = 1; + public static TRADEMODE_ALLOWED: number = 2; + + private _roomId: number = -1; + private _name: string = null; + private _description: string = null; + private _doorMode: number = RoomSettingsData.DOORMODE_OPEN; + private _categoryId: number = -1; + private _maximumVisitors: number = 0; + private _maximumVisitorsLimit: number = 0; + private _tags: string[] = []; + private _tradeMode: number = RoomSettingsData.TRADEMODE_NOT_ALLOWED; + private _allowPets: boolean = false; + private _allowFoodConsume: boolean = false; + private _allowWalkThrough: boolean = false; + private _hideWalls: boolean = false; + private _wallThickness: number = 0; + private _floorThickness: number = 0; + private _controllersById: Map = new Map(); + private _controllerList: FlatControllerData[] = null; + private _highlightedUserId: number = -1; + private _bannedUsersById: Map = new Map(); + private _bannedUsersList: BannedUserData[] = null; + private _roomModerationSettings: RoomModerationSettings = null; + private _chatSettings: RoomChatSettings = null; + private _allowNavigatorDynamicCats: boolean = false; + + public static from(settings: RoomSettingsData) + { + const instance = new RoomSettingsData(); + + instance._roomId = settings._roomId; + instance._name = settings._name; + instance._description = settings._description; + instance._doorMode = settings._doorMode; + instance._categoryId = settings._categoryId; + instance._maximumVisitors = settings._maximumVisitors; + instance._maximumVisitorsLimit = settings._maximumVisitorsLimit; + instance._tags = settings._tags; + instance._tradeMode = settings._tradeMode; + instance._allowPets = settings._allowPets; + instance._allowFoodConsume = settings._allowFoodConsume; + instance._allowWalkThrough = settings._allowWalkThrough; + instance._hideWalls = settings._hideWalls; + instance._wallThickness = settings._wallThickness; + instance._floorThickness = settings._floorThickness; + instance._controllersById = settings._controllersById; + instance._controllerList = settings._controllerList; + instance._highlightedUserId = settings._highlightedUserId; + instance._bannedUsersById = settings._bannedUsersById; + instance._bannedUsersList = settings._bannedUsersList; + instance._roomModerationSettings = settings._roomModerationSettings; + instance._chatSettings = settings._chatSettings; + instance._allowNavigatorDynamicCats = settings._allowNavigatorDynamicCats; + + return instance; + } + + // public static _Str_26097(k: number): string + // { + // switch (k) + // { + // case RoomSettingsData.DOORMODE_OPEN: + // return "${navigator.door.mode.open}"; + // case RoomSettingsData.DOORMODE_CLOSED: + // return "${navigator.door.mode.closed}"; + // case RoomSettingsData.DOORMODE_PASSWORD: + // return "${navigator.door.mode.password}"; + // case RoomSettingsData.DOORMODE_INVISIBLE: + // return "${navigator.door.mode.invisible}"; + // case RoomSettingsData.DOORMODE_NOOBS_ONLY: + // return "${navigator.door.mode.noobs_only}"; + // } + // return ""; + // } + + public get tradeMode(): number + { + return this._tradeMode; + } + + public set tradeMode(mode: number) + { + this._tradeMode = mode; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public set allowPets(flag: boolean) + { + this._allowPets = flag; + } + + public get allowFoodConsume(): boolean + { + return this._allowFoodConsume; + } + + public set allowFoodConsume(flag: boolean) + { + this._allowFoodConsume = flag; + } + + public get allowWalkThrough(): boolean + { + return this._allowWalkThrough; + } + + public set allowWalkThrough(flag: boolean) + { + this._allowWalkThrough = flag; + } + + public get hideWalls(): boolean + { + return this._hideWalls; + } + + public set hideWalls(flag: boolean) + { + this._hideWalls = flag; + } + + public get wallThickness(): number + { + return this._wallThickness; + } + + public set wallThickness(thickness: number) + { + this._wallThickness = thickness; + } + + public get floorThickness(): number + { + return this._floorThickness; + } + + public set floorThickness(thickness: number) + { + this._floorThickness = thickness; + } + + public get roomId(): number + { + return this._roomId; + } + + public set roomId(id: number) + { + this._roomId = id; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + this._name = name; + } + + public get description(): string + { + return this._description; + } + + public set description(description: string) + { + this._description = description; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public set doorMode(mode: number) + { + this._doorMode = mode; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public set categoryId(id: number) + { + this._categoryId = id; + } + + public get maximumVisitors(): number + { + return this._maximumVisitors; + } + + public set maximumVisitors(max: number) + { + this._maximumVisitors = max; + } + + public get maximumVisitorsLimit(): number + { + return this._maximumVisitorsLimit; + } + + public set maximumVisitorsLimit(limit: number) + { + this._maximumVisitorsLimit = limit; + } + + public get tags(): string[] + { + return this._tags; + } + + public set tags(tags: string[]) + { + this._tags = tags; + } + + public _Str_17474(id: number, data: FlatControllerData): void + { + this._controllersById.set(id, data); + + this._controllerList = null; + this._highlightedUserId = id; + } + + public get roomModerationSettings(): RoomModerationSettings + { + return this._roomModerationSettings; + } + + public set roomModerationSettings(settings: RoomModerationSettings) + { + this._roomModerationSettings = settings; + } + + public get controllersById(): Map + { + return this._controllersById; + } + + public set controllersById(controllers: Map) + { + this._controllersById = controllers; + } + + public get controllerList(): FlatControllerData[] + { + if(!this._controllerList) + { + this._controllerList = []; + + for(const controllerData of this._controllersById.values()) this._controllerList.push(controllerData); + + this._controllerList.sort((a, b) => a.userName.localeCompare(b.userName)); + } + + return this._controllerList; + } + + public get highlightedUserId(): number + { + return this._highlightedUserId; + } + + public _Str_22019(id: number, data: BannedUserData): void + { + this._bannedUsersById.set(id, data); + + this._bannedUsersList = null; + } + + public get bannedUsersById(): Map + { + return this._bannedUsersById; + } + + public get bannedUsersList(): BannedUserData[] + { + if(!this._bannedUsersList) + { + this._bannedUsersList = []; + + for(const bannedUserData of this._bannedUsersById.values()) this._bannedUsersList.push(bannedUserData); + + this._bannedUsersList.sort((a, b) => a.userName.localeCompare(b.userName)); + } + + return this._bannedUsersList; + } + + public get chatSettings(): RoomChatSettings + { + return this._chatSettings; + } + + public set chatSettings(settings: RoomChatSettings) + { + this._chatSettings = settings; + } + + public get allowNavigatorDynamicCats(): boolean + { + return this._allowNavigatorDynamicCats; + } + + public set allowNavigatorDynamicCats(flag: boolean) + { + this._allowNavigatorDynamicCats = flag; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts new file mode 100644 index 00000000..50486457 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { RoomSettingsDataParser } from '../../parser/roomsettings/RoomSettingsDataParser'; + +export class RoomSettingsDataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsDataParser); + } + + public getParser(): RoomSettingsDataParser + { + return this.parser as RoomSettingsDataParser; + } +} diff --git a/src/nitro/communication/messages/incoming/room/data/RoomSettingsErrorEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts similarity index 52% rename from src/nitro/communication/messages/incoming/room/data/RoomSettingsErrorEvent.ts rename to src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts index 8e75b0b9..b99ef07a 100644 --- a/src/nitro/communication/messages/incoming/room/data/RoomSettingsErrorEvent.ts +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts @@ -1,6 +1,6 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsErrorParser } from '../../../parser/room/data/RoomSettingsErrorParser'; +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { RoomSettingsErrorParser } from '../../parser/roomsettings/RoomSettingsErrorParser'; export class RoomSettingsErrorEvent extends MessageEvent implements IMessageEvent { diff --git a/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts new file mode 100644 index 00000000..948eb238 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { RoomSettingsSaveErrorParser } from '../../parser/roomsettings/RoomSettingsSaveErrorParser'; + +export class RoomSettingsSaveErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsSaveErrorParser); + } + + public getParser(): RoomSettingsSaveErrorParser + { + return this.parser as RoomSettingsSaveErrorParser; + } +} diff --git a/src/nitro/communication/messages/incoming/room/data/RoomSettingsSavedEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts similarity index 52% rename from src/nitro/communication/messages/incoming/room/data/RoomSettingsSavedEvent.ts rename to src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts index cb9bdcfa..42eb4fd9 100644 --- a/src/nitro/communication/messages/incoming/room/data/RoomSettingsSavedEvent.ts +++ b/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts @@ -1,6 +1,6 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomSettingsSavedParser } from '../../../parser/room/data/RoomSettingsSavedParser'; +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { RoomSettingsSavedParser } from '../../parser/roomsettings/RoomSettingsSavedParser'; export class RoomSettingsSavedEvent extends MessageEvent implements IMessageEvent { diff --git a/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts new file mode 100644 index 00000000..a6cd16cf --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { ShowEnforceRoomCategoryDialogParser } from '../../parser/roomsettings/ShowEnforceRoomCategoryDialogParser'; + +export class ShowEnforceRoomCategoryDialogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ShowEnforceRoomCategoryDialogParser); + } + + public getParser(): ShowEnforceRoomCategoryDialogParser + { + return this.parser as ShowEnforceRoomCategoryDialogParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts b/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts new file mode 100644 index 00000000..ec9a4c14 --- /dev/null +++ b/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { UserUnbannedFromRoomParser } from '../../parser/roomsettings/UserUnbannedFromRoomParser'; + +export class UserUnbannedFromRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserUnbannedFromRoomParser); + } + + public getParser(): UserUnbannedFromRoomParser + { + return this.parser as UserUnbannedFromRoomParser; + } +} diff --git a/src/nitro/communication/messages/incoming/roomsettings/index.ts b/src/nitro/communication/messages/incoming/roomsettings/index.ts index 23be8bde..a30ed0ec 100644 --- a/src/nitro/communication/messages/incoming/roomsettings/index.ts +++ b/src/nitro/communication/messages/incoming/roomsettings/index.ts @@ -5,3 +5,11 @@ export * from './FlatControllerData'; export * from './FlatControllerRemovedEvent'; export * from './FlatControllersEvent'; export * from './IFlatUser'; +export * from './MuteAllInRoomEvent'; +export * from './NoSuchFlatEvent'; +export * from './RoomChatSettings'; +export * from './RoomModerationSettings'; +export * from './RoomSettingsData'; +export * from './RoomSettingsDataEvent'; +export * from './RoomSettingsErrorEvent'; +export * from './RoomSettingsSaveErrorEvent'; diff --git a/src/nitro/communication/messages/outgoing/index.ts b/src/nitro/communication/messages/outgoing/index.ts index a310f6e8..888c8dae 100644 --- a/src/nitro/communication/messages/outgoing/index.ts +++ b/src/nitro/communication/messages/outgoing/index.ts @@ -25,6 +25,7 @@ export * from './poll'; export * from './quest'; export * from './room'; export * from './roomevents'; +export * from './roomsettings'; export * from './sound'; export * from './talent'; export * from './user'; diff --git a/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts b/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts new file mode 100644 index 00000000..521045e0 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts @@ -0,0 +1,267 @@ +export class SaveableRoomSettingsData +{ + private _roomId: number; + private _name: string; + private _description: string; + private _doorMode: number; + private _password: string; + private _categoryId: number; + private _maximumVisitors: number; + private _tags: string[]; + private _tradeMode: number; + private _allowPets: boolean; + private _allowFoodConsume: boolean; + private _allowWalkThrough: boolean; + private _allowNavigatorDynCats: boolean; + private _hideWalls: boolean; + private _wallThickness: number; + private _floorThickness: number; + private _whoCanMute: number; + private _whoCanKick: number; + private _whoCanBan: number; + private _chatMode: number; + private _chatBubbleSize: number; + private _chatScrollUpFrequency: number; + private _chatFullHearRange: number; + private _chatFloodSensitivity: number; + + public get tradeMode(): number + { + return this._tradeMode; + } + + public set tradeMode(mode: number) + { + this._tradeMode = mode; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public set allowPets(flag: boolean) + { + this._allowPets = flag; + } + + public get allowFoodConsume(): boolean + { + return this._allowFoodConsume; + } + + public set allowFoodConsume(flag: boolean) + { + this._allowFoodConsume = flag; + } + + public get allowWalkThrough(): boolean + { + return this._allowWalkThrough; + } + + public set allowWalkThrough(flag: boolean) + { + this._allowWalkThrough = flag; + } + + public get hideWalls(): boolean + { + return this._hideWalls; + } + + public set hideWalls(flag: boolean) + { + this._hideWalls = flag; + } + + public get wallThickness(): number + { + return this._wallThickness; + } + + public set wallThickness(thickness: number) + { + this._wallThickness = thickness; + } + + public get floorThickness(): number + { + return this._floorThickness; + } + + public set floorThickness(thickness: number) + { + this._floorThickness = thickness; + } + + public get roomId(): number + { + return this._roomId; + } + + public set roomId(id: number) + { + this._roomId = id; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + this._name = name; + } + + public get description(): string + { + return this._description; + } + + public set description(description: string) + { + this._description = description; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public set doorMode(mode: number) + { + this._doorMode = mode; + } + + public get password(): string + { + return this._password; + } + + public set password(password: string) + { + this._password = password; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public set categoryId(id: number) + { + this._categoryId = id; + } + + public get maximumVisitors(): number + { + return this._maximumVisitors; + } + + public set maximumVisitors(max: number) + { + this._maximumVisitors = max; + } + + public get tags(): string[] + { + return this._tags; + } + + public set tags(tags: string[]) + { + this._tags = tags; + } + + public get whoCanMute(): number + { + return this._whoCanMute; + } + + public set whoCanMute(mute: number) + { + this._whoCanMute = mute; + } + + public get whoCanKick(): number + { + return this._whoCanKick; + } + + public set whoCanKick(kick: number) + { + this._whoCanKick = kick; + } + + public get whoCanBan(): number + { + return this._whoCanBan; + } + + public set whoCanBan(ban: number) + { + this._whoCanBan = ban; + } + + public get chatMode(): number + { + return this._chatMode; + } + + public set chatMode(mode: number) + { + this._chatMode = mode; + } + + public get chatBubbleSize(): number + { + return this._chatBubbleSize; + } + + public set chatBubbleSize(size: number) + { + this._chatBubbleSize = size; + } + + public get chatScrollUpFrequency(): number + { + return this._chatScrollUpFrequency; + } + + public set chatScrollUpFrequency(frequency: number) + { + this._chatScrollUpFrequency = frequency; + } + + public get chatFullHearRange(): number + { + return this._chatFullHearRange; + } + + public set chatFullHearRange(range: number) + { + this._chatFullHearRange = range; + } + + public get chatFloodSensitivity(): number + { + return this._chatFloodSensitivity; + } + + public set chatFloodSensitivity(sensitivity: number) + { + this._chatFloodSensitivity = sensitivity; + } + + public get allowNavigatorDynCats(): boolean + { + return this._allowNavigatorDynCats; + } + + public set allowNavigatorDynCats(flag: boolean) + { + this._allowNavigatorDynCats = flag; + } +} diff --git a/src/nitro/communication/messages/outgoing/roomsettings/index.ts b/src/nitro/communication/messages/outgoing/roomsettings/index.ts new file mode 100644 index 00000000..36ffb020 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/roomsettings/index.ts @@ -0,0 +1 @@ +export * from './SaveableRoomSettingsData'; diff --git a/src/nitro/communication/messages/parser/room/data/RoomSettingsUpdatedParser.ts b/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts similarity index 97% rename from src/nitro/communication/messages/parser/room/data/RoomSettingsUpdatedParser.ts rename to src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts index ec491ea5..592fe611 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomSettingsUpdatedParser.ts +++ b/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; export class RoomSettingsUpdatedParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/navigator/index.ts b/src/nitro/communication/messages/parser/navigator/index.ts index 006abc82..ea204d19 100644 --- a/src/nitro/communication/messages/parser/navigator/index.ts +++ b/src/nitro/communication/messages/parser/navigator/index.ts @@ -12,4 +12,5 @@ export * from './NavigatorOpenRoomCreatorParser'; export * from './NavigatorSearchesParser'; export * from './NavigatorSearchParser'; export * from './NavigatorSettingsParser'; +export * from './RoomSettingsUpdatedParser'; export * from './utils'; diff --git a/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts b/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts index 7fc5270e..f7149942 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts @@ -1,5 +1,5 @@ import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; -import { RoomChatSettings } from './RoomChatSettings'; +import { RoomChatSettings } from '../../../incoming/roomsettings/RoomChatSettings'; export class RoomChatSettingsParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts b/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts index bbd25e13..6f6ab9ab 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts @@ -1,8 +1,8 @@ import { IMessageParser } from '../../../../../../././core/communication/messages/IMessageParser'; import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; -import { RoomChatSettings } from './RoomChatSettings'; +import { RoomChatSettings } from '../../../incoming/roomsettings/RoomChatSettings'; +import { RoomModerationSettings } from '../../../incoming/roomsettings/RoomModerationSettings'; import { RoomDataParser } from './RoomDataParser'; -import { RoomModerationSettings } from './RoomModerationSettings'; export class RoomInfoParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/room/data/RoomSettingsParser.ts b/src/nitro/communication/messages/parser/room/data/RoomSettingsParser.ts deleted file mode 100644 index e45b2511..00000000 --- a/src/nitro/communication/messages/parser/room/data/RoomSettingsParser.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; -import { RoomChatSettings } from './RoomChatSettings'; -import { RoomModerationSettings } from './RoomModerationSettings'; - -export class RoomSettingsParser implements IMessageParser -{ - private _roomId: number; - private _name: string; - private _description: string; - private _state: number; - private _categoryId: number; - private _userCount: number; - private _maxUserCount: number; - private _tags: string[]; - private _tradeMode: number; - private _allowPets: number; - private _allowPetsEat: number; - private _allowWalkthrough: number; - private _hideWalls: number; - private _thicknessWall: number; - private _thicknessFloor: number; - private _chat: RoomChatSettings; - private _moderation: RoomModerationSettings; - - public flush(): boolean - { - this._roomId = 0; - - return true; - } - - public parse(wrapper: IMessageDataWrapper): boolean - { - if(!wrapper) return false; - - this._roomId = wrapper.readInt(); - this._name = wrapper.readString(); - this._description = wrapper.readString(); - this._state = wrapper.readInt(); - this._categoryId = wrapper.readInt(); - this._userCount = wrapper.readInt(); - this._maxUserCount = wrapper.readInt(); - - this.parseTags(wrapper); - - this._tradeMode = wrapper.readInt(); - this._allowPets = wrapper.readInt(); - this._allowPetsEat = wrapper.readInt(); - this._allowWalkthrough = wrapper.readInt(); - this._hideWalls = wrapper.readInt(); - this._thicknessWall = wrapper.readInt(); - this._thicknessFloor = wrapper.readInt(); - this._chat = new RoomChatSettings(wrapper); - wrapper.readBoolean(); - this._moderation = new RoomModerationSettings(wrapper); - - return true; - } - - private parseTags(wrapper: IMessageDataWrapper): boolean - { - if(!wrapper) return false; - - this._tags = []; - - let totalTags = wrapper.readInt(); - - while(totalTags > 0) - { - this._tags.push(wrapper.readString()); - - totalTags--; - } - - return true; - } - - public get roomId(): number - { - return this._roomId; - } - - public get name(): string - { - return this._name; - } - - public get description(): string - { - return this._description; - } - - public get state(): number - { - return this._state; - } - - public get categoryId(): number - { - return this._categoryId; - } - - public get userCount(): number - { - return this._userCount; - } - - public get maxUserCount(): number - { - return this._maxUserCount; - } - - public get tags(): string[] - { - return this._tags; - } - - public get tradeMode(): number - { - return this._tradeMode; - } - - public get allowPets(): boolean - { - return this._allowPets === 1; - } - - public get allowPetsEat(): boolean - { - return this._allowPetsEat === 1; - } - - public get allowWalkthrough(): boolean - { - return this._allowWalkthrough === 1; - } - - public get hideWalls(): boolean - { - return this._hideWalls === 1; - } - - public get thicknessWall(): number - { - return this._thicknessWall; - } - - public get thicknessFloor(): number - { - return this._thicknessFloor; - } - - public get chatSettings(): RoomChatSettings - { - return this._chat; - } - - public get moderationSettings(): RoomModerationSettings - { - return this._moderation; - } -} diff --git a/src/nitro/communication/messages/parser/room/data/index.ts b/src/nitro/communication/messages/parser/room/data/index.ts index d003c377..989b28d2 100644 --- a/src/nitro/communication/messages/parser/room/data/index.ts +++ b/src/nitro/communication/messages/parser/room/data/index.ts @@ -1,11 +1,5 @@ -export * from './RoomChatSettings'; export * from './RoomChatSettingsParser'; export * from './RoomDataParser'; export * from './RoomEntryInfoMessageParser'; export * from './RoomInfoParser'; -export * from './RoomModerationSettings'; export * from './RoomScoreParser'; -export * from './RoomSettingsErrorParser'; -export * from './RoomSettingsParser'; -export * from './RoomSettingsSavedParser'; -export * from './RoomSettingsUpdatedParser'; diff --git a/src/nitro/communication/messages/parser/roomevents/index.ts b/src/nitro/communication/messages/parser/roomevents/index.ts index f4dbfc98..a0b2373d 100644 --- a/src/nitro/communication/messages/parser/roomevents/index.ts +++ b/src/nitro/communication/messages/parser/roomevents/index.ts @@ -1,4 +1,3 @@ -export * from './RoomMutedParser'; export * from './WiredFurniActionParser'; export * from './WiredFurniConditionParser'; export * from './WiredFurniTriggerParser'; diff --git a/src/nitro/communication/messages/parser/roomevents/RoomMutedParser.ts b/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts similarity index 57% rename from src/nitro/communication/messages/parser/roomevents/RoomMutedParser.ts rename to src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts index 4136485a..99fe26f1 100644 --- a/src/nitro/communication/messages/parser/roomevents/RoomMutedParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.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 RoomMutedParser implements IMessageParser +export class MuteAllInRoomParser implements IMessageParser { private _isMuted: boolean; diff --git a/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts b/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts new file mode 100644 index 00000000..bf65ac6c --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class NoSuchFlatParser implements IMessageParser +{ + private _roomId: number; + + public flush(): boolean + { + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts new file mode 100644 index 00000000..204e56be --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts @@ -0,0 +1,60 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; +import { RoomChatSettings } from '../../incoming/roomsettings/RoomChatSettings'; +import { RoomModerationSettings } from '../../incoming/roomsettings/RoomModerationSettings'; +import { RoomSettingsData } from '../../incoming/roomsettings/RoomSettingsData'; + +export class RoomSettingsDataParser implements IMessageParser +{ + private _roomSettingsData: RoomSettingsData; + + public flush(): boolean + { + this._roomSettingsData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomSettingsData = new RoomSettingsData(); + + this._roomSettingsData.roomId = wrapper.readInt(); + this._roomSettingsData.name = wrapper.readString(); + this._roomSettingsData.description = wrapper.readString(); + this._roomSettingsData.doorMode = wrapper.readInt(); + this._roomSettingsData.categoryId = wrapper.readInt(); + this._roomSettingsData.maximumVisitors = wrapper.readInt(); + this._roomSettingsData.maximumVisitorsLimit = wrapper.readInt(); + this._roomSettingsData.tags = []; + + let totalTags = wrapper.readInt(); + + while(totalTags > 0) + { + this._roomSettingsData.tags.push(wrapper.readString()); + + totalTags--; + } + + this._roomSettingsData.tradeMode = wrapper.readInt(); + this._roomSettingsData.allowPets = (wrapper.readInt() === 1); + this._roomSettingsData.allowFoodConsume = (wrapper.readInt() === 1); + this._roomSettingsData.allowWalkThrough = (wrapper.readInt() === 1); + this._roomSettingsData.hideWalls = (wrapper.readInt() === 1); + this._roomSettingsData.wallThickness = wrapper.readInt(); + this._roomSettingsData.floorThickness = wrapper.readInt(); + this._roomSettingsData.chatSettings = new RoomChatSettings(wrapper); + this._roomSettingsData.allowNavigatorDynamicCats = wrapper.readBoolean(); + this._roomSettingsData.roomModerationSettings = new RoomModerationSettings(wrapper); + + return true; + } + + public get data(): RoomSettingsData + { + return this._roomSettingsData; + } +} diff --git a/src/nitro/communication/messages/parser/room/data/RoomSettingsErrorParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts similarity index 69% rename from src/nitro/communication/messages/parser/room/data/RoomSettingsErrorParser.ts rename to src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts index 6fdcbad0..a03f7d2b 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomSettingsErrorParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts @@ -1,16 +1,15 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; export class RoomSettingsErrorParser implements IMessageParser { private _roomId: number; private _code: number; - private _message: string; public flush(): boolean { this._roomId = 0; this._code = 0; - this._message = null; return true; } @@ -21,7 +20,6 @@ export class RoomSettingsErrorParser implements IMessageParser this._roomId = wrapper.readInt(); this._code = wrapper.readInt(); - this._message = wrapper.readString(); return true; } @@ -35,9 +33,4 @@ export class RoomSettingsErrorParser implements IMessageParser { return this._code; } - - public get message(): string - { - return this._message; - } } diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts new file mode 100644 index 00000000..1e79ee49 --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts @@ -0,0 +1,58 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class RoomSettingsSaveErrorParser implements IMessageParser +{ + public static ERROR_ROOM_NOT_FOUND: number = 1; + public static ERROR_NOT_OWNER: number = 2; + public static ERROR_INVALID_DOOR_MODE: number = 3; + public static ERROR_INVALID_USER_LIMIT: number = 4; + public static ERROR_INVALID_PASSWORD: number = 5; + public static ERROR_INVALID_CATEGORY: number = 6; + public static ERROR_INVALID_NAME: number = 7; + public static ERROR_UNACCEPTABLE_NAME: number = 8; + public static ERROR_INVALID_DESCRIPTION: number = 9; + public static ERROR_UNACCEPTABLE_DESCRIPTION: number = 10; + public static ERROR_INVALID_TAG: number = 11; + public static ERROR_NON_USER_CHOOSABLE_TAG: number = 12; + public static ERROR_TOO_MANY_CHARACTERS_IN_TAG: number = 13; + + private _roomId: number; + private _code: number; + private _message: string; + + public flush(): boolean + { + this._roomId = 0; + this._code = 0; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._code = wrapper.readInt(); + this._message = wrapper.readString(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get code(): number + { + return this._code; + } + + public get message(): string + { + return this._message; + } +} diff --git a/src/nitro/communication/messages/parser/room/data/RoomSettingsSavedParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts similarity index 97% rename from src/nitro/communication/messages/parser/room/data/RoomSettingsSavedParser.ts rename to src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts index 8b360eec..02613c34 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomSettingsSavedParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../core'; +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; export class RoomSettingsSavedParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts b/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts new file mode 100644 index 00000000..c8201149 --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class ShowEnforceRoomCategoryDialogParser implements IMessageParser +{ + private _selectionType: number; + + public flush(): boolean + { + this._selectionType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._selectionType = wrapper.readInt(); + + return true; + } + + public get selectionType(): number + { + return this._selectionType; + } +} diff --git a/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts b/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts new file mode 100644 index 00000000..0ce1892e --- /dev/null +++ b/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class UserUnbannedFromRoomParser 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/roomsettings/index.ts b/src/nitro/communication/messages/parser/roomsettings/index.ts index b38e5f28..f16ece47 100644 --- a/src/nitro/communication/messages/parser/roomsettings/index.ts +++ b/src/nitro/communication/messages/parser/roomsettings/index.ts @@ -2,3 +2,9 @@ export * from './BannedUsersFromRoomParser'; export * from './FlatControllerAddedParser'; export * from './FlatControllerRemovedParser'; export * from './FlatControllersParser'; +export * from './MuteAllInRoomParser'; +export * from './NoSuchFlatParser'; +export * from './RoomSettingsDataParser'; +export * from './RoomSettingsErrorParser'; +export * from './RoomSettingsSavedParser'; +export * from './RoomSettingsSaveErrorParser'; diff --git a/src/nitro/session/IRoomSession.ts b/src/nitro/session/IRoomSession.ts index bfb60cea..bd92b142 100644 --- a/src/nitro/session/IRoomSession.ts +++ b/src/nitro/session/IRoomSession.ts @@ -1,6 +1,6 @@ import { IDisposable } from '../../core/common/disposable/IDisposable'; import { IConnection } from '../../core/communication/connections/IConnection'; -import { RoomModerationSettings } from '../communication/messages/parser/room/data/RoomModerationSettings'; +import { RoomModerationSettings } from '../communication/messages/incoming/roomsettings/RoomModerationSettings'; import { UserDataManager } from './UserDataManager'; export interface IRoomSession extends IDisposable diff --git a/src/nitro/session/RoomSession.ts b/src/nitro/session/RoomSession.ts index 5ce340b8..6fec6f48 100644 --- a/src/nitro/session/RoomSession.ts +++ b/src/nitro/session/RoomSession.ts @@ -1,6 +1,7 @@ import { Disposable } from '../../core/common/disposable/Disposable'; import { IConnection } from '../../core/communication/connections/IConnection'; import { CompostPlantMessageComposer, FurnitureMultiStateComposer, HarvestPetMessageComposer, PetMountComposer, PollAnswerComposer, PollRejectComposer, PollStartComposer, RemovePetSaddleComposer, TogglePetBreedingComposer, TogglePetRidingComposer, UsePetProductComposer } from '../communication'; +import { RoomModerationSettings } from '../communication/messages/incoming/roomsettings/RoomModerationSettings'; import { RoomDoorbellAccessComposer } from '../communication/messages/outgoing/room/access/RoomDoorbellAccessComposer'; import { RoomEnterComposer } from '../communication/messages/outgoing/room/access/RoomEnterComposer'; import { RoomAmbassadorAlertComposer } from '../communication/messages/outgoing/room/action/RoomAmbassadorAlertComposer'; @@ -25,7 +26,6 @@ import { RoomUnitDanceComposer } from '../communication/messages/outgoing/room/u import { RoomUnitPostureComposer } from '../communication/messages/outgoing/room/unit/RoomUnitPostureComposer'; import { RoomUnitSignComposer } from '../communication/messages/outgoing/room/unit/RoomUnitSignComposer'; import { UserMottoComposer } from '../communication/messages/outgoing/user/data/UserMottoComposer'; -import { RoomModerationSettings } from '../communication/messages/parser/room/data/RoomModerationSettings'; import { RoomControllerLevel } from './enum/RoomControllerLevel'; import { RoomTradingLevelEnum } from './enum/RoomTradingLevelEnum'; import { RoomSessionEvent } from './events/RoomSessionEvent';