From bd75d422719efc5ed9565416d3255f83d62805c7 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 19 Jul 2022 12:08:05 -0400 Subject: [PATCH] Remove chat style code - move to ui --- src/nitro/session/ISessionDataManager.ts | 2 - src/nitro/session/SessionDataManager.ts | 116 ++++++++++------------- 2 files changed, 50 insertions(+), 68 deletions(-) diff --git a/src/nitro/session/ISessionDataManager.ts b/src/nitro/session/ISessionDataManager.ts index 17b51789..0720265d 100644 --- a/src/nitro/session/ISessionDataManager.ts +++ b/src/nitro/session/ISessionDataManager.ts @@ -26,7 +26,6 @@ export interface ISessionDataManager extends INitroManager giveRespect(userId: number): void; givePetRespect(petId: number): void; sendSpecialCommandMessage(text: string, styleId?: number): void; - sendChatStyleUpdate(styleId: number): void; ignoreUser(name: string): void; unignoreUser(name: string): void; isUserIgnored(name: string): boolean; @@ -53,6 +52,5 @@ export interface ISessionDataManager extends INitroManager isAuthenticHabbo: boolean; isModerator: boolean; isCameraFollowDisabled: boolean; - chatStyle: number; uiFlags: number; } diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index a8f9adf7..bbd8889b 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -14,7 +14,6 @@ import { UserNameChangeMessageEvent } from '../communication/messages/incoming/u import { InClientLinkEvent } from '../communication/messages/incoming/user/InClientLinkEvent'; import { PetRespectComposer } from '../communication/messages/outgoing/pet/PetRespectComposer'; import { RoomUnitChatComposer } from '../communication/messages/outgoing/room/unit/chat/RoomUnitChatComposer'; -import { RoomUnitChatStyleComposer } from '../communication/messages/outgoing/room/unit/chat/RoomUnitChatStyleComposer'; import { UserRespectComposer } from '../communication/messages/outgoing/user/UserRespectComposer'; import { NitroSettingsEvent } from '../events/NitroSettingsEvent'; import { Nitro } from '../Nitro'; @@ -61,7 +60,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private _systemShutdown: boolean; private _isAuthenticHabbo: boolean; private _isRoomCameraFollowDisabled: boolean; - private _chatStyle: number; private _uiFlags: number; private _floorItems: Map; @@ -98,7 +96,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._systemShutdown = false; this._isAuthenticHabbo = false; this._isRoomCameraFollowDisabled = false; - this._chatStyle = 0; this._uiFlags = 0; this._floorItems = new Map(); @@ -146,14 +143,14 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { this.destroyFurnitureData(); - if(this._ignoredUsersManager) + if (this._ignoredUsersManager) { this._ignoredUsersManager.dispose(); this._ignoredUsersManager = null; } - if(this._groupInformationManager) + if (this._groupInformationManager) { this._groupInformationManager.dispose(); @@ -199,7 +196,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private loadBadgeImageManager(): void { - if(this._badgeImageManager) return; + if (this._badgeImageManager) return; this._badgeImageManager = new BadgeImageManager(Nitro.instance.core.asset, this); this._badgeImageManager.init(); @@ -207,34 +204,34 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public hasProductData(listener: IProductDataListener): boolean { - if(this._productsReady) return true; + if (this._productsReady) return true; - if(listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); + if (listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); return false; } public getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] { - if(!this._furnitureReady) + if (!this._furnitureReady) { - if(this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); + if (this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); return null; } const furnitureData: IFurnitureData[] = []; - for(const data of this._floorItems.values()) + for (const data of this._floorItems.values()) { - if(!data) continue; + if (!data) continue; furnitureData.push(data); } - for(const data of this._wallItems.values()) + for (const data of this._wallItems.values()) { - if(!data) continue; + if (!data) continue; furnitureData.push(data); } @@ -244,18 +241,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public removePendingFurniDataListener(listener: IFurnitureDataListener): void { - if(!this._pendingFurnitureListeners) return; + if (!this._pendingFurnitureListeners) return; const index = this._pendingFurnitureListeners.indexOf(listener); - if(index === -1) return; + if (index === -1) return; this._pendingFurnitureListeners.splice(index, 1); } private onUserFigureEvent(event: FigureUpdateEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; this._figure = event.getParser().figure; this._gender = event.getParser().gender; @@ -265,13 +262,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserInfoEvent(event: UserInfoEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; this.resetUserInfo(); const userInfo = event.getParser().userInfo; - if(!userInfo) return; + if (!userInfo) return; this._userId = userInfo.userId; this._name = userInfo.username; @@ -288,7 +285,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserPermissionsEvent(event: UserPermissionsEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; this._clubLevel = event.getParser().clubLevel; this._securityLevel = event.getParser().securityLevel; @@ -297,11 +294,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; this._systemOpen = parser.isOpen; this._systemShutdown = parser.onShutdown; @@ -310,13 +307,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; - if(parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; + if (parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; this._canChangeName = false; @@ -325,13 +322,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void { - if(!event || !event.connection) return; + if (!event || !event.connection) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; - if(parser.webId !== this.userId) return; + if (parser.webId !== this.userId) return; this._name = parser.newName; this._canChangeName = false; @@ -341,11 +338,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onRoomModelNameEvent(event: RoomReadyMessageEvent): void { - if(!event) return; + if (!event) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; HabboWebTools.roomVisited(parser.roomId); } @@ -356,13 +353,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._furnitureReady = true; - if(!this._furnitureListenersNotified) + if (!this._furnitureListenersNotified) { this._furnitureListenersNotified = true; - if(this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) + if (this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) { - for(const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); + for (const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); } } @@ -375,29 +372,29 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._productsReady = true; - for(const listener of this._pendingProductListeners) listener && listener.loadProductData(); + for (const listener of this._pendingProductListeners) listener && listener.loadProductData(); this._pendingProductListeners = []; } - private onInClientLinkEvent(event: InClientLinkEvent):void + private onInClientLinkEvent(event: InClientLinkEvent): void { - if(!event) return; + if (!event) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; Nitro.instance.createLinkEvent(parser.link); } private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void { - if(!event) return; + if (!event) return; const parser = event.getParser(); - if(!parser) return; + if (!parser) return; this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); } @@ -406,7 +403,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { this._noobnessLevel = event.getParser().noobnessLevel; - if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) + if (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) { Nitro.instance.core.configuration.setValue('new.identity', 1); } @@ -415,7 +412,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onNitroSettingsEvent(event: NitroSettingsEvent): void { this._isRoomCameraFollowDisabled = event.cameraFollow; - this._chatStyle = event.chatType; this._uiFlags = event.flags; this.events.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags)); @@ -423,7 +419,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private destroyFurnitureData(): void { - if(!this._furnitureData) return; + if (!this._furnitureData) return; this._furnitureData.dispose(); @@ -432,7 +428,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private destroyProductData(): void { - if(!this._productData) return; + if (!this._productData) return; this._productData.dispose(); @@ -443,18 +439,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { const existing = this._floorItems.get(id); - if(!existing) return null; + if (!existing) return null; return existing; } public getFloorItemDataByName(name: string): IFurnitureData { - if(!name || !this._floorItems || !this._floorItems.size) return null; + if (!name || !this._floorItems || !this._floorItems.size) return null; - for(const item of this._floorItems.values()) + for (const item of this._floorItems.values()) { - if(!item || (item.className !== name)) continue; + if (!item || (item.className !== name)) continue; return item; } @@ -464,18 +460,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { const existing = this._wallItems.get(id); - if(!existing) return null; + if (!existing) return null; return existing; } public getWallItemDataByName(name: string): IFurnitureData { - if(!name || !this._wallItems || !this._wallItems.size) return null; + if (!name || !this._wallItems || !this._wallItems.size) return null; - for(const item of this._wallItems.values()) + for (const item of this._wallItems.values()) { - if(!item || (item.className !== name)) continue; + if (!item || (item.className !== name)) continue; return item; } @@ -483,7 +479,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public getProductData(type: string): IProductData { - if(!this._productsReady) this.loadProductData(); + if (!this._productsReady) this.loadProductData(); return this._products.get(type); } @@ -525,7 +521,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public giveRespect(userId: number): void { - if((userId < 0) || (this._respectsLeft <= 0)) return; + if ((userId < 0) || (this._respectsLeft <= 0)) return; this.send(new UserRespectComposer(userId)); @@ -534,7 +530,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public givePetRespect(petId: number): void { - if((petId < 0) || (this._respectsPetLeft <= 0)) return; + if ((petId < 0) || (this._respectsPetLeft <= 0)) return; this.send(new PetRespectComposer(petId)); @@ -546,13 +542,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this.send(new RoomUnitChatComposer(text)); } - public sendChatStyleUpdate(styleId: number): void - { - this._chatStyle = styleId; - - this.send(new RoomUnitChatStyleComposer(styleId)); - } - public ignoreUser(name: string): void { (this._ignoredUsersManager && this._ignoredUsersManager.ignoreUser(name)); @@ -688,11 +677,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana return this._isRoomCameraFollowDisabled; } - public get chatStyle(): number - { - return this._chatStyle; - } - public get uiFlags(): number { return this._uiFlags;