User tags

This commit is contained in:
oobjectt 2022-12-23 00:35:05 +01:00
parent abc1ecee7f
commit 230c92cd6d
10 changed files with 116 additions and 2 deletions

View File

@ -19,6 +19,7 @@ export interface ISessionDataManager extends INitroManager
getBadgeUrl(name: string): string; getBadgeUrl(name: string): string;
getGroupBadgeUrl(name: string): string; getGroupBadgeUrl(name: string): string;
getBadgeImage(name: string): Texture<Resource>; getBadgeImage(name: string): Texture<Resource>;
getUserTags(roomUnitId: number): string[];
loadBadgeImage(name: string): string; loadBadgeImage(name: string): string;
getGroupBadgeImage(name: string): Texture<Resource>; getGroupBadgeImage(name: string): Texture<Resource>;
loadGroupBadgeImage(name: string): string; loadGroupBadgeImage(name: string): string;
@ -53,4 +54,5 @@ export interface ISessionDataManager extends INitroManager
isModerator: boolean; isModerator: boolean;
isCameraFollowDisabled: boolean; isCameraFollowDisabled: boolean;
uiFlags: number; uiFlags: number;
tags: string[];
} }

File diff suppressed because one or more lines are too long

View File

@ -227,6 +227,7 @@ export class IncomingHeader
public static USER_SETTINGS = 513; public static USER_SETTINGS = 513;
public static USER_SUBSCRIPTION = 954; public static USER_SUBSCRIPTION = 954;
public static USER_WARDROBE_PAGE = 3315; public static USER_WARDROBE_PAGE = 3315;
public static GET_USER_TAGS = 1255;
public static WIRED_ACTION = 1434; public static WIRED_ACTION = 1434;
public static WIRED_CONDITION = 1108; public static WIRED_CONDITION = 1108;
public static WIRED_ERROR = 156; public static WIRED_ERROR = 156;

View File

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

View File

@ -4,3 +4,4 @@ export * from './UserInfoEvent';
export * from './UserNameChangeMessageEvent'; export * from './UserNameChangeMessageEvent';
export * from './UserProfileEvent'; export * from './UserProfileEvent';
export * from './UserSettingsEvent'; export * from './UserSettingsEvent';
export * from './UserTagsMessageEvent';

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../../../api';
export class GetUserTagsComposer implements IMessageComposer<ConstructorParameters<typeof GetUserTagsComposer>>
{
private _data: ConstructorParameters<typeof GetUserTagsComposer>;
constructor(roomUnitId: number)
{
this._data = [roomUnitId];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,5 +1,6 @@
export * from './GetExtendedProfileByNameMessageComposer'; export * from './GetExtendedProfileByNameMessageComposer';
export * from './GetIgnoredUsersComposer'; export * from './GetIgnoredUsersComposer';
export * from './GetUserTagsComposer';
export * from './IgnoreUserComposer'; export * from './IgnoreUserComposer';
export * from './IgnoreUserIdComposer'; export * from './IgnoreUserIdComposer';
export * from './UnignoreUserComposer'; export * from './UnignoreUserComposer';

View File

@ -0,0 +1,43 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
export class UserTagsParser implements IMessageParser
{
private _roomUnitId: number;
private _tags: string[];
public flush(): boolean
{
this._roomUnitId = -1;
this._tags = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._roomUnitId = wrapper.readInt();
let totalTags = wrapper.readInt();
while(totalTags > 0)
{
this._tags.push(wrapper.readString());
totalTags--;
}
return true;
}
public get roomUnitId(): number
{
return this._roomUnitId;
}
public get tags(): string[]
{
return this._tags;
}
}

View File

@ -7,3 +7,4 @@ export * from './UserInfoParser';
export * from './UserNameChangeMessageParser'; export * from './UserNameChangeMessageParser';
export * from './UserProfileParser'; export * from './UserProfileParser';
export * from './UserSettingsParser'; export * from './UserSettingsParser';
export * from './UserTagsParser';

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, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer } from '../communication'; import { AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, 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';
@ -50,6 +50,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private _furnitureListenersNotified: boolean; private _furnitureListenersNotified: boolean;
private _pendingFurnitureListeners: IFurnitureDataListener[]; private _pendingFurnitureListeners: IFurnitureDataListener[];
private _pendingProductListeners: IProductDataListener[]; private _pendingProductListeners: IProductDataListener[];
private _tags: string[];
private _badgeImageManager: BadgeImageManager; private _badgeImageManager: BadgeImageManager;
@ -85,6 +86,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._furnitureListenersNotified = false; this._furnitureListenersNotified = false;
this._pendingFurnitureListeners = []; this._pendingFurnitureListeners = [];
this._pendingProductListeners = []; this._pendingProductListeners = [];
this._tags = [];
this._badgeImageManager = null; this._badgeImageManager = null;
@ -108,6 +110,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this))); this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this)));
this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this))); this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this)));
this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this))); this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this)));
this._communication.registerMessageEvent(new UserTagsMessageEvent(this.onUserTags.bind(this)));
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)));
@ -313,6 +316,17 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this.events.dispatchEvent(new UserNameUpdateEvent(this._name)); this.events.dispatchEvent(new UserNameUpdateEvent(this._name));
} }
private onUserTags(event: UserTagsMessageEvent): void
{
if(!event || !event.connection) return;
const parser = event.getParser();
if(!parser) return;
this._tags = parser.tags;
}
private onRoomModelNameEvent(event: RoomReadyMessageEvent): void private onRoomModelNameEvent(event: RoomReadyMessageEvent): void
{ {
if(!event) return; if(!event) return;
@ -481,6 +495,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
return this._badgeImageManager.getBadgeImage(name, BadgeImageManager.GROUP_BADGE); return this._badgeImageManager.getBadgeImage(name, BadgeImageManager.GROUP_BADGE);
} }
public getUserTags(roomUnitId: number): string[]
{
if(roomUnitId < 0) return;
this.send(new GetUserTagsComposer(roomUnitId));
}
public loadBadgeImage(name: string): string public loadBadgeImage(name: string): string
{ {
return this._badgeImageManager.loadBadgeImage(name); return this._badgeImageManager.loadBadgeImage(name);
@ -658,4 +679,9 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
{ {
return this._uiFlags; return this._uiFlags;
} }
public get tags(): string[]
{
return this._tags;
}
} }