Remove chat style code - move to ui

This commit is contained in:
Bill 2022-07-19 12:08:05 -04:00
parent 5e94ebdd33
commit bd75d42271
2 changed files with 50 additions and 68 deletions

View File

@ -26,7 +26,6 @@ export interface ISessionDataManager extends INitroManager
giveRespect(userId: number): void; giveRespect(userId: number): void;
givePetRespect(petId: number): void; givePetRespect(petId: number): void;
sendSpecialCommandMessage(text: string, styleId?: number): void; sendSpecialCommandMessage(text: string, styleId?: number): void;
sendChatStyleUpdate(styleId: number): void;
ignoreUser(name: string): void; ignoreUser(name: string): void;
unignoreUser(name: string): void; unignoreUser(name: string): void;
isUserIgnored(name: string): boolean; isUserIgnored(name: string): boolean;
@ -53,6 +52,5 @@ export interface ISessionDataManager extends INitroManager
isAuthenticHabbo: boolean; isAuthenticHabbo: boolean;
isModerator: boolean; isModerator: boolean;
isCameraFollowDisabled: boolean; isCameraFollowDisabled: boolean;
chatStyle: number;
uiFlags: number; uiFlags: number;
} }

View File

@ -14,7 +14,6 @@ import { UserNameChangeMessageEvent } from '../communication/messages/incoming/u
import { InClientLinkEvent } from '../communication/messages/incoming/user/InClientLinkEvent'; import { InClientLinkEvent } from '../communication/messages/incoming/user/InClientLinkEvent';
import { PetRespectComposer } from '../communication/messages/outgoing/pet/PetRespectComposer'; import { PetRespectComposer } from '../communication/messages/outgoing/pet/PetRespectComposer';
import { RoomUnitChatComposer } from '../communication/messages/outgoing/room/unit/chat/RoomUnitChatComposer'; 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 { UserRespectComposer } from '../communication/messages/outgoing/user/UserRespectComposer';
import { NitroSettingsEvent } from '../events/NitroSettingsEvent'; import { NitroSettingsEvent } from '../events/NitroSettingsEvent';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
@ -61,7 +60,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private _systemShutdown: boolean; private _systemShutdown: boolean;
private _isAuthenticHabbo: boolean; private _isAuthenticHabbo: boolean;
private _isRoomCameraFollowDisabled: boolean; private _isRoomCameraFollowDisabled: boolean;
private _chatStyle: number;
private _uiFlags: number; private _uiFlags: number;
private _floorItems: Map<number, IFurnitureData>; private _floorItems: Map<number, IFurnitureData>;
@ -98,7 +96,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._systemShutdown = false; this._systemShutdown = false;
this._isAuthenticHabbo = false; this._isAuthenticHabbo = false;
this._isRoomCameraFollowDisabled = false; this._isRoomCameraFollowDisabled = false;
this._chatStyle = 0;
this._uiFlags = 0; this._uiFlags = 0;
this._floorItems = new Map(); this._floorItems = new Map();
@ -146,14 +143,14 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
{ {
this.destroyFurnitureData(); this.destroyFurnitureData();
if(this._ignoredUsersManager) if (this._ignoredUsersManager)
{ {
this._ignoredUsersManager.dispose(); this._ignoredUsersManager.dispose();
this._ignoredUsersManager = null; this._ignoredUsersManager = null;
} }
if(this._groupInformationManager) if (this._groupInformationManager)
{ {
this._groupInformationManager.dispose(); this._groupInformationManager.dispose();
@ -199,7 +196,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private loadBadgeImageManager(): void private loadBadgeImageManager(): void
{ {
if(this._badgeImageManager) return; if (this._badgeImageManager) return;
this._badgeImageManager = new BadgeImageManager(Nitro.instance.core.asset, this); this._badgeImageManager = new BadgeImageManager(Nitro.instance.core.asset, this);
this._badgeImageManager.init(); this._badgeImageManager.init();
@ -207,34 +204,34 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
public hasProductData(listener: IProductDataListener): boolean 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; return false;
} }
public getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] 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; return null;
} }
const furnitureData: IFurnitureData[] = []; 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); 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); furnitureData.push(data);
} }
@ -244,18 +241,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
public removePendingFurniDataListener(listener: IFurnitureDataListener): void public removePendingFurniDataListener(listener: IFurnitureDataListener): void
{ {
if(!this._pendingFurnitureListeners) return; if (!this._pendingFurnitureListeners) return;
const index = this._pendingFurnitureListeners.indexOf(listener); const index = this._pendingFurnitureListeners.indexOf(listener);
if(index === -1) return; if (index === -1) return;
this._pendingFurnitureListeners.splice(index, 1); this._pendingFurnitureListeners.splice(index, 1);
} }
private onUserFigureEvent(event: FigureUpdateEvent): void private onUserFigureEvent(event: FigureUpdateEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this._figure = event.getParser().figure; this._figure = event.getParser().figure;
this._gender = event.getParser().gender; this._gender = event.getParser().gender;
@ -265,13 +262,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onUserInfoEvent(event: UserInfoEvent): void private onUserInfoEvent(event: UserInfoEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this.resetUserInfo(); this.resetUserInfo();
const userInfo = event.getParser().userInfo; const userInfo = event.getParser().userInfo;
if(!userInfo) return; if (!userInfo) return;
this._userId = userInfo.userId; this._userId = userInfo.userId;
this._name = userInfo.username; this._name = userInfo.username;
@ -288,7 +285,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onUserPermissionsEvent(event: UserPermissionsEvent): void private onUserPermissionsEvent(event: UserPermissionsEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this._clubLevel = event.getParser().clubLevel; this._clubLevel = event.getParser().clubLevel;
this._securityLevel = event.getParser().securityLevel; this._securityLevel = event.getParser().securityLevel;
@ -297,11 +294,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._systemOpen = parser.isOpen; this._systemOpen = parser.isOpen;
this._systemShutdown = parser.onShutdown; this._systemShutdown = parser.onShutdown;
@ -310,13 +307,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
const parser = event.getParser(); 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; this._canChangeName = false;
@ -325,13 +322,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
const parser = event.getParser(); 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._name = parser.newName;
this._canChangeName = false; this._canChangeName = false;
@ -341,11 +338,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onRoomModelNameEvent(event: RoomReadyMessageEvent): void private onRoomModelNameEvent(event: RoomReadyMessageEvent): void
{ {
if(!event) return; if (!event) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
HabboWebTools.roomVisited(parser.roomId); HabboWebTools.roomVisited(parser.roomId);
} }
@ -356,13 +353,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._furnitureReady = true; this._furnitureReady = true;
if(!this._furnitureListenersNotified) if (!this._furnitureListenersNotified)
{ {
this._furnitureListenersNotified = true; 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; this._productsReady = true;
for(const listener of this._pendingProductListeners) listener && listener.loadProductData(); for (const listener of this._pendingProductListeners) listener && listener.loadProductData();
this._pendingProductListeners = []; this._pendingProductListeners = [];
} }
private onInClientLinkEvent(event: InClientLinkEvent):void private onInClientLinkEvent(event: InClientLinkEvent): void
{ {
if(!event) return; if (!event) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
Nitro.instance.createLinkEvent(parser.link); Nitro.instance.createLinkEvent(parser.link);
} }
private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void
{ {
if(!event) return; if (!event) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); 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; this._noobnessLevel = event.getParser().noobnessLevel;
if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) if (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY)
{ {
Nitro.instance.core.configuration.setValue<number>('new.identity', 1); Nitro.instance.core.configuration.setValue<number>('new.identity', 1);
} }
@ -415,7 +412,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private onNitroSettingsEvent(event: NitroSettingsEvent): void private onNitroSettingsEvent(event: NitroSettingsEvent): void
{ {
this._isRoomCameraFollowDisabled = event.cameraFollow; this._isRoomCameraFollowDisabled = event.cameraFollow;
this._chatStyle = event.chatType;
this._uiFlags = event.flags; this._uiFlags = event.flags;
this.events.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags)); this.events.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags));
@ -423,7 +419,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private destroyFurnitureData(): void private destroyFurnitureData(): void
{ {
if(!this._furnitureData) return; if (!this._furnitureData) return;
this._furnitureData.dispose(); this._furnitureData.dispose();
@ -432,7 +428,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
private destroyProductData(): void private destroyProductData(): void
{ {
if(!this._productData) return; if (!this._productData) return;
this._productData.dispose(); this._productData.dispose();
@ -443,18 +439,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
{ {
const existing = this._floorItems.get(id); const existing = this._floorItems.get(id);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
public getFloorItemDataByName(name: string): IFurnitureData 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; return item;
} }
@ -464,18 +460,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
{ {
const existing = this._wallItems.get(id); const existing = this._wallItems.get(id);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
public getWallItemDataByName(name: string): IFurnitureData 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; return item;
} }
@ -483,7 +479,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
public getProductData(type: string): IProductData public getProductData(type: string): IProductData
{ {
if(!this._productsReady) this.loadProductData(); if (!this._productsReady) this.loadProductData();
return this._products.get(type); return this._products.get(type);
} }
@ -525,7 +521,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
public giveRespect(userId: number): void public giveRespect(userId: number): void
{ {
if((userId < 0) || (this._respectsLeft <= 0)) return; if ((userId < 0) || (this._respectsLeft <= 0)) return;
this.send(new UserRespectComposer(userId)); this.send(new UserRespectComposer(userId));
@ -534,7 +530,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
public givePetRespect(petId: number): void public givePetRespect(petId: number): void
{ {
if((petId < 0) || (this._respectsPetLeft <= 0)) return; if ((petId < 0) || (this._respectsPetLeft <= 0)) return;
this.send(new PetRespectComposer(petId)); this.send(new PetRespectComposer(petId));
@ -546,13 +542,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this.send(new RoomUnitChatComposer(text)); this.send(new RoomUnitChatComposer(text));
} }
public sendChatStyleUpdate(styleId: number): void
{
this._chatStyle = styleId;
this.send(new RoomUnitChatStyleComposer(styleId));
}
public ignoreUser(name: string): void public ignoreUser(name: string): void
{ {
(this._ignoredUsersManager && this._ignoredUsersManager.ignoreUser(name)); (this._ignoredUsersManager && this._ignoredUsersManager.ignoreUser(name));
@ -688,11 +677,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
return this._isRoomCameraFollowDisabled; return this._isRoomCameraFollowDisabled;
} }
public get chatStyle(): number
{
return this._chatStyle;
}
public get uiFlags(): number public get uiFlags(): number
{ {
return this._uiFlags; return this._uiFlags;