diff --git a/src/core/configuration/ConfigurationManager.ts b/src/core/configuration/ConfigurationManager.ts index 11145f26..93f847e3 100644 --- a/src/core/configuration/ConfigurationManager.ts +++ b/src/core/configuration/ConfigurationManager.ts @@ -159,7 +159,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration return (existing as T); } - public setValue(key: string, value: string): void + public setValue(key: string, value: T): void { this._definitions.set(key, value); } diff --git a/src/core/configuration/IConfigurationManager.ts b/src/core/configuration/IConfigurationManager.ts index 7f9f8165..ce9b1093 100644 --- a/src/core/configuration/IConfigurationManager.ts +++ b/src/core/configuration/IConfigurationManager.ts @@ -4,6 +4,6 @@ export interface IConfigurationManager extends INitroManager { interpolate(value: string, regex?: RegExp): string; getValue(key: string, value?: T): T; - setValue(key: string, value: string): void; + setValue(key: string, value: T): void; definitions: Map; } diff --git a/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts b/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts index 44b9c87d..16a73c38 100644 --- a/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts +++ b/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts @@ -1,16 +1,16 @@ import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; -import { CallForHelpDisabledNotifyMessageParser } from '../../parser/help/CallForHelpDisabledNotifyMessageParser'; +import { NoobnessLevelMessageParser } from '../../parser/handshake/NoobnessLevelMessageParser'; export class NoobnessLevelMessageEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { - super(callBack, CallForHelpDisabledNotifyMessageParser); + super(callBack, NoobnessLevelMessageParser); } - public getParser(): CallForHelpDisabledNotifyMessageParser + public getParser(): NoobnessLevelMessageParser { - return this.parser as CallForHelpDisabledNotifyMessageParser; + return this.parser as NoobnessLevelMessageParser; } } diff --git a/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts b/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts index 08b0eab6..0d2305f4 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomInfoParser.ts @@ -7,8 +7,8 @@ export class RoomInfoParser implements IMessageParser { private _roomEnter: boolean; private _roomForward: boolean; - private _staffPick: boolean; private _data: RoomDataParser; + private _staffPick: boolean; private _isGroupMember: boolean; private _moderation: RoomModerationSettings; private _chat: RoomChatSettings; @@ -17,8 +17,8 @@ export class RoomInfoParser implements IMessageParser { this._roomEnter = false; this._roomForward = false; - this._staffPick = false; this._data = null; + this._staffPick = false; this._isGroupMember = false; this._moderation = null; this._chat = null; @@ -33,7 +33,7 @@ export class RoomInfoParser implements IMessageParser this._roomEnter = wrapper.readBoolean(); this._data = new RoomDataParser(wrapper); this._roomForward = wrapper.readBoolean(); - this.data.roomPicker = wrapper.readBoolean(); + this._staffPick = wrapper.readBoolean(); this._isGroupMember = wrapper.readBoolean(); this.data.allInRoomMuted = wrapper.readBoolean(); this._moderation = new RoomModerationSettings(wrapper); @@ -58,6 +58,11 @@ export class RoomInfoParser implements IMessageParser return this._data; } + public get staffPick(): boolean + { + return this._staffPick; + } + public get isGroupMember(): boolean { return this._isGroupMember; diff --git a/src/nitro/session/ISessionDataManager.ts b/src/nitro/session/ISessionDataManager.ts index 22e5000a..91629989 100644 --- a/src/nitro/session/ISessionDataManager.ts +++ b/src/nitro/session/ISessionDataManager.ts @@ -47,6 +47,8 @@ export interface ISessionDataManager extends INitroManager clubLevel: number; securityLevel: number; isAmbassador: boolean; + isNoob: boolean; + isRealNoob: boolean; isSystemOpen: boolean; isSystemShutdown: boolean; isAuthenticHabbo: boolean; diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index efd49edc..beb70d62 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -6,6 +6,7 @@ import { FigureUpdateEvent, MysteryBoxKeysEvent } from '../communication'; import { INitroCommunicationManager } from '../communication/INitroCommunicationManager'; import { AvailabilityStatusMessageEvent } from '../communication/messages/incoming/availability/AvailabilityStatusMessageEvent'; import { ChangeUserNameResultMessageEvent } from '../communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent'; +import { NoobnessLevelMessageEvent } from '../communication/messages/incoming/handshake/NoobnessLevelMessageEvent'; import { RoomReadyMessageEvent } from '../communication/messages/incoming/room/mapping/RoomReadyMessageEvent'; import { UserPermissionsEvent } from '../communication/messages/incoming/user/access/UserPermissionsEvent'; import { UserInfoEvent } from '../communication/messages/incoming/user/data/UserInfoEvent'; @@ -19,6 +20,7 @@ import { NitroSettingsEvent } from '../events/NitroSettingsEvent'; import { Nitro } from '../Nitro'; import { HabboWebTools } from '../utils/HabboWebTools'; import { BadgeImageManager } from './badge/BadgeImageManager'; +import { NoobnessLevelEnum } from './enum/NoobnessLevelEnum'; import { SecurityLevel } from './enum/SecurityLevel'; import { MysteryBoxKeysUpdateEvent } from './events'; import { SessionDataPreferencesEvent } from './events/SessionDataPreferencesEvent'; @@ -53,6 +55,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private _clubLevel: number; private _securityLevel: number; private _isAmbassador: boolean; + private _noobnessLevel: number; private _systemOpen: boolean; private _systemShutdown: boolean; @@ -89,6 +92,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._clubLevel = 0; this._securityLevel = 0; this._isAmbassador = false; + this._noobnessLevel = -1; this._systemOpen = false; this._systemShutdown = false; @@ -134,6 +138,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._communication.registerMessageEvent(new RoomReadyMessageEvent(this.onRoomModelNameEvent.bind(this))); this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this))); this._communication.registerMessageEvent(new MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.bind(this))); + this._communication.registerMessageEvent(new NoobnessLevelMessageEvent(this.onNoobnessLevelMessageEvent.bind(this))); Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); } @@ -398,6 +403,16 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); } + private onNoobnessLevelMessageEvent(event: NoobnessLevelMessageEvent): void + { + this._noobnessLevel = event.getParser().noobnessLevel; + + if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) + { + Nitro.instance.core.configuration.setValue('new.identity', 1); + } + } + private onNitroSettingsEvent(event: NitroSettingsEvent): void { this._isRoomCameraFollowDisabled = event.cameraFollow; @@ -634,6 +649,16 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana return this._isAmbassador; } + public get isNoob(): boolean + { + return (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY); + } + + public get isRealNoob(): boolean + { + return (this._noobnessLevel === NoobnessLevelEnum.REAL_NOOB); + } + public get isSystemOpen(): boolean { return this._systemOpen; diff --git a/src/nitro/session/enum/NoobnessLevelEnum.ts b/src/nitro/session/enum/NoobnessLevelEnum.ts new file mode 100644 index 00000000..c9aecaff --- /dev/null +++ b/src/nitro/session/enum/NoobnessLevelEnum.ts @@ -0,0 +1,6 @@ +export class NoobnessLevelEnum +{ + public static OLD_IDENTITY: number = 0; + public static NEW_IDENTITY: number = 1; + public static REAL_NOOB: number = 2; +} diff --git a/src/nitro/session/enum/index.ts b/src/nitro/session/enum/index.ts index 3179fbdb..1e96fd3c 100644 --- a/src/nitro/session/enum/index.ts +++ b/src/nitro/session/enum/index.ts @@ -1,4 +1,5 @@ export * from './GenericErrorEnum'; +export * from './NoobnessLevelEnum'; export * from './RoomControllerLevel'; export * from './RoomTradingLevelEnum'; export * from './SecurityLevel';