Use NoobnessLevelMessageEvent

This commit is contained in:
Bill 2022-03-18 21:30:01 -04:00
parent f6383d13c4
commit c25cb1e2cf
8 changed files with 48 additions and 9 deletions

View File

@ -159,7 +159,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
return (existing as T);
}
public setValue(key: string, value: string): void
public setValue<T>(key: string, value: T): void
{
this._definitions.set(key, value);
}

View File

@ -4,6 +4,6 @@ export interface IConfigurationManager extends INitroManager
{
interpolate(value: string, regex?: RegExp): string;
getValue<T>(key: string, value?: T): T;
setValue(key: string, value: string): void;
setValue<T>(key: string, value: T): void;
definitions: Map<string, unknown>;
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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<number>('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;

View File

@ -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;
}

View File

@ -1,4 +1,5 @@
export * from './GenericErrorEnum';
export * from './NoobnessLevelEnum';
export * from './RoomControllerLevel';
export * from './RoomTradingLevelEnum';
export * from './SecurityLevel';