Add packets

This commit is contained in:
Bill 2021-05-22 12:16:40 -04:00
parent 5325c65b10
commit 40be434792
9 changed files with 81 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { SellablePetPalettesEvent } from './messages';
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, SellablePetPalettesEvent } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent';
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
@ -444,6 +444,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.REDEEM_VOUCHER_ERROR, CatalogRedeemVoucherErrorEvent);
this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, CatalogRedeemVoucherOkEvent);
this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, SellablePetPalettesEvent);
this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, CatalogApproveNameResultEvent);
// CLIENT
this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent);
@ -938,6 +939,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.ROOM_MUTE, RoomMuteComposer);
// USER
this._composers.set(OutgoingHeader.APPROVE_NAME, ApproveNameMessageComposer);
this._composers.set(OutgoingHeader.USER_RESPECT, UserRespectComposer);
// DATA

View File

@ -246,4 +246,5 @@ export class IncomingHeader
public static MARKETPLACE_ITEMS_SEARCHED = 680;
public static MARKETPLACE_AFTER_ORDER_STATUS = 2032;
public static CATALOG_RECEIVE_PET_BREEDS = 3331;
public static CATALOG_APPROVE_NAME_RESULT = 1503;
}

View File

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

View File

@ -1,3 +1,4 @@
export * from './CatalogApproveNameResultEvent';
export * from './CatalogClubEvent';
export * from './CatalogClubGiftsEvent';
export * from './CatalogGiftConfigurationEvent';

View File

@ -231,4 +231,5 @@ export class OutgoingHeader
public static MARKETPLACE_REQUEST_OFFERS = 2407;
public static MARKETPLACE_BUY_OFFER = 1603;
public static CATALOG_REQUESET_PET_BREEDS = 1756;
public static APPROVE_NAME = 2109;
}

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class ApproveNameMessageComposer implements IMessageComposer<ConstructorParameters<typeof ApproveNameMessageComposer>>
{
private _data: ConstructorParameters<typeof ApproveNameMessageComposer>;
constructor(name: string, type: number)
{
this._data = [ name, type ];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,3 +1,4 @@
export * from './ApproveNameMessageComposer';
export * from './data';
export * from './inventory';
export * from './settings';

View File

@ -0,0 +1,36 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class CatalogApproveNameResultParser implements IMessageParser
{
private _result: number;
private _validationInfo: string;
public flush(): boolean
{
this._result = -1;
this._validationInfo = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._result = wrapper.readInt();
this._validationInfo = wrapper.readString();
return true;
}
public get result(): number
{
return this._result;
}
public get validationInfo(): string
{
return this._validationInfo;
}
}

View File

@ -1,3 +1,4 @@
export * from './CatalogApproveNameResultParser';
export * from './CatalogClubGiftsParser';
export * from './CatalogClubParser';
export * from './CatalogGiftConfigurationParser';