Account Safety Lock Status

This commit is contained in:
Snaiker 2022-12-24 15:11:11 +00:00
parent 26741b78a7
commit 8481fffb99
7 changed files with 65 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -414,4 +414,5 @@ export class IncomingHeader
public static SHOW_ENFORCE_ROOM_CATEGORY = 3896;
public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
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 './AccountSafetyLockStatusChangeMessageEvent';
export * from './ApproveNameMessageEvent';
export * from './data';
export * from './GuildMembershipsMessageEvent';

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 './AccountSafetyLockStatusChangeParser';
export * from './ApproveNameResultParser';
export * from './data';
export * from './GuildMembershipsMessageParser';

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 { NitroManager } from '../../core';
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 { HabboWebTools } from '../utils/HabboWebTools';
import { BadgeImageManager } from './badge/BadgeImageManager';
@ -24,6 +24,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private _respectsLeft: number;
private _respectsPetLeft: number;
private _canChangeName: boolean;
private _safetyLocked: boolean;
private _ignoredUsersManager: IgnoredUsersManager;
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 MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.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);
}
@ -151,6 +153,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._gender = null;
this._realName = null;
this._canChangeName = false;
this._safetyLocked = false;
}
private loadFurnitureData(): void
@ -260,6 +263,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._respectsLeft = userInfo.respectsRemaining;
this._respectsPetLeft = userInfo.respectsPetRemaining;
this._canChangeName = userInfo.canChangeName;
this._safetyLocked = userInfo.safetyLocked;
(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
{
this._isRoomCameraFollowDisabled = event.cameraFollow;