Add avatar packets

This commit is contained in:
Bill 2021-08-22 18:37:49 -04:00
parent 8883da18f4
commit 1e8ccf0fd3
14 changed files with 241 additions and 35 deletions

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, AvailabilityTimeMessageEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, ClubGiftNotificationEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, GetJukeboxPlayListMessageComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, MaintenanceStatusMessageEvent, MysteryBoxKeysEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomUnitGiveHandItemPetComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent } from './messages';
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, AvailabilityTimeMessageEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, CheckUserNameResultMessageEvent, ClubGiftNotificationEvent, FigureUpdateEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, GetJukeboxPlayListMessageComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, MaintenanceStatusMessageEvent, MysteryBoxKeysEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomUnitGiveHandItemPetComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent, WardrobeMessageEvent } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent';
import { CameraPurchaseOKMessageEvent } from './messages/incoming/camera/CameraPurchaseOKMessageEvent';
@ -214,7 +214,6 @@ import { UserPerksEvent } from './messages/incoming/user/access/UserPerksEvent';
import { UserPermissionsEvent } from './messages/incoming/user/access/UserPermissionsEvent';
import { RelationshipStatusInfoEvent } from './messages/incoming/user/data/RelationshipStatusInfoEvent';
import { UserCurrentBadgesEvent } from './messages/incoming/user/data/UserCurrentBadgesEvent';
import { UserFigureEvent } from './messages/incoming/user/data/UserFigureEvent';
import { UserInfoEvent } from './messages/incoming/user/data/UserInfoEvent';
import { UserNameChangeMessageEvent } from './messages/incoming/user/data/UserNameChangeMessageEvent';
import { UserProfileEvent } from './messages/incoming/user/data/UserProfileEvent';
@ -490,6 +489,9 @@ export class NitroMessages implements IMessageConfiguration
// AVATAR
this._events.set(IncomingHeader.USER_CHANGE_NAME, ChangeUserNameResultMessageEvent);
this._events.set(IncomingHeader.CHECK_USER_NAME, CheckUserNameResultMessageEvent);
this._events.set(IncomingHeader.USER_FIGURE, FigureUpdateEvent);
this._events.set(IncomingHeader.USER_OUTFITS, WardrobeMessageEvent);
// CATALOG
this._events.set(IncomingHeader.CATALOG_CLUB, CatalogClubEvent);
@ -744,7 +746,6 @@ export class NitroMessages implements IMessageConfiguration
// DATA
this._events.set(IncomingHeader.USER_BADGES_CURRENT, UserCurrentBadgesEvent);
this._events.set(IncomingHeader.USER_FIGURE, UserFigureEvent);
this._events.set(IncomingHeader.USER_INFO, UserInfoEvent);
this._events.set(IncomingHeader.UNIT_CHANGE_NAME, UserNameChangeMessageEvent);
this._events.set(IncomingHeader.USER_SETTINGS, UserSettingsEvent);

View File

@ -288,4 +288,5 @@ export class IncomingHeader
public static PLAYLIST_SONG_ADDED = 1140;
public static TRAX_SONG_INFO = 3365;
public static USER_SONG_DISKS_INVENTORY = 2602;
public static CHECK_USER_NAME = 563;
}

View File

@ -1,25 +1,25 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { ChangeNameUpdateParser } from '../../parser/avatar/ChangeNameUpdateParser';
import { ChangeUserNameResultMessageParser } from '../../parser/avatar/ChangeUserNameResultMessageParser';
export class ChangeUserNameResultMessageEvent extends MessageEvent implements IMessageEvent
{
public static NAME_OK: number = 0;
public static ERROR_NAME_REQUIRED: number = 1;
public static ERROR_NAME_TOO_SHORT: number = 2;
public static ERROR_NAME_TOO_LONG: number = 3;
public static ERROR_NAME_NOT_VALID: number = 4;
public static ERROR_NAME_IN_USE: number = 5;
public static ERROR_NAME_CHANGE_NOT_ALLOWED: number = 6;
public static ERROR_MERGE_HOTEL_DOWN: number = 7;
public static NAME_OK: number = 0;
public static ERROR_NAME_REQUIRED: number = 1;
public static ERROR_NAME_TOO_SHORT: number = 2;
public static ERROR_NAME_TOO_LONG: number = 3;
public static ERROR_NAME_NOT_VALID: number = 4;
public static ERROR_NAME_IN_USE: number = 5;
public static ERROR_NAME_CHANGE_NOT_ALLOWED: number = 6;
public static ERROR_MERGE_HOTEL_DOWN: number = 7;
constructor(callBack: Function)
{
super(callBack, ChangeNameUpdateParser);
super(callBack, ChangeUserNameResultMessageParser);
}
public getParser(): ChangeNameUpdateParser
public getParser(): ChangeUserNameResultMessageParser
{
return this.parser as ChangeNameUpdateParser;
return this.parser as ChangeUserNameResultMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CheckUserNameResultMessageParser } from '../../parser/avatar/CheckUserNameResultMessageParser';
export class CheckUserNameResultMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CheckUserNameResultMessageParser);
}
public getParser(): CheckUserNameResultMessageParser
{
return this.parser as CheckUserNameResultMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { FigureUpdateParser } from '../../parser';
export class FigureUpdateEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, FigureUpdateParser);
}
public getParser(): FigureUpdateParser
{
return this.parser as FigureUpdateParser;
}
}

View File

@ -0,0 +1,30 @@
import { IMessageDataWrapper } from '../../../../../core';
export class OutfitData
{
private _slotId: number;
private _figureString: string;
private _gender: string;
constructor(wrapper: IMessageDataWrapper)
{
this._slotId = wrapper.readInt();
this._figureString = wrapper.readString();
this._gender = wrapper.readString();
}
public get slotId(): number
{
return this._slotId;
}
public get figureString(): string
{
return this._figureString;
}
public get gender(): string
{
return this._gender;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { WardrobeMessageParser } from '../../parser';
export class WardrobeMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, WardrobeMessageParser);
}
public getParser(): WardrobeMessageParser
{
return this.parser as WardrobeMessageParser;
}
}

View File

@ -1 +1,5 @@
export * from './ChangeUserNameResultMessageEvent';
export * from './CheckUserNameResultMessageEvent';
export * from './FigureUpdateEvent';
export * from './OutfitData';
export * from './WardrobeMessageEvent';

View File

@ -1,16 +0,0 @@
import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent';
import { UserFigureParser } from '../../../parser/user/data/UserFigureParser';
export class UserFigureEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, UserFigureParser);
}
public getParser(): UserFigureParser
{
return this.parser as UserFigureParser;
}
}

View File

@ -0,0 +1,52 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class ChangeUserNameResultMessageParser implements IMessageParser
{
private _resultCode: number;
private _name: string;
private _nameSuggestions: string[];
public flush(): boolean
{
this._resultCode = -1;
this._name = '';
this._nameSuggestions = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._resultCode = wrapper.readInt();
this._name = wrapper.readString();
let totalSuggestions = wrapper.readInt();
while(totalSuggestions > 0)
{
this._nameSuggestions.push(wrapper.readString());
totalSuggestions--;
}
return true;
}
public get resultCode(): number
{
return this._resultCode;
}
public get name(): string
{
return this._name;
}
public get nameSuggestions(): string[]
{
return this._nameSuggestions;
}
}

View File

@ -1,11 +1,11 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class ChangeNameUpdateParser implements IMessageParser
export class CheckUserNameResultMessageParser implements IMessageParser
{
private _resultCode: number;
private _name: string;
private _nameSuggestions;
private _nameSuggestions: string[];
public flush(): boolean
{
@ -49,4 +49,4 @@ export class ChangeNameUpdateParser implements IMessageParser
{
return this._nameSuggestions;
}
}
}

View File

@ -0,0 +1,38 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class FigureUpdateParser implements IMessageParser
{
private _figure: string;
private _gender: string;
public flush(): boolean
{
this._figure = '';
this._gender = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._figure = wrapper.readString();
this._gender = wrapper.readString();
if(this._gender) this._gender = this._gender.toUpperCase();
return true;
}
public get figure(): string
{
return this._figure;
}
public get gender(): string
{
return this._gender;
}
}

View File

@ -0,0 +1,45 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
import { OutfitData } from '../../incoming';
export class WardrobeMessageParser implements IMessageParser
{
private _state: number;
private _outfits: OutfitData[];
public flush(): boolean
{
this._state = 0;
this._outfits = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._state = wrapper.readInt();
let count = wrapper.readInt();
while(count > 0)
{
this._outfits.push(new OutfitData(wrapper));
count--;
}
return true;
}
public get state(): number
{
return this._state;
}
public get outfits(): OutfitData[]
{
return this._outfits;
}
}

View File

@ -1 +1,4 @@
export * from './ChangeNameUpdateParser';
export * from './ChangeUserNameResultMessageParser';
export * from './CheckUserNameResultMessageParser';
export * from './FigureUpdateParser';
export * from './WardrobeMessageParser';