From 8b58133e6effa422b0c4a8e9da661ae1f362d91f Mon Sep 17 00:00:00 2001 From: dank074 Date: Sun, 22 Aug 2021 03:04:17 -0500 Subject: [PATCH] added incoming jukebox messages --- src/nitro/communication/NitroMessages.ts | 12 +++- .../messages/incoming/IncomingHeader.ts | 8 +++ .../communication/messages/incoming/index.ts | 1 + .../sound/JukeboxPlayListFullMessageEvent.ts | 15 +++++ .../sound/JukeboxSongDisksMessageEvent.ts | 15 +++++ .../incoming/sound/NowPlayingMessageEvent.ts | 15 +++++ .../sound/OfficialSongIdMessageEvent.ts | 15 +++++ .../messages/incoming/sound/PlayListEntry.ts | 46 +++++++++++++++ .../incoming/sound/PlayListMessageEvent.ts | 15 +++++ .../sound/PlayListSongAddedMessageEvent.ts | 15 +++++ .../messages/incoming/sound/SongInfoEntry.ts | 17 ++++++ .../sound/TraxSongInfoMessageEvent.ts | 15 +++++ .../UserSongDisksInventoryMessageEvent.ts | 15 +++++ .../messages/incoming/sound/index.ts | 10 ++++ .../communication/messages/parser/index.ts | 1 + .../sound/JukeboxPlayListFullMessageParser.ts | 14 +++++ .../sound/JukeboxSongDisksMessageParser.ts | 37 ++++++++++++ .../parser/sound/NowPlayingMessageParser.ts | 56 +++++++++++++++++++ .../sound/OfficialSongIdMessageParser.ts | 31 ++++++++++ .../parser/sound/PlayListMessageParser.ts | 40 +++++++++++++ .../sound/PlayListSongAddedMessageParser.ts | 24 ++++++++ .../parser/sound/TraxSongInfoMessageParser.ts | 35 ++++++++++++ .../UserSongDisksInventoryMessageParser.ts | 46 +++++++++++++++ .../messages/parser/sound/index.ts | 8 +++ 24 files changed, 505 insertions(+), 1 deletion(-) create mode 100644 src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/PlayListEntry.ts create mode 100644 src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/SongInfoEntry.ts create mode 100644 src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/sound/index.ts create mode 100644 src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/sound/index.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 180ae3f0..a5230b1e 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 { AchievementNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, GetJukeboxPlayListMessageComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, MysteryBoxKeysEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer } from './messages'; +import { AchievementNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, GetJukeboxPlayListMessageComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, MysteryBoxKeysEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent } from './messages'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent'; import { CameraPurchaseOKMessageEvent } from './messages/incoming/camera/CameraPurchaseOKMessageEvent'; @@ -817,6 +817,16 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.COMPETITION_STATUS, CompetitionStatusMessageEvent); this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent); this._events.set(IncomingHeader.THUMBNAIL_STATUS, ThumbnailStatusMessageEvent); + + // SOUNDS + this._events.set(IncomingHeader.JUKEBOX_PLAYLIST_FULL, JukeboxPlayListFullMessageEvent); + this._events.set(IncomingHeader.JUKEBOX_SONG_DISKS, JukeboxSongDisksMessageEvent); + this._events.set(IncomingHeader.NOW_PLAYING, NowPlayingMessageEvent); + this._events.set(IncomingHeader.OFFICIAL_SONG_ID, OfficialSongIdMessageEvent); + this._events.set(IncomingHeader.PLAYLIST, PlayListMessageEvent); + this._events.set(IncomingHeader.PLAYLIST_SONG_ADDED, PlayListSongAddedMessageEvent); + this._events.set(IncomingHeader.TRAX_SONG_INFO, TraxSongInfoMessageEvent); + this._events.set(IncomingHeader.USER_SONG_DISKS_INVENTORY, UserSongDisksInventoryMessageEvent); } private registerComposers(): void diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 9efcd5be..abdfe4ed 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -272,4 +272,12 @@ export class IncomingHeader public static INIT_CAMERA = 3878; public static THUMBNAIL_STATUS = 3595; public static ACHIEVEMENT_NOTIFICATION = 806; + public static JUKEBOX_PLAYLIST_FULL = 105; + public static JUKEBOX_SONG_DISKS = 34; + public static NOW_PLAYING = 469; + public static OFFICIAL_SONG_ID = 1381; + public static PLAYLIST = 1748; + public static PLAYLIST_SONG_ADDED = 1140; + public static TRAX_SONG_INFO = 3365; + public static USER_SONG_DISKS_INVENTORY = 2602; } diff --git a/src/nitro/communication/messages/incoming/index.ts b/src/nitro/communication/messages/incoming/index.ts index 997f29e8..ff0a0af2 100644 --- a/src/nitro/communication/messages/incoming/index.ts +++ b/src/nitro/communication/messages/incoming/index.ts @@ -46,6 +46,7 @@ export * from './room/unit'; export * from './room/unit/chat'; export * from './roomevents'; export * from './security'; +export * from './sound'; export * from './user'; export * from './user/access'; export * from './user/data'; diff --git a/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts new file mode 100644 index 00000000..350a4bf6 --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { JukeboxPlayListFullMessageParser } from '../../parser'; + +export class JukeboxPlayListFullMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JukeboxPlayListFullMessageParser); + } + + public getParser(): JukeboxPlayListFullMessageParser + { + return this.parser as JukeboxPlayListFullMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts new file mode 100644 index 00000000..dc383a5e --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { JukeboxSongDisksMessageParser } from '../../parser'; + +export class JukeboxSongDisksMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JukeboxSongDisksMessageParser); + } + + public getParser(): JukeboxSongDisksMessageParser + { + return this.parser as JukeboxSongDisksMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts new file mode 100644 index 00000000..d8756b4e --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { NowPlayingMessageParser } from '../../parser'; + +export class NowPlayingMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NowPlayingMessageParser); + } + + public getParser(): NowPlayingMessageParser + { + return this.parser as NowPlayingMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts new file mode 100644 index 00000000..01524c21 --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { OfficialSongIdMessageParser } from '../../parser'; + +export class OfficialSongIdMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OfficialSongIdMessageParser); + } + + public getParser(): OfficialSongIdMessageParser + { + return this.parser as OfficialSongIdMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/PlayListEntry.ts b/src/nitro/communication/messages/incoming/sound/PlayListEntry.ts new file mode 100644 index 00000000..6a0f447e --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/PlayListEntry.ts @@ -0,0 +1,46 @@ +export class PlayListEntry +{ + protected _id: number; + protected _length: number; + protected _name: string; + protected _creator: string; + private _startPlayHead: number = 0; + + constructor(id: number, length: number, name: string, creator: string) + { + this._id = id; + this._length = length; + this._name = name; + this._creator = creator; + } + + public get id(): number + { + return this._id; + } + + public get length(): number + { + return this._length; + } + + public get name(): string + { + return this._name; + } + + public get creator(): string + { + return this._creator; + } + + public get startPlayHeadPos(): number + { + return this._startPlayHead; + } + + public set startPlayHeadPos(k: number) + { + this._startPlayHead = k; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts new file mode 100644 index 00000000..27eb5279 --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { PlayListMessageParser } from '../../parser'; + +export class PlayListMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PlayListMessageParser); + } + + public getParser(): PlayListMessageParser + { + return this.parser as PlayListMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts new file mode 100644 index 00000000..7ce8fc79 --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { PlayListSongAddedMessageParser } from '../../parser'; + +export class PlayListSongAddedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PlayListSongAddedMessageParser); + } + + public getParser(): PlayListSongAddedMessageParser + { + return this.parser as PlayListSongAddedMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/SongInfoEntry.ts b/src/nitro/communication/messages/incoming/sound/SongInfoEntry.ts new file mode 100644 index 00000000..37eaaabb --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/SongInfoEntry.ts @@ -0,0 +1,17 @@ +import { PlayListEntry } from '.'; + +export class SongInfoEntry extends PlayListEntry +{ + private _data:string = ''; + + constructor(id:number, length:number, name:string, creator:string, data:string) + { + super(id, length, name, creator); + this._data = data; + } + + public get data():string + { + return this._data; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts new file mode 100644 index 00000000..80c1b83b --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { TraxSongInfoMessageParser } from '../../parser'; + +export class TraxSongInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TraxSongInfoMessageParser); + } + + public getParser(): TraxSongInfoMessageParser + { + return this.parser as TraxSongInfoMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts b/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts new file mode 100644 index 00000000..006912ca --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts @@ -0,0 +1,15 @@ +import { IMessageEvent, MessageEvent } from '../../../../../core'; +import { UserSongDisksInventoryMessageParser } from '../../parser'; + +export class UserSongDisksInventoryMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserSongDisksInventoryMessageParser); + } + + public getParser(): UserSongDisksInventoryMessageParser + { + return this.parser as UserSongDisksInventoryMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/sound/index.ts b/src/nitro/communication/messages/incoming/sound/index.ts new file mode 100644 index 00000000..7fa245a1 --- /dev/null +++ b/src/nitro/communication/messages/incoming/sound/index.ts @@ -0,0 +1,10 @@ +export * from './JukeboxPlayListFullMessageEvent'; +export * from './JukeboxSongDisksMessageEvent'; +export * from './NowPlayingMessageEvent'; +export * from './OfficialSongIdMessageEvent'; +export * from './PlayListEntry'; +export * from './PlayListMessageEvent'; +export * from './PlayListSongAddedMessageEvent'; +export * from './SongInfoEntry'; +export * from './TraxSongInfoMessageEvent'; +export * from './UserSongDisksInventoryMessageEvent'; diff --git a/src/nitro/communication/messages/parser/index.ts b/src/nitro/communication/messages/parser/index.ts index f9898c17..6f954ccb 100644 --- a/src/nitro/communication/messages/parser/index.ts +++ b/src/nitro/communication/messages/parser/index.ts @@ -20,4 +20,5 @@ export * from './quest'; export * from './room'; export * from './roomevents'; export * from './security'; +export * from './sound'; export * from './user'; diff --git a/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts b/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts new file mode 100644 index 00000000..9daa014a --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class JukeboxPlayListFullMessageParser implements IMessageParser +{ + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts new file mode 100644 index 00000000..f07ab3fa --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class JukeboxSongDisksMessageParser implements IMessageParser +{ + private _songDisks: Map = new Map(); + private _maxLength: number; + + flush(): boolean + { + this._songDisks.clear(); + this._maxLength = 0; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._maxLength = wrapper.readInt(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._songDisks.set(wrapper.readInt(), wrapper.readInt()); + } + + return true; + } + + public get songDisks(): Map + { + return this._songDisks; + } + + public get maxLength(): number + { + return this._maxLength; + } +} diff --git a/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts b/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts new file mode 100644 index 00000000..2ea7d4f0 --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts @@ -0,0 +1,56 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class NowPlayingMessageParser implements IMessageParser +{ + private _currentSongId:number; + private _currentPosition:number; + private _nextSongId:number; + private _nextPosition:number; + private _syncCount:number; + + flush(): boolean + { + this._currentSongId = -1; + this._currentPosition = -1; + this._nextSongId = -1; + this._nextPosition = -1; + this._syncCount = -1; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._currentSongId = wrapper.readInt(); + this._currentPosition = wrapper.readInt(); + this._nextSongId = wrapper.readInt(); + this._nextPosition = wrapper.readInt(); + this._syncCount = wrapper.readInt(); + return true; + } + + public get currentSongId():number + { + return this._currentSongId; + } + + public get currentPosition():number + { + return this._currentPosition; + } + + public get nextSongId():number + { + return this._nextSongId; + } + + public get nextPosition():number + { + return this._nextPosition; + } + + public get syncCount():number + { + return this._syncCount; + } + +} diff --git a/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts b/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts new file mode 100644 index 00000000..c6d2770d --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class OfficialSongIdMessageParser implements IMessageParser +{ + private _songId:number; + private _officialSongId:string; + + flush(): boolean + { + this._songId = 0; + this._officialSongId = ''; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._officialSongId = wrapper.readString(); + this._songId = wrapper.readInt(); + return true; + } + + public get songId():number + { + return this._songId; + } + + public get officialSongId():string + { + return this._officialSongId; + } +} diff --git a/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts b/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts new file mode 100644 index 00000000..3ceb7920 --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; +import { PlayListEntry } from '../../incoming/sound'; + +export class PlayListMessageParser implements IMessageParser +{ + private _synchronizationCount:number; + private _playlist:PlayListEntry[]; + + flush(): boolean + { + this._synchronizationCount = -1; + this._playlist = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._synchronizationCount = wrapper.readInt(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._playlist.push(new PlayListEntry( + wrapper.readInt(), wrapper.readInt(), wrapper.readString(), wrapper.readString() + )); + } + return true; + } + + public get synchronizationCount():number + { + return this._synchronizationCount; + } + + public get playList():PlayListEntry[] + { + return this._playlist; + } + +} diff --git a/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts b/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts new file mode 100644 index 00000000..d138839b --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; +import { PlayListEntry } from '../../incoming/sound'; + +export class PlayListSongAddedMessageParser implements IMessageParser +{ + private _entry:PlayListEntry; + + flush(): boolean + { + this._entry = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._entry = new PlayListEntry(wrapper.readInt(), wrapper.readInt(), wrapper.readString(), wrapper.readString()); + return true; + } + + public get entry():PlayListEntry + { + return this._entry; + } +} diff --git a/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts b/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts new file mode 100644 index 00000000..71fe79e6 --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; +import { SongInfoEntry } from '../../incoming/sound/SongInfoEntry'; + +export class TraxSongInfoMessageParser implements IMessageParser +{ + private _songs:SongInfoEntry[]; + + flush(): boolean + { + this._songs = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + const count = wrapper.readInt(); + for(let i = 0; i< count; i++) + { + const id = wrapper.readInt(); + const _local_3 = wrapper.readString(); + const name = wrapper.readString(); + const data = wrapper.readString(); + const length = wrapper.readInt(); + const creator = wrapper.readString(); + const _local_10 = new SongInfoEntry(id, length, name, creator, data); + this._songs.push(_local_10); + } + return true; + } + + public get songs():SongInfoEntry[] + { + return this._songs; + } +} diff --git a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts new file mode 100644 index 00000000..8717ea9c --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts @@ -0,0 +1,46 @@ +import { AdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class UserSongDisksInventoryMessageParser implements IMessageParser +{ + private _songDiskInventory: AdvancedMap = new AdvancedMap(); + + flush(): boolean + { + this._songDiskInventory.reset(); + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._songDiskInventory.add(wrapper.readInt(), wrapper.readInt()); + } + return true; + } + + public getDiskId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getKey(k); + } + return -1; + } + + public getSongId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getWithIndex(k); + } + return -1; + } + + public get songDiskCount(): number + { + return this._songDiskInventory.length; + } +} diff --git a/src/nitro/communication/messages/parser/sound/index.ts b/src/nitro/communication/messages/parser/sound/index.ts new file mode 100644 index 00000000..edf11c6d --- /dev/null +++ b/src/nitro/communication/messages/parser/sound/index.ts @@ -0,0 +1,8 @@ +export * from './JukeboxPlayListFullMessageParser'; +export * from './JukeboxSongDisksMessageParser'; +export * from './NowPlayingMessageParser'; +export * from './OfficialSongIdMessageParser'; +export * from './PlayListMessageParser'; +export * from './PlayListSongAddedMessageParser'; +export * from './TraxSongInfoMessageParser'; +export * from './UserSongDisksInventoryMessageParser';