diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 4a9d8d8e..43244677 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -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 diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index a069fa15..60f5b9ba 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -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; } diff --git a/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts b/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts new file mode 100644 index 00000000..4415ec2a --- /dev/null +++ b/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts @@ -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; + } +} diff --git a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts index cc4258b1..6467ab4a 100644 --- a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts +++ b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -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; } diff --git a/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts b/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts new file mode 100644 index 00000000..8b62a03f --- /dev/null +++ b/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; + +export class GroupUnfavoriteComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [ groupId ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/group/index.ts b/src/nitro/communication/messages/outgoing/group/index.ts index bf1b8fc3..d2f5f4f0 100644 --- a/src/nitro/communication/messages/outgoing/group/index.ts +++ b/src/nitro/communication/messages/outgoing/group/index.ts @@ -18,3 +18,4 @@ export * from './GroupSaveColorsComposer'; export * from './GroupSaveInformationComposer'; export * from './GroupSavePreferencesComposer'; export * from './GroupSettingsComposer'; +export * from './GroupUnfavoriteComposer'; diff --git a/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts b/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts new file mode 100644 index 00000000..6832e872 --- /dev/null +++ b/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts @@ -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); + } +} diff --git a/src/nitro/communication/messages/parser/user/index.ts b/src/nitro/communication/messages/parser/user/index.ts index 8c1e2d8e..401714ae 100644 --- a/src/nitro/communication/messages/parser/user/index.ts +++ b/src/nitro/communication/messages/parser/user/index.ts @@ -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';