2024-03-19 21:53:17 -04:00
|
|
|
import { ICommunicationManager, IFurnitureData, IGroupInformationManager, IMessageComposer, IProductData, ISessionDataManager, NoobnessLevelEnum, SecurityLevel } from '@nitrots/api';
|
|
|
|
import { AccountSafetyLockStatusChangeMessageEvent, AccountSafetyLockStatusChangeParser, AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, EmailStatusResultEvent, FigureUpdateEvent, GetCommunication, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '@nitrots/communication';
|
|
|
|
import { GetConfiguration } from '@nitrots/configuration';
|
|
|
|
import { GetEventDispatcher, MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '@nitrots/events';
|
|
|
|
import { CreateLinkEvent, HabboWebTools } from '@nitrots/utils';
|
|
|
|
import { Texture } from 'pixi.js';
|
2021-09-03 16:01:49 -03:00
|
|
|
import { GroupInformationManager } from './GroupInformationManager';
|
2021-03-16 22:02:09 -04:00
|
|
|
import { IgnoredUsersManager } from './IgnoredUsersManager';
|
2023-07-11 22:33:18 -04:00
|
|
|
import { BadgeImageManager } from './badge/BadgeImageManager';
|
|
|
|
import { FurnitureDataLoader } from './furniture/FurnitureDataLoader';
|
2021-04-19 23:10:07 -04:00
|
|
|
import { ProductDataLoader } from './product/ProductDataLoader';
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
export class SessionDataManager implements ISessionDataManager
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
|
|
|
private _userId: number;
|
|
|
|
private _name: string;
|
|
|
|
private _figure: string;
|
|
|
|
private _gender: string;
|
|
|
|
private _realName: string;
|
|
|
|
private _respectsReceived: number;
|
|
|
|
private _respectsLeft: number;
|
|
|
|
private _respectsPetLeft: number;
|
|
|
|
private _canChangeName: boolean;
|
2022-12-24 15:11:11 +00:00
|
|
|
private _safetyLocked: boolean;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
private _ignoredUsersManager: IgnoredUsersManager = new IgnoredUsersManager();
|
|
|
|
private _groupInformationManager: IGroupInformationManager = new GroupInformationManager();
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
private _clubLevel: number = 0;
|
|
|
|
private _securityLevel: number = 0;
|
|
|
|
private _isAmbassador: boolean = false;
|
|
|
|
private _noobnessLevel: number = -1;
|
|
|
|
private _isEmailVerified: boolean = false;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
private _systemOpen: boolean = false;
|
|
|
|
private _systemShutdown: boolean = false;
|
|
|
|
private _isAuthenticHabbo: boolean = false;
|
|
|
|
private _isRoomCameraFollowDisabled: boolean = false;
|
|
|
|
private _uiFlags: number = 0;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
private _floorItems: Map<number, IFurnitureData> = new Map();
|
|
|
|
private _wallItems: Map<number, IFurnitureData> = new Map();
|
|
|
|
private _products: Map<string, IProductData> = new Map();
|
|
|
|
private _furnitureData: FurnitureDataLoader = new FurnitureDataLoader(this._floorItems, this._wallItems);
|
|
|
|
private _productData: ProductDataLoader = new ProductDataLoader(this._products);
|
|
|
|
private _tags: string[] = [];
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
private _badgeImageManager: BadgeImageManager = new BadgeImageManager();
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
constructor()
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
|
|
|
this.resetUserInfo();
|
|
|
|
|
2022-03-02 19:21:30 -05:00
|
|
|
this.onNitroSettingsEvent = this.onNitroSettingsEvent.bind(this);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
public async init(): Promise<void>
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
await this._furnitureData.init();
|
|
|
|
await this._productData.init();
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
this._badgeImageManager.init();
|
|
|
|
this._ignoredUsersManager.init();
|
|
|
|
this._groupInformationManager.init();
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetCommunication().registerMessageEvent(new FigureUpdateEvent((event: FigureUpdateEvent) =>
|
2023-07-18 20:28:28 -04:00
|
|
|
{
|
|
|
|
this._figure = event.getParser().figure;
|
|
|
|
this._gender = event.getParser().gender;
|
|
|
|
|
|
|
|
HabboWebTools.updateFigure(this._figure);
|
|
|
|
}));
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetCommunication().registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new PetScratchFailedMessageEvent(this.onPetRespectFailed.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new UserTagsMessageEvent(this.onUserTags.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new RoomReadyMessageEvent(this.onRoomModelNameEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new NoobnessLevelMessageEvent(this.onNoobnessLevelMessageEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this)));
|
|
|
|
GetCommunication().registerMessageEvent(new EmailStatusResultEvent(this.onEmailStatus.bind(this)));
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetEventDispatcher().addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private resetUserInfo(): void
|
|
|
|
{
|
2022-03-02 19:21:30 -05:00
|
|
|
this._userId = 0;
|
|
|
|
this._name = null;
|
|
|
|
this._figure = null;
|
|
|
|
this._gender = null;
|
|
|
|
this._realName = null;
|
2021-03-16 22:02:09 -04:00
|
|
|
this._canChangeName = false;
|
2022-12-24 15:11:11 +00:00
|
|
|
this._safetyLocked = false;
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
public getAllFurnitureData(): IFurnitureData[]
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
return [ ...Array.from(this._floorItems.values()), ...Array.from(this._wallItems.values()) ];
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private onUserInfoEvent(event: UserInfoEvent): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event || !event.connection) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
this.resetUserInfo();
|
|
|
|
|
|
|
|
const userInfo = event.getParser().userInfo;
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!userInfo) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-03-02 19:21:30 -05:00
|
|
|
this._userId = userInfo.userId;
|
|
|
|
this._name = userInfo.username;
|
|
|
|
this._figure = userInfo.figure;
|
|
|
|
this._gender = userInfo.gender;
|
|
|
|
this._realName = userInfo.realName;
|
|
|
|
this._respectsReceived = userInfo.respectsReceived;
|
|
|
|
this._respectsLeft = userInfo.respectsRemaining;
|
|
|
|
this._respectsPetLeft = userInfo.respectsPetRemaining;
|
|
|
|
this._canChangeName = userInfo.canChangeName;
|
2022-12-24 15:11:11 +00:00
|
|
|
this._safetyLocked = userInfo.safetyLocked;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
this._ignoredUsersManager.requestIgnoredUsers(userInfo.username);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private onUserPermissionsEvent(event: UserPermissionsEvent): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event || !event.connection) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-03-02 19:21:30 -05:00
|
|
|
this._clubLevel = event.getParser().clubLevel;
|
2021-03-16 22:02:09 -04:00
|
|
|
this._securityLevel = event.getParser().securityLevel;
|
2022-03-02 19:21:30 -05:00
|
|
|
this._isAmbassador = event.getParser().isAmbassador;
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event || !event.connection) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-03-02 19:21:30 -05:00
|
|
|
this._systemOpen = parser.isOpen;
|
|
|
|
this._systemShutdown = parser.onShutdown;
|
|
|
|
this._isAuthenticHabbo = parser.isAuthenticUser;
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2022-12-23 21:12:13 +01:00
|
|
|
private onPetRespectFailed(event: PetScratchFailedMessageEvent): void
|
|
|
|
{
|
|
|
|
if(!event || !event.connection) return;
|
|
|
|
|
|
|
|
this._respectsPetLeft++;
|
|
|
|
}
|
|
|
|
|
2021-06-11 19:44:40 -05:00
|
|
|
private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event || !event.connection) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
this._canChangeName = false;
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetEventDispatcher().dispatchEvent(new UserNameUpdateEvent(parser.name));
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event || !event.connection) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(parser.webId !== this.userId) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-03-02 19:21:30 -05:00
|
|
|
this._name = parser.newName;
|
2021-03-16 22:02:09 -04:00
|
|
|
this._canChangeName = false;
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetEventDispatcher().dispatchEvent(new UserNameUpdateEvent(this._name));
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2022-12-23 00:35:05 +01:00
|
|
|
private onUserTags(event: UserTagsMessageEvent): void
|
|
|
|
{
|
|
|
|
if(!event || !event.connection) return;
|
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
|
|
|
if(!parser) return;
|
|
|
|
|
|
|
|
this._tags = parser.tags;
|
|
|
|
}
|
|
|
|
|
2021-11-12 00:20:33 -05:00
|
|
|
private onRoomModelNameEvent(event: RoomReadyMessageEvent): void
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
HabboWebTools.roomVisited(parser.roomId);
|
|
|
|
}
|
|
|
|
|
2022-07-19 12:08:05 -04:00
|
|
|
private onInClientLinkEvent(event: InClientLinkEvent): void
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
CreateLinkEvent(parser.link);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2021-07-12 00:48:44 -04:00
|
|
|
private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!event) return;
|
2021-07-12 00:48:44 -04:00
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!parser) return;
|
2021-07-12 00:48:44 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetEventDispatcher().dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor));
|
2021-07-12 00:48:44 -04:00
|
|
|
}
|
|
|
|
|
2022-03-18 21:30:01 -04:00
|
|
|
private onNoobnessLevelMessageEvent(event: NoobnessLevelMessageEvent): void
|
|
|
|
{
|
|
|
|
this._noobnessLevel = event.getParser().noobnessLevel;
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) GetConfiguration().setValue<number>('new.identity', 1);
|
2022-03-18 21:30:01 -04:00
|
|
|
}
|
|
|
|
|
2022-12-24 15:11:11 +00:00
|
|
|
private onAccountSafetyLockStatusChangeMessageEvent(event: AccountSafetyLockStatusChangeMessageEvent): void
|
|
|
|
{
|
|
|
|
if(!event) return;
|
|
|
|
|
|
|
|
const parser = event.getParser();
|
|
|
|
|
|
|
|
if(!parser) return;
|
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
this._safetyLocked = (parser.status === AccountSafetyLockStatusChangeParser.SAFETY_LOCK_STATUS_LOCKED);
|
2022-12-24 15:11:11 +00:00
|
|
|
}
|
|
|
|
|
2022-12-25 16:12:05 +01:00
|
|
|
private onEmailStatus(event: EmailStatusResultEvent): void
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
this._isEmailVerified = event?.getParser()?.isVerified ?? false;
|
2022-12-25 16:12:05 +01:00
|
|
|
}
|
|
|
|
|
2021-03-16 22:02:09 -04:00
|
|
|
private onNitroSettingsEvent(event: NitroSettingsEvent): void
|
|
|
|
{
|
2022-03-02 19:21:30 -05:00
|
|
|
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
|
|
|
this._uiFlags = event.flags;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
GetEventDispatcher().dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags));
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public getFloorItemData(id: number): IFurnitureData
|
|
|
|
{
|
|
|
|
const existing = this._floorItems.get(id);
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!existing) return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
return existing;
|
|
|
|
}
|
|
|
|
|
|
|
|
public getFloorItemDataByName(name: string): IFurnitureData
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!name || !this._floorItems || !this._floorItems.size) return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
for(const item of this._floorItems.values())
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!item || (item.className !== name)) continue;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
2023-07-18 20:28:28 -04:00
|
|
|
|
|
|
|
return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public getWallItemData(id: number): IFurnitureData
|
|
|
|
{
|
|
|
|
const existing = this._wallItems.get(id);
|
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!existing) return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
return existing;
|
|
|
|
}
|
|
|
|
|
|
|
|
public getWallItemDataByName(name: string): IFurnitureData
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!name || !this._wallItems || !this._wallItems.size) return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
2022-11-08 16:50:16 -05:00
|
|
|
for(const item of this._wallItems.values())
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if(!item || (item.className !== name)) continue;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
2023-07-18 20:28:28 -04:00
|
|
|
|
|
|
|
return null;
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public getProductData(type: string): IProductData
|
|
|
|
{
|
|
|
|
return this._products.get(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getBadgeUrl(name: string): string
|
|
|
|
{
|
|
|
|
return this._badgeImageManager.getBadgeUrl(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getGroupBadgeUrl(name: string): string
|
|
|
|
{
|
|
|
|
return this._badgeImageManager.getBadgeUrl(name, BadgeImageManager.GROUP_BADGE);
|
|
|
|
}
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
public getBadgeImage(name: string): Texture
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
|
|
|
return this._badgeImageManager.getBadgeImage(name);
|
|
|
|
}
|
|
|
|
|
2024-03-19 21:53:17 -04:00
|
|
|
public getGroupBadgeImage(name: string): Texture
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
|
|
|
return this._badgeImageManager.getBadgeImage(name, BadgeImageManager.GROUP_BADGE);
|
|
|
|
}
|
|
|
|
|
2022-12-23 00:35:05 +01:00
|
|
|
public getUserTags(roomUnitId: number): string[]
|
|
|
|
{
|
|
|
|
if(roomUnitId < 0) return;
|
|
|
|
|
|
|
|
this.send(new GetUserTagsComposer(roomUnitId));
|
|
|
|
}
|
|
|
|
|
2021-03-16 22:02:09 -04:00
|
|
|
public loadBadgeImage(name: string): string
|
|
|
|
{
|
|
|
|
return this._badgeImageManager.loadBadgeImage(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public loadGroupBadgeImage(name: string): string
|
|
|
|
{
|
|
|
|
return this._badgeImageManager.loadBadgeImage(name, BadgeImageManager.GROUP_BADGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasSecurity(level: number): boolean
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
return (this._securityLevel >= level);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public giveRespect(userId: number): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if((userId < 0) || (this._respectsLeft <= 0)) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
this.send(new UserRespectComposer(userId));
|
|
|
|
|
|
|
|
this._respectsLeft--;
|
|
|
|
}
|
|
|
|
|
|
|
|
public givePetRespect(petId: number): void
|
|
|
|
{
|
2022-11-08 16:50:16 -05:00
|
|
|
if((petId < 0) || (this._respectsPetLeft <= 0)) return;
|
2021-03-16 22:02:09 -04:00
|
|
|
|
|
|
|
this.send(new PetRespectComposer(petId));
|
|
|
|
|
|
|
|
this._respectsPetLeft--;
|
|
|
|
}
|
|
|
|
|
|
|
|
public sendSpecialCommandMessage(text: string, styleId: number = 0): void
|
|
|
|
{
|
|
|
|
this.send(new RoomUnitChatComposer(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
public ignoreUser(name: string): void
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
this._ignoredUsersManager.ignoreUser(name);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public unignoreUser(name: string): void
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
this._ignoredUsersManager.unignoreUser(name);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public isUserIgnored(name: string): boolean
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
return this._ignoredUsersManager.isIgnored(name);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2021-09-03 16:01:49 -03:00
|
|
|
public getGroupBadge(groupId: number): string
|
|
|
|
{
|
2023-07-18 20:28:28 -04:00
|
|
|
return this._groupInformationManager.getGroupBadge(groupId);
|
2021-09-03 16:01:49 -03:00
|
|
|
}
|
|
|
|
|
2021-03-16 22:02:09 -04:00
|
|
|
public send(composer: IMessageComposer<unknown[]>): void
|
|
|
|
{
|
2024-03-19 21:53:17 -04:00
|
|
|
GetCommunication().connection.send(composer);
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
2023-07-18 20:28:28 -04:00
|
|
|
public get communication(): ICommunicationManager
|
2021-03-16 22:02:09 -04:00
|
|
|
{
|
2024-03-19 21:53:17 -04:00
|
|
|
return GetCommunication();
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public get userId(): number
|
|
|
|
{
|
|
|
|
return this._userId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get userName(): string
|
|
|
|
{
|
|
|
|
return this._name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get figure(): string
|
|
|
|
{
|
|
|
|
return this._figure;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get gender(): string
|
|
|
|
{
|
|
|
|
return this._gender;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get realName(): string
|
|
|
|
{
|
|
|
|
return this._realName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get ignoredUsersManager(): IgnoredUsersManager
|
|
|
|
{
|
|
|
|
return this._ignoredUsersManager;
|
|
|
|
}
|
|
|
|
|
2022-11-02 01:54:01 -04:00
|
|
|
public get groupInformationManager(): IGroupInformationManager
|
2022-03-21 01:54:27 -04:00
|
|
|
{
|
|
|
|
return this._groupInformationManager;
|
|
|
|
}
|
|
|
|
|
2021-03-16 22:02:09 -04:00
|
|
|
public get respectsReceived(): number
|
|
|
|
{
|
|
|
|
return this._respectsReceived;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get respectsLeft(): number
|
|
|
|
{
|
|
|
|
return this._respectsLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get respectsPetLeft(): number
|
|
|
|
{
|
|
|
|
return this._respectsPetLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get canChangeName(): boolean
|
|
|
|
{
|
|
|
|
return this._canChangeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get clubLevel(): number
|
|
|
|
{
|
|
|
|
return this._clubLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get securityLevel(): number
|
|
|
|
{
|
|
|
|
return this._securityLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isAmbassador(): boolean
|
|
|
|
{
|
|
|
|
return this._isAmbassador;
|
|
|
|
}
|
|
|
|
|
2022-12-25 16:12:05 +01:00
|
|
|
public get isEmailVerified(): boolean
|
|
|
|
{
|
|
|
|
return this._isEmailVerified;
|
|
|
|
}
|
|
|
|
|
2022-03-18 21:30:01 -04:00
|
|
|
public get isNoob(): boolean
|
|
|
|
{
|
|
|
|
return (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isRealNoob(): boolean
|
|
|
|
{
|
|
|
|
return (this._noobnessLevel === NoobnessLevelEnum.REAL_NOOB);
|
|
|
|
}
|
|
|
|
|
2021-03-16 22:02:09 -04:00
|
|
|
public get isSystemOpen(): boolean
|
|
|
|
{
|
|
|
|
return this._systemOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isSystemShutdown(): boolean
|
|
|
|
{
|
|
|
|
return this._systemShutdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isAuthenticHabbo(): boolean
|
|
|
|
{
|
|
|
|
return this._isAuthenticHabbo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isModerator(): boolean
|
|
|
|
{
|
|
|
|
return (this._securityLevel >= SecurityLevel.MODERATOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isCameraFollowDisabled(): boolean
|
|
|
|
{
|
|
|
|
return this._isRoomCameraFollowDisabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get uiFlags(): number
|
|
|
|
{
|
|
|
|
return this._uiFlags;
|
|
|
|
}
|
2022-12-23 00:35:05 +01:00
|
|
|
|
|
|
|
public get tags(): string[]
|
|
|
|
{
|
|
|
|
return this._tags;
|
|
|
|
}
|
2021-03-16 22:02:09 -04:00
|
|
|
}
|