From 815a1d87304274bb42fb40430d2b3b74b7ac64b9 Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Sun, 20 Jun 2021 11:04:14 -0300 Subject: [PATCH] RoomWidgetCamera packets --- src/nitro/communication/NitroMessages.ts | 20 ++++++++- .../messages/incoming/IncomingHeader.ts | 2 + .../RoomWidgetCameraConfigurationEvent.ts | 16 +++++++ .../camera/RoomWidgetCameraPublishedEvent.ts | 16 +++++++ ...RoomWidgetCameraPurchaseSuccessfulEvent.ts | 16 +++++++ .../messages/incoming/room/camera/index.ts | 3 ++ .../messages/incoming/room/index.ts | 1 + .../messages/outgoing/OutgoingHeader.ts | 2 + .../RoomWidgetCameraConfigurationComposer.ts | 21 +++++++++ .../camera/RoomWidgetCameraPublishComposer.ts | 21 +++++++++ .../RoomWidgetCameraPurchaseComposer.ts | 21 +++++++++ .../RoomWidgetCameraRoomPictureComposer.ts | 21 +++++++++ .../RoomWidgetCameraRoomThumbnailComposer.ts | 21 +++++++++ .../messages/outgoing/room/camera/index.ts | 5 +++ .../messages/outgoing/room/index.ts | 1 + .../RoomWidgetCameraConfigurationParser.ts | 44 +++++++++++++++++++ .../camera/RoomWidgetCameraPublishedParser.ts | 44 +++++++++++++++++++ ...oomWidgetCameraPurchaseSuccessfulParser.ts | 17 +++++++ .../messages/parser/room/camera/index.ts | 3 ++ .../messages/parser/room/index.ts | 1 + 20 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraConfigurationEvent.ts create mode 100644 src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPublishedEvent.ts create mode 100644 src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPurchaseSuccessfulEvent.ts create mode 100644 src/nitro/communication/messages/incoming/room/camera/index.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraConfigurationComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPublishComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPurchaseComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomPictureComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomThumbnailComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/camera/index.ts create mode 100644 src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraConfigurationParser.ts create mode 100644 src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPublishedParser.ts create mode 100644 src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPurchaseSuccessfulParser.ts create mode 100644 src/nitro/communication/messages/parser/room/camera/index.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index cb76d426..f57aeca9 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -1,5 +1,5 @@ import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; -import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, RoomUnitGiveHandItemPetComposer, SellablePetPalettesEvent } from './messages'; +import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent } from './messages'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent'; @@ -120,6 +120,8 @@ import { RoomEnterErrorEvent } from './messages/incoming/room/access/RoomEnterEr 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 { RoomWidgetCameraConfigurationEvent } from './messages/incoming/room/camera/RoomWidgetCameraConfigurationEvent'; +import { RoomWidgetCameraPurchaseSuccessfulEvent } from './messages/incoming/room/camera/RoomWidgetCameraPurchaseSuccessfulEvent'; import { RoomBannedUsersEvent } from './messages/incoming/room/data/RoomBannedUsersEvent'; import { RoomChatSettingsEvent } from './messages/incoming/room/data/RoomChatSettingsEvent'; import { RoomInfoEvent } from './messages/incoming/room/data/RoomInfoEvent'; @@ -319,6 +321,10 @@ import { RoomStaffPickComposer } from './messages/outgoing/room/action/RoomStaff import { RoomTakeRightsComposer } from './messages/outgoing/room/action/RoomTakeRightsComposer'; import { RoomUnbanUserComposer } from './messages/outgoing/room/action/RoomUnbanUserComposer'; import { RequestBotCommandConfigurationComposer } from './messages/outgoing/room/bots/RequestBotConfigurationComposer'; +import { RoomWidgetCameraConfigurationComposer } from './messages/outgoing/room/camera/RoomWidgetCameraConfigurationComposer'; +import { RoomWidgetCameraPublishComposer } from './messages/outgoing/room/camera/RoomWidgetCameraPublishComposer'; +import { RoomWidgetCameraRoomPictureComposer } from './messages/outgoing/room/camera/RoomWidgetCameraRoomPictureComposer'; +import { RoomWidgetCameraRoomThumbnailComposer } from './messages/outgoing/room/camera/RoomWidgetCameraRoomThumbnailComposer'; import { RoomBannedUsersComposer } from './messages/outgoing/room/data/RoomBannedUsersComposer'; import { RoomInfoComposer } from './messages/outgoing/room/data/RoomInfoComposer'; import { RoomSettingsComposer } from './messages/outgoing/room/data/RoomSettingsComposer'; @@ -446,6 +452,11 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, SellablePetPalettesEvent); this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, CatalogApproveNameResultEvent); + // CAMERA + this._events.set(IncomingHeader.CAMERA_PRICE, RoomWidgetCameraConfigurationEvent); + this._events.set(IncomingHeader.CAMERA_PUBLISHED, RoomWidgetCameraPublishedEvent); + this._events.set(IncomingHeader.CAMERA_PURCHASE_SUCCESSFUL, RoomWidgetCameraPurchaseSuccessfulEvent); + // CLIENT this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent); @@ -744,6 +755,13 @@ export class NitroMessages implements IMessageConfiguration this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, CatalogSelectClubGiftComposer); this._composers.set(OutgoingHeader.CATALOG_REQUESET_PET_BREEDS, CatalogRequestPetBreedsComposer); + // CAMERA + this._composers.set(OutgoingHeader.CAMERA_PRICE, RoomWidgetCameraConfigurationComposer); + this._composers.set(OutgoingHeader.CAMERA_PUBLISH, RoomWidgetCameraPublishComposer); + this._composers.set(OutgoingHeader.CAMERA_PURCHASE, RoomWidgetCameraPurchaseComposer); + this._composers.set(OutgoingHeader.CAMERA_SAVE, RoomWidgetCameraRoomPictureComposer); + this._composers.set(OutgoingHeader.CAMERA_THUMBNAIL, RoomWidgetCameraRoomThumbnailComposer); + // CLIENT this._composers.set(OutgoingHeader.CLIENT_PONG, ClientPongComposer); this._composers.set(OutgoingHeader.RELEASE_VERSION, ClientReleaseVersionComposer); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index fac838bb..cc0e5958 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -5,6 +5,8 @@ export class IncomingHeader public static AVAILABILITY_STATUS = 2033; public static BUILDERS_CLUB_EXPIRED = 1452; public static CAMERA_PRICE = 3878; + public static CAMERA_PUBLISHED = 2057; + public static CAMERA_PURCHASE_SUCCESSFUL = 2783; public static CAMERA_THUMBNAIL_SAVED = 3595; public static CAMERA_URL = 3696; public static CATALOG_CLUB = 2405; diff --git a/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraConfigurationEvent.ts b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraConfigurationEvent.ts new file mode 100644 index 00000000..2c7293ef --- /dev/null +++ b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraConfigurationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { RoomWidgetCameraConfigurationParser } from '../../../parser/room/camera/RoomWidgetCameraConfigurationParser'; + +export class RoomWidgetCameraConfigurationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomWidgetCameraConfigurationParser); + } + + public getParser(): RoomWidgetCameraConfigurationParser + { + return this.parser as RoomWidgetCameraConfigurationParser; + } +} diff --git a/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPublishedEvent.ts b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPublishedEvent.ts new file mode 100644 index 00000000..dac2a890 --- /dev/null +++ b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPublishedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { RoomWidgetCameraPublishedParser } from '../../../parser/room/camera/RoomWidgetCameraPublishedParser'; + +export class RoomWidgetCameraPublishedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomWidgetCameraPublishedParser); + } + + public getParser(): RoomWidgetCameraPublishedParser + { + return this.parser as RoomWidgetCameraPublishedParser; + } +} diff --git a/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPurchaseSuccessfulEvent.ts b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPurchaseSuccessfulEvent.ts new file mode 100644 index 00000000..eb153983 --- /dev/null +++ b/src/nitro/communication/messages/incoming/room/camera/RoomWidgetCameraPurchaseSuccessfulEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { RoomWidgetCameraPurchaseSuccessfulParser } from '../../../parser/room/camera/RoomWidgetCameraPurchaseSuccessfulParser'; + +export class RoomWidgetCameraPurchaseSuccessfulEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomWidgetCameraPurchaseSuccessfulParser); + } + + public getParser(): RoomWidgetCameraPurchaseSuccessfulParser + { + return this.parser as RoomWidgetCameraPurchaseSuccessfulParser; + } +} diff --git a/src/nitro/communication/messages/incoming/room/camera/index.ts b/src/nitro/communication/messages/incoming/room/camera/index.ts new file mode 100644 index 00000000..b1984472 --- /dev/null +++ b/src/nitro/communication/messages/incoming/room/camera/index.ts @@ -0,0 +1,3 @@ +export * from './RoomWidgetCameraConfigurationEvent'; +export * from './RoomWidgetCameraPublishedEvent'; +export * from './RoomWidgetCameraPurchaseSuccessfulEvent'; diff --git a/src/nitro/communication/messages/incoming/room/index.ts b/src/nitro/communication/messages/incoming/room/index.ts index e692b601..0af11081 100644 --- a/src/nitro/communication/messages/incoming/room/index.ts +++ b/src/nitro/communication/messages/incoming/room/index.ts @@ -1,5 +1,6 @@ export * from './access'; export * from './bots'; +export * from './camera'; export * from './data'; export * from './engine'; export * from './furniture'; diff --git a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts index bf00374a..355ce787 100644 --- a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts +++ b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -6,6 +6,8 @@ export class OutgoingHeader public static BOT_PLACE = 1592; public static BOT_SKILL_SAVE = 2624; public static CAMERA_PRICE = 796; + public static CAMERA_PUBLISH = 2068; + public static CAMERA_PURCHASE = 2408; public static CAMERA_SAVE = 3226; public static CAMERA_THUMBNAIL = 1982; public static CATALOG_CLUB = 3285; diff --git a/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraConfigurationComposer.ts b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraConfigurationComposer.ts new file mode 100644 index 00000000..6f47811f --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraConfigurationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomWidgetCameraConfigurationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPublishComposer.ts b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPublishComposer.ts new file mode 100644 index 00000000..586ce45a --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPublishComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomWidgetCameraPublishComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPurchaseComposer.ts b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPurchaseComposer.ts new file mode 100644 index 00000000..eaae2502 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraPurchaseComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomWidgetCameraPurchaseComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomPictureComposer.ts b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomPictureComposer.ts new file mode 100644 index 00000000..e353dc4b --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomPictureComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomWidgetCameraRoomPictureComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unknownFloat: number, image: number[]) + { + this._data = [ unknownFloat, image ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomThumbnailComposer.ts b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomThumbnailComposer.ts new file mode 100644 index 00000000..99ca2682 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/RoomWidgetCameraRoomThumbnailComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomWidgetCameraRoomThumbnailComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unknownFloat: number, image: number[]) + { + this._data = [ unknownFloat, image ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/room/camera/index.ts b/src/nitro/communication/messages/outgoing/room/camera/index.ts new file mode 100644 index 00000000..bfad4dc9 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/camera/index.ts @@ -0,0 +1,5 @@ +export * from './RoomWidgetCameraConfigurationComposer'; +export * from './RoomWidgetCameraPublishComposer'; +export * from './RoomWidgetCameraPurchaseComposer'; +export * from './RoomWidgetCameraRoomPictureComposer'; +export * from './RoomWidgetCameraRoomThumbnailComposer'; diff --git a/src/nitro/communication/messages/outgoing/room/index.ts b/src/nitro/communication/messages/outgoing/room/index.ts index 4b101b0e..48d479c2 100644 --- a/src/nitro/communication/messages/outgoing/room/index.ts +++ b/src/nitro/communication/messages/outgoing/room/index.ts @@ -1,6 +1,7 @@ export * from './access'; export * from './action'; export * from './bots'; +export * from './camera'; export * from './data'; export * from './engine'; export * from './furniture'; diff --git a/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraConfigurationParser.ts b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraConfigurationParser.ts new file mode 100644 index 00000000..5c4e809b --- /dev/null +++ b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraConfigurationParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class RoomWidgetCameraConfigurationParser implements IMessageParser +{ + private _credits: number; + private _points: number; + private _pointsType: number; + + public flush(): boolean + { + this._credits = 0; + this._points = 0; + this._pointsType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._credits = wrapper.readInt(); + this._points = wrapper.readInt(); + this._pointsType = wrapper.readInt(); + + return true; + } + + public get credits(): number + { + return this._credits; + } + + public get points(): number + { + return this._points; + } + + public get pointsType(): number + { + return this._pointsType; + } +} diff --git a/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPublishedParser.ts b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPublishedParser.ts new file mode 100644 index 00000000..f68c41b8 --- /dev/null +++ b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPublishedParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class RoomWidgetCameraPublishedParser implements IMessageParser +{ + private _wasSuccessful: boolean; + private _cooldownSeconds: number; + private _extraDataId: number; + + public flush(): boolean + { + this._wasSuccessful = false; + this._cooldownSeconds = 0; + this._extraDataId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._wasSuccessful = wrapper.readBoolean(); + this._cooldownSeconds = wrapper.readInt(); + this._extraDataId = wrapper.readInt(); + + return true; + } + + public get wasSuccessful(): boolean + { + return this._wasSuccessful; + } + + public get cooldownSeconds(): number + { + return this._cooldownSeconds; + } + + public get extraDataId(): number + { + return this._extraDataId; + } +} diff --git a/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPurchaseSuccessfulParser.ts b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPurchaseSuccessfulParser.ts new file mode 100644 index 00000000..33a55829 --- /dev/null +++ b/src/nitro/communication/messages/parser/room/camera/RoomWidgetCameraPurchaseSuccessfulParser.ts @@ -0,0 +1,17 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class RoomWidgetCameraPurchaseSuccessfulParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/src/nitro/communication/messages/parser/room/camera/index.ts b/src/nitro/communication/messages/parser/room/camera/index.ts new file mode 100644 index 00000000..32a976b4 --- /dev/null +++ b/src/nitro/communication/messages/parser/room/camera/index.ts @@ -0,0 +1,3 @@ +export * from './RoomWidgetCameraConfigurationParser'; +export * from './RoomWidgetCameraPublishedParser'; +export * from './RoomWidgetCameraPurchaseSuccessfulParser'; diff --git a/src/nitro/communication/messages/parser/room/index.ts b/src/nitro/communication/messages/parser/room/index.ts index e692b601..0af11081 100644 --- a/src/nitro/communication/messages/parser/room/index.ts +++ b/src/nitro/communication/messages/parser/room/index.ts @@ -1,5 +1,6 @@ export * from './access'; export * from './bots'; +export * from './camera'; export * from './data'; export * from './engine'; export * from './furniture';