From 5a8b7f933ff7acea043b2e79c52327fd332cfd0e Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 18 Mar 2022 18:50:52 -0400 Subject: [PATCH] Add NoobnessLevelEvent --- src/nitro/communication/NitroMessages.ts | 4 +++ .../messages/incoming/IncomingHeader.ts | 1 + .../handshake/NoobnessLevelMessageEvent.ts | 16 +++++++++++ .../messages/incoming/handshake/index.ts | 1 + .../communication/messages/incoming/index.ts | 1 + .../handshake/NoobnessLevelMessageParser.ts | 27 +++++++++++++++++++ .../messages/parser/handshake/index.ts | 1 + .../communication/messages/parser/index.ts | 1 + 8 files changed, 52 insertions(+) create mode 100644 src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/handshake/index.ts create mode 100644 src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts create mode 100644 src/nitro/communication/messages/parser/handshake/index.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 4f38a336..25b84c9e 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -50,6 +50,7 @@ import { GroupMembersEvent } from './messages/incoming/group/GroupMembersEvent'; import { GroupPurchasedEvent } from './messages/incoming/group/GroupPurchasedEvent'; import { GroupSettingsEvent } from './messages/incoming/group/GroupSettingsEvent'; import { HabboGroupDeactivatedMessageEvent } from './messages/incoming/group/HabboGroupDeactivatedMessageEvent'; +import { NoobnessLevelMessageEvent } from './messages/incoming/handshake/NoobnessLevelMessageEvent'; import { CallForHelpDisabledNotifyMessageEvent } from './messages/incoming/help/CallForHelpDisabledNotifyMessageEvent'; import { CallForHelpResultMessageEvent } from './messages/incoming/help/CallForHelpResultMessageEvent'; import { GuideReportingStatusMessageEvent } from './messages/incoming/help/GuideReportingStatusMessageEvent'; @@ -887,6 +888,9 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent); this._events.set(IncomingHeader.GROUP_LIST, GuildMembershipsMessageEvent); this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, ApproveNameMessageEvent); + + // HANDSHAKE + this._events.set(IncomingHeader.NOOBNESS_LEVEL, NoobnessLevelMessageEvent); } private registerComposers(): void diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index b27a42b7..5577aafa 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -367,4 +367,5 @@ export class IncomingHeader public static GROUP_DEACTIVATE = 3129; public static PET_RESPECTED = 2788; public static PET_SUPPLEMENT = 3441; + public static NOOBNESS_LEVEL = 3738; } diff --git a/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts b/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts new file mode 100644 index 00000000..44b9c87d --- /dev/null +++ b/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { CallForHelpDisabledNotifyMessageParser } from '../../parser/help/CallForHelpDisabledNotifyMessageParser'; + +export class NoobnessLevelMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpDisabledNotifyMessageParser); + } + + public getParser(): CallForHelpDisabledNotifyMessageParser + { + return this.parser as CallForHelpDisabledNotifyMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/handshake/index.ts b/src/nitro/communication/messages/incoming/handshake/index.ts new file mode 100644 index 00000000..5fe605ba --- /dev/null +++ b/src/nitro/communication/messages/incoming/handshake/index.ts @@ -0,0 +1 @@ +export * from './NoobnessLevelMessageEvent'; diff --git a/src/nitro/communication/messages/incoming/index.ts b/src/nitro/communication/messages/incoming/index.ts index d48d41f5..2b47824c 100644 --- a/src/nitro/communication/messages/incoming/index.ts +++ b/src/nitro/communication/messages/incoming/index.ts @@ -13,6 +13,7 @@ export * from './friendlist'; export * from './game'; export * from './generic'; export * from './group'; +export * from './handshake'; export * from './help'; export * from './IncomingHeader'; export * from './inventory'; diff --git a/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts b/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts new file mode 100644 index 00000000..c51b85de --- /dev/null +++ b/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; + +export class NoobnessLevelMessageParser implements IMessageParser +{ + private _noobnessLevel: number; + + public flush(): boolean + { + this._noobnessLevel = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._noobnessLevel = wrapper.readInt(); + + return true; + } + + public get noobnessLevel(): number + { + return this._noobnessLevel; + } +} diff --git a/src/nitro/communication/messages/parser/handshake/index.ts b/src/nitro/communication/messages/parser/handshake/index.ts new file mode 100644 index 00000000..d4796c32 --- /dev/null +++ b/src/nitro/communication/messages/parser/handshake/index.ts @@ -0,0 +1 @@ +export * from './NoobnessLevelMessageParser'; diff --git a/src/nitro/communication/messages/parser/index.ts b/src/nitro/communication/messages/parser/index.ts index bfd1ea42..3c3fcf66 100644 --- a/src/nitro/communication/messages/parser/index.ts +++ b/src/nitro/communication/messages/parser/index.ts @@ -14,6 +14,7 @@ export * from './friendlist'; export * from './game'; export * from './generic'; export * from './group'; +export * from './handshake'; export * from './help'; export * from './inventory'; export * from './landingview';