added incoming jukebox messages

This commit is contained in:
dank074 2021-08-22 03:04:17 -05:00
parent a364af0985
commit 8b58133e6e
24 changed files with 505 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; 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 { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent'; import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent';
import { CameraPurchaseOKMessageEvent } from './messages/incoming/camera/CameraPurchaseOKMessageEvent'; 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.COMPETITION_STATUS, CompetitionStatusMessageEvent);
this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent); this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent);
this._events.set(IncomingHeader.THUMBNAIL_STATUS, ThumbnailStatusMessageEvent); 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 private registerComposers(): void

View File

@ -272,4 +272,12 @@ export class IncomingHeader
public static INIT_CAMERA = 3878; public static INIT_CAMERA = 3878;
public static THUMBNAIL_STATUS = 3595; public static THUMBNAIL_STATUS = 3595;
public static ACHIEVEMENT_NOTIFICATION = 806; 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;
} }

View File

@ -46,6 +46,7 @@ export * from './room/unit';
export * from './room/unit/chat'; export * from './room/unit/chat';
export * from './roomevents'; export * from './roomevents';
export * from './security'; export * from './security';
export * from './sound';
export * from './user'; export * from './user';
export * from './user/access'; export * from './user/access';
export * from './user/data'; export * from './user/data';

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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';

View File

@ -20,4 +20,5 @@ export * from './quest';
export * from './room'; export * from './room';
export * from './roomevents'; export * from './roomevents';
export * from './security'; export * from './security';
export * from './sound';
export * from './user'; export * from './user';

View File

@ -0,0 +1,14 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class JukeboxPlayListFullMessageParser implements IMessageParser
{
flush(): boolean
{
return true;
}
parse(wrapper: IMessageDataWrapper): boolean
{
return true;
}
}

View File

@ -0,0 +1,37 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class JukeboxSongDisksMessageParser implements IMessageParser
{
private _songDisks: Map<number, number> = 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<number, number>
{
return this._songDisks;
}
public get maxLength(): number
{
return this._maxLength;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,46 @@
import { AdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class UserSongDisksInventoryMessageParser implements IMessageParser
{
private _songDiskInventory: AdvancedMap<number, number> = 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;
}
}

View File

@ -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';