Merge branch 'new-account-safety-lock-status' of https://github.com/Snaiker/nitro-renderer into Snaiker-new-account-safety-lock-status

This commit is contained in:
dank074 2022-12-26 01:05:07 -06:00
commit 68c3b6ec28
7 changed files with 65 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -422,4 +422,5 @@ export class IncomingHeader
public static CUSTOM_USER_NOTIFICATION = 909; public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575; public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
public static CONNECTION_ERROR = 1004; public static CONNECTION_ERROR = 1004;
public static ACCOUNT_SAFETY_LOCK_STATUS_CHANGE = 1243;
} }

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { AccountSafetyLockStatusChangeParser } from '../../parser/user/AccountSafetyLockStatusChangeParser';
export class AccountSafetyLockStatusChangeMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, AccountSafetyLockStatusChangeParser);
}
public getParser(): AccountSafetyLockStatusChangeParser
{
return this.parser as AccountSafetyLockStatusChangeParser;
}
}

View File

@ -1,4 +1,5 @@
export * from './access'; export * from './access';
export * from './AccountSafetyLockStatusChangeMessageEvent';
export * from './ApproveNameMessageEvent'; export * from './ApproveNameMessageEvent';
export * from './data'; export * from './data';
export * from './GroupDetailsChangedMessageEvent'; export * from './GroupDetailsChangedMessageEvent';

View File

@ -0,0 +1,28 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class AccountSafetyLockStatusChangeParser implements IMessageParser
{
public static SAFETY_LOCK_STATUS_LOCKED: number = 0;
public static SAFETY_LOCK_STATUS_UNLOCKED: number = 1;
private _status: number;
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._status = wrapper.readInt();
return true;
}
public get status(): number
{
return this._status;
}
}

View File

@ -1,4 +1,5 @@
export * from './access'; export * from './access';
export * from './AccountSafetyLockStatusChangeParser';
export * from './ApproveNameResultParser'; export * from './ApproveNameResultParser';
export * from './data'; export * from './data';
export * from './GroupDetailsChangedMessageParser'; export * from './GroupDetailsChangedMessageParser';

View File

@ -2,7 +2,7 @@ import { Resource, Texture } from '@pixi/core';
import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api';
import { NitroManager } from '../../core'; import { NitroManager } from '../../core';
import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events';
import { AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication'; import { AccountSafetyLockStatusChangeMessageEvent, AccountSafetyLockStatusChangeParser, AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication';
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';
@ -24,6 +24,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private _respectsLeft: number; private _respectsLeft: number;
private _respectsPetLeft: number; private _respectsPetLeft: number;
private _canChangeName: boolean; private _canChangeName: boolean;
private _safetyLocked: boolean;
private _ignoredUsersManager: IgnoredUsersManager; private _ignoredUsersManager: IgnoredUsersManager;
private _groupInformationManager: IGroupInformationManager; private _groupInformationManager: IGroupInformationManager;
@ -116,6 +117,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
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))); this._communication.registerMessageEvent(new NoobnessLevelMessageEvent(this.onNoobnessLevelMessageEvent.bind(this)));
this._communication.registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this)));
Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent);
} }
@ -151,6 +153,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._gender = null; this._gender = null;
this._realName = null; this._realName = null;
this._canChangeName = false; this._canChangeName = false;
this._safetyLocked = false;
} }
private loadFurnitureData(): void private loadFurnitureData(): void
@ -260,6 +263,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._respectsLeft = userInfo.respectsRemaining; this._respectsLeft = userInfo.respectsRemaining;
this._respectsPetLeft = userInfo.respectsPetRemaining; this._respectsPetLeft = userInfo.respectsPetRemaining;
this._canChangeName = userInfo.canChangeName; this._canChangeName = userInfo.canChangeName;
this._safetyLocked = userInfo.safetyLocked;
(this._ignoredUsersManager && this._ignoredUsersManager.requestIgnoredUsers()); (this._ignoredUsersManager && this._ignoredUsersManager.requestIgnoredUsers());
} }
@ -408,6 +412,17 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
} }
} }
private onAccountSafetyLockStatusChangeMessageEvent(event: AccountSafetyLockStatusChangeMessageEvent): void
{
if(!event) return;
const parser = event.getParser();
if(!parser) return;
this._safetyLocked = (parser.status == AccountSafetyLockStatusChangeParser.SAFETY_LOCK_STATUS_LOCKED);
}
private onNitroSettingsEvent(event: NitroSettingsEvent): void private onNitroSettingsEvent(event: NitroSettingsEvent): void
{ {
this._isRoomCameraFollowDisabled = event.cameraFollow; this._isRoomCameraFollowDisabled = event.cameraFollow;