mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 22:36:27 +01:00
Use NoobnessLevelMessageEvent
This commit is contained in:
parent
f6383d13c4
commit
c25cb1e2cf
@ -159,7 +159,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
|
|||||||
return (existing as T);
|
return (existing as T);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setValue(key: string, value: string): void
|
public setValue<T>(key: string, value: T): void
|
||||||
{
|
{
|
||||||
this._definitions.set(key, value);
|
this._definitions.set(key, value);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ export interface IConfigurationManager extends INitroManager
|
|||||||
{
|
{
|
||||||
interpolate(value: string, regex?: RegExp): string;
|
interpolate(value: string, regex?: RegExp): string;
|
||||||
getValue<T>(key: string, value?: T): T;
|
getValue<T>(key: string, value?: T): T;
|
||||||
setValue(key: string, value: string): void;
|
setValue<T>(key: string, value: T): void;
|
||||||
definitions: Map<string, unknown>;
|
definitions: Map<string, unknown>;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
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
|
export class NoobnessLevelMessageEvent extends MessageEvent implements IMessageEvent
|
||||||
{
|
{
|
||||||
constructor(callBack: Function)
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ export class RoomInfoParser implements IMessageParser
|
|||||||
{
|
{
|
||||||
private _roomEnter: boolean;
|
private _roomEnter: boolean;
|
||||||
private _roomForward: boolean;
|
private _roomForward: boolean;
|
||||||
private _staffPick: boolean;
|
|
||||||
private _data: RoomDataParser;
|
private _data: RoomDataParser;
|
||||||
|
private _staffPick: boolean;
|
||||||
private _isGroupMember: boolean;
|
private _isGroupMember: boolean;
|
||||||
private _moderation: RoomModerationSettings;
|
private _moderation: RoomModerationSettings;
|
||||||
private _chat: RoomChatSettings;
|
private _chat: RoomChatSettings;
|
||||||
@ -17,8 +17,8 @@ export class RoomInfoParser implements IMessageParser
|
|||||||
{
|
{
|
||||||
this._roomEnter = false;
|
this._roomEnter = false;
|
||||||
this._roomForward = false;
|
this._roomForward = false;
|
||||||
this._staffPick = false;
|
|
||||||
this._data = null;
|
this._data = null;
|
||||||
|
this._staffPick = false;
|
||||||
this._isGroupMember = false;
|
this._isGroupMember = false;
|
||||||
this._moderation = null;
|
this._moderation = null;
|
||||||
this._chat = null;
|
this._chat = null;
|
||||||
@ -33,7 +33,7 @@ export class RoomInfoParser implements IMessageParser
|
|||||||
this._roomEnter = wrapper.readBoolean();
|
this._roomEnter = wrapper.readBoolean();
|
||||||
this._data = new RoomDataParser(wrapper);
|
this._data = new RoomDataParser(wrapper);
|
||||||
this._roomForward = wrapper.readBoolean();
|
this._roomForward = wrapper.readBoolean();
|
||||||
this.data.roomPicker = wrapper.readBoolean();
|
this._staffPick = wrapper.readBoolean();
|
||||||
this._isGroupMember = wrapper.readBoolean();
|
this._isGroupMember = wrapper.readBoolean();
|
||||||
this.data.allInRoomMuted = wrapper.readBoolean();
|
this.data.allInRoomMuted = wrapper.readBoolean();
|
||||||
this._moderation = new RoomModerationSettings(wrapper);
|
this._moderation = new RoomModerationSettings(wrapper);
|
||||||
@ -58,6 +58,11 @@ export class RoomInfoParser implements IMessageParser
|
|||||||
return this._data;
|
return this._data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get staffPick(): boolean
|
||||||
|
{
|
||||||
|
return this._staffPick;
|
||||||
|
}
|
||||||
|
|
||||||
public get isGroupMember(): boolean
|
public get isGroupMember(): boolean
|
||||||
{
|
{
|
||||||
return this._isGroupMember;
|
return this._isGroupMember;
|
||||||
|
@ -47,6 +47,8 @@ export interface ISessionDataManager extends INitroManager
|
|||||||
clubLevel: number;
|
clubLevel: number;
|
||||||
securityLevel: number;
|
securityLevel: number;
|
||||||
isAmbassador: boolean;
|
isAmbassador: boolean;
|
||||||
|
isNoob: boolean;
|
||||||
|
isRealNoob: boolean;
|
||||||
isSystemOpen: boolean;
|
isSystemOpen: boolean;
|
||||||
isSystemShutdown: boolean;
|
isSystemShutdown: boolean;
|
||||||
isAuthenticHabbo: boolean;
|
isAuthenticHabbo: boolean;
|
||||||
|
@ -6,6 +6,7 @@ import { FigureUpdateEvent, MysteryBoxKeysEvent } from '../communication';
|
|||||||
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
|
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
|
||||||
import { AvailabilityStatusMessageEvent } from '../communication/messages/incoming/availability/AvailabilityStatusMessageEvent';
|
import { AvailabilityStatusMessageEvent } from '../communication/messages/incoming/availability/AvailabilityStatusMessageEvent';
|
||||||
import { ChangeUserNameResultMessageEvent } from '../communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent';
|
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 { RoomReadyMessageEvent } from '../communication/messages/incoming/room/mapping/RoomReadyMessageEvent';
|
||||||
import { UserPermissionsEvent } from '../communication/messages/incoming/user/access/UserPermissionsEvent';
|
import { UserPermissionsEvent } from '../communication/messages/incoming/user/access/UserPermissionsEvent';
|
||||||
import { UserInfoEvent } from '../communication/messages/incoming/user/data/UserInfoEvent';
|
import { UserInfoEvent } from '../communication/messages/incoming/user/data/UserInfoEvent';
|
||||||
@ -19,6 +20,7 @@ import { NitroSettingsEvent } from '../events/NitroSettingsEvent';
|
|||||||
import { Nitro } from '../Nitro';
|
import { Nitro } from '../Nitro';
|
||||||
import { HabboWebTools } from '../utils/HabboWebTools';
|
import { HabboWebTools } from '../utils/HabboWebTools';
|
||||||
import { BadgeImageManager } from './badge/BadgeImageManager';
|
import { BadgeImageManager } from './badge/BadgeImageManager';
|
||||||
|
import { NoobnessLevelEnum } from './enum/NoobnessLevelEnum';
|
||||||
import { SecurityLevel } from './enum/SecurityLevel';
|
import { SecurityLevel } from './enum/SecurityLevel';
|
||||||
import { MysteryBoxKeysUpdateEvent } from './events';
|
import { MysteryBoxKeysUpdateEvent } from './events';
|
||||||
import { SessionDataPreferencesEvent } from './events/SessionDataPreferencesEvent';
|
import { SessionDataPreferencesEvent } from './events/SessionDataPreferencesEvent';
|
||||||
@ -53,6 +55,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
|||||||
private _clubLevel: number;
|
private _clubLevel: number;
|
||||||
private _securityLevel: number;
|
private _securityLevel: number;
|
||||||
private _isAmbassador: boolean;
|
private _isAmbassador: boolean;
|
||||||
|
private _noobnessLevel: number;
|
||||||
|
|
||||||
private _systemOpen: boolean;
|
private _systemOpen: boolean;
|
||||||
private _systemShutdown: boolean;
|
private _systemShutdown: boolean;
|
||||||
@ -89,6 +92,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
|||||||
this._clubLevel = 0;
|
this._clubLevel = 0;
|
||||||
this._securityLevel = 0;
|
this._securityLevel = 0;
|
||||||
this._isAmbassador = false;
|
this._isAmbassador = false;
|
||||||
|
this._noobnessLevel = -1;
|
||||||
|
|
||||||
this._systemOpen = false;
|
this._systemOpen = false;
|
||||||
this._systemShutdown = 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 RoomReadyMessageEvent(this.onRoomModelNameEvent.bind(this)));
|
||||||
this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this)));
|
this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this)));
|
||||||
this._communication.registerMessageEvent(new MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.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);
|
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));
|
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
|
private onNitroSettingsEvent(event: NitroSettingsEvent): void
|
||||||
{
|
{
|
||||||
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
||||||
@ -634,6 +649,16 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
|||||||
return this._isAmbassador;
|
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
|
public get isSystemOpen(): boolean
|
||||||
{
|
{
|
||||||
return this._systemOpen;
|
return this._systemOpen;
|
||||||
|
6
src/nitro/session/enum/NoobnessLevelEnum.ts
Normal file
6
src/nitro/session/enum/NoobnessLevelEnum.ts
Normal 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;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
export * from './GenericErrorEnum';
|
export * from './GenericErrorEnum';
|
||||||
|
export * from './NoobnessLevelEnum';
|
||||||
export * from './RoomControllerLevel';
|
export * from './RoomControllerLevel';
|
||||||
export * from './RoomTradingLevelEnum';
|
export * from './RoomTradingLevelEnum';
|
||||||
export * from './SecurityLevel';
|
export * from './SecurityLevel';
|
||||||
|
Loading…
Reference in New Issue
Block a user