Add packets

This commit is contained in:
Bill 2022-03-16 19:26:56 -04:00
parent 434de97751
commit 78016ae104
8 changed files with 95 additions and 0 deletions

View File

@ -222,6 +222,7 @@ import { InClientLinkEvent } from './messages/incoming/user/InClientLinkEvent';
import { UserCreditsEvent } from './messages/incoming/user/inventory/currency/UserCreditsEvent';
import { UserCurrencyEvent } from './messages/incoming/user/inventory/currency/UserCurrencyEvent';
import { UserSubscriptionEvent } from './messages/incoming/user/inventory/subscription/UserSubscriptionEvent';
import { PetRespectNoficationEvent } from './messages/incoming/user/PetRespectNoficationEvent';
import { RespectReceivedEvent } from './messages/incoming/user/RespectReceivedEvent';
import { UserWardrobePageEvent } from './messages/incoming/user/wardrobe/UserWardrobePageEvent';
import { RequestAchievementsMessageComposer } from './messages/outgoing/advertisement/RequestAchievementsMessageComposer';
@ -293,6 +294,7 @@ import { GroupSaveColorsComposer } from './messages/outgoing/group/GroupSaveColo
import { GroupSaveInformationComposer } from './messages/outgoing/group/GroupSaveInformationComposer';
import { GroupSavePreferencesComposer } from './messages/outgoing/group/GroupSavePreferencesComposer';
import { GroupSettingsComposer } from './messages/outgoing/group/GroupSettingsComposer';
import { GroupUnfavoriteComposer } from './messages/outgoing/group/GroupUnfavoriteComposer';
import { AuthenticationMessageComposer } from './messages/outgoing/handshake/AuthenticationMessageComposer';
import { ClientHelloMessageComposer } from './messages/outgoing/handshake/ClientHelloMessageComposer';
import { DisconnectMessageComposer } from './messages/outgoing/handshake/DisconnectMessageComposer';
@ -878,6 +880,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.USER_SUBSCRIPTION, UserSubscriptionEvent);
this._events.set(IncomingHeader.USER_WARDROBE_PAGE, UserWardrobePageEvent);
this._events.set(IncomingHeader.SCR_SEND_KICKBACK_INFO, ScrSendKickbackInfoMessageEvent);
this._events.set(IncomingHeader.PET_RESPECTED, PetRespectNoficationEvent);
this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent);
this._events.set(IncomingHeader.GROUP_LIST, GuildMembershipsMessageEvent);
@ -1073,6 +1076,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.GROUP_SAVE_INFORMATION, GroupSaveInformationComposer);
this._composers.set(OutgoingHeader.GROUP_SAVE_PREFERENCES, GroupSavePreferencesComposer);
this._composers.set(OutgoingHeader.GROUP_FAVORITE, GroupFavoriteComposer);
this._composers.set(OutgoingHeader.GROUP_UNFAVORITE, GroupUnfavoriteComposer);
this._composers.set(OutgoingHeader.GROUP_BADGES, GroupBadgesComposer);
// NAVIGATOR

View File

@ -365,4 +365,5 @@ export class IncomingHeader
public static SCR_SEND_KICKBACK_INFO = 3277;
public static PET_STATUS = 1907;
public static GROUP_DEACTIVATE = 3129;
public static PET_RESPECTED = 2788;
}

View File

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

View File

@ -381,4 +381,5 @@ export class OutgoingHeader
public static SCR_GET_KICKBACK_INFO = 869;
public static COMPOST_PLANT = 3835;
public static HARVEST_PET = 1521;
public static GROUP_UNFAVORITE = 1820;
}

View File

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

View File

@ -18,3 +18,4 @@ export * from './GroupSaveColorsComposer';
export * from './GroupSaveInformationComposer';
export * from './GroupSavePreferencesComposer';
export * from './GroupSettingsComposer';
export * from './GroupUnfavoriteComposer';

View File

@ -0,0 +1,50 @@
import { PetData } from '..';
import { PetType } from '../../../..';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class PetRespectNotificationParser implements IMessageParser
{
private _respect: number;
private _petOwnerId: number;
private _petData: PetData;
public flush(): boolean
{
this._respect = 0;
this._petOwnerId = 0;
this._petData = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._respect = wrapper.readInt();
this._petOwnerId = wrapper.readInt();
this._petData = new PetData(wrapper);
return true;
}
public get respect(): number
{
return this._respect;
}
public get petOwnerId(): number
{
return this._petOwnerId;
}
public get petData(): PetData
{
return this._petData;
}
public get isTreat(): boolean
{
return (this._petData.typeId === PetType.MONSTERPLANT);
}
}

View File

@ -6,6 +6,7 @@ export * from './IgnoredUsersParser';
export * from './IgnoreResultParser';
export * from './InClientLinkParser';
export * from './inventory';
export * from './PetRespectNotificationParser';
export * from './RespectReceivedParser';
export * from './RoomEntryData';
export * from './ScrSendKickbackInfoMessageParser';