diff --git a/src/api/common/IEventDispatcher.ts b/src/api/common/IEventDispatcher.ts index 3d4f1785..2e4ebdbd 100644 --- a/src/api/common/IEventDispatcher.ts +++ b/src/api/common/IEventDispatcher.ts @@ -1,10 +1,10 @@ -import { IDisposable } from './IDisposable'; import { INitroEvent } from './INitroEvent'; -export interface IEventDispatcher extends IDisposable +export interface IEventDispatcher { - addEventListener(type: string, callback: Function): void + dispose(): void; + addEventListener(type: string, callback: (event: T) => void): void; removeEventListener(type: string, callback: Function): void; removeAllListeners(): void; - dispatchEvent(event: INitroEvent): boolean; + dispatchEvent(event: T): boolean; } diff --git a/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts b/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts index 4ed78f83..dbef5543 100644 --- a/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts +++ b/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts @@ -1,8 +1,7 @@ -import { IEventDispatcher } from '../../common'; -export interface IAvatarAssetDownloadLibrary extends IEventDispatcher +export interface IAvatarAssetDownloadLibrary { - downloadAsset(): void; + downloadAsset(): Promise; readonly libraryName: string; readonly isLoaded: boolean; } diff --git a/src/api/nitro/avatar/IAvatarRenderManager.ts b/src/api/nitro/avatar/IAvatarRenderManager.ts index 0c983e37..7a8a8646 100644 --- a/src/api/nitro/avatar/IAvatarRenderManager.ts +++ b/src/api/nitro/avatar/IAvatarRenderManager.ts @@ -1,14 +1,14 @@ import { AvatarAssetDownloadManager, AvatarStructure } from '../../../nitro'; import { IAssetManager, IGraphicAsset } from '../../asset'; -import { INitroManager } from '../../common'; import { IAvatarEffectListener } from './IAvatarEffectListener'; import { IAvatarFigureContainer } from './IAvatarFigureContainer'; import { IAvatarImage } from './IAvatarImage'; import { IAvatarImageListener } from './IAvatarImageListener'; import { IStructureData } from './structure'; -export interface IAvatarRenderManager extends INitroManager +export interface IAvatarRenderManager { + init(): Promise; createFigureContainer(figure: string): IAvatarFigureContainer; isFigureContainerReady(container: IAvatarFigureContainer): boolean; createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage; @@ -19,7 +19,6 @@ export interface IAvatarRenderManager extends INitroManager getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[]; getAssetByName(name: string): IGraphicAsset; assets: IAssetManager; - isReady: boolean; structure: AvatarStructure; structureData: IStructureData; downloadManager: AvatarAssetDownloadManager; diff --git a/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts b/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts index d08cd31a..b76a32e3 100644 --- a/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts +++ b/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts @@ -1,7 +1,6 @@ import { IAssetAnimation } from '../../asset'; -import { IEventDispatcher } from '../../common'; -export interface IEffectAssetDownloadLibrary extends IEventDispatcher +export interface IEffectAssetDownloadLibrary { downloadAsset(): void; readonly libraryName: string; diff --git a/src/api/nitro/camera/IRoomCameraWidgetManager.ts b/src/api/nitro/camera/IRoomCameraWidgetManager.ts index 8bca5c06..eb80fdb8 100644 --- a/src/api/nitro/camera/IRoomCameraWidgetManager.ts +++ b/src/api/nitro/camera/IRoomCameraWidgetManager.ts @@ -1,5 +1,4 @@ import { Resource, Texture } from '@pixi/core'; -import { IEventDispatcher } from '../../common'; import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffect'; @@ -7,7 +6,6 @@ export interface IRoomCameraWidgetManager { init(): void; applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise; - events: IEventDispatcher; effects: Map; isLoaded: boolean; } diff --git a/src/api/nitro/communication/INitroCommunicationManager.ts b/src/api/nitro/communication/ICommunicationManager.ts similarity index 52% rename from src/api/nitro/communication/INitroCommunicationManager.ts rename to src/api/nitro/communication/ICommunicationManager.ts index 9be1331f..7c15877c 100644 --- a/src/api/nitro/communication/INitroCommunicationManager.ts +++ b/src/api/nitro/communication/ICommunicationManager.ts @@ -1,12 +1,10 @@ -import { INitroManager } from '../../common'; import { IConnection } from './IConnection'; import { IMessageEvent } from './IMessageEvent'; -import { INitroCommunicationDemo } from './INitroCommunicationDemo'; -export interface INitroCommunicationManager extends INitroManager +export interface ICommunicationManager { + init(): Promise; registerMessageEvent(event: IMessageEvent): IMessageEvent; removeMessageEvent(event: IMessageEvent): void; - demo: INitroCommunicationDemo; connection: IConnection; } diff --git a/src/api/nitro/communication/IConnection.ts b/src/api/nitro/communication/IConnection.ts index 69ac955d..3139c228 100644 --- a/src/api/nitro/communication/IConnection.ts +++ b/src/api/nitro/communication/IConnection.ts @@ -1,13 +1,11 @@ -import { IEventDispatcher } from '../../common'; import { IMessageComposer } from './IMessageComposer'; import { IMessageConfiguration } from './IMessageConfiguration'; import { IMessageEvent } from './IMessageEvent'; -export interface IConnection extends IEventDispatcher +export interface IConnection { init(socketUrl: string): void; - dispose(): void; - onReady(): void; + ready(): void; authenticated(): void; send(...composers: IMessageComposer[]): void; processReceivedData(): void; diff --git a/src/api/nitro/communication/INitroCommunicationDemo.ts b/src/api/nitro/communication/INitroCommunicationDemo.ts deleted file mode 100644 index cab1521a..00000000 --- a/src/api/nitro/communication/INitroCommunicationDemo.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { INitroManager } from '../../common'; - -export type INitroCommunicationDemo = INitroManager diff --git a/src/api/nitro/communication/index.ts b/src/api/nitro/communication/index.ts index 1ddc8c03..01b0ed35 100644 --- a/src/api/nitro/communication/index.ts +++ b/src/api/nitro/communication/index.ts @@ -1,4 +1,5 @@ export * from './ICodec'; +export * from './ICommunicationManager'; export * from './IConnection'; export * from './IConnectionStateListener'; export * from './IMessageComposer'; @@ -6,6 +7,4 @@ export * from './IMessageConfiguration'; export * from './IMessageDataWrapper'; export * from './IMessageEvent'; export * from './IMessageParser'; -export * from './INitroCommunicationDemo'; -export * from './INitroCommunicationManager'; export * from './enums'; diff --git a/src/api/nitro/configuration/IConfigurationManager.ts b/src/api/nitro/configuration/IConfigurationManager.ts index ae98bcf7..a9fb696e 100644 --- a/src/api/nitro/configuration/IConfigurationManager.ts +++ b/src/api/nitro/configuration/IConfigurationManager.ts @@ -1,3 +1,6 @@ -import { INitroManager } from '../../common'; - -export type IConfigurationManager = INitroManager + +export interface IConfigurationManager +{ + init(): Promise; + reloadConfiguration(): Promise; +} diff --git a/src/api/nitro/configuration/NitroConfiguration.ts b/src/api/nitro/configuration/NitroConfiguration.ts index 419fe4da..8896916d 100644 --- a/src/api/nitro/configuration/NitroConfiguration.ts +++ b/src/api/nitro/configuration/NitroConfiguration.ts @@ -6,6 +6,13 @@ export class NitroConfiguration private static _config: any = {}; private static _missingKeys: string[] = []; + public static resetConfiguration(): void + { + this._definitions.clear(); + this._config = {}; + this._missingKeys = []; + } + public static parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean { if(!data) return false; diff --git a/src/api/nitro/localization/INitroLocalizationManager.ts b/src/api/nitro/localization/ILocalizationManager.ts similarity index 85% rename from src/api/nitro/localization/INitroLocalizationManager.ts rename to src/api/nitro/localization/ILocalizationManager.ts index 7cc681a7..86070d02 100644 --- a/src/api/nitro/localization/INitroLocalizationManager.ts +++ b/src/api/nitro/localization/ILocalizationManager.ts @@ -1,7 +1,6 @@ -import { INitroManager } from '../../common'; - -export interface INitroLocalizationManager extends INitroManager +export interface ILocalizationManager { + init(): Promise; getRomanNumeral(number: number): string; getPreviousLevelBadgeId(badgeName: string): string; hasValue(key: string): boolean; diff --git a/src/api/nitro/localization/index.ts b/src/api/nitro/localization/index.ts index f02abe85..3aee8f54 100644 --- a/src/api/nitro/localization/index.ts +++ b/src/api/nitro/localization/index.ts @@ -1 +1 @@ -export * from './INitroLocalizationManager'; +export * from './ILocalizationManager'; diff --git a/src/api/nitro/room/IRoomContentLoader.ts b/src/api/nitro/room/IRoomContentLoader.ts index 4fe3b0b1..77cfa6ff 100644 --- a/src/api/nitro/room/IRoomContentLoader.ts +++ b/src/api/nitro/room/IRoomContentLoader.ts @@ -3,14 +3,11 @@ import { IPetColorResult, IRoomContentListener } from '.'; import { IGraphicAssetCollection, IGraphicAssetGifCollection } from '../../asset'; import { IEventDispatcher } from '../../common'; import { IRoomObject } from '../../room'; -import { ISessionDataManager } from '../session'; export interface IRoomContentLoader { - dispose: () => void; - initialize(events: IEventDispatcher): void; - setSessionDataManager(sessionData: ISessionDataManager): void; - downloadAsset(type: string, events: IEventDispatcher): void; + init(): Promise; + downloadAsset(type: string): Promise; isLoaderType(type: string): boolean; getCollection(name: string): IGraphicAssetCollection; getPlaceholderName(type: string): string; diff --git a/src/api/nitro/room/IRoomEngine.ts b/src/api/nitro/room/IRoomEngine.ts index 98dd3769..e4987e81 100644 --- a/src/api/nitro/room/IRoomEngine.ts +++ b/src/api/nitro/room/IRoomEngine.ts @@ -1,7 +1,6 @@ import { RenderTexture } from '@pixi/core'; import { DisplayObject } from '@pixi/display'; import { Point, Rectangle } from '@pixi/math'; -import { INitroManager } from '../../common'; import { IRoomGeometry, IRoomManager, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRendererFactory, IRoomRenderingCanvas, IVector3D } from '../../room'; import { IPetCustomPart } from '../avatar'; import { IRoomSessionManager, ISessionDataManager } from '../session'; @@ -12,10 +11,10 @@ import { IRoomContentLoader } from './IRoomContentLoader'; import { IRoomObjectEventManager } from './IRoomObjectEventManager'; import { IObjectData, IRoomMapData } from './object'; -export interface IRoomEngine extends INitroManager +export interface IRoomEngine { + init(): Promise; setActiveRoomId(roomId: number): void; - onRoomEngineInitalized(flag: boolean): void; disableUpdate(flag: boolean): void; runUpdate(): void; createRoomInstance(roomId: number, roomMap: IRoomMapData): void; @@ -96,7 +95,6 @@ export interface IRoomEngine extends INitroManager logicFactory: IRoomObjectLogicFactory; roomContentLoader: IRoomContentLoader; activeRoomId: number; - ready: boolean; disposed: boolean; selectedAvatarId: number; isDecorating: boolean; diff --git a/src/api/nitro/room/IRoomEngineServices.ts b/src/api/nitro/room/IRoomEngineServices.ts index af1444b5..88dc8931 100644 --- a/src/api/nitro/room/IRoomEngineServices.ts +++ b/src/api/nitro/room/IRoomEngineServices.ts @@ -1,6 +1,5 @@ -import { IEventDispatcher } from '../../common'; -import { IConnection } from '../../communication'; import { IRoomInstance, IRoomObjectController, IRoomRenderingCanvas, IVector3D } from '../../room'; +import { IConnection } from '../communication'; import { IRoomSessionManager, ISessionDataManager } from '../session'; import { ISelectedRoomObjectData } from './ISelectedRoomObjectData'; import { IObjectData } from './object'; @@ -42,6 +41,5 @@ export interface IRoomEngineServices sessionDataManager: ISessionDataManager; roomSessionManager: IRoomSessionManager; activeRoomId: number; - events: IEventDispatcher; isDecorating: boolean; } diff --git a/src/api/nitro/room/object/data/IObjectData.ts b/src/api/nitro/room/object/data/IObjectData.ts index be56f1c8..7069b91d 100644 --- a/src/api/nitro/room/object/data/IObjectData.ts +++ b/src/api/nitro/room/object/data/IObjectData.ts @@ -1,5 +1,5 @@ -import { IMessageDataWrapper } from '../../../../communication'; import { IRoomObjectModel } from '../../../../room'; +import { IMessageDataWrapper } from '../../../communication'; export interface IObjectData { diff --git a/src/api/nitro/session/IRoomHandlerListener.ts b/src/api/nitro/session/IRoomHandlerListener.ts index cf364cb9..affd9231 100644 --- a/src/api/nitro/session/IRoomHandlerListener.ts +++ b/src/api/nitro/session/IRoomHandlerListener.ts @@ -1,4 +1,3 @@ -import { IEventDispatcher } from '../../common'; import { IRoomSession } from './IRoomSession'; export interface IRoomHandlerListener @@ -6,5 +5,4 @@ export interface IRoomHandlerListener getSession(id: number): IRoomSession; sessionUpdate(id: number, type: string): void; sessionReinitialize(fromRoomId: number, toRoomId: number): void; - events: IEventDispatcher; } diff --git a/src/api/nitro/session/IRoomSessionManager.ts b/src/api/nitro/session/IRoomSessionManager.ts index 28f21186..64cc3e77 100644 --- a/src/api/nitro/session/IRoomSessionManager.ts +++ b/src/api/nitro/session/IRoomSessionManager.ts @@ -1,13 +1,13 @@ -import { INitroManager } from '../../common'; -import { INitroCommunicationManager } from '../communication'; +import { ICommunicationManager } from '../communication'; import { IRoomSession } from './IRoomSession'; -export interface IRoomSessionManager extends INitroManager +export interface IRoomSessionManager { + init(): Promise; getSession(id: number): IRoomSession; createSession(roomId: number, password?: string): boolean; startSession(session: IRoomSession): boolean; removeSession(id: number, openLandingView?: boolean): void; - communication: INitroCommunicationManager; + communication: ICommunicationManager; viewerSession: IRoomSession; } diff --git a/src/api/nitro/session/ISessionDataManager.ts b/src/api/nitro/session/ISessionDataManager.ts index 8d26861b..7b8c950b 100644 --- a/src/api/nitro/session/ISessionDataManager.ts +++ b/src/api/nitro/session/ISessionDataManager.ts @@ -1,16 +1,14 @@ import { Resource, Texture } from '@pixi/core'; -import { INitroManager } from '../../common'; -import { INitroCommunicationManager } from '../communication'; +import { ICommunicationManager } from '../communication'; import { IFurnitureData } from './IFurnitureData'; -import { IFurnitureDataListener } from './IFurnitureDataListener'; import { IGroupInformationManager } from './IGroupInformationManager'; import { IIgnoredUsersManager } from './IIgnoredUsersManager'; import { IProductData } from './IProductData'; -export interface ISessionDataManager extends INitroManager +export interface ISessionDataManager { - getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[]; - removePendingFurniDataListener(listener: IFurnitureDataListener): void; + init(): Promise; + getAllFurnitureData(): IFurnitureData[]; getFloorItemData(id: number): IFurnitureData; getFloorItemDataByName(name: string): IFurnitureData; getWallItemData(id: number): IFurnitureData; @@ -31,7 +29,7 @@ export interface ISessionDataManager extends INitroManager unignoreUser(name: string): void; isUserIgnored(name: string): boolean; getGroupBadge(groupId: number): string; - communication: INitroCommunicationManager; + communication: ICommunicationManager; userId: number; userName: string; figure: string; diff --git a/src/api/nitro/sound/ISoundManager.ts b/src/api/nitro/sound/ISoundManager.ts index e0bbb0f7..87714b53 100644 --- a/src/api/nitro/sound/ISoundManager.ts +++ b/src/api/nitro/sound/ISoundManager.ts @@ -1,8 +1,8 @@ -import { INitroManager } from '../../common'; import { IMusicController } from './IMusicController'; -export interface ISoundManager extends INitroManager +export interface ISoundManager { - get musicController(): IMusicController; - get traxVolume(): number; + init(): Promise; + musicController: IMusicController; + traxVolume: number; } diff --git a/src/api/room/IRoomManager.ts b/src/api/room/IRoomManager.ts index 44c6b4a5..f1eee60a 100644 --- a/src/api/room/IRoomManager.ts +++ b/src/api/room/IRoomManager.ts @@ -1,18 +1,15 @@ -import { IEventDispatcher, INitroManager } from '../common'; -import { IRoomContentLoader } from '../nitro'; import { IRoomInstance } from './IRoomInstance'; import { IRoomObject } from './object'; -export interface IRoomManager extends INitroManager +export interface IRoomManager { + init(): Promise; getRoomInstance(roomId: string): IRoomInstance; createRoomInstance(roomId: string): IRoomInstance; removeRoomInstance(roomId: string): boolean; addUpdateCategory(category: number): void; removeUpdateCategory(category: number): void; createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; - setContentLoader(loader: IRoomContentLoader): void; update(time: number, update?: boolean): void; rooms: Map; - events: IEventDispatcher; } diff --git a/src/api/room/IRoomManagerListener.ts b/src/api/room/IRoomManagerListener.ts index 3bf9681b..aa46e8d8 100644 --- a/src/api/room/IRoomManagerListener.ts +++ b/src/api/room/IRoomManagerListener.ts @@ -1,6 +1,5 @@ export interface IRoomManagerListener { - onRoomEngineInitalized(flag: boolean): void; objectInitialized(roomId: string, objectId: number, category: number): void; initalizeTemporaryObjectsByType(type: string, _arg_2: boolean): void; -} \ No newline at end of file +} diff --git a/src/api/room/object/logic/IRoomObjectLogicFactory.ts b/src/api/room/object/logic/IRoomObjectLogicFactory.ts index 142b5198..b574e6f7 100644 --- a/src/api/room/object/logic/IRoomObjectLogicFactory.ts +++ b/src/api/room/object/logic/IRoomObjectLogicFactory.ts @@ -1,10 +1,11 @@ +import { RoomObjectEvent } from '../../../../events'; import { IEventDispatcher } from '../../../common'; import { IRoomObjectEventHandler } from './IRoomObjectEventHandler'; export interface IRoomObjectLogicFactory { getLogic(type: string): IRoomObjectEventHandler; - registerEventFunction(func: Function): void; - removeEventFunction(func: Function): void; + registerEventFunction(func: (event: RoomObjectEvent) => void): void; + removeEventFunction(func: (event: RoomObjectEvent) => void): void; events: IEventDispatcher; } diff --git a/src/common/EventDispatcher.ts b/src/common/EventDispatcher.ts index abbcc701..66f0c658 100644 --- a/src/common/EventDispatcher.ts +++ b/src/common/EventDispatcher.ts @@ -1,25 +1,15 @@ -import { IDisposable, IEventDispatcher, INitroEvent, NitroLogger } from '../api'; -import { Disposable } from './Disposable'; +import { IEventDispatcher, INitroEvent, NitroLogger } from '../api'; -export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable +export class EventDispatcher implements IEventDispatcher { - private _listeners: Map; + private _listeners: Map = new Map(); - constructor() - { - super(); - - this._listeners = new Map(); - } - - protected onDispose(): void + public dispose(): void { this.removeAllListeners(); - - super.onDispose(); } - public addEventListener(type: string, callback: Function): void + public addEventListener(type: string, callback: (event: T) => void): void { if(!type || !callback) return; @@ -35,7 +25,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi existing.push(callback); } - public removeEventListener(type: string, callback: any): void + public removeEventListener(type: string, callback: Function): void { if(!type || !callback) return; @@ -55,7 +45,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi } } - public dispatchEvent(event: INitroEvent): boolean + public dispatchEvent(event: T): boolean { if(!event) return false; @@ -66,7 +56,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi return true; } - private processEvent(event: INitroEvent): void + private processEvent(event: T): void { const existing = this._listeners.get(event.type); diff --git a/src/events/NitroEventDispatcher.ts b/src/events/NitroEventDispatcher.ts new file mode 100644 index 00000000..08468c18 --- /dev/null +++ b/src/events/NitroEventDispatcher.ts @@ -0,0 +1,4 @@ +import { IEventDispatcher } from '../api'; +import { EventDispatcher } from '../common'; + +export const NitroEventDispatcher: IEventDispatcher = new EventDispatcher(); diff --git a/src/events/NitroEventType.ts b/src/events/NitroEventType.ts new file mode 100644 index 00000000..563bcb75 --- /dev/null +++ b/src/events/NitroEventType.ts @@ -0,0 +1,16 @@ +export class NitroEventType +{ + public static readonly CONFIG_LOADED = 'CONFIG_LOADED'; + public static readonly CONFIG_FAILED = 'CONFIG_FAILED'; + public static readonly LOCALIZATION_LOADED = 'LOCALIZATION_LOADED'; + public static readonly LOCALIZATION_FAILED = 'LOCALIZATION_FAILED'; + public static readonly SOCKET_OPENED = 'SOCKET_OPENED'; + public static readonly SOCKET_CLOSED = 'SOCKET_CLOSED'; + public static readonly SOCKET_ERROR = 'SOCKET_ERROR'; + public static readonly SOCKET_CONNECTED = 'SOCKET_CONNECTED'; + public static readonly AVATAR_ASSET_DOWNLOADED = 'AVATAR_ASSET_DOWNLOADED'; + public static readonly AVATAR_ASSET_LOADED = 'AVATAR_ASSET_LOADED'; + public static readonly AVATAR_EFFECT_DOWNLOADED = 'AVATAR_EFFECT_DOWNLOADED'; + public static readonly AVATAR_EFFECT_LOADED = 'AVATAR_EFFECT_LOADED'; + public static readonly FURNITURE_DATA_LOADED = 'FURNITURE_DATA_LOADED'; +} diff --git a/src/events/avatar/AvatarRenderEvent.ts b/src/events/avatar/AvatarRenderEvent.ts deleted file mode 100644 index d3292e68..00000000 --- a/src/events/avatar/AvatarRenderEvent.ts +++ /dev/null @@ -1,4 +0,0 @@ -export class AvatarRenderEvent -{ - public static AVATAR_RENDER_READY: string = 'AVATAR_RENDER_READY'; -} \ No newline at end of file diff --git a/src/events/avatar/index.ts b/src/events/avatar/index.ts index 3fb9605c..13a14689 100644 --- a/src/events/avatar/index.ts +++ b/src/events/avatar/index.ts @@ -1,3 +1,2 @@ export * from './AvatarRenderEffectLibraryEvent'; -export * from './AvatarRenderEvent'; export * from './AvatarRenderLibraryEvent'; diff --git a/src/events/index.ts b/src/events/index.ts index 17b21217..fae4c597 100644 --- a/src/events/index.ts +++ b/src/events/index.ts @@ -1,11 +1,12 @@ -export * from './avatar'; -export * from './camera'; -export * from './communication'; -export * from './core'; -export * from './localization'; +export * from './NitroEventDispatcher'; +export * from './NitroEventType'; export * from './NitroSettingsEvent'; export * from './NitroSoundEvent'; export * from './NitroToolbarAnimateIconEvent'; export * from './NitroToolbarEvent'; +export * from './avatar'; +export * from './camera'; +export * from './communication'; +export * from './core'; export * from './room'; export * from './session'; diff --git a/src/events/localization/NitroLocalizationEvent.ts b/src/events/localization/NitroLocalizationEvent.ts deleted file mode 100644 index a011d392..00000000 --- a/src/events/localization/NitroLocalizationEvent.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NitroEvent } from '../core'; - -export class NitroLocalizationEvent extends NitroEvent -{ - public static LOADED: string = 'NLE_LOADED'; - public static FAILED: string = 'NLE_FAILED'; - - constructor(type: string) - { - super(type); - } -} diff --git a/src/events/localization/index.ts b/src/events/localization/index.ts deleted file mode 100644 index 30cf817d..00000000 --- a/src/events/localization/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './NitroLocalizationEvent'; diff --git a/src/nitro/INitro.ts b/src/nitro/INitro.ts index 5392f03c..d134800b 100644 --- a/src/nitro/INitro.ts +++ b/src/nitro/INitro.ts @@ -1,10 +1,9 @@ import { Application } from '@pixi/app'; -import { IAvatarRenderManager, IConfigurationManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager } from '../api'; +import { IAvatarRenderManager, ICommunicationManager, IConfigurationManager, IEventDispatcher, ILinkEventTracker, ILocalizationManager, IRoomCameraWidgetManager, IRoomEngine, ISessionDataManager, ISoundManager } from '../api'; export interface INitro { - init(): void; - dispose(): void; + init(): Promise; getConfiguration(key: string, value?: T): T; getLocalization(key: string): string; getLocalizationWithParameter(key: string, parameter: string, replacement: string): string; @@ -15,17 +14,13 @@ export interface INitro application: Application; configuration: IConfigurationManager; events: IEventDispatcher; - localization: INitroLocalizationManager; - communication: INitroCommunicationManager; + localization: ILocalizationManager; + communication: ICommunicationManager; avatar: IAvatarRenderManager; roomEngine: IRoomEngine; sessionDataManager: ISessionDataManager; - roomSessionManager: IRoomSessionManager; - roomManager: IRoomManager; cameraManager: IRoomCameraWidgetManager; soundManager: ISoundManager; width: number; height: number; - isReady: boolean; - isDisposed: boolean; } diff --git a/src/nitro/Nitro.ts b/src/nitro/Nitro.ts index 884b6e24..e9f55098 100644 --- a/src/nitro/Nitro.ts +++ b/src/nitro/Nitro.ts @@ -1,23 +1,21 @@ import { Application, IApplicationOptions } from '@pixi/app'; import { SCALE_MODES } from '@pixi/constants'; import { settings } from '@pixi/settings'; -import { IAvatarRenderManager, IConfigurationManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, NitroConfiguration, NitroLogger } from '../api'; +import { AssetManager, IAvatarRenderManager, ICommunicationManager, IConfigurationManager, IEventDispatcher, ILinkEventTracker, ILocalizationManager, IRoomCameraWidgetManager, IRoomEngine, ISessionDataManager, ISoundManager, NitroConfiguration, NitroLogger } from '../api'; import { EventDispatcher } from '../common'; -import { ConfigurationEvent, NitroEvent, RoomEngineEvent } from '../events'; import { GetTicker, PixiApplicationProxy } from '../pixi-proxy'; -import { RoomManager } from '../room'; import { INitro } from './INitro'; import { NitroVersion } from './NitroVersion'; import './Plugins'; import { AvatarRenderManager } from './avatar'; import { RoomCameraWidgetManager } from './camera'; -import { NitroCommunicationManager } from './communication'; +import { CommunicationManager } from './communication'; import { ConfigurationManager } from './configuration'; import { LegacyExternalInterface } from './externalInterface'; import { GameMessageHandler } from './game'; -import { NitroLocalizationManager } from './localization'; +import { LocalizationManager } from './localization'; import { LandscapeRasterizer, RoomEngine } from './room'; -import { RoomSessionManager, SessionDataManager } from './session'; +import { SessionDataManager } from './session'; import { SoundManager } from './sound'; import { HabboWebTools } from './utils/HabboWebTools'; @@ -36,166 +34,74 @@ export class Nitro implements INitro private static INSTANCE: INitro = null; private _application: Application; - private _configuration: IConfigurationManager; - private _events: IEventDispatcher; - private _communication: INitroCommunicationManager; - private _localization: INitroLocalizationManager; - private _avatar: IAvatarRenderManager; - private _roomEngine: IRoomEngine; - private _sessionDataManager: ISessionDataManager; - private _roomSessionManager: IRoomSessionManager; - private _roomManager: IRoomManager; - private _cameraManager: IRoomCameraWidgetManager; - private _soundManager: ISoundManager; - private _linkTrackers: ILinkEventTracker[]; - - private _isReady: boolean; - private _isDisposed: boolean; + private _configuration: IConfigurationManager = new ConfigurationManager(); + private _events: IEventDispatcher = new EventDispatcher(); + private _communication: ICommunicationManager = new CommunicationManager(); + private _localization: ILocalizationManager = new LocalizationManager(this._communication); + private _avatar: IAvatarRenderManager = new AvatarRenderManager(); + private _sessionDataManager: ISessionDataManager = new SessionDataManager(this._communication); + private _roomEngine: IRoomEngine = new RoomEngine(this._communication, this._sessionDataManager); + private _cameraManager: IRoomCameraWidgetManager = new RoomCameraWidgetManager(); + private _soundManager: ISoundManager = new SoundManager(); + private _linkTrackers: ILinkEventTracker[] = []; constructor(options?: IApplicationOptions) { if(!Nitro.INSTANCE) Nitro.INSTANCE = this; this._application = new PixiApplicationProxy(options); - this._configuration = new ConfigurationManager(); - this._events = new EventDispatcher(); - this._communication = new NitroCommunicationManager(); - this._localization = new NitroLocalizationManager(this._communication); - this._avatar = new AvatarRenderManager(); - this._roomEngine = new RoomEngine(this._communication); - this._sessionDataManager = new SessionDataManager(this._communication); - this._roomSessionManager = new RoomSessionManager(this._communication, this._roomEngine); - this._roomManager = new RoomManager(this._roomEngine, this._roomEngine.visualizationFactory, this._roomEngine.logicFactory); - this._cameraManager = new RoomCameraWidgetManager(); - this._soundManager = new SoundManager(); - this._linkTrackers = []; - - this._isReady = false; - this._isDisposed = false; - - this._configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this)); - this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this)); } public static bootstrap(): void { NitroVersion.sayHello(); - if(Nitro.INSTANCE) - { - Nitro.INSTANCE.dispose(); - - Nitro.INSTANCE = null; - } - const canvas = document.createElement('canvas'); - const instance = new this({ + new this({ autoDensity: false, width: window.innerWidth, height: window.innerHeight, resolution: window.devicePixelRatio, view: canvas }); - - canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST))); } - public init(): void + public async init(): Promise { - if(this._isReady || this._isDisposed) return; - - if(this._avatar) this._avatar.init(); - - if(this._soundManager) this._soundManager.init(); - - if(this._roomEngine) + try { - this._roomEngine.sessionDataManager = this._sessionDataManager; - this._roomEngine.roomSessionManager = this._roomSessionManager; - this._roomEngine.roomManager = this._roomManager; + await this._configuration.init(); - if(this._sessionDataManager) this._sessionDataManager.init(); - if(this._roomSessionManager) this._roomSessionManager.init(); + this.setDefaultConfiguration(); - this._roomEngine.init(); + await Promise.all([ + this._localization.init(), + AssetManager._INSTANCE.downloadAssets(NitroConfiguration.getValue('preload.assets.urls')?.map(url => NitroConfiguration.interpolate(url))), + this._communication.init(), + this._avatar.init(), + this._soundManager.init(), + this._sessionDataManager.init() + ]); + + await this._roomEngine.init(); + + new GameMessageHandler(this._communication.connection); + + if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); + + HabboWebTools.sendHeartBeat(); + + setInterval(() => HabboWebTools.sendHeartBeat(), 10000); } - if(!this._communication.connection) + catch (err) { - throw new Error('No connection found'); + throw new Error(err); } - - new GameMessageHandler(this._communication.connection); - - this._isReady = true; } - public dispose(): void - { - if(this._isDisposed) return; - - if(this._roomManager) - { - this._roomManager.dispose(); - - this._roomManager = null; - } - - if(this._roomSessionManager) - { - this._roomSessionManager.dispose(); - - this._roomSessionManager = null; - } - - if(this._sessionDataManager) - { - this._sessionDataManager.dispose(); - - this._sessionDataManager = null; - } - - if(this._roomEngine) - { - this._roomEngine.dispose(); - - this._roomEngine = null; - } - - if(this._avatar) - { - this._avatar.dispose(); - - this._avatar = null; - } - - if(this._soundManager) - { - this._soundManager.dispose(); - - this._soundManager = null; - } - - if(this._communication) - { - this._communication.dispose(); - - this._communication = null; - } - - if(this._application) - { - this._application.destroy(); - - this._application = null; - } - - this._isDisposed = true; - this._isReady = false; - } - - private onConfigurationLoadedEvent(event: ConfigurationEvent): void + private setDefaultConfiguration(): void { GetTicker().maxFPS = NitroConfiguration.getValue('system.fps.max', 24); @@ -208,11 +114,6 @@ export class Nitro implements INitro LandscapeRasterizer.LANDSCAPES_ENABLED = NitroConfiguration.getValue('room.landscapes.enabled', true); } - private onRoomEngineReady(event: RoomEngineEvent): void - { - this.startSendingHeartBeat(); - } - public getConfiguration(key: string, value: T = null): T { return NitroConfiguration.getValue(key, value); @@ -270,18 +171,6 @@ export class Nitro implements INitro } } - private startSendingHeartBeat(): void - { - this.sendHeartBeat(); - - setInterval(this.sendHeartBeat, 10000); - } - - private sendHeartBeat(): void - { - HabboWebTools.sendHeartBeat(); - } - public get application(): Application { return this._application; @@ -297,12 +186,12 @@ export class Nitro implements INitro return this._events; } - public get localization(): INitroLocalizationManager + public get localization(): ILocalizationManager { return this._localization; } - public get communication(): INitroCommunicationManager + public get communication(): ICommunicationManager { return this._communication; } @@ -322,16 +211,6 @@ export class Nitro implements INitro return this._sessionDataManager; } - public get roomSessionManager(): IRoomSessionManager - { - return this._roomSessionManager; - } - - public get roomManager(): IRoomManager - { - return this._roomManager; - } - public get cameraManager(): IRoomCameraWidgetManager { return this._cameraManager; @@ -352,16 +231,6 @@ export class Nitro implements INitro return this._application.renderer.height; } - public get isReady(): boolean - { - return this._isReady; - } - - public get isDisposed(): boolean - { - return this._isDisposed; - } - public static get instance(): INitro { return this.INSTANCE || null; diff --git a/src/nitro/avatar/AvatarAssetDownloadLibrary.ts b/src/nitro/avatar/AvatarAssetDownloadLibrary.ts index 34c77df1..f845d5c3 100644 --- a/src/nitro/avatar/AvatarAssetDownloadLibrary.ts +++ b/src/nitro/avatar/AvatarAssetDownloadLibrary.ts @@ -1,8 +1,7 @@ import { IAssetManager, IAvatarAssetDownloadLibrary } from '../../api'; -import { EventDispatcher } from '../../common'; -import { AvatarRenderLibraryEvent } from '../../events'; +import { AvatarRenderLibraryEvent, NitroEventDispatcher, NitroEventType } from '../../events'; -export class AvatarAssetDownloadLibrary extends EventDispatcher implements IAvatarAssetDownloadLibrary +export class AvatarAssetDownloadLibrary implements IAvatarAssetDownloadLibrary { public static DOWNLOAD_COMPLETE: string = 'AADL_DOWNLOAD_COMPLETE'; @@ -10,54 +9,50 @@ export class AvatarAssetDownloadLibrary extends EventDispatcher implements IAvat private static LOADING: number = 1; private static LOADED: number = 2; - private _state: number; + private _state: number = AvatarAssetDownloadLibrary.NOT_LOADED; private _libraryName: string; private _revision: string; private _downloadUrl: string; - private _assets: IAssetManager; + private _assetManager: IAssetManager; - constructor(id: string, revision: string, assets: IAssetManager, assetUrl: string) + constructor(libraryName: string, revision: string, downloadUrl: string, assetManager: IAssetManager) { - super(); - - this._state = AvatarAssetDownloadLibrary.NOT_LOADED; - this._libraryName = id; + this._libraryName = libraryName; this._revision = revision; - this._downloadUrl = assetUrl; - this._assets = assets; + this._downloadUrl = downloadUrl; + this._assetManager = assetManager; this._downloadUrl = this._downloadUrl.replace(/%libname%/gi, this._libraryName); this._downloadUrl = this._downloadUrl.replace(/%revision%/gi, this._revision); - const asset = this._assets.getCollection(this._libraryName); - - if(asset) this._state = AvatarAssetDownloadLibrary.LOADED; + this.checkIsLoaded(); } public async downloadAsset(): Promise { - if(!this._assets || (this._state === AvatarAssetDownloadLibrary.LOADING) || (this._state === AvatarAssetDownloadLibrary.LOADED)) return; + if(!this._assetManager || (this._state === AvatarAssetDownloadLibrary.LOADING) || (this._state === AvatarAssetDownloadLibrary.LOADED)) return; - const asset = this._assets.getCollection(this._libraryName); - - if(asset) + if(!this.checkIsLoaded()) { - this._state = AvatarAssetDownloadLibrary.LOADED; + this._state = AvatarAssetDownloadLibrary.LOADING; - this.dispatchEvent(new AvatarRenderLibraryEvent(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this)); + const status = await this._assetManager.downloadAsset(this._downloadUrl); - return; + if(!status) throw new Error('Could not download asset'); } - this._state = AvatarAssetDownloadLibrary.LOADING; + if(this.checkIsLoaded()) NitroEventDispatcher.dispatchEvent(new AvatarRenderLibraryEvent(NitroEventType.AVATAR_ASSET_DOWNLOADED, this)); + } - const status = await this._assets.downloadAsset(this._downloadUrl); + private checkIsLoaded(): boolean + { + const asset = this._assetManager.getCollection(this._libraryName); - if(!status) return; + if(!asset) return false; this._state = AvatarAssetDownloadLibrary.LOADED; - this.dispatchEvent(new AvatarRenderLibraryEvent(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this)); + return true; } public get libraryName(): string diff --git a/src/nitro/avatar/AvatarAssetDownloadManager.ts b/src/nitro/avatar/AvatarAssetDownloadManager.ts index 2cbef080..4dc399b4 100644 --- a/src/nitro/avatar/AvatarAssetDownloadManager.ts +++ b/src/nitro/avatar/AvatarAssetDownloadManager.ts @@ -1,110 +1,65 @@ -import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; -import { EventDispatcher } from '../../common'; -import { AvatarRenderEvent, AvatarRenderLibraryEvent, NitroEvent } from '../../events'; +import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener, NitroConfiguration } from '../../api'; +import { AvatarRenderLibraryEvent, NitroEvent, NitroEventDispatcher, NitroEventType } from '../../events'; import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary'; import { AvatarStructure } from './AvatarStructure'; -export class AvatarAssetDownloadManager extends EventDispatcher +export class AvatarAssetDownloadManager { - public static DOWNLOADER_READY: string = 'AADM_DOWNLOADER_READY'; - public static LIBRARY_LOADED: string = 'AADM_LIBRARY_LOADED'; - - private static MAX_DOWNLOADS: number = 2; - private _assets: IAssetManager; private _structure: AvatarStructure; - private _missingMandatoryLibs: string[]; - private _figureMap: Map; - private _pendingContainers: [IAvatarFigureContainer, IAvatarImageListener][]; - private _figureListeners: Map; - private _incompleteFigures: Map; - private _pendingDownloadQueue: AvatarAssetDownloadLibrary[]; - private _currentDownloads: AvatarAssetDownloadLibrary[]; - private _libraryNames: string[]; - private _isReady: boolean; + private _missingMandatoryLibs: string[] = []; + private _figureMap: Map = new Map(); + private _figureListeners: Map = new Map(); + private _incompleteFigures: Map = new Map(); + private _currentDownloads: AvatarAssetDownloadLibrary[] = []; + private _libraryNames: string[] = []; constructor(assets: IAssetManager, structure: AvatarStructure) { - super(); - this._assets = assets; this._structure = structure; - - this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.libraries'); - this._figureMap = new Map(); - this._pendingContainers = []; - this._figureListeners = new Map(); - this._incompleteFigures = new Map(); - this._pendingDownloadQueue = []; - this._currentDownloads = []; - this._libraryNames = []; - this._isReady = false; - - this.onLibraryLoaded = this.onLibraryLoaded.bind(this); - this.onAvatarRenderReady = this.onAvatarRenderReady.bind(this); - - this.loadFigureMap(); - - this._structure.renderManager.events.addEventListener(AvatarRenderEvent.AVATAR_RENDER_READY, this.onAvatarRenderReady); } - private loadFigureMap(): void + public async init(): Promise { - const request = new XMLHttpRequest(); + this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.libraries'); - try - { - request.open('GET', NitroConfiguration.getValue('avatar.figuremap.url')); + const url = NitroConfiguration.getValue('avatar.figuremap.url'); - request.send(); + if(!url || !url.length) throw new Error('Invalid figure map url'); - request.onloadend = e => - { - if(request.responseText) - { - const data = JSON.parse(request.responseText); + const response = await fetch(url); - this.processFigureMap(data.libraries); + if(response.status !== 200) throw new Error('Invalid figure map file'); - this.processMissingLibraries(); + const responseData = await response.json(); - this._isReady = true; + this.processFigureMap(responseData.libraries); - this.dispatchEvent(new NitroEvent(AvatarAssetDownloadManager.DOWNLOADER_READY)); - } - }; + NitroEventDispatcher.addEventListener(NitroEventType.AVATAR_ASSET_DOWNLOADED, (event: AvatarRenderLibraryEvent) => this.onLibraryLoaded(event)); - request.onerror = e => - { - throw new Error('invalid_avatar_figure_map'); - }; - } - - catch (e) - { - NitroLogger.error(e); - } + await this.processMissingLibraries(); } private processFigureMap(data: any): void { if(!data) return; + const downloadUrl = NitroConfiguration.getValue('avatar.asset.url'); + for(const library of data) { if(!library) continue; - const id = (library.id as string); + const libraryName = (library.id as string); const revision = (library.revision || ''); - if(this._libraryNames.indexOf(id) >= 0) continue; + if(this._libraryNames.indexOf(libraryName) >= 0) continue; - this._libraryNames.push(id); + this._libraryNames.push(libraryName); - const downloadLibrary = new AvatarAssetDownloadLibrary(id, revision, this._assets, NitroConfiguration.getValue('avatar.asset.url')); - - downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); + const downloadLibrary = new AvatarAssetDownloadLibrary(libraryName, revision, downloadUrl, this._assets); for(const part of library.parts) { @@ -123,16 +78,20 @@ export class AvatarAssetDownloadManager extends EventDispatcher } } - private onAvatarRenderReady(event: INitroEvent): void + private async processMissingLibraries(): Promise { - if(!event) return; + const promises: Promise[] = []; - for(const [container, listener] of this._pendingContainers) + this._missingMandatoryLibs.forEach(value => { - this.downloadAvatarFigure(container, listener); - } + const libraries = this._figureMap.get(value); - this._pendingContainers = []; + if(libraries) for(const library of libraries) promises.push(library.downloadAsset()); + }); + + this._missingMandatoryLibs = []; + + await Promise.all(promises); } private onLibraryLoaded(event: AvatarRenderLibraryEvent): void @@ -172,7 +131,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher this._figureListeners.delete(figure); - this.dispatchEvent(new NitroEvent(AvatarAssetDownloadManager.LIBRARY_LOADED)); + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.AVATAR_ASSET_LOADED)); } } @@ -198,30 +157,9 @@ export class AvatarAssetDownloadManager extends EventDispatcher } } - public processMissingLibraries(): void - { - const libraries = this._missingMandatoryLibs.slice(); - - for(const library of libraries) - { - if(!library) continue; - - const map = this._figureMap.get(library); - - if(map) for(const avatar of map) avatar && this.downloadLibrary(avatar); - } - } - public isAvatarFigureContainerReady(container: IAvatarFigureContainer): boolean { - if(!this._isReady || !this._structure.renderManager.isReady) - { - return false; - } - - const pendingLibraries = this.getAvatarFigurePendingLibraries(container); - - return !pendingLibraries.length; + return !this.getAvatarFigurePendingLibraries(container).length; } private getAvatarFigurePendingLibraries(container: IAvatarFigureContainer): AvatarAssetDownloadLibrary[] @@ -271,13 +209,6 @@ export class AvatarAssetDownloadManager extends EventDispatcher public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void { - if(!this._isReady || !this._structure.renderManager.isReady) - { - this._pendingContainers.push([container, listener]); - - return; - } - const figure = container.getFigureString(); const pendingLibraries = this.getAvatarFigurePendingLibraries(container); @@ -303,7 +234,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher { if(!library) continue; - this.downloadLibrary(library); + library.downloadAsset(); } } else @@ -311,27 +242,4 @@ export class AvatarAssetDownloadManager extends EventDispatcher if(listener && !listener.disposed) listener.resetFigure(figure); } } - - private downloadLibrary(library: AvatarAssetDownloadLibrary): void - { - if(!library || library.isLoaded) return; - - if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; - - this._pendingDownloadQueue.push(library); - - this.processDownloadQueue(); - } - - private processDownloadQueue(): void - { - while(this._pendingDownloadQueue.length) - { - const library = this._pendingDownloadQueue[0]; - - library.downloadAsset(); - - this._currentDownloads.push(this._pendingDownloadQueue.shift()); - } - } } diff --git a/src/nitro/avatar/AvatarRenderManager.ts b/src/nitro/avatar/AvatarRenderManager.ts index e513b903..a36cdacd 100644 --- a/src/nitro/avatar/AvatarRenderManager.ts +++ b/src/nitro/avatar/AvatarRenderManager.ts @@ -1,6 +1,5 @@ -import { AvatarSetType, GetAssetManager, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, INitroEvent, IStructureData, NitroConfiguration, NitroLogger } from '../../api'; -import { NitroManager } from '../../common'; -import { AvatarRenderEvent, NitroEvent } from '../../events'; +import { AvatarSetType, GetAssetManager, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IGraphicAsset, IStructureData, NitroConfiguration } from '../../api'; +import { NitroEventDispatcher, NitroEventType } from '../../events'; import { FigureDataContainer } from '../utils'; import { AssetAliasCollection } from './alias'; import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; @@ -12,241 +11,71 @@ import { HabboAvatarGeometry } from './data/HabboAvatarGeometry'; import { HabboAvatarPartSets } from './data/HabboAvatarPartSets'; import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; import { PlaceHolderAvatarImage } from './PlaceHolderAvatarImage'; -import { AvatarStructureDownload } from './structure'; -export class AvatarRenderManager extends NitroManager implements IAvatarRenderManager +export class AvatarRenderManager implements IAvatarRenderManager { private static DEFAULT_FIGURE: string = 'hd-99999-99999'; - private _aliasCollection: AssetAliasCollection; + private _structure: AvatarStructure = new AvatarStructure(this); + private _aliasCollection: AssetAliasCollection = new AssetAliasCollection(this, GetAssetManager()); + private _avatarAssetDownloadManager: AvatarAssetDownloadManager = new AvatarAssetDownloadManager(GetAssetManager(), this._structure); + private _effectAssetDownloadManager: EffectAssetDownloadManager = new EffectAssetDownloadManager(GetAssetManager(), this._structure); - private _structure: AvatarStructure; - private _avatarAssetDownloadManager: AvatarAssetDownloadManager; - private _effectAssetDownloadManager: EffectAssetDownloadManager; + private _placeHolderFigure: AvatarFigureContainer = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); - private _placeHolderFigure: AvatarFigureContainer; - - private _figureMapReady: boolean; - private _effectMapReady: boolean; - private _actionsReady: boolean; - private _structureReady: boolean; - private _geometryReady: boolean; - private _partSetsReady: boolean; - private _animationsReady: boolean; - private _isReady: boolean; - - constructor() + public async init(): Promise { - super(); + this._structure?.initGeometry(HabboAvatarGeometry.geometry); + this._structure?.initPartSets(HabboAvatarPartSets.partSets); - this._structure = null; - this._avatarAssetDownloadManager = null; + await this.loadActions(); - this._placeHolderFigure = null; - - this._figureMapReady = false; - this._effectMapReady = false; - this._actionsReady = false; - this._geometryReady = false; - this._partSetsReady = false; - this._animationsReady = false; - this._isReady = false; - - this.onAvatarAssetDownloaderReady = this.onAvatarAssetDownloaderReady.bind(this); - this.onAvatarAssetDownloaded = this.onAvatarAssetDownloaded.bind(this); - this.onEffectAssetDownloaderReady = this.onEffectAssetDownloaderReady.bind(this); - this.onEffectAssetDownloaded = this.onEffectAssetDownloaded.bind(this); - this.onAvatarStructureDownloadDone = this.onAvatarStructureDownloadDone.bind(this); - } - - public onInit(): void - { - this._structure = new AvatarStructure(this); - - this.loadGeometry(); - this.loadPartSets(); - this.loadActions(); - this.loadAnimations(); - this.loadFigureData(); - - this._aliasCollection = new AssetAliasCollection(this, GetAssetManager()); + this._structure?.initAnimation(HabboAvatarAnimations.animations); + await this.loadFigureData(); this._aliasCollection.init(); - if(!this._avatarAssetDownloadManager) - { - this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(GetAssetManager(), this._structure); + NitroEventDispatcher.addEventListener(NitroEventType.AVATAR_ASSET_LOADED, () => this._aliasCollection.reset()); + NitroEventDispatcher.addEventListener(NitroEventType.AVATAR_EFFECT_LOADED, () => this._aliasCollection.reset()); - this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); - this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); - } - - if(!this._effectAssetDownloadManager) - { - this._effectAssetDownloadManager = new EffectAssetDownloadManager(GetAssetManager(), this._structure); - - this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); - this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.LIBRARY_LOADED, this.onEffectAssetDownloaded); - } - - this.checkReady(); + await this._avatarAssetDownloadManager.init(); + await this._effectAssetDownloadManager.init(); } - public onDispose(): void - { - if(this._avatarAssetDownloadManager) - { - this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); - - this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); - } - - if(this._effectAssetDownloadManager) - { - this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); - - this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.LIBRARY_LOADED, this.onEffectAssetDownloaded); - } - } - - private loadGeometry(): void - { - if(!this._structure) return; - - this._structure.initGeometry(HabboAvatarGeometry.geometry); - - this._geometryReady = true; - - this.checkReady(); - } - - private loadPartSets(): void - { - if(!this._structure) return; - - this._structure.initPartSets(HabboAvatarPartSets.partSets); - - this._partSetsReady = true; - - this.checkReady(); - } - - private loadActions(): void + private async loadActions(): Promise { const defaultActions = NitroConfiguration.getValue('avatar.default.actions'); if(defaultActions) this._structure.initActions(GetAssetManager(), defaultActions); - const request = new XMLHttpRequest(); + const url = NitroConfiguration.getValue('avatar.actions.url'); - try - { - request.open('GET', NitroConfiguration.getValue('avatar.actions.url')); + if(!url || !url.length) throw new Error('Invalid avatar action url'); - request.send(); + const response = await fetch(url); - request.onloadend = e => - { - if(!this._structure) return; + if(response.status !== 200) throw new Error('Invalid avatar action file'); - this._structure.updateActions(JSON.parse(request.responseText)); - - this._actionsReady = true; - - this.checkReady(); - }; - - request.onerror = e => - { - throw new Error('invalid_avatar_actions'); - }; - } - - catch (e) - { - NitroLogger.error(e); - } + this._structure.updateActions(await response.json()); } - private loadAnimations(): void - { - if(!this._structure) return; - - this._structure.initAnimation(HabboAvatarAnimations.animations); - - this._animationsReady = true; - - this.checkReady(); - } - - private loadFigureData(): void + private async loadFigureData(): Promise { const defaultFigureData = NitroConfiguration.getValue('avatar.default.figuredata'); - if(!defaultFigureData || (typeof defaultFigureData === 'string')) - { - NitroLogger.error('XML figuredata is no longer supported'); + if(defaultFigureData) this._structure?.initFigureData(defaultFigureData); - return; - } + const url = NitroConfiguration.getValue('avatar.figuredata.url'); - if(this._structure) this._structure.initFigureData(defaultFigureData); + if(!url || !url.length) throw new Error('Invalid figure data url'); - const structureDownloader = new AvatarStructureDownload(NitroConfiguration.getValue('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData)); + const response = await fetch(url); - structureDownloader.addEventListener(AvatarStructureDownload.AVATAR_STRUCTURE_DONE, this.onAvatarStructureDownloadDone); - } + if(response.status !== 200) throw new Error('Invalid figure data file'); - private onAvatarStructureDownloadDone(event: INitroEvent): void - { - this._structureReady = true; + this._structure.figureData.appendJSON(await response.json()); this._structure.init(); - - this.checkReady(); - } - - private onAvatarAssetDownloaderReady(event: INitroEvent): void - { - if(!event) return; - - this._figureMapReady = true; - - this.checkReady(); - } - - private onAvatarAssetDownloaded(event: INitroEvent): void - { - if(!event) return; - - this._aliasCollection.reset(); - } - - private onEffectAssetDownloaderReady(event: INitroEvent): void - { - if(!event) return; - - this._effectMapReady = true; - - this.checkReady(); - } - - private onEffectAssetDownloaded(event: INitroEvent): void - { - if(!event) return; - - this._aliasCollection.reset(); - } - - private checkReady(): void - { - if(this._isReady) return; - - if(!this._geometryReady || !this._partSetsReady || !this._actionsReady || !this._animationsReady || !this._figureMapReady || !this._effectMapReady || !this._structureReady) return; - - this._isReady = true; - - if(this.events) this.events.dispatchEvent(new NitroEvent(AvatarRenderEvent.AVATAR_RENDER_READY)); } public createFigureContainer(figure: string): IAvatarFigureContainer @@ -274,8 +103,6 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa return new AvatarImage(this._structure, this._aliasCollection, figureContainer, size, this._effectAssetDownloadManager, effectListener); } - if(!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); - this._avatarAssetDownloadManager.downloadAvatarFigure(figureContainer, listener); return new PlaceHolderAvatarImage(this._structure, this._aliasCollection, this._placeHolderFigure, size, this._effectAssetDownloadManager); @@ -444,11 +271,6 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa return GetAssetManager(); } - public get isReady(): boolean - { - return this._isReady; - } - public get structure(): AvatarStructure { return this._structure; diff --git a/src/nitro/avatar/AvatarStructure.ts b/src/nitro/avatar/AvatarStructure.ts index bb443d2c..557e5708 100644 --- a/src/nitro/avatar/AvatarStructure.ts +++ b/src/nitro/avatar/AvatarStructure.ts @@ -40,19 +40,6 @@ export class AvatarStructure extends EventDispatcher } - public dispose(): void - { - if(this.disposed) return; - - super.dispose(); - - this._renderManager = null; - this._figureData = null; - this._partSetsData = null; - this._animationData = null; - this._mandatorySetTypeIds = null; - } - public initGeometry(k: any): void { if(!k) return; diff --git a/src/nitro/avatar/EffectAssetDownloadLibrary.ts b/src/nitro/avatar/EffectAssetDownloadLibrary.ts index 8789cce3..694cc06a 100644 --- a/src/nitro/avatar/EffectAssetDownloadLibrary.ts +++ b/src/nitro/avatar/EffectAssetDownloadLibrary.ts @@ -1,8 +1,7 @@ import { IAssetAnimation, IAssetManager, IEffectAssetDownloadLibrary } from '../../api'; -import { EventDispatcher } from '../../common'; -import { AvatarRenderEffectLibraryEvent } from '../../events'; +import { AvatarRenderEffectLibraryEvent, NitroEventDispatcher, NitroEventType } from '../../events'; -export class EffectAssetDownloadLibrary extends EventDispatcher implements IEffectAssetDownloadLibrary +export class EffectAssetDownloadLibrary implements IEffectAssetDownloadLibrary { public static DOWNLOAD_COMPLETE: string = 'EADL_DOWNLOAD_COMPLETE'; @@ -10,60 +9,53 @@ export class EffectAssetDownloadLibrary extends EventDispatcher implements IEffe private static LOADING: number = 1; private static LOADED: number = 2; - private _state: number; + private _state: number = EffectAssetDownloadLibrary.NOT_LOADED; private _libraryName: string; private _revision: string; private _downloadUrl: string; - private _assets: IAssetManager; - private _animation: { [index: string]: IAssetAnimation }; + private _assetManager: IAssetManager; + private _animation: { [index: string]: IAssetAnimation } = null; - constructor(id: string, revision: string, assets: IAssetManager, assetUrl: string) + constructor(libraryName: string, revision: string, downloadUrl: string, assetManager: IAssetManager) { - super(); - - this._state = EffectAssetDownloadLibrary.NOT_LOADED; - this._libraryName = id; + this._libraryName = libraryName; this._revision = revision; - this._downloadUrl = assetUrl; - this._assets = assets; - this._animation = null; + this._downloadUrl = downloadUrl; + this._assetManager = assetManager; this._downloadUrl = this._downloadUrl.replace(/%libname%/gi, this._libraryName); this._downloadUrl = this._downloadUrl.replace(/%revision%/gi, this._revision); - const asset = this._assets.getCollection(this._libraryName); - - if(asset) this._state = EffectAssetDownloadLibrary.LOADED; + this.checkIsLoaded(); } public async downloadAsset(): Promise { - if(!this._assets || (this._state === EffectAssetDownloadLibrary.LOADING) || (this._state === EffectAssetDownloadLibrary.LOADED)) return; + if(!this._assetManager || (this._state === EffectAssetDownloadLibrary.LOADING) || (this._state === EffectAssetDownloadLibrary.LOADED)) return; - const asset = this._assets.getCollection(this._libraryName); - - if(asset) + if(!this.checkIsLoaded()) { - this._state = EffectAssetDownloadLibrary.LOADED; + this._state = EffectAssetDownloadLibrary.LOADING; - this.dispatchEvent(new AvatarRenderEffectLibraryEvent(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this)); + const status = await this._assetManager.downloadAsset(this._downloadUrl); - return; + if(!status) throw new Error('Could not download asset'); } - this._state = EffectAssetDownloadLibrary.LOADING; + if(this.checkIsLoaded()) NitroEventDispatcher.dispatchEvent(new AvatarRenderEffectLibraryEvent(NitroEventType.AVATAR_EFFECT_DOWNLOADED, this)); + } - const status = await this._assets.downloadAsset(this._downloadUrl); + private checkIsLoaded(): boolean + { + const asset = this._assetManager.getCollection(this._libraryName); - if(!status) return; + if(!asset) return false; this._state = EffectAssetDownloadLibrary.LOADED; - const collection = this._assets.getCollection(this._libraryName); + this._animation = asset.data.animations; - if(collection) this._animation = collection.data.animations; - - this.dispatchEvent(new AvatarRenderEffectLibraryEvent(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this)); + return true; } public get libraryName(): string diff --git a/src/nitro/avatar/EffectAssetDownloadManager.ts b/src/nitro/avatar/EffectAssetDownloadManager.ts index bc78450a..0a7fbfad 100644 --- a/src/nitro/avatar/EffectAssetDownloadManager.ts +++ b/src/nitro/avatar/EffectAssetDownloadManager.ts @@ -1,111 +1,66 @@ -import { IAssetManager, IAvatarEffectListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; -import { EventDispatcher } from '../../common'; -import { AvatarRenderEffectLibraryEvent, AvatarRenderEvent, NitroEvent } from '../../events'; +import { IAssetManager, IAvatarEffectListener, NitroConfiguration } from '../../api'; +import { AvatarRenderEffectLibraryEvent, NitroEvent, NitroEventDispatcher, NitroEventType } from '../../events'; import { AvatarStructure } from './AvatarStructure'; import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary'; -export class EffectAssetDownloadManager extends EventDispatcher +export class EffectAssetDownloadManager { - public static DOWNLOADER_READY: string = 'EADM_DOWNLOADER_READY'; - public static LIBRARY_LOADED: string = 'EADM_LIBRARY_LOADED'; - - private static MAX_DOWNLOADS: number = 2; - private _assets: IAssetManager; private _structure: AvatarStructure; - private _missingMandatoryLibs: string[]; - private _effectMap: Map; - private _initDownloadBuffer: [number, IAvatarEffectListener][]; - private _effectListeners: Map; - private _incompleteEffects: Map; - private _pendingDownloadQueue: EffectAssetDownloadLibrary[]; - private _currentDownloads: EffectAssetDownloadLibrary[]; - private _libraryNames: string[]; - private _isReady: boolean; + private _missingMandatoryLibs: string[] = []; + private _effectMap: Map = new Map(); + private _effectListeners: Map = new Map(); + private _incompleteEffects: Map = new Map(); + private _currentDownloads: EffectAssetDownloadLibrary[] = []; + private _libraryNames: string[] = []; constructor(assets: IAssetManager, structure: AvatarStructure) { - super(); - this._assets = assets; this._structure = structure; - - this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.effect.libraries'); - this._effectMap = new Map(); - this._effectListeners = new Map(); - this._incompleteEffects = new Map(); - this._initDownloadBuffer = []; - this._pendingDownloadQueue = []; - this._currentDownloads = []; - this._libraryNames = []; - this._isReady = false; - - this.onLibraryLoaded = this.onLibraryLoaded.bind(this); - this.onAvatarRenderReady = this.onAvatarRenderReady.bind(this); - - this.loadEffectMap(); - - this._structure.renderManager.events.addEventListener(AvatarRenderEvent.AVATAR_RENDER_READY, this.onAvatarRenderReady); } - private loadEffectMap(): void + public async init(): Promise { - const request = new XMLHttpRequest(); + this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.effect.libraries'); - try - { - request.open('GET', NitroConfiguration.getValue('avatar.effectmap.url')); + const url = NitroConfiguration.getValue('avatar.effectmap.url'); - request.send(); + if(!url || !url.length) throw new Error('Invalid effect map url'); - request.onloadend = e => - { - if(request.responseText) - { - const data = JSON.parse(request.responseText); + const response = await fetch(url); - this.processEffectMap(data.effects); + if(response.status !== 200) throw new Error('Invalid effect map file'); - this.processMissingLibraries(); + const responseData = await response.json(); - this._isReady = true; + this.processEffectMap(responseData.effects); - this.dispatchEvent(new NitroEvent(EffectAssetDownloadManager.DOWNLOADER_READY)); - } - }; + NitroEventDispatcher.addEventListener(NitroEventType.AVATAR_EFFECT_DOWNLOADED, (event: AvatarRenderEffectLibraryEvent) => this.onLibraryLoaded(event)); - request.onerror = e => - { - throw new Error('invalid_avatar_effect_map'); - }; - } - - catch (e) - { - NitroLogger.error(e); - } + await this.processMissingLibraries(); } private processEffectMap(data: any): void { if(!data) return; + const downloadUrl = NitroConfiguration.getValue('avatar.asset.effect.url'); + for(const effect of data) { if(!effect) continue; const id = (effect.id as string); - const lib = (effect.lib as string); + const libraryName = (effect.lib as string); const revision = (effect.revision || ''); - if(this._libraryNames.indexOf(lib) >= 0) continue; + if(this._libraryNames.indexOf(libraryName) >= 0) continue; - this._libraryNames.push(lib); + this._libraryNames.push(libraryName); - const downloadLibrary = new EffectAssetDownloadLibrary(lib, revision, this._assets, NitroConfiguration.getValue('avatar.asset.effect.url')); - - downloadLibrary.addEventListener(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); + const downloadLibrary = new EffectAssetDownloadLibrary(libraryName, revision, downloadUrl, this._assets); let existing = this._effectMap.get(id); @@ -117,55 +72,20 @@ export class EffectAssetDownloadManager extends EventDispatcher } } - public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void + private async processMissingLibraries(): Promise { - if(!this._isReady || !this._structure.renderManager.isReady) + const promises: Promise[] = []; + + this._missingMandatoryLibs.forEach(value => { - this._initDownloadBuffer.push([id, listener]); + const libraries = this._effectMap.get(value); - return; - } + if(libraries) for(const library of libraries) promises.push(library.downloadAsset()); + }); - const pendingLibraries = this.getAvatarEffectPendingLibraries(id); + this._missingMandatoryLibs = []; - if(pendingLibraries && pendingLibraries.length) - { - if(listener && !listener.disposed) - { - let listeners = this._effectListeners.get(id.toString()); - - if(!listeners) listeners = []; - - listeners.push(listener); - - this._effectListeners.set(id.toString(), listeners); - } - - this._incompleteEffects.set(id.toString(), pendingLibraries); - - for(const library of pendingLibraries) - { - if(!library) continue; - - this.downloadLibrary(library); - } - } - else - { - if(listener && !listener.disposed) listener.resetEffect(id); - } - } - - private onAvatarRenderReady(event: INitroEvent): void - { - if(!event) return; - - for(const [id, listener] of this._initDownloadBuffer) - { - this.downloadAvatarEffect(id, listener); - } - - this._initDownloadBuffer = []; + await Promise.all(promises); } private onLibraryLoaded(event: AvatarRenderEffectLibraryEvent): void @@ -204,7 +124,7 @@ export class EffectAssetDownloadManager extends EventDispatcher this._effectListeners.delete(id); - this.dispatchEvent(new NitroEvent(EffectAssetDownloadManager.LIBRARY_LOADED)); + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.AVATAR_EFFECT_LOADED)); } } @@ -225,30 +145,9 @@ export class EffectAssetDownloadManager extends EventDispatcher } } - public processMissingLibraries(): void - { - const libraries = this._missingMandatoryLibs.slice(); - - for(const library of libraries) - { - if(!library) continue; - - const map = this._effectMap.get(library); - - if(map) for(const effect of map) effect && this.downloadLibrary(effect); - } - } - public isAvatarEffectReady(effect: number): boolean { - if(!this._isReady || !this._structure.renderManager.isReady) - { - return false; - } - - const pendingLibraries = this.getAvatarEffectPendingLibraries(effect); - - return !pendingLibraries.length; + return !this.getAvatarEffectPendingLibraries(effect).length; } private getAvatarEffectPendingLibraries(id: number): EffectAssetDownloadLibrary[] @@ -272,26 +171,35 @@ export class EffectAssetDownloadManager extends EventDispatcher return pendingLibraries; } - private downloadLibrary(library: EffectAssetDownloadLibrary): void + public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void { - if(!library || library.isLoaded) return; + const pendingLibraries = this.getAvatarEffectPendingLibraries(id); - if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; - - this._pendingDownloadQueue.push(library); - - this.processDownloadQueue(); - } - - private processDownloadQueue(): void - { - while(this._pendingDownloadQueue.length) + if(pendingLibraries && pendingLibraries.length) { - const library = this._pendingDownloadQueue[0]; + if(listener && !listener.disposed) + { + let listeners = this._effectListeners.get(id.toString()); - library.downloadAsset(); + if(!listeners) listeners = []; - this._currentDownloads.push(this._pendingDownloadQueue.shift()); + listeners.push(listener); + + this._effectListeners.set(id.toString(), listeners); + } + + this._incompleteEffects.set(id.toString(), pendingLibraries); + + for(const library of pendingLibraries) + { + if(!library) continue; + + library.downloadAsset(); + } + } + else + { + if(listener && !listener.disposed) listener.resetEffect(id); } } } diff --git a/src/nitro/avatar/structure/AvatarStructureDownload.ts b/src/nitro/avatar/structure/AvatarStructureDownload.ts deleted file mode 100644 index e0a4de49..00000000 --- a/src/nitro/avatar/structure/AvatarStructureDownload.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { IFigureSetData, NitroLogger } from '../../../api'; -import { EventDispatcher } from '../../../common'; -import { NitroEvent } from '../../../events'; - -export class AvatarStructureDownload extends EventDispatcher -{ - public static AVATAR_STRUCTURE_DONE: string = 'AVATAR_STRUCTURE_DONE'; - - private _dataReceiver: IFigureSetData; - - constructor(downloadUrl: string, dataReceiver: IFigureSetData) - { - super(); - - this._dataReceiver = dataReceiver; - - this.download(downloadUrl); - } - - private download(url: string): void - { - const request = new XMLHttpRequest(); - - try - { - request.open('GET', url); - - request.send(); - - request.onloadend = e => - { - const response = request.responseText; - - if(!response || !response.length) throw new Error('invalid_figure_data'); - - if(this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response)); - - this.dispatchEvent(new NitroEvent(AvatarStructureDownload.AVATAR_STRUCTURE_DONE)); - }; - - request.onerror = e => - { - throw new Error('invalid_avatar_figure_data'); - }; - } - - catch (e) - { - NitroLogger.error(e); - } - } -} diff --git a/src/nitro/avatar/structure/index.ts b/src/nitro/avatar/structure/index.ts index 11269ae9..9d2754f3 100644 --- a/src/nitro/avatar/structure/index.ts +++ b/src/nitro/avatar/structure/index.ts @@ -1,8 +1,7 @@ -export * from './animation'; export * from './AvatarAnimationData'; export * from './AvatarCanvas'; -export * from './AvatarStructureDownload'; -export * from './figure'; export * from './FigureSetData'; -export * from './parts'; export * from './PartSetsData'; +export * from './animation'; +export * from './figure'; +export * from './parts'; diff --git a/src/nitro/camera/RoomCameraWidgetManager.ts b/src/nitro/camera/RoomCameraWidgetManager.ts index b9c84bbc..a3276d28 100644 --- a/src/nitro/camera/RoomCameraWidgetManager.ts +++ b/src/nitro/camera/RoomCameraWidgetManager.ts @@ -1,21 +1,18 @@ import { Texture } from '@pixi/core'; import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix'; -import { IEventDispatcher, IRoomCameraWidgetEffect, IRoomCameraWidgetManager, IRoomCameraWidgetSelectedEffect, NitroConfiguration } from '../../api'; -import { EventDispatcher } from '../../common'; -import { RoomCameraWidgetManagerEvent } from '../../events'; +import { IRoomCameraWidgetEffect, IRoomCameraWidgetManager, IRoomCameraWidgetSelectedEffect, NitroConfiguration } from '../../api'; +import { NitroEventDispatcher, RoomCameraWidgetManagerEvent } from '../../events'; import { NitroContainer, NitroSprite, TextureUtils } from '../../pixi-proxy'; import { RoomCameraWidgetEffect } from './RoomCameraWidgetEffect'; export class RoomCameraWidgetManager implements IRoomCameraWidgetManager { private _effects: Map; - private _events: IEventDispatcher; private _isLoaded: boolean; constructor() { this._effects = new Map(); - this._events = new EventDispatcher(); this._isLoaded = false; } @@ -47,7 +44,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager this._effects.set(cameraEffect.name, cameraEffect); } - this.events.dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED)); + NitroEventDispatcher.dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED)); } public async applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise @@ -94,11 +91,6 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager return this._effects; } - public get events(): IEventDispatcher - { - return this._events; - } - public get isLoaded(): boolean { return this._isLoaded; diff --git a/src/nitro/communication/CommunicationManager.ts b/src/nitro/communication/CommunicationManager.ts new file mode 100644 index 00000000..2bd64f17 --- /dev/null +++ b/src/nitro/communication/CommunicationManager.ts @@ -0,0 +1,96 @@ +import { ICommunicationManager, IConnection, IMessageConfiguration, IMessageEvent, NitroConfiguration } from '../../api'; +import { NitroEventDispatcher, NitroEventType } from '../../events'; +import { GetTickerTime } from '../../pixi-proxy'; +import { NitroMessages } from './NitroMessages'; +import { SocketConnection } from './SocketConnection'; +import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from './messages'; + +export class CommunicationManager implements ICommunicationManager +{ + private _connection: IConnection = new SocketConnection(); + private _messages: IMessageConfiguration = new NitroMessages(); + + private _pongInterval: any = null; + + constructor() + { + this._connection.registerMessages(this._messages); + } + + public async init(): Promise + { + NitroEventDispatcher.addEventListener(NitroEventType.SOCKET_CLOSED, () => + { + this.stopPong(); + }); + + return new Promise((resolve, reject) => + { + NitroEventDispatcher.addEventListener(NitroEventType.SOCKET_OPENED, () => + { + if(NitroConfiguration.getValue('system.pong.manually', false)) this.startPong(); + + this._connection.send(new ClientHelloMessageComposer(null, null, null, null)); + this._connection.send(new SSOTicketMessageComposer(NitroConfiguration.getValue('sso.ticket', null), GetTickerTime())); + }); + + NitroEventDispatcher.addEventListener(NitroEventType.SOCKET_ERROR, () => + { + reject(); + }); + + this._connection.addMessageEvent(new ClientPingEvent((event: ClientPingEvent) => this.sendPong())); + + this._connection.addMessageEvent(new AuthenticatedEvent((event: AuthenticatedEvent) => + { + this._connection.authenticated(); + + resolve(); + + event.connection.send(new InfoRetrieveMessageComposer()); + })); + + this._connection.init(NitroConfiguration.getValue('socket.url')); + }); + } + + protected startPong(): void + { + if(this._pongInterval) this.stopPong(); + + this._pongInterval = setInterval(() => this.sendPong(), NitroConfiguration.getValue('system.pong.interval.ms', 20000)); + } + + protected stopPong(): void + { + if(!this._pongInterval) return; + + clearInterval(this._pongInterval); + + this._pongInterval = null; + } + + protected sendPong(): void + { + this._connection?.send(new PongMessageComposer()); + } + + public registerMessageEvent(event: IMessageEvent): IMessageEvent + { + if(this._connection) this._connection.addMessageEvent(event); + + return event; + } + + public removeMessageEvent(event: IMessageEvent): void + { + if(!this._connection) return; + + this._connection.removeMessageEvent(event); + } + + public get connection(): IConnection + { + return this._connection; + } +} diff --git a/src/nitro/communication/NitroCommunicationDemo.ts b/src/nitro/communication/NitroCommunicationDemo.ts deleted file mode 100644 index 558b480b..00000000 --- a/src/nitro/communication/NitroCommunicationDemo.ts +++ /dev/null @@ -1,191 +0,0 @@ -import { IConnection, INitroCommunicationDemo, INitroCommunicationManager, NitroConfiguration, NitroLogger } from '../../api'; -import { NitroManager } from '../../common'; -import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events'; -import { GetTickerTime } from '../../pixi-proxy'; -import { Nitro } from '../Nitro'; -import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from './messages'; - -export class NitroCommunicationDemo extends NitroManager implements INitroCommunicationDemo -{ - private _communication: INitroCommunicationManager; - - private _handShaking: boolean; - private _didConnect: boolean; - - private _pongInterval: any; - - constructor(communication: INitroCommunicationManager) - { - super(); - - this._communication = communication; - - this._handShaking = false; - this._didConnect = false; - - this._pongInterval = null; - - this.onConnectionOpenedEvent = this.onConnectionOpenedEvent.bind(this); - this.onConnectionClosedEvent = this.onConnectionClosedEvent.bind(this); - this.onConnectionErrorEvent = this.onConnectionErrorEvent.bind(this); - this.sendPong = this.sendPong.bind(this); - } - - protected onInit(): void - { - const connection = this._communication.connection; - - if(connection) - { - connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); - connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); - connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); - } - - this._communication.registerMessageEvent(new ClientPingEvent(this.onClientPingEvent.bind(this))); - this._communication.registerMessageEvent(new AuthenticatedEvent(this.onAuthenticatedEvent.bind(this))); - } - - protected onDispose(): void - { - const connection = this._communication.connection; - - if(connection) - { - connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); - connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); - connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); - } - - this._handShaking = false; - - this.stopPonging(); - - super.onDispose(); - } - - private onConnectionOpenedEvent(event: Event): void - { - const connection = this._communication.connection; - - if(!connection) return; - - this._didConnect = true; - - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection); - - if(NitroConfiguration.getValue('system.pong.manually', false)) this.startPonging(); - - this.startHandshake(connection); - - connection.send(new ClientHelloMessageComposer(null, null, null, null)); - - this.tryAuthentication(connection); - } - - private onConnectionClosedEvent(event: CloseEvent): void - { - const connection = this._communication.connection; - - if(!connection) return; - - this.stopPonging(); - - if(this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); - } - - private onConnectionErrorEvent(event: CloseEvent): void - { - const connection = this._communication.connection; - - if(!connection) return; - - this.stopPonging(); - - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, connection); - } - - private tryAuthentication(connection: IConnection): void - { - if(!connection || !this.getSSO()) - { - if(!this.getSSO()) - { - NitroLogger.error('Login without an SSO ticket is not supported'); - } - - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, connection); - - return; - } - - connection.send(new SSOTicketMessageComposer(this.getSSO(), GetTickerTime())); - } - - private onClientPingEvent(event: ClientPingEvent): void - { - if(!event || !event.connection) return; - - this.sendPong(event.connection); - } - - private onAuthenticatedEvent(event: AuthenticatedEvent): void - { - if(!event || !event.connection) return; - - this.completeHandshake(event.connection); - - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, event.connection); - - event.connection.send(new InfoRetrieveMessageComposer()); - } - - private startHandshake(connection: IConnection): void - { - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, connection); - - this._handShaking = true; - } - - private completeHandshake(connection: IConnection): void - { - this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKED, connection); - - this._handShaking = false; - } - - private startPonging(): void - { - this.stopPonging(); - - this._pongInterval = setInterval(this.sendPong, NitroConfiguration.getValue('system.pong.interval.ms', 20000)); - } - - private stopPonging(): void - { - if(!this._pongInterval) return; - - clearInterval(this._pongInterval); - - this._pongInterval = null; - } - - private sendPong(connection: IConnection = null): void - { - connection = ((connection || this._communication.connection) || null); - - if(!connection) return; - - connection.send(new PongMessageComposer()); - } - - private dispatchCommunicationDemoEvent(type: string, connection: IConnection): void - { - Nitro.instance.events.dispatchEvent(new NitroCommunicationDemoEvent(type, connection)); - } - - private getSSO(): string - { - return NitroConfiguration.getValue('sso.ticket', null); - } -} diff --git a/src/nitro/communication/NitroCommunicationManager.ts b/src/nitro/communication/NitroCommunicationManager.ts deleted file mode 100644 index 9668dca7..00000000 --- a/src/nitro/communication/NitroCommunicationManager.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { IConnection, IConnectionStateListener, IMessageConfiguration, IMessageEvent, INitroCommunicationDemo, INitroCommunicationManager, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; -import { NitroManager } from '../../common'; -import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events'; -import { Nitro } from '../Nitro'; -import { NitroCommunicationDemo } from './NitroCommunicationDemo'; -import { NitroMessages } from './NitroMessages'; -import { SocketConnection } from './SocketConnection'; - -export class NitroCommunicationManager extends NitroManager implements INitroCommunicationManager, IConnectionStateListener -{ - private _connection: IConnection; - private _messages: IMessageConfiguration; - - private _demo: INitroCommunicationDemo; - - constructor() - { - super(); - - this._connection = null; - this._messages = new NitroMessages(); - - this._demo = new NitroCommunicationDemo(this); - - this.onConnectionOpenedEvent = this.onConnectionOpenedEvent.bind(this); - this.onConnectionClosedEvent = this.onConnectionClosedEvent.bind(this); - this.onConnectionErrorEvent = this.onConnectionErrorEvent.bind(this); - this.onConnectionAuthenticatedEvent = this.onConnectionAuthenticatedEvent.bind(this); - } - - protected onInit(): void - { - if(this._connection) return; - - Nitro.instance.events.addEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); - - this._connection = new SocketConnection(this); - - this._connection.registerMessages(this._messages); - - this._connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); - this._connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); - this._connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); - - if(this._demo) this._demo.init(); - - this._connection.init(NitroConfiguration.getValue('socket.url')); - } - - protected onDispose(): void - { - if(this._demo) this._demo.dispose(); - - if(this._connection) - { - this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); - this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); - this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); - } - - Nitro.instance.events.removeEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); - - super.onDispose(); - } - - private onConnectionOpenedEvent(event: Event): void - { - NitroLogger.log('Connection Initialized'); - } - - private onConnectionClosedEvent(event: CloseEvent): void - { - NitroLogger.log('Connection Closed'); - } - - private onConnectionErrorEvent(event: Event): void - { - NitroLogger.log('Connection Error'); - } - - private onConnectionAuthenticatedEvent(event: INitroEvent): void - { - NitroLogger.log('Connection Authenticated'); - - if(this._connection) this._connection.authenticated(); - } - - public connectionInit(socketUrl: string): void - { - NitroLogger.log('Initializing Connection', socketUrl); - } - - public registerMessageEvent(event: IMessageEvent): IMessageEvent - { - if(this._connection) this._connection.addMessageEvent(event); - - return event; - } - - public removeMessageEvent(event: IMessageEvent): void - { - if(!this._connection) return; - - this._connection.removeMessageEvent(event); - } - - public get demo(): INitroCommunicationDemo - { - return this._demo; - } - - public get connection(): IConnection - { - return this._connection; - } -} diff --git a/src/nitro/communication/SocketConnection.ts b/src/nitro/communication/SocketConnection.ts index 2898d77b..712e8450 100644 --- a/src/nitro/communication/SocketConnection.ts +++ b/src/nitro/communication/SocketConnection.ts @@ -1,68 +1,45 @@ -import { ICodec, IConnection, IConnectionStateListener, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, NitroLogger, WebSocketEventEnum } from '../../api'; -import { EventDispatcher } from '../../common'; -import { SocketConnectionEvent } from '../../events'; +import { ICodec, IConnection, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, NitroLogger, WebSocketEventEnum } from '../../api'; +import { NitroEvent, NitroEventDispatcher, NitroEventType } from '../../events'; import { EvaWireFormat } from './codec'; import { MessageClassManager } from './messages'; -export class SocketConnection extends EventDispatcher implements IConnection +export class SocketConnection implements IConnection { - private _stateListener: IConnectionStateListener; - private _socket: WebSocket; - private _messages: MessageClassManager; - private _codec: ICodec; - private _dataBuffer: ArrayBuffer; - private _isReady: boolean; + private _socket: WebSocket = null; + private _messages: MessageClassManager = new MessageClassManager(); + private _codec: ICodec = new EvaWireFormat(); + private _dataBuffer: ArrayBuffer = null; + private _isReady: boolean = false; - private _pendingClientMessages: IMessageComposer[]; - private _pendingServerMessages: IMessageDataWrapper[]; + private _pendingClientMessages: IMessageComposer[] = []; + private _pendingServerMessages: IMessageDataWrapper[] = []; - private _isAuthenticated: boolean; - - constructor(stateListener: IConnectionStateListener) - { - super(); - - this._stateListener = stateListener; - this._socket = null; - this._messages = new MessageClassManager(); - this._codec = new EvaWireFormat(); - this._dataBuffer = null; - this._isReady = false; - - this._pendingClientMessages = []; - this._pendingServerMessages = []; - - this._isAuthenticated = false; - - this.onOpen = this.onOpen.bind(this); - this.onClose = this.onClose.bind(this); - this.onError = this.onError.bind(this); - this.onMessage = this.onMessage.bind(this); - } + private _isAuthenticated: boolean = false; public init(socketUrl: string): void { - if(this._stateListener) + if(!socketUrl || !socketUrl.length) return; + + this._dataBuffer = new ArrayBuffer(0); + + this._socket = new WebSocket(socketUrl); + this._socket.binaryType = 'arraybuffer'; + + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_OPENED, event => NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.SOCKET_OPENED))); + + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_CLOSED, event => NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.SOCKET_CLOSED))); + + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_ERROR, event => NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.SOCKET_ERROR))); + + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, (event: MessageEvent) => { - this._stateListener.connectionInit(socketUrl); - } + this._dataBuffer = this.concatArrayBuffers(this._dataBuffer, event.data); - this.createSocket(socketUrl); + this.processReceivedData(); + }); } - protected onDispose(): void - { - super.onDispose(); - - this.destroySocket(); - - this._stateListener = null; - this._messages = null; - this._codec = null; - this._dataBuffer = null; - } - - public onReady(): void + public ready(): void { if(this._isReady) return; @@ -76,67 +53,6 @@ export class SocketConnection extends EventDispatcher implements IConnection this._pendingClientMessages = []; } - private createSocket(socketUrl: string): void - { - if(!socketUrl) return; - - this.destroySocket(); - - this._dataBuffer = new ArrayBuffer(0); - this._socket = new WebSocket(socketUrl); - this._socket.binaryType = 'arraybuffer'; - - this._socket.addEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen); - this._socket.addEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose); - this._socket.addEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError); - this._socket.addEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage); - } - - private destroySocket(): void - { - if(!this._socket) return; - - this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen); - this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose); - this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError); - this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage); - - if(this._socket.readyState === WebSocket.OPEN) this._socket.close(); - - this._socket = null; - } - - private onOpen(event: Event): void - { - this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_OPENED, event); - } - - private onClose(event: CloseEvent): void - { - this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_CLOSED, event); - } - - private onError(event: Event): void - { - this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_ERROR, event); - } - - private onMessage(event: MessageEvent): void - { - if(!event) return; - - //this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_MESSAGE, event); - - this._dataBuffer = this.concatArrayBuffers(this._dataBuffer, event.data); - - this.processReceivedData(); - } - - private dispatchConnectionEvent(type: string, event: Event): void - { - this.dispatchEvent(new SocketConnectionEvent(type, this, event)); - } - public authenticated(): void { this._isAuthenticated = true; @@ -144,14 +60,12 @@ export class SocketConnection extends EventDispatcher implements IConnection public send(...composers: IMessageComposer[]): boolean { - if(this.disposed || !composers) return false; + if(!composers) return false; composers = [...composers]; if(this._isAuthenticated && !this._isReady) { - if(!this._pendingClientMessages) this._pendingClientMessages = []; - this._pendingClientMessages.push(...composers); return false; @@ -271,7 +185,7 @@ export class SocketConnection extends EventDispatcher implements IConnection { NitroLogger.packets('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper); - return; + return null; } try diff --git a/src/nitro/communication/index.ts b/src/nitro/communication/index.ts index ebb51440..c54089c1 100644 --- a/src/nitro/communication/index.ts +++ b/src/nitro/communication/index.ts @@ -1,5 +1,4 @@ -export * from './NitroCommunicationDemo'; -export * from './NitroCommunicationManager'; +export * from './CommunicationManager'; export * from './NitroMessages'; export * from './SocketConnection'; export * from './codec'; diff --git a/src/nitro/configuration/ConfigurationManager.ts b/src/nitro/configuration/ConfigurationManager.ts index a2ae04f2..6fcaca26 100644 --- a/src/nitro/configuration/ConfigurationManager.ts +++ b/src/nitro/configuration/ConfigurationManager.ts @@ -1,88 +1,44 @@ import { IConfigurationManager, NitroConfiguration } from '../../api'; -import { NitroManager } from '../../common'; -import { ConfigurationEvent } from '../../events/core/ConfigurationEvent'; +import { NitroEvent, NitroEventDispatcher, NitroEventType } from '../../events'; -export class ConfigurationManager extends NitroManager implements IConfigurationManager +export class ConfigurationManager implements IConfigurationManager { - private _definitions: Map; - private _config: any; - private _pendingUrls: string[]; - private _missingKeys: string[]; - - constructor() + public async init(): Promise { - super(); - - this._definitions = new Map(); - this._config = []; - this._pendingUrls = []; - this._missingKeys = []; - - this.onConfigurationLoaded = this.onConfigurationLoaded.bind(this); + await this.reloadConfiguration(); } - protected onInit(): void + public async reloadConfiguration(): Promise { - NitroConfiguration.parseConfiguration(this.getDefaultConfig(), true); - - this._pendingUrls = NitroConfiguration.getValue('config.urls').slice(); - - this.loadNextConfiguration(); - } - - private loadNextConfiguration(): void - { - if(!this._pendingUrls.length) + try { - this.dispatchConfigurationEvent(ConfigurationEvent.LOADED); + NitroConfiguration.resetConfiguration(); + NitroConfiguration.parseConfiguration(this.getDefaultConfig(), true); - return; + const configurationUrls = NitroConfiguration.getValue('config.urls').slice(); + + if(!configurationUrls || !configurationUrls.length) throw new Error('Invalid configuration urls'); + + for(const url of configurationUrls) + { + if(!url || !url.length) return; + + const response = await fetch(url); + + if(response.status !== 200) throw new Error('Invalid configuration file'); + + NitroConfiguration.parseConfiguration(await response.json()); + } + + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.CONFIG_LOADED)); } - this.loadConfigurationFromUrl(this._pendingUrls[0]); - } - - public loadConfigurationFromUrl(url: string): void - { - if(!url || (url === '')) + catch (err) { - this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.CONFIG_FAILED)); - return; + throw new Error(err); } - - fetch(url) - .then(response => response.json()) - .then(data => this.onConfigurationLoaded(data, url)) - .catch(err => this.onConfigurationFailed(err)); - } - - private onConfigurationLoaded(data: { [index: string]: any }, url: string): void - { - if(!data) return; - - if(NitroConfiguration.parseConfiguration(data)) - { - const index = this._pendingUrls.indexOf(url); - - if(index >= 0) this._pendingUrls.splice(index, 1); - - this.loadNextConfiguration(); - - return; - } - - this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); - } - - private onConfigurationFailed(error: Error): void - { - this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); - } - - private dispatchConfigurationEvent(type: string): void - { - this.events && this.events.dispatchEvent(new ConfigurationEvent(type)); } public getDefaultConfig(): { [index: string]: any } diff --git a/src/nitro/localization/NitroLocalizationManager.ts b/src/nitro/localization/LocalizationManager.ts similarity index 74% rename from src/nitro/localization/NitroLocalizationManager.ts rename to src/nitro/localization/LocalizationManager.ts index faf4d282..aeba5ec3 100644 --- a/src/nitro/localization/NitroLocalizationManager.ts +++ b/src/nitro/localization/LocalizationManager.ts @@ -1,84 +1,53 @@ -import { INitroCommunicationManager, INitroLocalizationManager, NitroConfiguration } from '../../api'; -import { NitroManager } from '../../common'; -import { NitroLocalizationEvent } from '../../events'; +import { ICommunicationManager, ILocalizationManager, NitroConfiguration } from '../../api'; +import { NitroEvent, NitroEventDispatcher, NitroEventType } from '../../events'; import { BadgePointLimitsEvent } from '../communication'; import { BadgeBaseAndLevel } from './BadgeBaseAndLevel'; -export class NitroLocalizationManager extends NitroManager implements INitroLocalizationManager +export class LocalizationManager implements ILocalizationManager { - private _communication: INitroCommunicationManager; - private _definitions: Map; - private _parameters: Map>; - private _badgePointLimits: Map; - private _romanNumerals: string[]; - private _pendingUrls: string[]; + private _communication: ICommunicationManager = null; + private _definitions: Map = new Map(); + private _parameters: Map> = new Map(); + private _badgePointLimits: Map = new Map(); + private _romanNumerals: string[] = [ 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI', 'XXII', 'XXIII', 'XXIV', 'XXV', 'XXVI', 'XXVII', 'XXVIII', 'XXIX', 'XXX' ]; - constructor(communication: INitroCommunicationManager) + constructor(communication: ICommunicationManager) { - super(); - this._communication = communication; - this._definitions = new Map(); - this._parameters = new Map(); - this._badgePointLimits = new Map(); - this._romanNumerals = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI', 'XXII', 'XXIII', 'XXIV', 'XXV', 'XXVI', 'XXVII', 'XXVIII', 'XXIX', 'XXX']; - this._pendingUrls = []; } - protected onInit(): void + public async init(): Promise { - this._communication.registerMessageEvent(new BadgePointLimitsEvent(this.onBadgePointLimitsEvent.bind(this))); - - let urls: string[] = NitroConfiguration.getValue('external.texts.url'); - - if(!Array.isArray(urls)) + try { - urls = [NitroConfiguration.getValue('external.texts.url')]; + const urls = NitroConfiguration.getValue('external.texts.url').slice(); + + if(!urls || !urls.length) throw new Error('Invalid localization urls'); + + for(let url of urls) + { + if(!url || !url.length) return; + + url = NitroConfiguration.interpolate(url); + + const response = await fetch(url); + + if(response.status !== 200) throw new Error('Invalid localization file'); + + this.parseLocalization(await response.json()); + } + + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.LOCALIZATION_LOADED)); + + this._communication.registerMessageEvent(new BadgePointLimitsEvent(this.onBadgePointLimitsEvent.bind(this))); } - for(let i = 0; i < urls.length; i++) urls[i] = NitroConfiguration.interpolate(urls[i]); - - this._pendingUrls = urls; - - this.loadNextLocalization(); - } - - private loadNextLocalization(): void - { - if(!this._pendingUrls.length) + catch (err) { - this.events && this.events.dispatchEvent(new NitroLocalizationEvent(NitroLocalizationEvent.LOADED)); + NitroEventDispatcher.dispatchEvent(new NitroEvent(NitroEventType.LOCALIZATION_FAILED)); - return; + throw new Error(err); } - - this.loadLocalizationFromURL(this._pendingUrls[0]); - } - - public loadLocalizationFromURL(url: string): void - { - fetch(url) - .then(response => response.json()) - .then(data => this.onLocalizationLoaded(data, url)) - .catch(err => this.onLocalizationFailed(err)); - } - - private onLocalizationLoaded(data: { [index: string]: any }, url: string): void - { - if(!data) return; - - if(!this.parseLocalization(data)) throw new Error(`Invalid json data for file ${url}`); - - const index = this._pendingUrls.indexOf(url); - - if(index >= 0) this._pendingUrls.splice(index, 1); - - this.loadNextLocalization(); - } - - private onLocalizationFailed(error: Error): void - { - this.events && this.events.dispatchEvent(new NitroLocalizationEvent(NitroLocalizationEvent.FAILED)); } private parseLocalization(data: { [index: string]: any }): boolean diff --git a/src/nitro/localization/index.ts b/src/nitro/localization/index.ts index 34e18ce3..ebe79399 100644 --- a/src/nitro/localization/index.ts +++ b/src/nitro/localization/index.ts @@ -1,2 +1,2 @@ export * from './BadgeBaseAndLevel'; -export * from './NitroLocalizationManager'; +export * from './LocalizationManager'; diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index dbfb9e41..b42e1a10 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -1,11 +1,11 @@ import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Spritesheet } from '@pixi/spritesheet'; -import { FurnitureType, GetAssetManager, GraphicAssetCollection, GraphicAssetGifCollection, IAssetData, IEventDispatcher, IFurnitureData, IFurnitureDataListener, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroBundle, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api'; -import { NitroEvent } from '../../events'; +import { FurnitureType, GetAssetManager, GraphicAssetCollection, GraphicAssetGifCollection, IAssetData, IEventDispatcher, IFurnitureData, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroBundle, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api'; +import { NitroEventDispatcher } from '../../events'; import { RoomContentLoadedEvent } from '../../events/room/RoomContentLoadedEvent'; import { PetColorResult } from './PetColorResult'; -export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLoader +export class RoomContentLoader implements IRoomContentLoader { private static PLACE_HOLDER: string = 'place_holder'; private static PLACE_HOLDER_WALL: string = 'place_holder_wall'; @@ -15,113 +15,42 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo private static TILE_CURSOR: string = 'tile_cursor'; private static SELECTION_ARROW: string = 'selection_arrow'; - public static LOADER_READY: string = 'RCL_LOADER_READY'; public static MANDATORY_LIBRARIES: string[] = [RoomContentLoader.PLACE_HOLDER, RoomContentLoader.PLACE_HOLDER_WALL, RoomContentLoader.PLACE_HOLDER_PET, RoomContentLoader.ROOM, RoomContentLoader.TILE_CURSOR, RoomContentLoader.SELECTION_ARROW]; - private _stateEvents: IEventDispatcher; private _sessionDataManager: ISessionDataManager; - private _waitingForSessionDataManager: boolean; private _iconListener: IRoomContentListener; - private _collections: Map; - private _gifCollections: Map; - private _images: Map; + private _collections: Map = new Map(); + private _gifCollections: Map = new Map(); + private _images: Map = new Map(); - private _events: Map; - private _activeObjects: { [index: string]: number }; - private _activeObjectTypes: Map; - private _activeObjectTypeIds: Map; - private _objectTypeAdUrls: Map; - private _wallItems: { [index: string]: number }; - private _wallItemTypes: Map; - private _wallItemTypeIds: Map; - private _furniRevisions: Map; - private _pets: { [index: string]: number }; - private _petColors: Map>; - private _objectAliases: Map; - private _objectOriginalNames: Map; + private _activeObjects: { [index: string]: number } = {}; + private _activeObjectTypes: Map = new Map(); + private _activeObjectTypeIds: Map = new Map(); + private _objectTypeAdUrls: Map = new Map(); + private _wallItems: { [index: string]: number } = {}; + private _wallItemTypes: Map = new Map(); + private _wallItemTypeIds: Map = new Map(); + private _furniRevisions: Map = new Map(); + private _pets: { [index: string]: number } = {}; + private _petColors: Map> = new Map(); + private _objectAliases: Map = new Map(); + private _objectOriginalNames: Map = new Map(); - private _pendingContentTypes: string[]; - private _dataInitialized: boolean; + private _pendingContentTypes: string[] = []; + private _dataInitialized: boolean = false; - constructor() + constructor(sessionDataManager: ISessionDataManager) { - this._stateEvents = null; - this._sessionDataManager = null; - this._waitingForSessionDataManager = false; - this._iconListener = null; - this._collections = new Map(); - this._gifCollections = new Map(); - this._images = new Map(); - - this._events = new Map(); - this._activeObjects = {}; - this._activeObjectTypes = new Map(); - this._activeObjectTypeIds = new Map(); - this._objectTypeAdUrls = new Map(); - this._wallItems = {}; - this._wallItemTypes = new Map(); - this._wallItemTypeIds = new Map(); - this._furniRevisions = new Map(); - this._pets = {}; - this._petColors = new Map(); - this._objectAliases = new Map(); - this._objectOriginalNames = new Map(); - - this._pendingContentTypes = []; - this._dataInitialized = false; + this._sessionDataManager = sessionDataManager; } - public initialize(events: IEventDispatcher): void + public async init(): Promise { - this._stateEvents = events; - - this.setFurnitureData(); + this.processFurnitureData(this._sessionDataManager.getAllFurnitureData()); for(const [index, name] of NitroConfiguration.getValue('pet.types').entries()) this._pets[name] = index; } - public dispose(): void - { - - } - - public setSessionDataManager(sessionData: ISessionDataManager): void - { - this._sessionDataManager = sessionData; - - if(this._waitingForSessionDataManager) - { - this._waitingForSessionDataManager = false; - - this.setFurnitureData(); - } - } - - public loadFurnitureData(): void - { - this.setFurnitureData(); - } - - private setFurnitureData(): void - { - if(!this._sessionDataManager) - { - this._waitingForSessionDataManager = true; - - return; - } - - const furnitureData = this._sessionDataManager.getAllFurnitureData(this); - - if(!furnitureData) return; - - this._sessionDataManager.removePendingFurniDataListener(this); - - this.processFurnitureData(furnitureData); - - this._stateEvents.dispatchEvent(new NitroEvent(RoomContentLoader.LOADER_READY)); - } - private processFurnitureData(furnitureData: IFurnitureData[]): void { if(!furnitureData) return; @@ -480,49 +409,41 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo return false; } - public async downloadAsset(type: string, events: IEventDispatcher): Promise + public async downloadAsset(type: string): Promise { const assetUrl: string = this.getAssetUrls(type)?.[0]; if(!assetUrl || !assetUrl.length) return; - if((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return; + if((this._pendingContentTypes.indexOf(type) >= 0)) return; this._pendingContentTypes.push(type); - this._events.set(type, events); try { const response = await fetch(assetUrl); + + if(response.status !== 200) throw new Error(`${ type } error`); + let contentType = 'application/octet-stream'; - if(response.headers.has('Content-Type')) + if(response.headers.has('Content-Type')) contentType = response.headers.get('Content-Type'); + + if(contentType === 'application/octet-stream') { - contentType = response.headers.get('Content-Type'); + const nitroBundle = new NitroBundle(await response.arrayBuffer()); + + await this.processAsset(nitroBundle.baseTexture, (nitroBundle.jsonFile as IAssetData)); + + NitroEventDispatcher.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_SUCCESS, type)); } - switch(contentType) - { - case 'application/octet-stream': { - const nitroBundle = new NitroBundle(await response.arrayBuffer()); - - await this.processAsset(nitroBundle.baseTexture, (nitroBundle.jsonFile as IAssetData)); - - const events = this._events.get(type); - - if(!events) return; - - events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_SUCCESS, type)); - break; - } - default: - throw new Error(); - } + throw new Error('Invalid asset'); } catch (err) { - events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_FAILURE, type)); + NitroEventDispatcher.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_FAILURE, type)); } } @@ -688,15 +609,6 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo model.setValue(RoomObjectVariable.OBJECT_ROOM_ID, roomId); } - private getOrRemoveEventDispatcher(type: string, remove: boolean = false): IEventDispatcher - { - const existing = this._events.get(type); - - if(remove) this._events.delete(type); - - return existing; - } - public setIconListener(listener: IRoomContentListener): void { this._iconListener = listener; diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index fd0a24ae..20475e2a 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -1,13 +1,14 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Container, DisplayObject } from '@pixi/display'; import { Matrix, Point, Rectangle } from '@pixi/math'; -import { IConnection, IDisposable, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, INitroCommunicationManager, INitroEvent, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, NitroConfiguration, NitroLogger, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api'; +import { ICommunicationManager, IConnection, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, NitroConfiguration, NitroLogger, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api'; import { NitroManager } from '../../common'; -import { BadgeImageReadyEvent, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '../../events'; +import { BadgeImageReadyEvent, NitroEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '../../events'; import { GetTicker, GetTickerTime, NitroSprite, TextureUtils } from '../../pixi-proxy'; -import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomObjectUpdateMessage, RoomRendererFactory } from '../../room'; +import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomManager, RoomObjectUpdateMessage, RoomRendererFactory } from '../../room'; import { PetFigureData } from '../avatar'; import { RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '../communication'; +import { RoomSessionManager } from '../session'; import { FurniId } from '../utils'; import { ImageResult } from './ImageResult'; import { RoomContentLoader } from './RoomContentLoader'; @@ -19,7 +20,7 @@ import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, Ob import { RoomLogic, RoomMapData, RoomObjectVisualizationFactory } from './object'; import { RoomCamera, RoomData, RoomFurnitureData, RoomInstanceData, RoomObjectBadgeImageAssetListener, SpriteDataCollector } from './utils'; -export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver, IDisposable +export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver { public static ROOM_OBJECT_ID: number = -1; public static ROOM_OBJECT_TYPE: string = 'room'; @@ -36,99 +37,57 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private static DRAG_THRESHOLD: number = 15; private static TEMPORARY_ROOM: string = 'temporary_room'; - private _communication: INitroCommunicationManager; - private _roomRendererFactory: IRoomRendererFactory; + private _communication: ICommunicationManager; + private _roomRendererFactory: IRoomRendererFactory = new RoomRendererFactory(); private _roomManager: IRoomManager; - private _visualizationFactory: IRoomObjectVisualizationFactory; + private _visualizationFactory: IRoomObjectVisualizationFactory = new RoomObjectVisualizationFactory(); private _sessionDataManager: ISessionDataManager; private _roomSessionManager: IRoomSessionManager; - private _roomObjectEventHandler: RoomObjectEventHandler; - private _roomMessageHandler: RoomMessageHandler; + private _roomObjectEventHandler: RoomObjectEventHandler = new RoomObjectEventHandler(this); + private _roomMessageHandler: RoomMessageHandler = new RoomMessageHandler(this); private _roomContentLoader: IRoomContentLoader; - private _ready: boolean; - private _roomContentLoaderReady: boolean; - private _imageObjectIdBank: NumberBank; - private _imageCallbacks: Map; - private _thumbnailObjectIdBank: NumberBank; - private _thumbnailCallbacks: Map; - private _activeRoomId: number; - private _activeRoomActiveCanvas: number; - private _activeRoomActiveCanvasMouseX: number; - private _activeRoomActiveCanvasMouseY: number; - private _activeRoomIsDragged: boolean; - private _activeRoomWasDragged: boolean; - private _activeRoomDragStartX: number; - private _activeRoomDragStartY: number; - private _activeRoomDragX: number; - private _activeRoomDragY: number; - private _roomDraggingAlwaysCenters: boolean; - private _roomAllowsDragging: boolean; - private _roomDatas: Map; - private _roomInstanceDatas: Map; - private _skipFurnitureCreationForNextFrame: boolean; - private _mouseCursorUpdate: boolean; - private _badgeListenerObjects: Map; - private _logicFactory: IRoomObjectLogicFactory; + private _imageObjectIdBank: NumberBank = new NumberBank(1000); + private _imageCallbacks: Map = new Map(); + private _thumbnailObjectIdBank: NumberBank = new NumberBank(1000); + private _thumbnailCallbacks: Map = new Map(); + private _activeRoomId: number = -1; + private _activeRoomActiveCanvas: number = -1; + private _activeRoomActiveCanvasMouseX: number = 0; + private _activeRoomActiveCanvasMouseY: number = 0; + private _activeRoomIsDragged: boolean = false; + private _activeRoomWasDragged: boolean = false; + private _activeRoomDragStartX: number = 0; + private _activeRoomDragStartY: number = 0; + private _activeRoomDragX: number = 0; + private _activeRoomDragY: number = 0; + private _roomDraggingAlwaysCenters: boolean = false; + private _roomAllowsDragging: boolean = true; + private _roomDatas: Map = new Map(); + private _roomInstanceDatas: Map = new Map(); + private _skipFurnitureCreationForNextFrame: boolean = false; + private _mouseCursorUpdate: boolean = false; + private _badgeListenerObjects: Map = new Map(); + private _logicFactory: IRoomObjectLogicFactory = new RoomObjectLogicFactory(); - constructor(communication: INitroCommunicationManager) + constructor(communication: ICommunicationManager, sessionDataManager: ISessionDataManager) { super(); this._communication = communication; - this._sessionDataManager = null; - this._roomSessionManager = null; - this._roomManager = null; - this._roomObjectEventHandler = new RoomObjectEventHandler(this); - this._roomMessageHandler = new RoomMessageHandler(this); - this._roomContentLoader = new RoomContentLoader(); - this._ready = false; - this._roomContentLoaderReady = false; + this._sessionDataManager = sessionDataManager; + this._roomSessionManager = new RoomSessionManager(this._communication, this); + this._roomContentLoader = new RoomContentLoader(sessionDataManager); + this._roomManager = new RoomManager(this, this._visualizationFactory, this._logicFactory, this._roomContentLoader); - this._activeRoomId = -1; - this._activeRoomActiveCanvas = -1; - this._roomInstanceDatas = new Map(); - this._roomDatas = new Map(); - - this._roomRendererFactory = new RoomRendererFactory(); - this._visualizationFactory = new RoomObjectVisualizationFactory(); - this._logicFactory = new RoomObjectLogicFactory(); - - this._activeRoomActiveCanvasMouseX = 0; - this._activeRoomActiveCanvasMouseY = 0; - this._activeRoomIsDragged = false; - this._activeRoomWasDragged = false; - this._activeRoomDragStartX = 0; - this._activeRoomDragStartY = 0; - this._activeRoomDragX = 0; - this._activeRoomDragY = 0; - this._skipFurnitureCreationForNextFrame = false; - this._mouseCursorUpdate = false; - this._imageObjectIdBank = null; - this._imageCallbacks = new Map(); - this._thumbnailCallbacks = new Map(); - this._roomDraggingAlwaysCenters = false; - this._roomAllowsDragging = true; - this._badgeListenerObjects = new Map(); - - this.runVisibilityUpdate = this.runVisibilityUpdate.bind(this); - this.processRoomObjectEvent = this.processRoomObjectEvent.bind(this); - this.onRoomSessionEvent = this.onRoomSessionEvent.bind(this); - this.onRoomContentLoaderReadyEvent = this.onRoomContentLoaderReadyEvent.bind(this); this.onBadgeImageReadyEvent = this.onBadgeImageReadyEvent.bind(this); } - public onInit(): void + public async init(): Promise { - if(this._ready) return; - - this._imageObjectIdBank = new NumberBank(1000); - this._thumbnailObjectIdBank = new NumberBank(1000); - - this._logicFactory.registerEventFunction(this.processRoomObjectEvent); + this._logicFactory.registerEventFunction(this.processRoomObjectEvent.bind(this)); if(this._roomManager) { - this._roomManager.setContentLoader(this._roomContentLoader); this._roomManager.addUpdateCategory(RoomObjectCategory.FLOOR); this._roomManager.addUpdateCategory(RoomObjectCategory.WALL); this._roomManager.addUpdateCategory(RoomObjectCategory.UNIT); @@ -138,51 +97,26 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this._roomMessageHandler.setConnection(this._communication.connection); - this._roomContentLoader.initialize(this.events); - this._roomContentLoader.setSessionDataManager(this._sessionDataManager); - this._roomContentLoader.setIconListener(this); + NitroEventDispatcher.addEventListener(RoomSessionEvent.STARTED, event => this.onRoomSessionEvent(event)); + NitroEventDispatcher.addEventListener(RoomSessionEvent.ENDED, event => this.onRoomSessionEvent(event)); - if(this._roomSessionManager) + await this._roomContentLoader.init(), this._roomContentLoader.setIconListener(this); + await this._roomManager.init(); + await this._roomSessionManager.init(); + + for(const roomData of this._roomDatas.values()) { - this._roomSessionManager.events.addEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); - this._roomSessionManager.events.addEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); - } + if(!roomData) continue; - this.events.addEventListener(RoomContentLoader.LOADER_READY, this.onRoomContentLoaderReadyEvent); + this.createRoomInstance(roomData.roomId, roomData.data); + } GetTicker().add(this.update, this); - document.addEventListener('visibilitychange', this.runVisibilityUpdate); - } - - public onDispose(): void - { - if(!this._ready) return; - - for(const [key, value] of this._roomInstanceDatas) + document.addEventListener('visibilitychange', event => { - this.removeRoomInstance(key); - } - - document.removeEventListener('visibilitychange', this.runVisibilityUpdate); - - GetTicker().remove(this.update, this); - - if(this._roomObjectEventHandler) this._roomObjectEventHandler.dispose(); - - if(this._roomMessageHandler) this._roomMessageHandler.dispose(); - - if(this._roomContentLoader) this._roomContentLoader.dispose(); - - this.events.removeEventListener(RoomContentLoader.LOADER_READY, this.onRoomContentLoaderReadyEvent); - - if(this._roomSessionManager) - { - this._roomSessionManager.events.removeEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); - this._roomSessionManager.events.removeEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); - } - - super.onDispose(); + if(!document.hidden) this.update(1, true); + }); } private onRoomSessionEvent(event: RoomSessionEvent): void @@ -204,13 +138,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - private onRoomContentLoaderReadyEvent(event: INitroEvent): void - { - this._roomContentLoaderReady = true; - - this._roomManager.init(); - } - public setActiveRoomId(roomId: number): void { this._activeRoomId = roomId; @@ -244,7 +171,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato existing.dispose(); } - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.DISPOSED, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.DISPOSED, roomId)); } public createRoomInstance(roomId: number, roomMap: RoomMapData): void @@ -253,32 +180,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let wallType = '201'; let landscapeType = '1'; - if(!this._ready) - { - let data = this._roomDatas.get(roomId); - - if(data) - { - this._roomDatas.delete(roomId); - - floorType = data.floorType; - wallType = data.wallType; - landscapeType = data.landscapeType; - } - - data = new RoomData(roomId, roomMap); - - data.floorType = floorType; - data.wallType = wallType; - data.landscapeType = landscapeType; - - this._roomDatas.set(roomId, data); - - NitroLogger.warn('Room Engine not initilized yet, can not create room. Room data stored for later initialization.'); - - return; - } - if(!roomMap) { NitroLogger.warn('Room property messages'); @@ -312,12 +213,12 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this._roomAllowsDragging = true; } - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.INITIALIZED, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.INITIALIZED, roomId)); } private setupRoomInstance(roomId: number, roomMap: RoomMapData, floorType: string, wallType: string, landscapeType: string, worldType: string): IRoomInstance { - if(!this._ready || !this._roomManager) return; + if(!this._roomManager) return; const instance = this._roomManager.createRoomInstance(this.getRoomId(roomId)); @@ -523,7 +424,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato roomCanvas.setScale(scale, point, offsetPoint, override, asDelta); - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ROOM_ZOOMED, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ROOM_ZOOMED, roomId)); } } @@ -573,7 +474,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return; - this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y))); + NitroEventDispatcher.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y))); renderingCanvas.screenOffsetX = x; renderingCanvas.screenOffsetY = y; @@ -714,7 +615,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato roomObject.logic.processUpdateMessage(event); - this.events.dispatchEvent(new RoomBackgroundColorEvent(roomId, color, light, backgroundOnly)); + NitroEventDispatcher.dispatchEvent(new RoomBackgroundColorEvent(roomId, color, light, backgroundOnly)); return true; } @@ -760,11 +661,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(mode === 0) { - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.NORMAL_MODE, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.NORMAL_MODE, roomId)); } else { - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.GAME_MODE, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.GAME_MODE, roomId)); } } @@ -800,11 +701,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this.update(1); } - public runVisibilityUpdate(): void - { - if(!document.hidden) this.update(1, true); - } - public update(time: number, update: boolean = false): void { if(!this._roomManager) return; @@ -912,22 +808,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - public onRoomEngineInitalized(flag: boolean): void - { - if(!flag) return; - - this._ready = true; - - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, 0)); - - for(const roomData of this._roomDatas.values()) - { - if(!roomData) continue; - - this.createRoomInstance(roomData.roomId, roomData.data); - } - } - private processPendingFurnitureFloor(roomId: number, id: number, data: RoomFurnitureData): boolean { if(!data) @@ -975,7 +855,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!this.updateRoomObjectFloorHeight(roomId, id, data.sizeZ)) return false; } - if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.FLOOR)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.FLOOR)); const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); @@ -1030,7 +910,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!this.updateRoomObjectWall(roomId, id, data.location, data.direction, data.state, extra)) return false; - if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.WALL)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.WALL)); const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); @@ -1622,8 +1502,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController { - if(!this._ready) return null; - let roomIdString = this.getRoomId(roomId); if(roomId === 0) roomIdString = RoomEngine.TEMPORARY_ROOM; @@ -1749,13 +1627,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const image = await TextureUtils.generateImage(icon); - if(this.events) + if(NitroEventDispatcher) { const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); event.iconName = ToolbarIconEnum.INVENTORY; - this.events.dispatchEvent(event); + NitroEventDispatcher.dispatchEvent(event); } })(); } @@ -1797,13 +1675,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const image = await TextureUtils.generateImage(icon); - if(this.events) + if(NitroEventDispatcher) { const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); event.iconName = ToolbarIconEnum.INVENTORY; - this.events.dispatchEvent(event); + NitroEventDispatcher.dispatchEvent(event); } })(); } @@ -1829,7 +1707,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato instance.removeRoomObject(objectId, category); - if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REMOVED, roomId, objectId, category)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REMOVED, roomId, objectId, category)); } public addFurnitureFloor(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra: number = NaN, expires: number = -1, usagePolicy: number = 0, ownerId: number = 0, ownerName: string = '', synchronized: boolean = true, realRoomObject: boolean = true, sizeZ: number = -1): boolean @@ -2023,7 +1901,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(figure) object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure)); - if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, objectId, RoomObjectCategory.UNIT)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, objectId, RoomObjectCategory.UNIT)); return true; } @@ -2046,7 +1924,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(roomSession && (roomSession.ownRoomIndex === objectId)) { - this._logicFactory.events.dispatchEvent(new RoomToObjectOwnAvatarMoveEvent(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, targetLocation)); + NitroEventDispatcher.dispatchEvent(new RoomToObjectOwnAvatarMoveEvent(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, targetLocation)); } return true; @@ -2249,7 +2127,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato object.processUpdateMessage(new ObjectDataUpdateMessage(object.getState(0), data)); } - this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.CONTENT_UPDATED, id, objectId, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.CONTENT_UPDATED, id, objectId, category)); } if(roomId !== RoomEngine.TEMPORARY_ROOM) this.addObjectToTileMap(id, object); @@ -2318,7 +2196,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!this._badgeListenerObjects.size) { - this._sessionDataManager.events.addEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); + NitroEventDispatcher.addEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); } let listeners = this._badgeListenerObjects.get(badgeId); @@ -2360,7 +2238,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!this._badgeListenerObjects.size) { - this._sessionDataManager.events.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); + NitroEventDispatcher.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); } } @@ -2399,9 +2277,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(type === MouseEventType.MOUSE_CLICK) { - if(this.events) + if(NitroEventDispatcher) { - this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM)); } eventType = RoomObjectMouseEvent.CLICK; @@ -2945,7 +2823,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato imageResult.id = -1; - if(!this._ready || !type) return imageResult; + if(!type) return imageResult; let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); @@ -3085,7 +2963,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato imageResult.id = -1; - if(!this._ready || !type) return imageResult; + if(!type) return imageResult; let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); @@ -3307,14 +3185,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomObjects(roomId: number, category: number): IRoomObject[] { - if(this._ready) - { - const _local_3 = this.getRoomId(roomId); - const _local_4 = this._roomManager.getRoomInstance(_local_3); + const _local_3 = this.getRoomId(roomId); + const _local_4 = this._roomManager.getRoomInstance(_local_3); - if(_local_4) return _local_4.getRoomObjectsForCategory(category); - } + if(_local_4) return _local_4.getRoomObjectsForCategory(category); return []; } @@ -3434,7 +3309,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomId = this.getRoomIdFromString(k); - this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, roomId)); + NitroEventDispatcher.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, roomId)); } public getRoomId(id: number): string @@ -3535,21 +3410,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato return this._sessionDataManager; } - public set sessionDataManager(manager: ISessionDataManager) - { - this._sessionDataManager = manager; - } - public get roomSessionManager(): IRoomSessionManager { return this._roomSessionManager; } - public set roomSessionManager(manager: IRoomSessionManager) - { - this._roomSessionManager = manager; - } - public get roomManager(): IRoomManager { return this._roomManager; @@ -3585,11 +3450,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato return this._activeRoomId; } - public get ready(): boolean - { - return this._ready; - } - public get roomContentLoader(): IRoomContentLoader { return this._roomContentLoader; diff --git a/src/nitro/room/RoomMessageHandler.ts b/src/nitro/room/RoomMessageHandler.ts index 7b48b344..9b132f2a 100644 --- a/src/nitro/room/RoomMessageHandler.ts +++ b/src/nitro/room/RoomMessageHandler.ts @@ -978,7 +978,7 @@ export class RoomMessageHandler extends Disposable // _SafeStr_4231._SafeStr_6766(); // return; // case 2: - // this._SafeStr_10592.roomSessionManager.events.dispatchEvent(new _SafeStr_2821(this._SafeStr_10593, -1, true)); + // NitroEventDispatcher.dispatchEvent(new _SafeStr_2821(this._SafeStr_10593, -1, true)); // return; // case 3: // arrayIndex = 0; diff --git a/src/nitro/room/RoomObjectEventHandler.ts b/src/nitro/room/RoomObjectEventHandler.ts index 5a3d2856..1e064a3e 100644 --- a/src/nitro/room/RoomObjectEventHandler.ts +++ b/src/nitro/room/RoomObjectEventHandler.ts @@ -1,6 +1,6 @@ import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api'; import { Disposable } from '../../common'; -import { RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnabledEvent, RoomObjectHSLColorEnableEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../events'; +import { NitroEventDispatcher, RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnabledEvent, RoomObjectHSLColorEnableEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../events'; import { RoomEnterEffect, RoomId, RoomObjectUpdateMessage } from '../../room'; import { BotPlaceComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '../communication'; import { Nitro } from '../Nitro'; @@ -35,7 +35,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.onRoomEngineObjectEvent = this.onRoomEngineObjectEvent.bind(this); - this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); + NitroEventDispatcher.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); } public dispose(): void @@ -45,7 +45,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this._eventIds = null; } - this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); + NitroEventDispatcher.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); this._roomEngine = null; } @@ -439,9 +439,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { if(category === RoomObjectCategory.FLOOR) { - if(this._roomEngine.events) + if(NitroEventDispatcher) { - this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_ROTATE, roomId, event.objectId, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_ROTATE, roomId, event.objectId, category)); } } } @@ -487,7 +487,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { this.deselectObject(roomId); - if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); this.setSelectedAvatar(roomId, 0, false); } @@ -500,9 +500,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const type = event.objectType; const category = this._roomEngine.getRoomObjectCategoryForType(type); - if(this._roomEngine.events) + if(NitroEventDispatcher) { - this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DOUBLE_CLICK, roomId, id, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DOUBLE_CLICK, roomId, id, category)); } } @@ -580,7 +580,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { if((event.altKey && !event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) { - if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MOVE, roomId, event.objectId, category)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MOVE, roomId, event.objectId, category)); } } return; @@ -606,7 +606,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { if((!event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) { - if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category)); + if(NitroEventDispatcher) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category)); } } return; @@ -619,9 +619,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const type = event.objectType; const category = this._roomEngine.getRoomObjectCategoryForType(type); - if(this._roomEngine.events) + if(NitroEventDispatcher) { - this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_ENTER, roomId, id, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_ENTER, roomId, id, category)); } } @@ -641,9 +641,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - if(this._roomEngine.events) + if(NitroEventDispatcher) { - this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_LEAVE, roomId, id, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_LEAVE, roomId, id, category)); } return; @@ -671,7 +671,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE: - this._roomEngine.events.dispatchEvent(new RoomEngineDimmerStateEvent(roomId, event.state, event.presetId, event.effectId, event.color, event.brightness)); + NitroEventDispatcher.dispatchEvent(new RoomEngineDimmerStateEvent(roomId, event.state, event.presetId, event.effectId, event.color, event.brightness)); return; } } @@ -710,124 +710,121 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const objectId = event.objectId; const objectType = event.objectType; const objectCategory = this._roomEngine.getRoomObjectCategoryForType(objectType); - const eventDispatcher = this._roomEngine.events; - - if(!eventDispatcher) return; if(RoomId.isRoomPreviewerId(roomId)) return; switch(event.type) { case RoomObjectWidgetRequestEvent.OPEN_WIDGET: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); return; case RoomObjectWidgetRequestEvent.CLOSE_WIDGET: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); return; case RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.contextMenu))); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.contextMenu))); return; case RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.PLACEHOLDER: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLACEHOLDER, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLACEHOLDER, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.CREDITFURNI: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.STACK_HEIGHT: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STACK_HEIGHT, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STACK_HEIGHT, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EXTERNAL_IMAGE, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EXTERNAL_IMAGE, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.STICKIE: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.PRESENT: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PRESENT, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PRESENT, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.TROPHY: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TROPHY, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TROPHY, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.TEASER: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TEASER, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TEASER, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.ECOTRONBOX: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ECOTRONBOX, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ECOTRONBOX, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.DIMMER: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_DIMMER, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_DIMMER, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REMOVE_DIMMER, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REMOVE_DIMMER, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.CLOTHING_CHANGE: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CLOTHING_CHANGE, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CLOTHING_CHANGE, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLAYLIST_EDITOR, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLAYLIST_EDITOR, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.MANNEQUIN: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MANNEQUIN, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MANNEQUIN, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU: - eventDispatcher.dispatchEvent(new RoomEngineUseProductEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineUseProductEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU: this._roomEngine.connection.send(new FurnitureGroupInfoComposer(event.objectId, event.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID))); return; case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EFFECTBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EFFECTBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYTROPHY_OPEN_DIALOG, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYTROPHY_OPEN_DIALOG, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN: this._roomEngine.connection.send(new GetResolutionAchievementsMessageComposer(event.objectId, 0)); return; case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_FAILED, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_FAILED, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_CONFIRM: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_CONFIRM, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_CONFIRM, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_ENGRAVING, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_ENGRAVING, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIDE_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIDE_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.INERNAL_LINK: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.ROOM_LINK: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK, roomId, objectId, objectCategory)); return; case RoomObjectWidgetRequestEvent.YOUTUBE: - eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_YOUTUBE, roomId, objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_YOUTUBE, roomId, objectId, objectCategory)); return; } } @@ -857,16 +854,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.SOUND_MACHINE_START: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_ON, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_ON, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_OFF, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_OFF, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, roomId, event.objectId, objectCategory)); return; } } @@ -889,16 +886,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectFurnitureActionEvent.JUKEBOX_INIT: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_INIT, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_INIT, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.JUKEBOX_START: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_ON, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_ON, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_OFF, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_OFF, roomId, event.objectId, objectCategory)); return; case RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE: - this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, roomId, event.objectId, objectCategory)); + NitroEventDispatcher.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, roomId, event.objectId, objectCategory)); return; } } @@ -927,7 +924,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK: - this._roomEngine.events.dispatchEvent(event); + NitroEventDispatcher.dispatchEvent(event); if(event.clickUrl && (event.clickUrl.length > 0)) { @@ -957,7 +954,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou break; } - if(eventType) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(eventType, roomId, event.objectId, this._roomEngine.getRoomObjectCategoryForType(event.objectType))); + if(eventType) NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(eventType, roomId, event.objectId, this._roomEngine.getRoomObjectCategoryForType(event.objectType))); } private onRoomObjectBadgeAssetEvent(event: RoomObjectBadgeAssetEvent, roomId: number): void @@ -991,10 +988,10 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectPlaySoundIdEvent.PLAY_SOUND: - this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); return; case RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH: - this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND_AT_PITCH, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND_AT_PITCH, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); return; } } @@ -1008,16 +1005,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED: - this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); break; case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED: - this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); break; case RoomObjectSamplePlaybackEvent.PLAY_SAMPLE: - this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); break; case RoomObjectSamplePlaybackEvent.CHANGE_PITCH: - this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.CHANGE_PITCH, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + NitroEventDispatcher.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.CHANGE_PITCH, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); break; } } @@ -1029,7 +1026,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou switch(event.type) { case RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR: - this._roomEngine.events.dispatchEvent(new RoomObjectHSLColorEnabledEvent(RoomObjectHSLColorEnabledEvent.ROOM_BACKGROUND_COLOR, roomId, event.enable, event.hue, event.saturation, event.lightness)); + NitroEventDispatcher.dispatchEvent(new RoomObjectHSLColorEnabledEvent(RoomObjectHSLColorEnabledEvent.ROOM_BACKGROUND_COLOR, roomId, event.enable, event.hue, event.saturation, event.lightness)); return; } } @@ -1064,7 +1061,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { if(!event || !this._roomEngine) return; - const eventDispatcher = this._roomEngine.events; + const eventDispatcher = NitroEventDispatcher; if(!eventDispatcher) return; @@ -1136,7 +1133,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { if(!event || !this._roomEngine) return; - const eventDispatcher = this._roomEngine.events; + const eventDispatcher = NitroEventDispatcher; if(!eventDispatcher) return; @@ -1704,11 +1701,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.resetSelectedObjectData(roomId); - if(this._roomEngine && this._roomEngine.events) + if(this._roomEngine && NitroEventDispatcher) { const placedInRoom = (roomObject && (roomObject.id === selectedData.id)); - this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlacedEvent(RoomEngineObjectEvent.PLACED, roomId, objectId, category, wallLocation, x, y, z, direction, placedInRoom, isTileEvent, isWallEvent, selectedData.instanceData)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectPlacedEvent(RoomEngineObjectEvent.PLACED, roomId, objectId, category, wallLocation, x, y, z, direction, placedInRoom, isTileEvent, isWallEvent, selectedData.instanceData)); } } @@ -1997,16 +1994,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou if(!_local_5) return; - if(!this._roomEngine || !this._roomEngine.events) return; + if(!this._roomEngine || !NitroEventDispatcher) return; - this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlacedOnUserEvent(RoomEngineObjectEvent.PLACED_ON_USER, roomId, objectId, category, _local_4.id, _local_4.category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectPlacedOnUserEvent(RoomEngineObjectEvent.PLACED_ON_USER, roomId, objectId, category, _local_4.id, _local_4.category)); } public setSelectedObject(roomId: number, objectId: number, category: number): void { if(!this._roomEngine) return; - const eventDispatcher = this._roomEngine.events; + const eventDispatcher = NitroEventDispatcher; if(!eventDispatcher) return; @@ -2040,7 +2037,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - eventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.SELECTED, roomId, objectId, category)); + NitroEventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.SELECTED, roomId, objectId, category)); return; } diff --git a/src/nitro/room/RoomObjectLogicFactory.ts b/src/nitro/room/RoomObjectLogicFactory.ts index c3f00e9e..06a74f35 100644 --- a/src/nitro/room/RoomObjectLogicFactory.ts +++ b/src/nitro/room/RoomObjectLogicFactory.ts @@ -1,24 +1,15 @@ import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, NitroLogger, RoomObjectLogicType } from '../../api'; import { EventDispatcher } from '../../common'; +import { RoomObjectEvent } from '../../events'; import { RoomObjectLogicBase } from '../../room'; import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object'; export class RoomObjectLogicFactory implements IRoomObjectLogicFactory { - private _events: IEventDispatcher; - - private _cachedEvents: Map; - private _registeredEvents: Map; - private _functions: Function[]; - - constructor() - { - this._events = new EventDispatcher(); - - this._cachedEvents = new Map(); - this._registeredEvents = new Map(); - this._functions = []; - } + private _events: IEventDispatcher = new EventDispatcher(); + private _cachedEvents: Map = new Map(); + private _registeredEvents: Map = new Map(); + private _functions: ((event: RoomObjectEvent) => void)[] = []; public getLogic(type: string): IRoomObjectEventHandler { @@ -63,7 +54,7 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory } } - public registerEventFunction(func: Function): void + public registerEventFunction(func: (event: RoomObjectEvent) => void): void { if(!func) return; @@ -79,7 +70,7 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory } } - public removeEventFunction(func: Function): void + public removeEventFunction(func: (event: RoomObjectEvent) => void): void { if(!func) return; diff --git a/src/nitro/room/preview/RoomPreviewer.ts b/src/nitro/room/preview/RoomPreviewer.ts index a02c0772..c2921096 100644 --- a/src/nitro/room/preview/RoomPreviewer.ts +++ b/src/nitro/room/preview/RoomPreviewer.ts @@ -3,13 +3,13 @@ import { Container, DisplayObject } from '@pixi/display'; import { Point, Rectangle } from '@pixi/math'; import { Sprite } from '@pixi/sprite'; import { IGetImageListener, IImageResult, IObjectData, IRoomEngine, IRoomObjectController, IRoomRenderingCanvas, IVector3D, LegacyDataType, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../../api'; -import { RoomEngineEvent, RoomEngineObjectEvent } from '../../../events'; +import { NitroEventDispatcher, RoomEngineEvent, RoomEngineObjectEvent } from '../../../events'; import { GetTickerTime, NitroSprite } from '../../../pixi-proxy'; import { RoomId } from '../../../room'; import { FloorHeightMapMessageParser, RoomEntryTileMessageParser } from '../../communication'; +import { RoomEngine } from '../RoomEngine'; import { ObjectRoomMapUpdateMessage } from '../messages'; import { RoomPlaneParser } from '../object/RoomPlaneParser'; -import { RoomEngine } from '../RoomEngine'; import { LegacyWallGeometry } from '../utils/LegacyWallGeometry'; export class RoomPreviewer @@ -54,11 +54,11 @@ export class RoomPreviewer this.onRoomObjectAdded = this.onRoomObjectAdded.bind(this); this.onRoomInitializedonRoomInitialized = this.onRoomInitializedonRoomInitialized.bind(this); - if(this.isRoomEngineReady && this._roomEngine.events) + if(this.isRoomEngineReady && NitroEventDispatcher) { - this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); - this._roomEngine.events.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); - this._roomEngine.events.addEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); + NitroEventDispatcher.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); + NitroEventDispatcher.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); + NitroEventDispatcher.addEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); } this.createRoomForPreview(); @@ -68,11 +68,11 @@ export class RoomPreviewer { this.reset(true); - if(this.isRoomEngineReady && this._roomEngine.events) + if(this.isRoomEngineReady && NitroEventDispatcher) { - this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); - this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); - this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); + NitroEventDispatcher.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); + NitroEventDispatcher.removeEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); + NitroEventDispatcher.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); } if(this._backgroundSprite) @@ -845,7 +845,7 @@ export class RoomPreviewer public get isRoomEngineReady(): boolean { - return (this._roomEngine && this._roomEngine.ready); + return true; } public get roomId(): number diff --git a/src/nitro/session/RoomSessionManager.ts b/src/nitro/session/RoomSessionManager.ts index 2a68eefb..5bc2ae44 100644 --- a/src/nitro/session/RoomSessionManager.ts +++ b/src/nitro/session/RoomSessionManager.ts @@ -1,52 +1,30 @@ -import { INitroCommunicationManager, IRoomEngine, IRoomHandlerListener, IRoomSession, IRoomSessionManager } from '../../api'; -import { NitroManager } from '../../common'; -import { RoomEngineEvent, RoomSessionEvent } from '../../events'; +import { ICommunicationManager, IRoomEngine, IRoomHandlerListener, IRoomSession, IRoomSessionManager } from '../../api'; +import { NitroEventDispatcher, RoomSessionEvent } from '../../events'; import { BaseHandler, GenericErrorHandler, PetPackageHandler, PollHandler, RoomChatHandler, RoomDataHandler, RoomDimmerPresetsHandler, RoomPermissionsHandler, RoomPresentHandler, RoomSessionHandler, RoomUsersHandler, WordQuizHandler } from './handler'; import { RoomSession } from './RoomSession'; -export class RoomSessionManager extends NitroManager implements IRoomSessionManager, IRoomHandlerListener +export class RoomSessionManager implements IRoomSessionManager, IRoomHandlerListener { - private _communication: INitroCommunicationManager; + private _communication: ICommunicationManager; private _roomEngine: IRoomEngine; - private _handlers: BaseHandler[]; - private _sessions: Map; - private _pendingSession: IRoomSession; + private _handlers: BaseHandler[] = []; + private _sessions: Map = new Map(); + private _pendingSession: IRoomSession = null; - private _sessionStarting: boolean; - private _viewerSession: IRoomSession; + private _sessionStarting: boolean = false; + private _viewerSession: IRoomSession = null; - constructor(communication: INitroCommunicationManager, roomEngine: IRoomEngine) + constructor(communication: ICommunicationManager, roomEngine: IRoomEngine) { - super(); - this._communication = communication; this._roomEngine = roomEngine; - - this._handlers = []; - this._sessions = new Map(); - this._pendingSession = null; - - this._sessionStarting = false; - this._viewerSession = null; - - this.onRoomEngineEvent = this.onRoomEngineEvent.bind(this); } - protected onInit(): void + public async init(): Promise { this.createHandlers(); - this.processPendingSession(); - - this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineEvent); - } - - protected onDispose(): void - { - this._roomEngine.events.removeEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineEvent); - - super.onDispose(); } private createHandlers(): void @@ -82,14 +60,9 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana } } - public onRoomEngineEvent(event: RoomEngineEvent): void - { - this.processPendingSession(); - } - private processPendingSession(): void { - if(!this._pendingSession || !this._roomEngine.ready) return; + if(!this._pendingSession) return; this.addSession(this._pendingSession); @@ -117,13 +90,6 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana private addSession(roomSession: IRoomSession): boolean { - if(!this._roomEngine.ready) - { - this._pendingSession = roomSession; - - return false; - } - this._sessionStarting = true; if(this._sessions.get(this.getRoomId(roomSession.roomId))) @@ -135,7 +101,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana this._sessions.set(this.getRoomId(roomSession.roomId), roomSession); - this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.CREATED, roomSession)); + NitroEventDispatcher.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.CREATED, roomSession)); this._viewerSession = roomSession; @@ -157,7 +123,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana return false; } - this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.STARTED, session)); + NitroEventDispatcher.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.STARTED, session)); this.setHandlers(session); @@ -172,7 +138,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana this._sessions.delete(this.getRoomId(id)); - this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ENDED, session, openLandingView)); + NitroEventDispatcher.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ENDED, session, openLandingView)); session.dispose(); } @@ -215,7 +181,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana return 'hard_coded_room_id'; } - public get communication(): INitroCommunicationManager + public get communication(): ICommunicationManager { return this._communication; } diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index 9a4e389d..1bfb5c42 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -1,7 +1,6 @@ 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 '../../common'; -import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; +import { GetAssetManager, ICommunicationManager, IFurnitureData, IGroupInformationManager, IMessageComposer, IProductData, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; +import { MysteryBoxKeysUpdateEvent, NitroEventDispatcher, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; import { Nitro } from '../Nitro'; import { AccountSafetyLockStatusChangeMessageEvent, AccountSafetyLockStatusChangeParser, AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, EmailStatusResultEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication'; import { HabboWebTools } from '../utils/HabboWebTools'; @@ -11,9 +10,9 @@ import { BadgeImageManager } from './badge/BadgeImageManager'; import { FurnitureDataLoader } from './furniture/FurnitureDataLoader'; import { ProductDataLoader } from './product/ProductDataLoader'; -export class SessionDataManager extends NitroManager implements ISessionDataManager +export class SessionDataManager implements ISessionDataManager { - private _communication: INitroCommunicationManager; + private _communication: ICommunicationManager; private _userId: number; private _name: string; @@ -26,88 +25,56 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private _canChangeName: boolean; private _safetyLocked: boolean; - private _ignoredUsersManager: IgnoredUsersManager; - private _groupInformationManager: IGroupInformationManager; + private _ignoredUsersManager: IgnoredUsersManager = new IgnoredUsersManager(this); + private _groupInformationManager: IGroupInformationManager = new GroupInformationManager(this); - private _clubLevel: number; - private _securityLevel: number; - private _isAmbassador: boolean; - private _noobnessLevel: number; - private _isEmailVerified: boolean; + private _clubLevel: number = 0; + private _securityLevel: number = 0; + private _isAmbassador: boolean = false; + private _noobnessLevel: number = -1; + private _isEmailVerified: boolean = false; - private _systemOpen: boolean; - private _systemShutdown: boolean; - private _isAuthenticHabbo: boolean; - private _isRoomCameraFollowDisabled: boolean; - private _uiFlags: number; + private _systemOpen: boolean = false; + private _systemShutdown: boolean = false; + private _isAuthenticHabbo: boolean = false; + private _isRoomCameraFollowDisabled: boolean = false; + private _uiFlags: number = 0; - private _floorItems: Map; - private _wallItems: Map; - private _products: Map; - private _furnitureData: FurnitureDataLoader; - private _productData: ProductDataLoader; + private _floorItems: Map = new Map(); + private _wallItems: Map = new Map(); + private _products: Map = new Map(); + private _furnitureData: FurnitureDataLoader = new FurnitureDataLoader(this._floorItems, this._wallItems); + private _productData: ProductDataLoader = new ProductDataLoader(this._products); + private _tags: string[] = []; - private _furnitureReady: boolean; - private _productsReady: boolean; - private _furnitureListenersNotified: boolean; - private _pendingFurnitureListeners: IFurnitureDataListener[]; - private _pendingProductListeners: IProductDataListener[]; - private _tags: string[]; + private _badgeImageManager: BadgeImageManager = new BadgeImageManager(GetAssetManager(), this); - private _badgeImageManager: BadgeImageManager; - - constructor(communication: INitroCommunicationManager) + constructor(communication: ICommunicationManager) { - super(); - this._communication = communication; this.resetUserInfo(); - this._ignoredUsersManager = new IgnoredUsersManager(this); - this._groupInformationManager = new GroupInformationManager(this); - - this._clubLevel = 0; - this._securityLevel = 0; - this._isAmbassador = false; - this._noobnessLevel = -1; - this._isEmailVerified = false; - - this._systemOpen = false; - this._systemShutdown = false; - this._isAuthenticHabbo = false; - this._isRoomCameraFollowDisabled = false; - this._uiFlags = 0; - - this._floorItems = new Map(); - this._wallItems = new Map(); - this._products = new Map(); - this._furnitureData = null; - - this._furnitureReady = false; - this._productsReady = false; - this._furnitureListenersNotified = false; - this._pendingFurnitureListeners = []; - this._pendingProductListeners = []; - this._tags = []; - - this._badgeImageManager = null; - - this.onFurnitureDataReadyEvent = this.onFurnitureDataReadyEvent.bind(this); - this.onProductDataReadyEvent = this.onProductDataReadyEvent.bind(this); this.onNitroSettingsEvent = this.onNitroSettingsEvent.bind(this); } - protected onInit(): void + public async init(): Promise { - this.loadFurnitureData(); - this.loadProductData(); - this.loadBadgeImageManager(); + await this._furnitureData.init(); + await this._productData.init(); - (this._ignoredUsersManager && this._ignoredUsersManager.init()); - (this._groupInformationManager && this._groupInformationManager.init()); + this._badgeImageManager.init(); + this._ignoredUsersManager.init(); + this._groupInformationManager.init(); + + this._communication.registerMessageEvent(new FigureUpdateEvent((event: FigureUpdateEvent) => + { + this._figure = event.getParser().figure; + this._gender = event.getParser().gender; + + HabboWebTools.updateFigure(this._figure); + })); - this._communication.registerMessageEvent(new FigureUpdateEvent(this.onUserFigureEvent.bind(this))); this._communication.registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this))); this._communication.registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this))); this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this))); @@ -122,30 +89,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._communication.registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this))); this._communication.registerMessageEvent(new EmailStatusResultEvent(this.onEmailStatus.bind(this))); - Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); - } - - protected onDispose(): void - { - this.destroyFurnitureData(); - - if(this._ignoredUsersManager) - { - this._ignoredUsersManager.dispose(); - - this._ignoredUsersManager = null; - } - - if(this._groupInformationManager) - { - this._groupInformationManager.dispose(); - - this._groupInformationManager = null; - } - - Nitro.instance.events.removeEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); - - super.onDispose(); + NitroEventDispatcher.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); } private resetUserInfo(): void @@ -159,92 +103,9 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._safetyLocked = false; } - private loadFurnitureData(): void + public getAllFurnitureData(): IFurnitureData[] { - this.destroyFurnitureData(); - - this._furnitureData = new FurnitureDataLoader(this._floorItems, this._wallItems, Nitro.instance.localization); - - this._furnitureData.addEventListener(FurnitureDataLoader.FURNITURE_DATA_READY, this.onFurnitureDataReadyEvent); - - this._furnitureData.loadFurnitureData(NitroConfiguration.getValue('furnidata.url')); - } - - private loadProductData(): void - { - this.destroyProductData(); - - this._productData = new ProductDataLoader(this._products); - - this._productData.addEventListener(ProductDataLoader.PDP_PRODUCT_DATA_READY, this.onProductDataReadyEvent); - - this._productData.loadProductData(NitroConfiguration.getValue('productdata.url')); - } - - private loadBadgeImageManager(): void - { - if(this._badgeImageManager) return; - - this._badgeImageManager = new BadgeImageManager(GetAssetManager(), this); - this._badgeImageManager.init(); - } - - public hasProductData(listener: IProductDataListener): boolean - { - if(this._productsReady) return true; - - if(listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); - - return false; - } - - public getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] - { - if(!this._furnitureReady) - { - if(this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); - - return null; - } - - const furnitureData: IFurnitureData[] = []; - - for(const data of this._floorItems.values()) - { - if(!data) continue; - - furnitureData.push(data); - } - - for(const data of this._wallItems.values()) - { - if(!data) continue; - - furnitureData.push(data); - } - - return furnitureData; - } - - public removePendingFurniDataListener(listener: IFurnitureDataListener): void - { - if(!this._pendingFurnitureListeners) return; - - const index = this._pendingFurnitureListeners.indexOf(listener); - - if(index === -1) return; - - this._pendingFurnitureListeners.splice(index, 1); - } - - private onUserFigureEvent(event: FigureUpdateEvent): void - { - if(!event || !event.connection) return; - - this._figure = event.getParser().figure; - this._gender = event.getParser().gender; - - HabboWebTools.updateFigure(this._figure); + return [ ...Array.from(this._floorItems.values()), ...Array.from(this._wallItems.values()) ]; } private onUserInfoEvent(event: UserInfoEvent): void @@ -268,7 +129,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._canChangeName = userInfo.canChangeName; this._safetyLocked = userInfo.safetyLocked; - (this._ignoredUsersManager && this._ignoredUsersManager.requestIgnoredUsers()); + this._ignoredUsersManager.requestIgnoredUsers(); } private onUserPermissionsEvent(event: UserPermissionsEvent): void @@ -312,7 +173,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._canChangeName = false; - this.events.dispatchEvent(new UserNameUpdateEvent(parser.name)); + NitroEventDispatcher.dispatchEvent(new UserNameUpdateEvent(parser.name)); } private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void @@ -328,7 +189,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._name = parser.newName; this._canChangeName = false; - this.events.dispatchEvent(new UserNameUpdateEvent(this._name)); + NitroEventDispatcher.dispatchEvent(new UserNameUpdateEvent(this._name)); } private onUserTags(event: UserTagsMessageEvent): void @@ -353,36 +214,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana HabboWebTools.roomVisited(parser.roomId); } - private onFurnitureDataReadyEvent(event: INitroEvent): void - { - this._furnitureData.removeEventListener(FurnitureDataLoader.FURNITURE_DATA_READY, this.onFurnitureDataReadyEvent); - - this._furnitureReady = true; - - if(!this._furnitureListenersNotified) - { - this._furnitureListenersNotified = true; - - if(this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) - { - for(const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); - } - } - - this._pendingProductListeners = []; - } - - private onProductDataReadyEvent(event: INitroEvent): void - { - this._productData.removeEventListener(ProductDataLoader.PDP_PRODUCT_DATA_READY, this.onProductDataReadyEvent); - - this._productsReady = true; - - for(const listener of this._pendingProductListeners) listener && listener.loadProductData(); - - this._pendingProductListeners = []; - } - private onInClientLinkEvent(event: InClientLinkEvent): void { if(!event) return; @@ -402,17 +233,14 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana if(!parser) return; - this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); + NitroEventDispatcher.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); } private onNoobnessLevelMessageEvent(event: NoobnessLevelMessageEvent): void { this._noobnessLevel = event.getParser().noobnessLevel; - if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) - { - NitroConfiguration.setValue('new.identity', 1); - } + if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) NitroConfiguration.setValue('new.identity', 1); } private onAccountSafetyLockStatusChangeMessageEvent(event: AccountSafetyLockStatusChangeMessageEvent): void @@ -423,18 +251,12 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana if(!parser) return; - this._safetyLocked = (parser.status == AccountSafetyLockStatusChangeParser.SAFETY_LOCK_STATUS_LOCKED); + this._safetyLocked = (parser.status === AccountSafetyLockStatusChangeParser.SAFETY_LOCK_STATUS_LOCKED); } private onEmailStatus(event: EmailStatusResultEvent): void { - if(!event) return; - - const parser = event.getParser(); - - if(!parser) return; - - this._isEmailVerified = parser.isVerified; + this._isEmailVerified = event?.getParser()?.isVerified ?? false; } private onNitroSettingsEvent(event: NitroSettingsEvent): void @@ -442,25 +264,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._isRoomCameraFollowDisabled = event.cameraFollow; this._uiFlags = event.flags; - this.events.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags)); - } - - private destroyFurnitureData(): void - { - if(!this._furnitureData) return; - - this._furnitureData.dispose(); - - this._furnitureData = null; - } - - private destroyProductData(): void - { - if(!this._productData) return; - - this._productData.dispose(); - - this._productData = null; + NitroEventDispatcher.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags)); } public getFloorItemData(id: number): IFurnitureData @@ -482,6 +286,8 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana return item; } + + return null; } public getWallItemData(id: number): IFurnitureData @@ -503,12 +309,12 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana return item; } + + return null; } public getProductData(type: string): IProductData { - if(!this._productsReady) this.loadProductData(); - return this._products.get(type); } @@ -551,7 +357,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public hasSecurity(level: number): boolean { - return this._securityLevel >= level; + return (this._securityLevel >= level); } public giveRespect(userId: number): void @@ -579,22 +385,22 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public ignoreUser(name: string): void { - (this._ignoredUsersManager && this._ignoredUsersManager.ignoreUser(name)); + this._ignoredUsersManager.ignoreUser(name); } public unignoreUser(name: string): void { - (this._ignoredUsersManager && this._ignoredUsersManager.unignoreUser(name)); + this._ignoredUsersManager.unignoreUser(name); } public isUserIgnored(name: string): boolean { - return (this._ignoredUsersManager && this._ignoredUsersManager.isIgnored(name)); + return this._ignoredUsersManager.isIgnored(name); } public getGroupBadge(groupId: number): string { - return (this._groupInformationManager && this._groupInformationManager.getGroupBadge(groupId)); + return this._groupInformationManager.getGroupBadge(groupId); } public send(composer: IMessageComposer): void @@ -602,7 +408,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._communication.connection.send(composer); } - public get communication(): INitroCommunicationManager + public get communication(): ICommunicationManager { return this._communication; } diff --git a/src/nitro/session/badge/BadgeImageManager.ts b/src/nitro/session/badge/BadgeImageManager.ts index 77aa9743..98e2761b 100644 --- a/src/nitro/session/badge/BadgeImageManager.ts +++ b/src/nitro/session/badge/BadgeImageManager.ts @@ -1,6 +1,6 @@ import { Resource, Texture } from '@pixi/core'; import { IAssetManager, IDisposable, IMessageEvent, NitroConfiguration } from '../../../api'; -import { BadgeImageReadyEvent } from '../../../events'; +import { BadgeImageReadyEvent, NitroEventDispatcher } from '../../../events'; import { NitroContainer, NitroSprite, NitroTexture, TextureUtils } from '../../../pixi-proxy'; import { GroupBadgePartsEvent } from '../../communication'; import { SessionDataManager } from './../SessionDataManager'; @@ -116,7 +116,7 @@ export class BadgeImageManager implements IDisposable const texture = this._assets.getTexture(url); - if(texture && this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone())); + if(texture && this._sessionDataManager) NitroEventDispatcher.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone())); }) .catch(err => { @@ -230,7 +230,7 @@ export class BadgeImageManager implements IDisposable const texture = TextureUtils.generateTexture(container); this._assets.setTexture(groupBadge.code, texture); - if(this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(groupBadge.code, texture)); + if(this._sessionDataManager) NitroEventDispatcher.dispatchEvent(new BadgeImageReadyEvent(groupBadge.code, texture)); } private onGroupBadgePartsEvent(event: GroupBadgePartsEvent): void diff --git a/src/nitro/session/furniture/FurnitureDataLoader.ts b/src/nitro/session/furniture/FurnitureDataLoader.ts index d04ce12e..65c0aea4 100644 --- a/src/nitro/session/furniture/FurnitureDataLoader.ts +++ b/src/nitro/session/furniture/FurnitureDataLoader.ts @@ -1,56 +1,33 @@ -import { FurnitureType, IFurnitureData, INitroLocalizationManager, NitroLogger } from '../../../api'; -import { EventDispatcher } from '../../../common'; -import { NitroEvent } from '../../../events'; +import { FurnitureType, IFurnitureData, NitroConfiguration } from '../../../api'; +import { Nitro } from '../../Nitro'; import { FurnitureData } from './FurnitureData'; -export class FurnitureDataLoader extends EventDispatcher +export class FurnitureDataLoader { - public static FURNITURE_DATA_READY: string = 'FDP_FURNITURE_DATA_READY'; - public static FURNITURE_DATA_ERROR: string = 'FDP_FURNITURE_DATA_ERROR'; - private _floorItems: Map; private _wallItems: Map; - private _localization: INitroLocalizationManager; - constructor(floorItems: Map, wallItems: Map, localization: INitroLocalizationManager) + constructor(floorItems: Map, wallItems: Map) { - super(); - this._floorItems = floorItems; this._wallItems = wallItems; - this._localization = localization; } - public loadFurnitureData(url: string): void + public async init(): Promise { - if(!url) return; + const url = NitroConfiguration.getValue('furnidata.url'); - fetch(url) - .then(response => response.json()) - .then(data => this.onFurnitureDataLoaded(data)) - .catch(err => this.onFurnitureDataError(err)); - } + if(!url || !url.length) throw new Error('invalid furni data url'); - private onFurnitureDataLoaded(data: { [index: string]: any }): void - { - if(!data) return; + const response = await fetch(url); - if((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) NitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.'); + if(response.status !== 200) throw new Error('Invalid furni data file'); - if(data.roomitemtypes) this.parseFloorItems(data.roomitemtypes); + const responseData = await response.json(); - if(data.wallitemtypes) this.parseWallItems(data.wallitemtypes); + if(responseData.roomitemtypes) this.parseFloorItems(responseData.roomitemtypes); - this.dispatchEvent(new NitroEvent(FurnitureDataLoader.FURNITURE_DATA_READY)); - } - - private onFurnitureDataError(error: Error): void - { - if(!error) return; - - NitroLogger.error(error); - - this.dispatchEvent(new NitroEvent(FurnitureDataLoader.FURNITURE_DATA_ERROR)); + if(responseData.wallitemtypes) this.parseWallItems(responseData.wallitemtypes); } private parseFloorItems(data: any): void @@ -113,17 +90,15 @@ export class FurnitureDataLoader extends EventDispatcher private updateLocalizations(furniture: FurnitureData): void { - if(!this._localization) return; - switch(furniture.type) { case FurnitureType.FLOOR: - this._localization.setValue(('roomItem.name.' + furniture.id), furniture.name); - this._localization.setValue(('roomItem.desc.' + furniture.id), furniture.description); + Nitro.instance.localization.setValue(('roomItem.name.' + furniture.id), furniture.name); + Nitro.instance.localization.setValue(('roomItem.desc.' + furniture.id), furniture.description); return; case FurnitureType.WALL: - this._localization.setValue(('wallItem.name.' + furniture.id), furniture.name); - this._localization.setValue(('wallItem.desc.' + furniture.id), furniture.description); + Nitro.instance.localization.setValue(('wallItem.name.' + furniture.id), furniture.name); + Nitro.instance.localization.setValue(('wallItem.desc.' + furniture.id), furniture.description); return; } } diff --git a/src/nitro/session/handler/GenericErrorHandler.ts b/src/nitro/session/handler/GenericErrorHandler.ts index 79ed20aa..9852f965 100644 --- a/src/nitro/session/handler/GenericErrorHandler.ts +++ b/src/nitro/session/handler/GenericErrorHandler.ts @@ -1,5 +1,5 @@ import { GenericErrorEnum, IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionErrorMessageEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionErrorMessageEvent } from '../../../events'; import { GenericErrorEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -37,6 +37,6 @@ export class GenericErrorHandler extends BaseHandler if(!type || type.length == 0) return; - this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, roomSession)); + NitroEventDispatcher.dispatchEvent(new RoomSessionErrorMessageEvent(type, roomSession)); } } diff --git a/src/nitro/session/handler/PetPackageHandler.ts b/src/nitro/session/handler/PetPackageHandler.ts index 0ef7f34f..aa5ad986 100644 --- a/src/nitro/session/handler/PetPackageHandler.ts +++ b/src/nitro/session/handler/PetPackageHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionPetPackageEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionPetPackageEvent } from '../../../events'; import { OpenPetPackageRequestedMessageEvent, OpenPetPackageResultMessageEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -25,7 +25,7 @@ export class PetPackageHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_REQUESTED, session, parser.objectId, parser.figureData, 0, null)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_REQUESTED, session, parser.objectId, parser.figureData, 0, null)); } private onOpenPetPackageResult(event: OpenPetPackageResultMessageEvent): void @@ -40,6 +40,6 @@ export class PetPackageHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_RESULT, session, parser.objectId, null, parser.nameValidationStatus, parser.nameValidationInfo)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_RESULT, session, parser.objectId, null, parser.nameValidationStatus, parser.nameValidationInfo)); } } diff --git a/src/nitro/session/handler/PollHandler.ts b/src/nitro/session/handler/PollHandler.ts index d4b06cc3..b2a4bfb2 100644 --- a/src/nitro/session/handler/PollHandler.ts +++ b/src/nitro/session/handler/PollHandler.ts @@ -1,6 +1,6 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionPollEvent, RoomSessionVoteEvent } from '../../../events'; -import { PollContentsEvent, PollErrorEvent, PollOfferEvent, StartRoomPollEvent, RoomPollResultEvent } from '../../communication'; +import { NitroEventDispatcher, RoomSessionPollEvent, RoomSessionVoteEvent } from '../../../events'; +import { PollContentsEvent, PollErrorEvent, PollOfferEvent, RoomPollResultEvent, StartRoomPollEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; export class PollHandler extends BaseHandler @@ -36,7 +36,7 @@ export class PollHandler extends BaseHandler pollEvent.questionArray = parser.questionArray; pollEvent.npsPoll = parser.npsPoll; - this.listener.events.dispatchEvent(pollEvent); + NitroEventDispatcher.dispatchEvent(pollEvent); } private onPollOfferEvent(event: PollOfferEvent): void @@ -56,7 +56,7 @@ export class PollHandler extends BaseHandler pollEvent.summary = parser.headline; pollEvent.summary = parser.summary; - this.listener.events.dispatchEvent(pollEvent); + NitroEventDispatcher.dispatchEvent(pollEvent); } private onPollErrorEvent(event: PollErrorEvent): void @@ -75,7 +75,7 @@ export class PollHandler extends BaseHandler pollEvent.headline = '???'; pollEvent.summary = '???'; - this.listener.events.dispatchEvent(pollEvent); + NitroEventDispatcher.dispatchEvent(pollEvent); } private onStartRoomPollEvent(event: StartRoomPollEvent): void @@ -92,7 +92,7 @@ export class PollHandler extends BaseHandler const pollEvent = new RoomSessionVoteEvent(RoomSessionVoteEvent.VOTE_QUESTION, session, parser.question, parser.choices); - this.listener.events.dispatchEvent(pollEvent); + NitroEventDispatcher.dispatchEvent(pollEvent); } private onRoomPollResultEvent(event: RoomPollResultEvent): void @@ -109,6 +109,6 @@ export class PollHandler extends BaseHandler const pollEvent = new RoomSessionVoteEvent(RoomSessionVoteEvent.VOTE_RESULT, session, parser.question, parser.choices, parser.SafeStr_7651, parser.SafeStr_7654); - this.listener.events.dispatchEvent(pollEvent); + NitroEventDispatcher.dispatchEvent(pollEvent); } } diff --git a/src/nitro/session/handler/RoomChatHandler.ts b/src/nitro/session/handler/RoomChatHandler.ts index 5f84504a..81668286 100644 --- a/src/nitro/session/handler/RoomChatHandler.ts +++ b/src/nitro/session/handler/RoomChatHandler.ts @@ -1,6 +1,6 @@ import { IConnection, IRoomHandlerListener, SystemChatStyleEnum } from '../../../api'; -import { RoomSessionChatEvent } from '../../../events'; -import { FloodControlEvent, PetRespectNoficationEvent, PetSupplementedNotificationEvent, PetSupplementTypeEnum, RemainingMuteEvent, RespectReceivedEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitHandItemReceivedEvent } from '../../communication'; +import { NitroEventDispatcher, RoomSessionChatEvent } from '../../../events'; +import { FloodControlEvent, PetRespectNoficationEvent, PetSupplementTypeEnum, PetSupplementedNotificationEvent, RemainingMuteEvent, RespectReceivedEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitHandItemReceivedEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; export class RoomChatHandler extends BaseHandler @@ -39,7 +39,7 @@ export class RoomChatHandler extends BaseHandler const chatEvent = new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.roomIndex, parser.message, chatType, parser.bubble); - this.listener.events.dispatchEvent(chatEvent); + NitroEventDispatcher.dispatchEvent(chatEvent); } private onRoomUnitHandItemReceivedEvent(event: RoomUnitHandItemReceivedEvent): void @@ -54,7 +54,7 @@ export class RoomChatHandler extends BaseHandler if(!parser) return; - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.giverUserId, '', RoomSessionChatEvent.CHAT_TYPE_HAND_ITEM_RECEIVED, SystemChatStyleEnum.GENERIC, null, parser.handItemType)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.giverUserId, '', RoomSessionChatEvent.CHAT_TYPE_HAND_ITEM_RECEIVED, SystemChatStyleEnum.GENERIC, null, parser.handItemType)); } private onRespectReceivedEvent(event: RespectReceivedEvent): void @@ -73,7 +73,7 @@ export class RoomChatHandler extends BaseHandler if(!userData) return; - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, userData.roomIndex, '', RoomSessionChatEvent.CHAT_TYPE_RESPECT, SystemChatStyleEnum.GENERIC)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, userData.roomIndex, '', RoomSessionChatEvent.CHAT_TYPE_RESPECT, SystemChatStyleEnum.GENERIC)); } private onPetRespectNoficationEvent(event: PetRespectNoficationEvent): void @@ -96,7 +96,7 @@ export class RoomChatHandler extends BaseHandler if(parser.isTreat) chatType = RoomSessionChatEvent.CHAT_TYPE_PETTREAT; - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC)); } private onPetSupplementedNotificationEvent(event: PetSupplementedNotificationEvent): void @@ -136,7 +136,7 @@ export class RoomChatHandler extends BaseHandler break; } - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC, null, userRoomIndex)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC, null, userRoomIndex)); } private onFloodControlEvent(event: FloodControlEvent): void @@ -153,7 +153,7 @@ export class RoomChatHandler extends BaseHandler const seconds = parser.seconds; - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.FLOOD_EVENT, session, -1, seconds.toString(), 0, 0)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.FLOOD_EVENT, session, -1, seconds.toString(), 0, 0)); } private onRemainingMuteEvent(event: RemainingMuteEvent): void @@ -168,6 +168,6 @@ export class RoomChatHandler extends BaseHandler if(!parser) return; - this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, session.ownRoomIndex, '', RoomSessionChatEvent.CHAT_TYPE_MUTE_REMAINING, SystemChatStyleEnum.GENERIC, null, parser.seconds)); + NitroEventDispatcher.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, session.ownRoomIndex, '', RoomSessionChatEvent.CHAT_TYPE_MUTE_REMAINING, SystemChatStyleEnum.GENERIC, null, parser.seconds)); } } diff --git a/src/nitro/session/handler/RoomDataHandler.ts b/src/nitro/session/handler/RoomDataHandler.ts index 18c3f70f..19321bba 100644 --- a/src/nitro/session/handler/RoomDataHandler.ts +++ b/src/nitro/session/handler/RoomDataHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionEvent, RoomSessionPropertyUpdateEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionEvent, RoomSessionPropertyUpdateEvent } from '../../../events'; import { GetGuestRoomResultEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -34,7 +34,7 @@ export class RoomDataHandler extends BaseHandler roomSession.allowPets = roomData.allowPets; roomSession.moderationSettings = parser.moderation; - this.listener.events.dispatchEvent(new RoomSessionPropertyUpdateEvent(RoomSessionPropertyUpdateEvent.RSDUE_ALLOW_PETS, roomSession)); - this.listener.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ROOM_DATA, roomSession)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPropertyUpdateEvent(RoomSessionPropertyUpdateEvent.RSDUE_ALLOW_PETS, roomSession)); + NitroEventDispatcher.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ROOM_DATA, roomSession)); } } diff --git a/src/nitro/session/handler/RoomDimmerPresetsHandler.ts b/src/nitro/session/handler/RoomDimmerPresetsHandler.ts index e1d0307b..ac0f49e1 100644 --- a/src/nitro/session/handler/RoomDimmerPresetsHandler.ts +++ b/src/nitro/session/handler/RoomDimmerPresetsHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionDimmerPresetsEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionDimmerPresetsEvent } from '../../../events'; import { RoomDimmerPresetsEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -39,6 +39,6 @@ export class RoomDimmerPresetsHandler extends BaseHandler i++; } - this.listener && this.listener.events.dispatchEvent(presetEvent); + NitroEventDispatcher.dispatchEvent(presetEvent); } } diff --git a/src/nitro/session/handler/RoomPresentHandler.ts b/src/nitro/session/handler/RoomPresentHandler.ts index 8ba41da0..c327175e 100644 --- a/src/nitro/session/handler/RoomPresentHandler.ts +++ b/src/nitro/session/handler/RoomPresentHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionPresentEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionPresentEvent } from '../../../events'; import { PresentOpenedMessageEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -26,9 +26,7 @@ export class RoomPresentHandler extends BaseHandler if(!session) return; - if(this.listener && this.listener.events) this.listener.events.dispatchEvent( - new RoomSessionPresentEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, session, parser.classId, parser.itemType, - parser.productCode, parser.placedItemId, parser.placedItemType, parser.placedInRoom, parser.petFigureString)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPresentEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, session, parser.classId, parser.itemType, parser.productCode, parser.placedItemId, parser.placedItemType, parser.placedInRoom, parser.petFigureString)); } diff --git a/src/nitro/session/handler/RoomSessionHandler.ts b/src/nitro/session/handler/RoomSessionHandler.ts index 57ce678e..e776ab54 100644 --- a/src/nitro/session/handler/RoomSessionHandler.ts +++ b/src/nitro/session/handler/RoomSessionHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionDoorbellEvent, RoomSessionSpectatorModeEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionDoorbellEvent, RoomSessionSpectatorModeEvent } from '../../../events'; import { DesktopViewEvent, FlatAccessDeniedMessageEvent, GoToFlatMessageComposer, RoomDoorbellAcceptedEvent, RoomEnterEvent, RoomReadyMessageEvent, YouAreSpectatorMessageEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -65,14 +65,11 @@ export class RoomSessionHandler extends BaseHandler } else { - if(this.listener.events) - { - const session = this.listener.getSession(this.roomId); + const session = this.listener.getSession(this.roomId); - if(!session) return; + if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, session, username)); - } + NitroEventDispatcher.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, session, username)); } } @@ -92,14 +89,11 @@ export class RoomSessionHandler extends BaseHandler } else { - if(this.listener.events) - { - const session = this.listener.getSession(this.roomId); + const session = this.listener.getSession(this.roomId); - if(!session) return; + if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, session, username)); - } + NitroEventDispatcher.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, session, username)); } } @@ -112,7 +106,7 @@ export class RoomSessionHandler extends BaseHandler if(!session) return; session.isSpectator = true; - this.listener.events.dispatchEvent(new RoomSessionSpectatorModeEvent(RoomSessionSpectatorModeEvent.SPECTATOR_MODE, session)); + NitroEventDispatcher.dispatchEvent(new RoomSessionSpectatorModeEvent(RoomSessionSpectatorModeEvent.SPECTATOR_MODE, session)); } } } diff --git a/src/nitro/session/handler/RoomUsersHandler.ts b/src/nitro/session/handler/RoomUsersHandler.ts index 12a20631..22e89862 100644 --- a/src/nitro/session/handler/RoomUsersHandler.ts +++ b/src/nitro/session/handler/RoomUsersHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api'; -import { RoomSessionConfirmPetBreedingEvent, RoomSessionConfirmPetBreedingResultEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionNestBreedingSuccessEvent, RoomSessionPetBreedingEvent, RoomSessionPetBreedingResultEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionConfirmPetBreedingEvent, RoomSessionConfirmPetBreedingResultEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionNestBreedingSuccessEvent, RoomSessionPetBreedingEvent, RoomSessionPetBreedingResultEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events'; import { BotErrorEvent, ConfirmBreedingRequestEvent, ConfirmBreedingResultEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NestBreedingSuccessEvent, NewFriendRequestEvent, PetBreedingMessageEvent, PetBreedingResultEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication'; import { RoomPetData } from '../RoomPetData'; import { RoomUserData } from '../RoomUserData'; @@ -82,7 +82,7 @@ export class RoomUsersHandler extends BaseHandler } } - this.listener.events.dispatchEvent(new RoomSessionUserDataUpdateEvent(session, usersToAdd)); + NitroEventDispatcher.dispatchEvent(new RoomSessionUserDataUpdateEvent(session, usersToAdd)); } private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void @@ -101,7 +101,7 @@ export class RoomUsersHandler extends BaseHandler session.userDataManager.updateMotto(parser.unitId, parser.motto); session.userDataManager.updateAchievementScore(parser.unitId, parser.achievementScore); - this.listener.events.dispatchEvent(new RoomSessionUserFigureUpdateEvent(session, parser.unitId, parser.figure, parser.gender, parser.motto, parser.achievementScore)); + NitroEventDispatcher.dispatchEvent(new RoomSessionUserFigureUpdateEvent(session, parser.unitId, parser.figure, parser.gender, parser.motto, parser.achievementScore)); } @@ -128,7 +128,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionDanceEvent(session, parser.unitId, parser.danceId)); + NitroEventDispatcher.dispatchEvent(new RoomSessionDanceEvent(session, parser.unitId, parser.danceId)); } private onUserCurrentBadgesEvent(event: UserCurrentBadgesEvent): void @@ -145,7 +145,7 @@ export class RoomUsersHandler extends BaseHandler session.userDataManager.setUserBadges(parser.userId, parser.badges); - this.listener.events.dispatchEvent(new RoomSessionUserBadgesEvent(session, parser.userId, parser.badges)); + NitroEventDispatcher.dispatchEvent(new RoomSessionUserBadgesEvent(session, parser.userId, parser.badges)); } private onRoomDoorbellEvent(event: DoorbellMessageEvent): void @@ -164,7 +164,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.DOORBELL, session, username)); + NitroEventDispatcher.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.DOORBELL, session, username)); } private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void @@ -196,7 +196,7 @@ export class RoomUsersHandler extends BaseHandler const request = parser.request; - this.listener.events.dispatchEvent(new RoomSessionFriendRequestEvent(session, request.requestId, request.requesterUserId, request.requesterName)); + NitroEventDispatcher.dispatchEvent(new RoomSessionFriendRequestEvent(session, request.requestId, request.requesterUserId, request.requesterName)); } private onPetInfoEvent(event: PetInfoEvent): void @@ -240,7 +240,7 @@ export class RoomUsersHandler extends BaseHandler petData.remainingGrowTime = parser.remainingGrowTime; petData.publiclyBreedable = parser.publiclyBreedable; - this.listener.events.dispatchEvent(new RoomSessionPetInfoUpdateEvent(session, petData)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetInfoUpdateEvent(session, petData)); } private onPetStatusUpdateEvent(event: PetStatusUpdateEvent): void @@ -257,7 +257,7 @@ export class RoomUsersHandler extends BaseHandler session.userDataManager.updatePetBreedingStatus(parser.roomIndex, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission); - this.listener.events.dispatchEvent(new RoomSessionPetStatusUpdateEvent(session, parser.petId, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetStatusUpdateEvent(session, parser.petId, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission)); } private onPetBreedingMessageEvent(event: PetBreedingMessageEvent): void @@ -272,7 +272,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionPetBreedingEvent(session, parser.state, parser.ownPetId, parser.otherPetId)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetBreedingEvent(session, parser.state, parser.ownPetId, parser.otherPetId)); } private onPetLevelUpdateMessageEvent(event: PetLevelUpdateMessageEvent): void @@ -289,7 +289,7 @@ export class RoomUsersHandler extends BaseHandler session.userDataManager.updatePetLevel(parser.roomIndex, parser.level); - this.listener.events.dispatchEvent(new RoomSessionPetLevelUpdateEvent(session, parser.petId, parser.level)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetLevelUpdateEvent(session, parser.petId, parser.level)); } private onConfirmBreedingResultEvent(event: ConfirmBreedingResultEvent): void @@ -304,7 +304,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionConfirmPetBreedingResultEvent(session, parser.breedingNestStuffId, parser.result)); + NitroEventDispatcher.dispatchEvent(new RoomSessionConfirmPetBreedingResultEvent(session, parser.breedingNestStuffId, parser.result)); } private onNestBreedingSuccessEvent(event: NestBreedingSuccessEvent): void @@ -319,7 +319,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionNestBreedingSuccessEvent(session, parser.petId, parser.rarityCategory)); + NitroEventDispatcher.dispatchEvent(new RoomSessionNestBreedingSuccessEvent(session, parser.petId, parser.rarityCategory)); } private onConfirmBreedingRequestEvent(event: ConfirmBreedingRequestEvent): void @@ -334,7 +334,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionConfirmPetBreedingEvent(session, parser.nestId, parser.pet1, parser.pet2, parser.rarityCategories, parser.resultPetType)); + NitroEventDispatcher.dispatchEvent(new RoomSessionConfirmPetBreedingEvent(session, parser.nestId, parser.pet1, parser.pet2, parser.rarityCategories, parser.resultPetType)); } private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void @@ -353,7 +353,7 @@ export class RoomUsersHandler extends BaseHandler session.userDataManager.updateFigure(parser.roomIndex, figure, '', parser.hasSaddle, parser.isRiding); - this.listener.events.dispatchEvent(new RoomSessionPetFigureUpdateEvent(session, parser.petId, figure)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetFigureUpdateEvent(session, parser.petId, figure)); } private onPetBreedingResultEvent(event: PetBreedingResultEvent): void @@ -368,7 +368,7 @@ export class RoomUsersHandler extends BaseHandler if(!session) return; - this.listener.events.dispatchEvent(new RoomSessionPetBreedingResultEvent(session, parser.resultData, parser.otherResultData)); + NitroEventDispatcher.dispatchEvent(new RoomSessionPetBreedingResultEvent(session, parser.resultData, parser.otherResultData)); } private onPetPlacingError(event: PetPlacingErrorEvent): void @@ -411,7 +411,7 @@ export class RoomUsersHandler extends BaseHandler if(!type || type.length == 0) return; - this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); + NitroEventDispatcher.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); } private onBotError(event: BotErrorEvent): void @@ -451,7 +451,7 @@ export class RoomUsersHandler extends BaseHandler if(!type || type.length == 0) return; - this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); + NitroEventDispatcher.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); } private onFavoriteMembershipUpdateMessageEvent(event: FavoriteMembershipUpdateMessageEvent): void @@ -470,6 +470,6 @@ export class RoomUsersHandler extends BaseHandler userData.groupId = parser.groupId; userData.groupName = parser.groupName; - this.listener.events.dispatchEvent(new RoomSessionFavoriteGroupUpdateEvent(session, parser.roomIndex, parser.groupId, parser.status, parser.groupName)); + NitroEventDispatcher.dispatchEvent(new RoomSessionFavoriteGroupUpdateEvent(session, parser.roomIndex, parser.groupId, parser.status, parser.groupName)); } } diff --git a/src/nitro/session/handler/WordQuizHandler.ts b/src/nitro/session/handler/WordQuizHandler.ts index 4907ce38..d5fcabab 100644 --- a/src/nitro/session/handler/WordQuizHandler.ts +++ b/src/nitro/session/handler/WordQuizHandler.ts @@ -1,5 +1,5 @@ import { IConnection, IRoomHandlerListener } from '../../../api'; -import { RoomSessionWordQuizEvent } from '../../../events'; +import { NitroEventDispatcher, RoomSessionWordQuizEvent } from '../../../events'; import { QuestionAnsweredEvent, QuestionEvent, QuestionFinishedEvent } from '../../communication'; import { BaseHandler } from './BaseHandler'; @@ -34,7 +34,7 @@ export class WordQuizHandler extends BaseHandler quizEvent.questionId = parser.questionId; quizEvent.pollId = parser.pollId; - this.listener.events.dispatchEvent(quizEvent); + NitroEventDispatcher.dispatchEvent(quizEvent); } private onQuestionAnsweredEvent(event: QuestionAnsweredEvent): void @@ -55,7 +55,7 @@ export class WordQuizHandler extends BaseHandler quizEvent.userId = parser.userId; quizEvent.answerCounts = parser.answerCounts; - this.listener.events.dispatchEvent(quizEvent); + NitroEventDispatcher.dispatchEvent(quizEvent); } private onQuestionFinishedEvent(event: QuestionFinishedEvent): void @@ -74,6 +74,6 @@ export class WordQuizHandler extends BaseHandler quizEvent.questionId = parser.questionId; quizEvent.answerCounts = parser.answerCounts; - this.listener.events.dispatchEvent(quizEvent); + NitroEventDispatcher.dispatchEvent(quizEvent); } } diff --git a/src/nitro/session/product/ProductDataLoader.ts b/src/nitro/session/product/ProductDataLoader.ts index 775fd0d6..5f5cbe4f 100644 --- a/src/nitro/session/product/ProductDataLoader.ts +++ b/src/nitro/session/product/ProductDataLoader.ts @@ -1,51 +1,28 @@ -import { IProductData } from '../../../api'; -import { EventDispatcher } from '../../../common'; -import { NitroEvent } from '../../../events'; +import { IProductData, NitroConfiguration } from '../../../api'; import { ProductData } from './ProductData'; -export class ProductDataLoader extends EventDispatcher +export class ProductDataLoader { - public static PDP_PRODUCT_DATA_READY: string = 'PDP_PRODUCT_DATA_READY'; - public static PDP_PRODUCT_DATA_FAILED: string = 'PDP_PRODUCT_DATA_FAILED'; - private _products: Map; constructor(products: Map) { - super(); - this._products = products; } - public dispose(): void + public async init(): Promise { - this._products = null; - } + const url = NitroConfiguration.getValue('productdata.url'); - public loadProductData(url: string): void - { - if(!url) return; + if(!url || !url.length) throw new Error('invalid product data url'); - fetch(url) - .then(response => response.json()) - .then(data => this.onProductDataLoadedEvent(data)) - .catch(err => this.onProductDataError(err)); - } + const response = await fetch(url); - private onProductDataLoadedEvent(data: { [index: string]: any }): void - { - if(!data) return; + if(response.status !== 200) throw new Error('Invalid product data file'); - this.parseProducts(data.productdata); + const responseData = await response.json(); - this.dispatchEvent(new NitroEvent(ProductDataLoader.PDP_PRODUCT_DATA_READY)); - } - - private onProductDataError(error: Error): void - { - if(!error) return; - - this.dispatchEvent(new NitroEvent(ProductDataLoader.PDP_PRODUCT_DATA_FAILED)); + this.parseProducts(responseData.productdata); } private parseProducts(data: { [index: string]: any }): void diff --git a/src/nitro/sound/SoundManager.ts b/src/nitro/sound/SoundManager.ts index 14e07915..50d1c460 100644 --- a/src/nitro/sound/SoundManager.ts +++ b/src/nitro/sound/SoundManager.ts @@ -1,61 +1,28 @@ import { AdvancedMap, IAdvancedMap, IMusicController, INitroEvent, ISoundManager, NitroConfiguration, NitroLogger } from '../../api'; -import { NitroManager } from '../../common'; -import { NitroSettingsEvent, NitroSoundEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineSamplePlaybackEvent } from '../../events'; -import { Nitro } from '../Nitro'; +import { NitroEventDispatcher, NitroSettingsEvent, NitroSoundEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineSamplePlaybackEvent } from '../../events'; import { MusicController } from './music/MusicController'; -export class SoundManager extends NitroManager implements ISoundManager +export class SoundManager implements ISoundManager { - private _volumeSystem: number; - private _volumeFurni: number; - private _volumeTrax: number; + private _volumeSystem: number = 0.5; + private _volumeFurni: number = 0.5; + private _volumeTrax: number = 0.5; - private _internalSamples: IAdvancedMap; - private _furniSamples: IAdvancedMap; - private _furnitureBeingPlayed: IAdvancedMap; + private _internalSamples: IAdvancedMap = new AdvancedMap(); + private _furniSamples: IAdvancedMap = new AdvancedMap(); + private _furnitureBeingPlayed: IAdvancedMap = new AdvancedMap(); - private _musicController: IMusicController; + private _musicController: IMusicController = new MusicController(); - constructor() - { - super(); - - this._volumeSystem = 0.5; - this._volumeFurni = 0.5; - this._volumeTrax = 0.5; - - this._internalSamples = new AdvancedMap(); - this._furniSamples = new AdvancedMap(); - this._furnitureBeingPlayed = new AdvancedMap(); - this._musicController = new MusicController(); - - this.onEvent = this.onEvent.bind(this); - } - - public onInit(): void + public async init(): Promise { this._musicController.init(); - Nitro.instance.roomEngine.events.addEventListener(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, this.onEvent); - Nitro.instance.roomEngine.events.addEventListener(RoomEngineObjectEvent.REMOVED, this.onEvent); - Nitro.instance.roomEngine.events.addEventListener(RoomEngineEvent.DISPOSED, this.onEvent); - Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onEvent); - Nitro.instance.events.addEventListener(NitroSoundEvent.PLAY_SOUND, this.onEvent); - } - - public onDispose(): void - { - if(this._musicController) - { - this._musicController.dispose(); - this._musicController = null; - } - - Nitro.instance.roomEngine.events.removeEventListener(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, this.onEvent); - Nitro.instance.roomEngine.events.removeEventListener(RoomEngineObjectEvent.REMOVED, this.onEvent); - Nitro.instance.roomEngine.events.removeEventListener(RoomEngineEvent.DISPOSED, this.onEvent); - Nitro.instance.events.removeEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onEvent); - Nitro.instance.events.removeEventListener(NitroSoundEvent.PLAY_SOUND, this.onEvent); + NitroEventDispatcher.addEventListener(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, event => this.onEvent(event)); + NitroEventDispatcher.addEventListener(RoomEngineObjectEvent.REMOVED, event => this.onEvent(event)); + NitroEventDispatcher.addEventListener(RoomEngineEvent.DISPOSED, event => this.onEvent(event)); + NitroEventDispatcher.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, event => this.onEvent(event)); + NitroEventDispatcher.addEventListener(NitroSoundEvent.PLAY_SOUND, event => this.onEvent(event)); } private onEvent(event: INitroEvent) @@ -150,20 +117,11 @@ export class SoundManager extends NitroManager implements ISoundManager if(!this._furnitureBeingPlayed.hasKey(objectId)) this._furnitureBeingPlayed.add(objectId, code); - sample.onended = (event) => - { - this.stopFurniSample(objectId); - }; + sample.onended = event => this.stopFurniSample(objectId); - sample.onpause = (event) => - { - this.stopFurniSample(objectId); - }; + sample.onpause = event => this.stopFurniSample(objectId); - sample.onerror = (event) => - { - this.stopFurniSample(objectId); - }; + sample.onerror = event => this.stopFurniSample(objectId); this.playSample(sample, this._volumeFurni, pitch); } diff --git a/src/nitro/sound/music/JukeboxPlaylistController.ts b/src/nitro/sound/music/JukeboxPlaylistController.ts index 184859a3..e8d3e5c7 100644 --- a/src/nitro/sound/music/JukeboxPlaylistController.ts +++ b/src/nitro/sound/music/JukeboxPlaylistController.ts @@ -1,4 +1,5 @@ import { IMessageEvent, IPlaylistController, ISongInfo } from '../../../api'; +import { NitroEventDispatcher } from '../../../events'; import { GetJukeboxPlayListMessageComposer, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, NowPlayingMessageEvent } from '../../communication'; import { Nitro } from '../../Nitro'; import { SongDataEntry } from '../common/SongDataEntry'; @@ -34,7 +35,7 @@ export class JukeboxPlaylistController implements IPlaylistController { this._messageEvents.forEach(event => Nitro.instance.communication.connection.addMessageEvent(event)); //this._events.addEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onSongFinishedPlayingEvent); - Nitro.instance.soundManager.events.addEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); + NitroEventDispatcher.addEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); } public get priority(): number @@ -62,7 +63,7 @@ export class JukeboxPlaylistController implements IPlaylistController this._playPosition = parser.currentPosition; //Dispatch local event NowPlayingEvent - Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_SONG_CHANGED, MusicPriorities.PRIORITY_ROOM_PLAYLIST, parser.currentSongId, parser.currentPosition)); + NitroEventDispatcher.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_SONG_CHANGED, MusicPriorities.PRIORITY_ROOM_PLAYLIST, parser.currentSongId, parser.currentPosition)); } private onJukeboxSongDisksMessageEvent(event: JukeboxSongDisksMessageEvent): void @@ -89,13 +90,13 @@ export class JukeboxPlaylistController implements IPlaylistController } if(this._missingSongInfo.length == 0) { - Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); + NitroEventDispatcher.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); } } private onJukeboxPlayListFullMessageEvent(event: JukeboxPlayListFullMessageEvent): void { - Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_FULL)); + NitroEventDispatcher.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_FULL)); } private onSongInfoReceivedEvent(songInfoEvent: SongInfoReceivedEvent): void @@ -122,7 +123,7 @@ export class JukeboxPlaylistController implements IPlaylistController } if(this._missingSongInfo.length == 0) { - Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); + NitroEventDispatcher.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); } } @@ -183,9 +184,9 @@ export class JukeboxPlaylistController implements IPlaylistController { this._disposed = true; this.stopPlaying(); - if(Nitro.instance.soundManager.events) + if(Nitro.instance.soundManager) { - Nitro.instance.soundManager.events.removeEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); + NitroEventDispatcher.removeEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); } this._messageEvents.forEach(event => Nitro.instance.communication.connection.removeMessageEvent(event)); this._messageEvents = null; diff --git a/src/nitro/sound/music/MusicController.ts b/src/nitro/sound/music/MusicController.ts index 431eadf2..5dfe6b35 100644 --- a/src/nitro/sound/music/MusicController.ts +++ b/src/nitro/sound/music/MusicController.ts @@ -1,5 +1,5 @@ import { AdvancedMap, IAdvancedMap, IMessageEvent, IMusicController, IPlaylistController, ISongInfo } from '../../../api'; -import { RoomObjectSoundMachineEvent } from '../../../events'; +import { NitroEventDispatcher, RoomObjectSoundMachineEvent } from '../../../events'; import { GetNowPlayingMessageComposer, GetSongInfoMessageComposer, GetUserSongDisksMessageComposer, TraxSongInfoMessageEvent, UserSongDisksInventoryMessageEvent } from '../../communication'; import { Nitro } from '../../Nitro'; import { SongDataEntry } from '../common/SongDataEntry'; @@ -67,12 +67,11 @@ export class MusicController implements IMusicController this._messageEvents.forEach(event => Nitro.instance.communication.connection.addMessageEvent(event)); - Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); - Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); - Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); - Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); - - Nitro.instance.soundManager.events.addEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); + NitroEventDispatcher.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); + NitroEventDispatcher.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); + NitroEventDispatcher.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); + NitroEventDispatcher.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); + NitroEventDispatcher.addEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); } public getRoomItemPlaylist(_arg_1?: number): IPlaylistController @@ -176,11 +175,11 @@ export class MusicController implements IMusicController this._messageEvents.forEach(event => Nitro.instance.communication.connection.removeMessageEvent(event)); - Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); - Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); - Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); - Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); - Nitro.instance.soundManager.events.removeEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); + NitroEventDispatcher.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); + NitroEventDispatcher.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); + NitroEventDispatcher.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); + NitroEventDispatcher.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); + NitroEventDispatcher.removeEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); } public get samplesIdsInUse(): number[] @@ -238,7 +237,7 @@ export class MusicController implements IMusicController this.playSongWithHighestPriority(); if(priorityPlaying >= MusicPriorities.PRIORITY_SONG_PLAY) { - Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPW_USER_STOP_SONG, priorityPlaying, k.id, -1)); + NitroEventDispatcher.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPW_USER_STOP_SONG, priorityPlaying, k.id, -1)); } } } @@ -268,13 +267,13 @@ export class MusicController implements IMusicController { this.playSongObject(topRequestPriotityIndex, songId); } - Nitro.instance.soundManager.events.dispatchEvent(new SongInfoReceivedEvent(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, song.id)); + NitroEventDispatcher.dispatchEvent(new SongInfoReceivedEvent(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, song.id)); while(this._diskInventoryMissingData.indexOf(song.id) != -1) { this._diskInventoryMissingData.splice(this._diskInventoryMissingData.indexOf(song.id), 1); if(this._diskInventoryMissingData.length === 0) { - Nitro.instance.soundManager.events.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); + NitroEventDispatcher.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); } } @@ -301,7 +300,7 @@ export class MusicController implements IMusicController } if(this._diskInventoryMissingData.length === 0) { - Nitro.instance.soundManager.events.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); + NitroEventDispatcher.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); } } @@ -430,7 +429,7 @@ export class MusicController implements IMusicController this._musicPlayer.preloadSamplesForSong(songData.songData).then(() => this._musicPlayer.play(songData.songData, songData.id, startPos, playLength)); if(priority > MusicPriorities.PRIORITY_ROOM_PLAYLIST) { - Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_USER_PLAY_SONG, priority, songData.id, -1)); + NitroEventDispatcher.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_USER_PLAY_SONG, priority, songData.id, -1)); } return true; } @@ -441,7 +440,7 @@ export class MusicController implements IMusicController const timeNow = Date.now(); if(((k.length >= _local_2) && ((!(this._previousNotifiedSongId == k.id)) || (timeNow > (this._previousNotificationTime + _local_2))))) { - Nitro.instance.soundManager.events.dispatchEvent(new NotifyPlayedSongEvent(k.name, k.creator)); + NitroEventDispatcher.dispatchEvent(new NotifyPlayedSongEvent(k.name, k.creator)); this._previousNotifiedSongId = k.id; this._previousNotificationTime = timeNow; } diff --git a/src/nitro/sound/music/MusicPlayer.ts b/src/nitro/sound/music/MusicPlayer.ts index 936ec218..48aab8ec 100644 --- a/src/nitro/sound/music/MusicPlayer.ts +++ b/src/nitro/sound/music/MusicPlayer.ts @@ -1,6 +1,6 @@ import { Howl, Howler } from 'howler'; import { NitroLogger } from '../../../api'; -import { Nitro } from '../../Nitro'; +import { NitroEventDispatcher } from '../../../events'; import { SoundManagerEvent } from '../events'; import { TraxData } from '../trax/TraxData'; @@ -79,7 +79,7 @@ export class MusicPlayer { const songId = this._currentSongId; this.reset(); - Nitro.instance.soundManager.events.dispatchEvent(new SoundManagerEvent(SoundManagerEvent.TRAX_SONG_COMPLETE, songId)); + NitroEventDispatcher.dispatchEvent(new SoundManagerEvent(SoundManagerEvent.TRAX_SONG_COMPLETE, songId)); //this.emit('stopped'); } diff --git a/src/room/RoomManager.ts b/src/room/RoomManager.ts index 95b1b85e..caec3e24 100644 --- a/src/room/RoomManager.ts +++ b/src/room/RoomManager.ts @@ -1,79 +1,41 @@ import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory, NitroLogger } from '../api'; -import { NitroManager } from '../common'; -import { RoomContentLoadedEvent } from '../events'; +import { NitroEventDispatcher, RoomContentLoadedEvent } from '../events'; import { RoomContentLoader } from '../nitro/room/RoomContentLoader'; import { RoomInstance } from './RoomInstance'; import { RoomObjectManager } from './RoomObjectManager'; -export class RoomManager extends NitroManager implements IRoomManager, IRoomInstanceContainer +export class RoomManager implements IRoomManager, IRoomInstanceContainer { - public static ROOM_MANAGER_ERROR: number = -1; - public static ROOM_MANAGER_LOADING: number = 0; - public static ROOM_MANAGER_LOADED: number = 1; - public static ROOM_MANAGER_INITIALIZING: number = 2; - public static ROOM_MANAGER_INITIALIZED: number = 3; - private static CONTENT_PROCESSING_TIME_LIMIT_MILLISECONDS: number = 40; - - private _state: number; - private _rooms: Map; - private _contentLoader: IRoomContentLoader; - private _updateCategories: number[]; + private _rooms: Map = new Map(); + private _contentLoader: IRoomContentLoader = null; + private _updateCategories: number[] = []; private _listener: IRoomManagerListener; private _visualizationFactory: IRoomObjectVisualizationFactory; private _logicFactory: IRoomObjectLogicFactory; - private _initialLoadList: string[]; - private _pendingContentTypes: string[]; - private _skipContentProcessing: boolean; + private _pendingContentTypes: string[] = []; + private _skipContentProcessing: boolean = false; - private _disposed: boolean; - - constructor(listener: IRoomManagerListener, visualizationFactory: IRoomObjectVisualizationFactory, logicFactory: IRoomObjectLogicFactory) + constructor(listener: IRoomManagerListener, visualizationFactory: IRoomObjectVisualizationFactory, logicFactory: IRoomObjectLogicFactory, contentLoader: IRoomContentLoader) { - super(); - - this._state = RoomManager.ROOM_MANAGER_LOADED; - this._rooms = new Map(); - this._contentLoader = null; - this._updateCategories = []; - this._listener = listener; this._visualizationFactory = visualizationFactory; this._logicFactory = logicFactory; - - this._initialLoadList = []; - this._pendingContentTypes = []; - this._skipContentProcessing = false; - - this._disposed = false; + this._contentLoader = contentLoader; this.onRoomContentLoadedEvent = this.onRoomContentLoadedEvent.bind(this); - this.events.addEventListener(RoomContentLoadedEvent.RCLE_SUCCESS, this.onRoomContentLoadedEvent); - this.events.addEventListener(RoomContentLoadedEvent.RCLE_FAILURE, this.onRoomContentLoadedEvent); - this.events.addEventListener(RoomContentLoadedEvent.RCLE_CANCEL, this.onRoomContentLoadedEvent); + NitroEventDispatcher.addEventListener(RoomContentLoadedEvent.RCLE_SUCCESS, this.onRoomContentLoadedEvent); + NitroEventDispatcher.addEventListener(RoomContentLoadedEvent.RCLE_FAILURE, this.onRoomContentLoadedEvent); + NitroEventDispatcher.addEventListener(RoomContentLoadedEvent.RCLE_CANCEL, this.onRoomContentLoadedEvent); } - public onInit(): void + public async init(): Promise { - if(this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return; + const promises = RoomContentLoader.MANDATORY_LIBRARIES.map(value => this._contentLoader.downloadAsset(value)); - const mandatoryLibraries = RoomContentLoader.MANDATORY_LIBRARIES; - - for(const library of mandatoryLibraries) - { - if(!library) continue; - - if(this._initialLoadList.indexOf(library) === -1) - { - this._contentLoader.downloadAsset(library, this.events); - - this._initialLoadList.push(library); - } - } - - this._state = RoomManager.ROOM_MANAGER_INITIALIZING; + await Promise.all(promises); } public getRoomInstance(roomId: string): IRoomInstance @@ -137,7 +99,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { isLoading = true; - this._contentLoader.downloadAsset(type, this.events); + this._contentLoader.downloadAsset(type); assetName = this._contentLoader.getPlaceholderName(type); asset = this._contentLoader.getCollection(assetName); @@ -294,13 +256,6 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst } } - public setContentLoader(loader: IRoomContentLoader): void - { - if(this._contentLoader) this._contentLoader.dispose(); - - this._contentLoader = loader; - } - private processPendingContentTypes(time: number): void { if(this._skipContentProcessing) @@ -331,38 +286,6 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst this.reinitializeRoomObjectsByType(type); if(this._listener) this._listener.initalizeTemporaryObjectsByType(type, true); - - if(this._initialLoadList.length > 0) this.removeFromInitialLoad(type); - } - } - - private removeFromInitialLoad(type: string): void - { - if(!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return; - - if(!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR; - - if(this._contentLoader.getCollection(type)) - { - const i = this._initialLoadList.indexOf(type); - - if(i >= 0) this._initialLoadList.splice(i, 1); - - if(!this._initialLoadList.length) - { - this._state = RoomManager.ROOM_MANAGER_INITIALIZED; - - if(this._listener) - { - this._listener.onRoomEngineInitalized(true); - } - } - } - else - { - this._state = RoomManager.ROOM_MANAGER_ERROR; - - if(this._listener) this._listener.onRoomEngineInitalized(false); } } @@ -395,9 +318,4 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { return this._rooms; } - - public get disposed(): boolean - { - return this._disposed; - } } diff --git a/yarn.lock b/yarn.lock index 885907fb..3b26fef1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,135 +2,157 @@ # yarn lockfile v1 -"@esbuild/android-arm64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.16.9.tgz#474da719599f99d820ec010c92846a4f685fa28a" - integrity sha512-ndIAZJUeLx4O+4AJbFQCurQW4VRUXjDsUvt1L+nP8bVELOWdmdCEOtlIweCUE6P+hU0uxYbEK2AEP0n5IVQvhg== +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@esbuild/android-arm@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.16.9.tgz#b0747ec074bba3ca652bfa8de3f55acfbb2d259e" - integrity sha512-kW5ccqWHVOOTGUkkJbtfoImtqu3kA1PFkivM+9QPFSHphPfPBlBalX9eDRqPK+wHCqKhU48/78T791qPgC9e9A== +"@esbuild/android-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" + integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== -"@esbuild/android-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.16.9.tgz#1cd75e8ed7d6d7eb5f9896f623df63882bd8e887" - integrity sha512-UbMcJB4EHrAVOnknQklREPgclNU2CPet2h+sCBCXmF2mfoYWopBn/CfTfeyOkb/JglOcdEADqAljFndMKnFtOw== +"@esbuild/android-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" + integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== -"@esbuild/darwin-arm64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.16.9.tgz#820c88738cd97621737abcd5f05400ae5e0c66e6" - integrity sha512-d7D7/nrt4CxPul98lx4PXhyNZwTYtbdaHhOSdXlZuu5zZIznjqtMqLac8Bv+IuT6SVHiHUwrkL6ywD7mOgLW+A== +"@esbuild/android-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" + integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== -"@esbuild/darwin-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.16.9.tgz#5a19c00781595e0dfeef1826b3512d04c37b98ff" - integrity sha512-LZc+Wlz06AkJYtwWsBM3x2rSqTG8lntDuftsUNQ3fCx9ZttYtvlDcVtgb+NQ6t9s6K5No5zutN3pcjZEC2a4iQ== +"@esbuild/darwin-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" + integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== -"@esbuild/freebsd-arm64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.9.tgz#2b7c16f5d15c259ed279b293b97c28c4a4bb107f" - integrity sha512-gIj0UQZlQo93CHYouHKkpzP7AuruSaMIm1etcWIxccFEVqCN1xDr6BWlN9bM+ol/f0W9w3hx3HDuEwcJVtGneQ== +"@esbuild/darwin-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" + integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== -"@esbuild/freebsd-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.16.9.tgz#2db48ffeeab149c2b970494a60b82bf3004b8630" - integrity sha512-GNors4vaMJ7lzGOuhzNc7jvgsQZqErGA8rsW+nck8N1nYu86CvsJW2seigVrQQWOV4QzEP8Zf3gm+QCjA2hnBQ== +"@esbuild/freebsd-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" + integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== -"@esbuild/linux-arm64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.16.9.tgz#4c63c9f8ddd690d140ac3e0f360226d3fcdd75d8" - integrity sha512-YPxQunReYp8RQ1FvexFrOEqqf+nLbS3bKVZF5FRT2uKM7Wio7BeATqAwO02AyrdSEntt3I5fhFsujUChIa8CZg== +"@esbuild/freebsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" + integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== -"@esbuild/linux-arm@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.16.9.tgz#7704de1c2a30bc68d8f615d3ecb1cf68f001256a" - integrity sha512-cNx1EF99c2t1Ztn0lk9N+MuwBijGF8mH6nx9GFsB3e0lpUpPkCE/yt5d+7NP9EwJf5uzqdjutgVYoH1SNqzudA== +"@esbuild/linux-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" + integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== -"@esbuild/linux-ia32@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.16.9.tgz#bf0fda9f046e6c8332d7c8350b8a94d63acb4ceb" - integrity sha512-zb12ixDIKNwFpIqR00J88FFitVwOEwO78EiUi8wi8FXlmSc3GtUuKV/BSO+730Kglt0B47+ZrJN1BhhOxZaVrw== +"@esbuild/linux-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" + integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== -"@esbuild/linux-loong64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.16.9.tgz#c16378b898fa38f5f788f76fbce16a45c49c8793" - integrity sha512-X8te4NLxtHiNT6H+4Pfm5RklzItA1Qy4nfyttihGGX+Koc53Ar20ViC+myY70QJ8PDEOehinXZj/F7QK3A+MKQ== +"@esbuild/linux-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" + integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== -"@esbuild/linux-mips64el@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.16.9.tgz#492605f13f19dc06c350d94e4048c21478b9dec4" - integrity sha512-ZqyMDLt02c5smoS3enlF54ndK5zK4IpClLTxF0hHfzHJlfm4y8IAkIF8LUW0W7zxcKy7oAwI7BRDqeVvC120SA== +"@esbuild/linux-loong64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" + integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== -"@esbuild/linux-ppc64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.16.9.tgz#ccaf759fc4f7a5fe72bdac05b4f5bf18ef1fe01b" - integrity sha512-k+ca5W5LDBEF3lfDwMV6YNXwm4wEpw9krMnNvvlNz3MrKSD2Eb2c861O0MaKrZkG/buTQAP4vkavbLwgIe6xjg== +"@esbuild/linux-mips64el@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" + integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== -"@esbuild/linux-riscv64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.16.9.tgz#542d0e68bc99fb658fe732b0917931c09775f1a3" - integrity sha512-GuInVdogjmg9DhgkEmNipHkC+3tzkanPJzgzTC2ihsvrruLyFoR1YrTGixblNSMPudQLpiqkcwGwwe0oqfrvfA== +"@esbuild/linux-ppc64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" + integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== -"@esbuild/linux-s390x@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.16.9.tgz#4398f9d9d64dba4cfa6eed267476eaa9c9b7f214" - integrity sha512-49wQ0aYkvwXonGsxc7LuuLNICMX8XtO92Iqmug5Qau0kpnV6SP34jk+jIeu4suHwAbSbRhVFtDv75yRmyfQcHw== +"@esbuild/linux-riscv64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" + integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== -"@esbuild/linux-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.16.9.tgz#67c6b418ef36addbca17af0d7a2274c37ddffba2" - integrity sha512-Nx4oKEAJ6EcQlt4dK7qJyuZUoXZG7CAeY22R7rqZijFzwFfMOD+gLP56uV7RrV86jGf8PeRY8TBsRmOcZoG42w== +"@esbuild/linux-s390x@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" + integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== -"@esbuild/netbsd-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.16.9.tgz#22ed58e404ebeb2475b821bc4e25f1027eb0c912" - integrity sha512-d0WnpgJ+FTiMZXEQ1NOv9+0gvEhttbgKEvVqWWAtl1u9AvlspKXbodKHzQ5MLP6YV1y52Xp+p8FMYqj8ykTahg== +"@esbuild/linux-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" + integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== -"@esbuild/openbsd-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.16.9.tgz#2b2597b4edd4d26946f7c56838680fbeb4d455eb" - integrity sha512-jccK11278dvEscHFfMk5EIPjF4wv1qGD0vps7mBV1a6TspdR36O28fgPem/SA/0pcsCPHjww5ouCLwP+JNAFlw== +"@esbuild/netbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" + integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== -"@esbuild/sunos-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.16.9.tgz#c132603a19ef79c0d7bd95afb09f41618ea8dda2" - integrity sha512-OetwTSsv6mIDLqN7I7I2oX9MmHGwG+AP+wKIHvq+6sIHwcPPJqRx+DJB55jy9JG13CWcdcQno/7V5MTJ5a0xfQ== +"@esbuild/openbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" + integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== -"@esbuild/win32-arm64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.16.9.tgz#bf74d007d7f0fe1fe32c4fff82d27b271b3e1d58" - integrity sha512-tKSSSK6unhxbGbHg+Cc+JhRzemkcsX0tPBvG0m5qsWbkShDK9c+/LSb13L18LWVdOQZwuA55Vbakxmt6OjBDOQ== +"@esbuild/sunos-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" + integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== -"@esbuild/win32-ia32@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.16.9.tgz#e46478e77431bca1a8b80f6260fc6b0020aa8127" - integrity sha512-ZTQ5vhNS5gli0KK8I6/s6+LwXmNEfq1ftjnSVyyNm33dBw8zDpstqhGXYUbZSWWLvkqiRRjgxgmoncmi6Yy7Ng== +"@esbuild/win32-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" + integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== -"@esbuild/win32-x64@0.16.9": - version "0.16.9" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.16.9.tgz#4595a29c2930c5157aa1be0963abbbac989647c9" - integrity sha512-C4ZX+YFIp6+lPrru3tpH6Gaapy8IBRHw/e7l63fzGDhn/EaiGpQgbIlT5paByyy+oMvRFQoxxyvC4LE0AjJMqQ== +"@esbuild/win32-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" + integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== -"@eslint/eslintrc@^1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" - integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== +"@esbuild/win32-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" + integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== + +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + +"@eslint/eslintrc@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" + integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.4.0" - globals "^13.15.0" + espree "^9.6.0" + globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" js-yaml "^4.1.0" minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@humanwhocodes/config-array@^0.11.6": - version "0.11.8" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" - integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== +"@eslint/js@8.44.0": + version "8.44.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" + integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== + +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -146,45 +168,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@jridgewell/gen-mapping@^0.3.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" - integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/source-map@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" - integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== - -"@jridgewell/trace-mapping@^0.3.9": - version "0.3.17" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" - integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== - dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" +"@jridgewell/source-map@^0.3.3": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.4.tgz#856a142864530d4059dda415659b48d37db2d556" + integrity sha512-KE/SxsDqNs3rrWwFHcRh15ZLVFrI0YoZtgAdIyIq9k5hUNmiWRXXThPomIxHuL20sLdgzbDFyvkUMna14bvtrw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -208,159 +195,159 @@ fastq "^1.6.0" "@pixi/app@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/app/-/app-6.5.8.tgz#0a09bce23a222458e6a769d8ecbb0643ee165368" - integrity sha512-pDPkamtYDaPhscNxack+bHNqazCwrqw6cAotKyoz1mvLXeGhxqTntOcfgGLZR2fNbnY8EBmdduLvH7n2jI/LTg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/app/-/app-6.5.9.tgz#bc60ae6f153ec7bb9626180ca0747973e9740fc1" + integrity sha512-RDFR8ea86eykTmxlQPb1PMdXqYaeLmf1BKprcEKOOr6vmNLykzn+UEaal4OJtmpgtAsHt6hkpW7nUeZ8idbWZA== "@pixi/basis@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/basis/-/basis-6.5.8.tgz#a9ded903fea5d0ba240c22839648868de2f64702" - integrity sha512-j4j08fZsdg8b3F1Cs1cE478m6aVk6ix53pTrv+kxq0Givl3ctO+wwWEU07BFAuvsGGySKrhAEt4vmz78cRK9KQ== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/basis/-/basis-6.5.9.tgz#52ca35aa0b02ffaff17f8e611a87b528c9e62bae" + integrity sha512-mWuqq3ZmNo2eZw6rapOAQdafd+LaHLOBaa/Iy/PqfmuB8aFYaBgzEyF4FjnHGK1TYn+2PKO85G3ptIoAh9c67g== "@pixi/canvas-display@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/canvas-display/-/canvas-display-6.5.8.tgz#9d280a2ee8b9ec0fbf2a9420b592152f91902997" - integrity sha512-7kgFmN2dCWBhgo+CEKpZDmgqRkYCQeHoVsyOSyxSvTqHDnMjFane1OwTBg6p4PlsE+Jn1BEx/3V2ja/XbR9XOg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/canvas-display/-/canvas-display-6.5.9.tgz#a62aba413377d15a147ce05e78c818618308dda6" + integrity sha512-ZxVBkyqDOPJKTkF9onGbGtwToICQEVcx/PTHh03LU6lkJ4/fenCd25f4265tdXarIFuu3k03liFKVCCy9sRU0g== "@pixi/canvas-extract@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/canvas-extract/-/canvas-extract-6.5.8.tgz#c4ae9f6c29aea26ac9cdc00ed89c84ba213aa2ec" - integrity sha512-9jRVlQpumyj0QWF9CQzsDqg7QkqYxLhX/Xu87o5bWfpwrocF6AlJJak0zc6WMLvDEJ1ZI3mNdV2P1AW9ba4+WA== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/canvas-extract/-/canvas-extract-6.5.9.tgz#c1e892ae8e8113792d1fadce1dd969aeb26bf7d9" + integrity sha512-EpOc1nHOhG4Ph6JsliXT0ZHxXzXicUezpXf/xuxjz0Td9A01pkzljI1gKI6qc5n/viD8Y2uaCKDnUSftdhiRsA== "@pixi/canvas-renderer@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/canvas-renderer/-/canvas-renderer-6.5.8.tgz#88c816f9b0aa116ac25d322963f6a0f7bc3051c4" - integrity sha512-W+qp05VNtPIoE1/azAyAcYLYXONdql15ts72bsGssRvGJGmECzfhOKq389S4j9X5uVKm51CZhChE7yReWkbUEw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/canvas-renderer/-/canvas-renderer-6.5.9.tgz#d760387d0695d066d2a4a93e2df9183c234a2144" + integrity sha512-bs97ub6ZfEopGqKXBpNntuONmSsWs1UEJ06yWfFUfkLzhXrWNsaFtF5CbaELDzB8AMqH0HY5QgNNWylj8VQ0tQ== "@pixi/constants@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-6.5.8.tgz#034bf0f318546bf3c9346f4f3a7528f8cadcdb55" - integrity sha512-yYRCebBPqajm1kn5f8QQTTvl7oDRDk1nppfO+JpqbrFXg0W7oqIMurec3KeG9RdZW5foOiXDoz1Gw+VtolYIEw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-6.5.9.tgz#671b29af33b3c3760dad81b500dbaa562a8c7213" + integrity sha512-749Vv+DUh4Tguku6uouXUIAUHThYU/cDZzWW4lYNv2UrqUrPxE1a7b8Ca0GakFjt6HZIenl6DnUYLP4yE6PWiQ== "@pixi/core@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/core/-/core-6.5.8.tgz#6b4fb6d877723427c8b3b438d071c1d523a859f5" - integrity sha512-Gconik7/PpFPMpCpOddXVIPx5C2StWKw7lQ4YX19yQ+cRRmecCea2cV0xTBtpEjjx0ilX7nBfIEuZ4zIlMmlbA== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/core/-/core-6.5.9.tgz#38d3a8e8183fd6d57ddd254c9303e2244fd51be1" + integrity sha512-NQGaEYtUIKNAQNeqLsfHSkx1BYuOWJzAYDpb63QEZFvV8gTRf2t3SBuyvSxvMFAGakNrqYefIXkfJXpmHOrk7A== dependencies: "@types/offscreencanvas" "^2019.6.4" "@pixi/display@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/display/-/display-6.5.8.tgz#f6e69aba09926affd610ad90b68b01cf6d5e3a64" - integrity sha512-2K8YOG8s0iF8x/k2Q0RTFmoMJ9biI6PXEh76nH3EqUFdpyrIIgrG5aOMnCkVDvOxlgVRrKG8Q3JBHlSievTmuw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/display/-/display-6.5.9.tgz#cd6e8ce241aa35042fdb20c792487551c168f1d1" + integrity sha512-85eODYWsOM/kIt2N/L51lsAl3DLJA+1Eed+Nl6ZeF/pEvQnXf7jDZzGwVmUKJurpPWhjkA5OnzWabFw3De2qZg== "@pixi/events@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/events/-/events-6.5.8.tgz#739a2bf634484d4394acc55019fa6910a35cf925" - integrity sha512-9pnL1Z/YBynIEk2I5f3ZvcB+fnqxeZ0dP5m1OKZ8GpKnkZz6/2FZ9hbelyeZgW9iHUPNy98A+Nrfv4oE7lB5Dg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/events/-/events-6.5.9.tgz#e1cc088ebeaeff659f55e8f530af0b8f80fca9c0" + integrity sha512-f5hiyy0nZtgIKrarbeO+DsZI441WvGz1W823D9G3g+FKDHXIoX72orXT5FvSIGJNNtuoS5LZKszKUQGNqJh/kQ== "@pixi/extensions@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/extensions/-/extensions-6.5.8.tgz#6976b8f582ce09dea9ba3baebd14c5958c39b222" - integrity sha512-6vEV801Vn/EkU/qjFiZ76OZWPq5KsBR2r+P5gfKv4YLnaDc3A+0IpUOJ7sLBAJqmr0iw68g6xV6MnuqVjNGjFg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/extensions/-/extensions-6.5.9.tgz#1afc871581f6ca7b921eaee9e342bbc89d7f4a46" + integrity sha512-vwzEhLkGiiCw9e7QmXBKHuJzX1DzaA2JcFw0Kl1DTI0lH1cIZccE3rVBbuVY8+Zvb33WV5XxwQC03/qyx4DUbw== "@pixi/extract@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/extract/-/extract-6.5.8.tgz#d2a07055a766b7269b3f3a0ad1fdb93762168f6f" - integrity sha512-qbuuD/iBA4J+TCBgrbMe8oDUFbCriyy9LTKEtQp+pghKD5MEMvJ3nO6Osumxqiqta2kYU6WldFLTldKyHEiQ7Q== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/extract/-/extract-6.5.9.tgz#a7e149a98191118f6bea6d764a704b0b73c7b902" + integrity sha512-fqnGfJFC6OJ63Js+lkt2YjTCLpzMnCETB3YTpty/DUM9K/0WzqZGHbWVyNmLo4XDHlG3qqgkXW2hmZQdY9BQAw== "@pixi/filter-alpha@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/filter-alpha/-/filter-alpha-6.5.8.tgz#627ac683285754ebc94ad560bf99c015721d3314" - integrity sha512-W4IkFTLTP84H+DS9XIdBGunAEpaXLrasDc4CQBeyp4c4hBlGlzriUZp30vkmqm7GPmFhzPe7aiJtNYgUpxKQBQ== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/filter-alpha/-/filter-alpha-6.5.9.tgz#d2a600f6f32570883ec562f53b7bd270a68de1d0" + integrity sha512-p87mGgMXX64CKUmTSadIOUzA7Q7MxybmsYPZbxFIFWsH2ML07RZChEaZWL2Bzql2CwgfejzxJPkCTXB/Qn5IRQ== "@pixi/filter-color-matrix@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/filter-color-matrix/-/filter-color-matrix-6.5.8.tgz#4fa64977c87fcb5420aff439df1652a2048c47a6" - integrity sha512-iix+a/KEi6HAwZwkUH3nkIzyLu0ln3HBuHEFLUUhug7xrQgQgGrTQZ32iWlfpJD/BZuKphIGfzlxMFfvyQmkVw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/filter-color-matrix/-/filter-color-matrix-6.5.9.tgz#ad45509677eba0c6cf057aac4ec229fae9eef4a5" + integrity sha512-ycx1SO3USLLbGHkqwo+3RwtvxnlffKinFuKQR59LrhuvULhrwLD9GVdB6e7wKgx7CrMtJe5kcED9ZTitLL7QbA== "@pixi/graphics-extras@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/graphics-extras/-/graphics-extras-6.5.8.tgz#79c113ff285f5954df78b64becf58a05c162936f" - integrity sha512-RdrAucGr6etEzz64TiViPcxlEpUfwJTj62j8eMDU1BjCwSaNDs5TN3LerY/en7IRRsUsrVLMn/3z52B25P+rjQ== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/graphics-extras/-/graphics-extras-6.5.9.tgz#5a8162d0447ecd9cc8b87d788d74447addf00e5e" + integrity sha512-MP5zAC1glGw6iIb3yfDH5IULbvgifgK6To0QiJ7EjRif8p/hjI7vgu1C0TLFqN3Zuhp9QbJVYrHCmmxEmXzFXw== "@pixi/graphics@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/graphics/-/graphics-6.5.8.tgz#25db47335d8191c38ae39adc95bd9eb20672247b" - integrity sha512-DUuUXHO4t5fg+n+srMkHX38QEH3WtS1IMXtovBGFJkkopG0Z0xjxSp5XvsPPw1J//4fzkHZI5OBrlN613p9+sg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/graphics/-/graphics-6.5.9.tgz#13ee11af626a6d1647da3e3a281412c68337c860" + integrity sha512-+b7Ke6MkngftcRq2WweqsEWtV4ttRRurCiiPYeOhM5kGuAwDoyWGhXnWltiBQUHAE026uEep8wFi3vmlAzlXTQ== "@pixi/interaction@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/interaction/-/interaction-6.5.8.tgz#d4e83cb4d1f03f23633706ef9495406a2401dc26" - integrity sha512-uP247r0f47vo9WSpEnsUfeD1izxVGpjtg4iAyGT/02ezWse2vD1aEL8AbxFa65TL0IXOKsHEQudCVL+wjnbSKQ== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/interaction/-/interaction-6.5.9.tgz#033ddfc8963a18c5384b4d01c032483651c7a27d" + integrity sha512-PXWPPpOBwZdf/VtrstYaKqtUfJcJR57oRGdSXZ0mtvN8jEhsWUe0GlmlHEp6PxTwtn5ECKDy8+i9V0CcqLKgug== "@pixi/loaders@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/loaders/-/loaders-6.5.8.tgz#5fe2e74c2c532b4bb900063ee2f33385e5446f7a" - integrity sha512-mj11UPKsqWaTEPMpCnFugr6heKkQeNFuVSddSwE8crg19l46zcMhk3ucpQX15RDpAdDJjtl3OraevQCHHbNENw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/loaders/-/loaders-6.5.9.tgz#e5b719ddd67023db042829dd6bf74624baf312be" + integrity sha512-wHza2gnDEkfz1xmlLrsrxBzkEIWOufS4DFR/i1gl9lyzDJs5be1UB6zLbp8r7gxAYhNXHTbqU+CODYaJq/1TAQ== "@pixi/math-extras@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/math-extras/-/math-extras-6.5.8.tgz#5329bcaa827f96fbdfea5c0b90709861bc37686a" - integrity sha512-Vkc1OHPZKoVI89mHigAtpBma6bU3z6t4XJfXwG6RkHX/D955gtnZ80BBeu3wt482z1iMedYLgHv9eqW70ROtxg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/math-extras/-/math-extras-6.5.9.tgz#23036b347352bbf60494e325247dd48df4b53bee" + integrity sha512-ObwX1u6AWpp2qQpun7xychY5dFkhoHi4/lXhqyOF0BKOeN61fuIcP6Ro5W9jWTcTRgJJZYRC18RH3QoM5NqtGQ== "@pixi/math@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/math/-/math-6.5.8.tgz#7dc06425c6a53b6a2adf5e66e57a2f9db0907cc9" - integrity sha512-9493KEH5ITnjOZvQZbaU22lD0kcg/XhNh+309KYfwFX787zA1BN/7is06oHEgHBDb2NemqioYi6sw1WnECgQig== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/math/-/math-6.5.9.tgz#c49ac52368e5c0bd0b1ac051b520cf9ddbfcb9d1" + integrity sha512-L6EARDZiMXXqyqrgvc4lTVpMppRhkeJcCCg+6XAilp73ZAehmcCKt1fuCENbscpJgdX8EDBDWlGVrDOq6Yfa3Q== "@pixi/mixin-cache-as-bitmap@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/mixin-cache-as-bitmap/-/mixin-cache-as-bitmap-6.5.8.tgz#3e70ae36d3c63cb53f75ca74fec7814f3bfc01b4" - integrity sha512-5TTv4w8v7guI6z3gKz5ppUCbNMRw+8RRNru/aq65qUl6kcUaJiYwQdBFJ/vJwpI9ePEScWrCuLVEc8QtX6xjNw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/mixin-cache-as-bitmap/-/mixin-cache-as-bitmap-6.5.9.tgz#60be0d9fd7b0ff2aef59b54838c48d95be44b719" + integrity sha512-nhBRLp5f4bxnf/q+3DrVWD4MNWn8kymi6V7AFr+ItDROnCurAg96fefOZlUcxOs9hXWKM6QXkR9XQSHeXKNq+Q== "@pixi/mixin-get-child-by-name@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/mixin-get-child-by-name/-/mixin-get-child-by-name-6.5.8.tgz#414a8bbf8d80686e351bc8f9abb8f12be2d04ff8" - integrity sha512-b15HTdHpW4ErDBpf7wm1vvWHrTv5kQzElXrwAPBCnLgvronfSL9mL7npOUkZOybUorCoEBq/7oNVjkimsQc5gw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/mixin-get-child-by-name/-/mixin-get-child-by-name-6.5.9.tgz#f3724513bb7b24fa11a747101ec3e8158d32af68" + integrity sha512-Co1exHIPACW3dURze2KKDi7TnBa7CwyhI1SuEflynopN2CkMEhJ9VQJDCvd5FNzkhmc14lIdIEqtN19w9EEOYw== "@pixi/mixin-get-global-position@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/mixin-get-global-position/-/mixin-get-global-position-6.5.8.tgz#7fc71b89e13d37fdf39955a3de680511883ef5f2" - integrity sha512-Y5epEW5mRrgpDOHvfc92t0PaBgboBKXR4n/AzOOFt0h9GRNTmVKYBpUQPp/HO+r1Bxq+XbaGm1CyfkjUUxnORA== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/mixin-get-global-position/-/mixin-get-global-position-6.5.9.tgz#8e35ced92a3535da3f998082b783bb18ebaca619" + integrity sha512-lwwbI4qVwlrknZjE8cVdgqsiIHdDyV4MdCL2wO7+zw5aW4EofPlyRb2av7za5onPagaFL/Jgj4WkUlZta40WaQ== "@pixi/polyfill@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/polyfill/-/polyfill-6.5.8.tgz#98d753fc6ca95cf086077ee230d089595a32bbfb" - integrity sha512-z2klHelxTZExMyO4oiLdxJMGzzXnToEIDn7Dwfy3FY+98LbxSa2dVFCgzDsYeiiS8fSMsni2Ru7aZT/DFsRDcA== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/polyfill/-/polyfill-6.5.9.tgz#bb7511ce09429c46d6f4428edc6bb854bbe0de09" + integrity sha512-S8ETjbGlW+YtJcC3Ysg9pSAHUsuyU3AvJfCL9PaQFG4/C39J36TqRLufB/9+WzUZ4TBI/CcsEWCh7InHpogT4Q== dependencies: object-assign "^4.1.1" promise-polyfill "^8.2.0" "@pixi/runner@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-6.5.8.tgz#e86ed6fac1f243d17dfa5d5317cb0b98fdce3960" - integrity sha512-/9KVgQjTKiBa1qHdNmhP9I+AHgC/Eu9QiKcc+oakLCJtpYi79lx+nDFrpLUamIi2c7lP0hDWVe0XqlQeYmSwag== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-6.5.9.tgz#f341c68ceb233e33f1662641417726ccf59ab520" + integrity sha512-xIfmhflbhrDw9ZEDezL46K+/L3pz79KU0qvtmg82eXgJdpsp9irDY2+QcEYgOO1AnYmqO9E1ygZd/RofCxRM1g== "@pixi/settings@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-6.5.8.tgz#574df7b10039903e4e158a067be8fd5d8531c653" - integrity sha512-gmnwHkg9+tlQRuFNOdimzl73Dup2fdEo/VYaF7spT+8womE4KWAvARCBMqY/10aAx1iYeYuo5av/RfqrePB5Hg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-6.5.9.tgz#2dda1a3b6c23ea9822c93c9a54433f8f5d819a1d" + integrity sha512-cOODlDuToO3uixgDRHlsxGbzlgZKNyZn+AeZKHyo6z8JpLh5mYrC4wEgLyHoKSOX0VgNzlSY6VNLthmgpu2gAg== "@pixi/sprite-tiling@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/sprite-tiling/-/sprite-tiling-6.5.8.tgz#2fafe50268565ab7f03d4aba50b2c2a975056edc" - integrity sha512-PG3tiWI6uUest/d7HAz4/3I8NjpYyeMUL2WDy86nMXCJ6bLdTs/s9Nq3DLckaUsyIMTGsVbj/BXjE8LP1WDTog== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/sprite-tiling/-/sprite-tiling-6.5.9.tgz#37180d1278223b354b53d95bedc9d9f36d94d12a" + integrity sha512-+I7iQfp/xhosyNCGx0JmOk+QGIPHC1kjq/QEhzaMwvFnw7rsoUdhy4B13fF38DMPdzrFpGuyWfdZW5xezRA3Ww== "@pixi/sprite@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/sprite/-/sprite-6.5.8.tgz#94bcf4fe590f674e193e64b02365fa4582453c40" - integrity sha512-ywvbrNgjK+K93X9cvHtDCnsBtU7B9JD/3wg+1G6v1Ktrr2E1gwVIQK1NANBrjzt6cYGphz5EqGAW68d0rMBliw== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/sprite/-/sprite-6.5.9.tgz#4ed1a161ef41045fd9d7f89ad35d10e5ee533c84" + integrity sha512-pgYHrIES9vZ1HfcFVpvDpdI8sMwzNRhInDkfRCfJX0K3NaAW8AWzu1DPPsn+eYzIF14gpi9JZXS3lT8JtD8lug== "@pixi/spritesheet@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/spritesheet/-/spritesheet-6.5.8.tgz#d369372e0341a522e44d75e2c750534392a5f9e6" - integrity sha512-WiJd4fKpSitD3A+/u5q8IPoHXMFT8++bsluhuJvDwzo//s0PHb9qExlF2xos7zUmekmydEFMkDnrl4+lWn2cyg== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/spritesheet/-/spritesheet-6.5.9.tgz#f8c33b1d8c085276b6747314c6ff04a3a79b9ae6" + integrity sha512-jf27xXl1/v2kA+Vr8E4/xLAMMO3xxNOk/blZCVr/RwKILS9T3R1Y7f4FICW2Gv4jLreBLvWwYM41NPon9/N3/g== "@pixi/text@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/text/-/text-6.5.8.tgz#ed23ea16812b0b5be2d0b964e707c5c407f1e758" - integrity sha512-7AZPj5+vWcUjK0QzQ3ehiEwEqywiWR8NhDmnnN5nRNHR9u5IOOnqCQtBTdDffYPN0uMgCi8MzUPwTJhGuyOeww== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/text/-/text-6.5.9.tgz#e086d4a15661847553c2a9327f2afbce5fab2c37" + integrity sha512-nhIQTplpO9e4bjw32/A0mGYtx9yMV7TeL5PQ+pXKUJjvMKxNiqzK4ULLNvGd8bZm/RED1FpFtxGhuw5x4r+0qQ== "@pixi/ticker@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/ticker/-/ticker-6.5.8.tgz#708120bcadce7c4446e2238df590c54debbaed78" - integrity sha512-7VKq5hfnRDSv6a16pATqZAmpQfEu4G171iUTloy3QZfbnPw0s3JervZSih1yJJD84GXEF4VzYB26pJ/x3arGjQ== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/ticker/-/ticker-6.5.9.tgz#e98bd3f1377e0328f1b45b672efe96a384dbdbb6" + integrity sha512-y7bpdSXc+UkfH2HPvOCV7XBk1eFsmoexsvVGqlRNd9r0sb/OXqcYLvnW4+BEyt5xKp7TpQibNBEKJCNih4dcMQ== "@pixi/tilemap@^3.2.2": version "3.2.2" @@ -368,9 +355,9 @@ integrity sha512-svdmMyJP63vdae3t66tCmE8IWeO/6lD1xXU+5gzfxqxJS5seTp2bm8mQok2c8PF0O6l/NYlLz6BRklOuEuHboQ== "@pixi/utils@~6.5.0": - version "6.5.8" - resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-6.5.8.tgz#5b7662c00951ac530bb0b72329bab922f4030930" - integrity sha512-zLnvmVQBWPDnwkfvrSpBBF2XpWSMt+kQAsX562eqjuME63ic9M6fK4u/IaA8csdlG2wtcjBvSYWrpWmPq0bWag== + version "6.5.9" + resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-6.5.9.tgz#1798cfb581353df31664e694cdededf9d582a4b6" + integrity sha512-eLYZihYs9gEyPscoNvxgpZtKTXeCskoZ7TFmI23gAoegOIA3SWUsCudi/DJuQwGJSulitQ0M2BDJoVoSEoonEA== dependencies: "@types/earcut" "^2.1.0" earcut "^2.2.4" @@ -400,9 +387,9 @@ integrity sha512-w8oigUCDjElRHRRrMvn/spybSMyX8MTkKA5Dv+tS1IE/TgmNZPqUYtvYBXGY8cieSE66gm+szeK+bnbxC2xHTQ== "@types/estree@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" - integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" + integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== "@types/howler@^2.2.7": version "2.2.7" @@ -410,9 +397,9 @@ integrity sha512-PEZldwZqJJw1PWRTpupyC7ajVTZA8aHd8nB/Y0n6zRZi5u8ktYDntsHj13ltEiBRqWwF06pASxBEvCTxniG8eA== "@types/json-schema@^7.0.9": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + version "7.0.12" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" + integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== "@types/offscreencanvas@^2019.6.4": version "2019.7.0" @@ -425,91 +412,92 @@ integrity sha512-Z+5bJSm28EXBSUJEgx29ioWeEEHUh6TiMkZHDhLwjc9wVFH+ressbkmX6waUZc5R3Gobn4Qu5llGxaoflZ+yhA== "@types/semver@^7.3.12": - version "7.3.13" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" - integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + version "7.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" + integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== "@typescript-eslint/eslint-plugin@^5.30.7": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz#098abb4c9354e19f460d57ab18bff1f676a6cff0" - integrity sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA== + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz#81382d6ecb92b8dda70e91f9035611cb2fecd1c3" + integrity sha512-KSWsVvsJsLJv3c4e73y/Bzt7OpqMCADUO846bHcuWYSYM19bldbAeDv7dYyV0jwkbMfJ2XdlzwjhXtuD7OY6bw== dependencies: - "@typescript-eslint/scope-manager" "5.46.1" - "@typescript-eslint/type-utils" "5.46.1" - "@typescript-eslint/utils" "5.46.1" + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/type-utils" "5.60.1" + "@typescript-eslint/utils" "5.60.1" debug "^4.3.4" + grapheme-splitter "^1.0.4" ignore "^5.2.0" natural-compare-lite "^1.4.0" - regexpp "^3.2.0" semver "^7.3.7" tsutils "^3.21.0" "@typescript-eslint/parser@^5.30.7": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.46.1.tgz#1fc8e7102c1141eb64276c3b89d70da8c0ba5699" - integrity sha512-RelQ5cGypPh4ySAtfIMBzBGyrNerQcmfA1oJvPj5f+H4jI59rl9xxpn4bonC0tQvUKOEN7eGBFWxFLK3Xepneg== + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.60.1.tgz#0f2f58209c0862a73e3d5a56099abfdfa21d0fd3" + integrity sha512-pHWlc3alg2oSMGwsU/Is8hbm3XFbcrb6P5wIxcQW9NsYBfnrubl/GhVVD/Jm/t8HXhA2WncoIRfBtnCgRGV96Q== dependencies: - "@typescript-eslint/scope-manager" "5.46.1" - "@typescript-eslint/types" "5.46.1" - "@typescript-eslint/typescript-estree" "5.46.1" + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/typescript-estree" "5.60.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz#70af8425c79bbc1178b5a63fb51102ddf48e104a" - integrity sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA== +"@typescript-eslint/scope-manager@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.60.1.tgz#35abdb47f500c68c08f2f2b4f22c7c79472854bb" + integrity sha512-Dn/LnN7fEoRD+KspEOV0xDMynEmR3iSHdgNsarlXNLGGtcUok8L4N71dxUgt3YvlO8si7E+BJ5Fe3wb5yUw7DQ== dependencies: - "@typescript-eslint/types" "5.46.1" - "@typescript-eslint/visitor-keys" "5.46.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/visitor-keys" "5.60.1" -"@typescript-eslint/type-utils@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz#195033e4b30b51b870dfcf2828e88d57b04a11cc" - integrity sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng== +"@typescript-eslint/type-utils@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.60.1.tgz#17770540e98d65ab4730c7aac618003f702893f4" + integrity sha512-vN6UztYqIu05nu7JqwQGzQKUJctzs3/Hg7E2Yx8rz9J+4LgtIDFWjjl1gm3pycH0P3mHAcEUBd23LVgfrsTR8A== dependencies: - "@typescript-eslint/typescript-estree" "5.46.1" - "@typescript-eslint/utils" "5.46.1" + "@typescript-eslint/typescript-estree" "5.60.1" + "@typescript-eslint/utils" "5.60.1" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.46.1.tgz#4e9db2107b9a88441c4d5ecacde3bb7a5ebbd47e" - integrity sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w== +"@typescript-eslint/types@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.60.1.tgz#a17473910f6b8d388ea83c9d7051af89c4eb7561" + integrity sha512-zDcDx5fccU8BA0IDZc71bAtYIcG9PowaOwaD8rjYbqwK7dpe/UMQl3inJ4UtUK42nOCT41jTSCwg76E62JpMcg== -"@typescript-eslint/typescript-estree@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz#5358088f98a8f9939355e0996f9c8f41c25eced2" - integrity sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg== +"@typescript-eslint/typescript-estree@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.1.tgz#8c71824b7165b64d5ebd7aa42968899525959834" + integrity sha512-hkX70J9+2M2ZT6fhti5Q2FoU9zb+GeZK2SLP1WZlvUDqdMbEKhexZODD1WodNRyO8eS+4nScvT0dts8IdaBzfw== dependencies: - "@typescript-eslint/types" "5.46.1" - "@typescript-eslint/visitor-keys" "5.46.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/visitor-keys" "5.60.1" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.46.1.tgz#7da3c934d9fd0eb4002a6bb3429f33298b469b4a" - integrity sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA== +"@typescript-eslint/utils@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.60.1.tgz#6861ebedbefba1ac85482d2bdef6f2ff1eb65b80" + integrity sha512-tiJ7FFdFQOWssFa3gqb94Ilexyw0JVxj6vBzaSpfN/8IhoKkDuSAenUKvsSHw2A/TMpJb26izIszTXaqygkvpQ== dependencies: + "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.46.1" - "@typescript-eslint/types" "5.46.1" - "@typescript-eslint/typescript-estree" "5.46.1" + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/typescript-estree" "5.60.1" eslint-scope "^5.1.1" - eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.46.1": - version "5.46.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz#126cc6fe3c0f83608b2b125c5d9daced61394242" - integrity sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg== +"@typescript-eslint/visitor-keys@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.1.tgz#19a877358bf96318ec35d90bfe6bd1445cce9434" + integrity sha512-xEYIxKcultP6E/RMKqube11pGjXH1DCo60mQoWhVYyKfLkwbIVVjYxmOenNMxILx0TjCujPTjjnTIVzm09TXIw== dependencies: - "@typescript-eslint/types" "5.46.1" + "@typescript-eslint/types" "5.60.1" eslint-visitor-keys "^3.3.0" acorn-jsx@^5.3.2: @@ -517,10 +505,10 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^8.5.0, acorn@^8.8.0: - version "8.8.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" - integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== +acorn@^8.8.2, acorn@^8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" + integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" @@ -579,6 +567,14 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +call-bind@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -601,9 +597,9 @@ chalk@^4.0.0: supports-color "^7.1.0" clean-css@^5.2.2: - version "5.3.1" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.1.tgz#d0610b0b90d125196a2894d35366f734e5d7aa32" - integrity sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg== + version "5.3.2" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.2.tgz#70ecc7d4d4114921f5d298349ff86a31a9975224" + integrity sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww== dependencies: source-map "~0.6.0" @@ -682,33 +678,33 @@ earcut@^2.2.4: resolved "https://registry.yarnpkg.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== -esbuild@^0.16.3: - version "0.16.9" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.16.9.tgz#01b6c3a6cbc072108253ac160a0734229bf8c921" - integrity sha512-gkH83yHyijMSZcZFs1IWew342eMdFuWXmQo3zkDPTre25LIPBJsXryg02M3u8OpTwCJdBkdaQwqKkDLnAsAeLQ== +esbuild@^0.17.5: + version "0.17.19" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" + integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== optionalDependencies: - "@esbuild/android-arm" "0.16.9" - "@esbuild/android-arm64" "0.16.9" - "@esbuild/android-x64" "0.16.9" - "@esbuild/darwin-arm64" "0.16.9" - "@esbuild/darwin-x64" "0.16.9" - "@esbuild/freebsd-arm64" "0.16.9" - "@esbuild/freebsd-x64" "0.16.9" - "@esbuild/linux-arm" "0.16.9" - "@esbuild/linux-arm64" "0.16.9" - "@esbuild/linux-ia32" "0.16.9" - "@esbuild/linux-loong64" "0.16.9" - "@esbuild/linux-mips64el" "0.16.9" - "@esbuild/linux-ppc64" "0.16.9" - "@esbuild/linux-riscv64" "0.16.9" - "@esbuild/linux-s390x" "0.16.9" - "@esbuild/linux-x64" "0.16.9" - "@esbuild/netbsd-x64" "0.16.9" - "@esbuild/openbsd-x64" "0.16.9" - "@esbuild/sunos-x64" "0.16.9" - "@esbuild/win32-arm64" "0.16.9" - "@esbuild/win32-ia32" "0.16.9" - "@esbuild/win32-x64" "0.16.9" + "@esbuild/android-arm" "0.17.19" + "@esbuild/android-arm64" "0.17.19" + "@esbuild/android-x64" "0.17.19" + "@esbuild/darwin-arm64" "0.17.19" + "@esbuild/darwin-x64" "0.17.19" + "@esbuild/freebsd-arm64" "0.17.19" + "@esbuild/freebsd-x64" "0.17.19" + "@esbuild/linux-arm" "0.17.19" + "@esbuild/linux-arm64" "0.17.19" + "@esbuild/linux-ia32" "0.17.19" + "@esbuild/linux-loong64" "0.17.19" + "@esbuild/linux-mips64el" "0.17.19" + "@esbuild/linux-ppc64" "0.17.19" + "@esbuild/linux-riscv64" "0.17.19" + "@esbuild/linux-s390x" "0.17.19" + "@esbuild/linux-x64" "0.17.19" + "@esbuild/netbsd-x64" "0.17.19" + "@esbuild/openbsd-x64" "0.17.19" + "@esbuild/sunos-x64" "0.17.19" + "@esbuild/win32-arm64" "0.17.19" + "@esbuild/win32-ia32" "0.17.19" + "@esbuild/win32-x64" "0.17.19" escape-string-regexp@^4.0.0: version "4.0.0" @@ -723,38 +719,29 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" - integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== eslint@^8.20.0: - version "8.29.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.29.0.tgz#d74a88a20fb44d59c51851625bc4ee8d0ec43f87" - integrity sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg== + version "8.44.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" + integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== dependencies: - "@eslint/eslintrc" "^1.3.3" - "@humanwhocodes/config-array" "^0.11.6" + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.1.0" + "@eslint/js" "8.44.0" + "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" @@ -763,49 +750,46 @@ eslint@^8.20.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.3.0" - espree "^9.4.0" - esquery "^1.4.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.6.0" + esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" find-up "^5.0.0" glob-parent "^6.0.2" - globals "^13.15.0" - grapheme-splitter "^1.0.4" + globals "^13.19.0" + graphemer "^1.4.0" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.1.2" natural-compare "^1.4.0" - optionator "^0.9.1" - regexpp "^3.2.0" + optionator "^0.9.3" strip-ansi "^6.0.1" strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.4.0: - version "9.4.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" - integrity sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg== +espree@^9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f" + integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A== dependencies: - acorn "^8.8.0" + acorn "^8.9.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" + eslint-visitor-keys "^3.4.1" -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" @@ -847,9 +831,9 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-glob@^3.2.9: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + version "3.3.0" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.0.tgz#7c40cb491e1e2ed5664749e87bfb516dbe8727c0" + integrity sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -868,9 +852,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: - version "1.14.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.14.0.tgz#107f69d7295b11e0fccc264e1fc6389f623731ce" - integrity sha512-eR2D+V9/ExcbF9ls441yIuN6TI2ED1Y2ZcA5BmMtJsOkWOFRJQ0Jt0g1UwqXJJVAb+V+umH5Dfr8oh4EVP7VVg== + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== dependencies: reusify "^1.0.4" @@ -924,6 +908,16 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +get-intrinsic@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" + integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-proto "^1.0.1" + has-symbols "^1.0.3" + gifuct-js@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/gifuct-js/-/gifuct-js-2.1.2.tgz#06152437ba30ec914db8398bd838bd0fbc8a6ecd" @@ -957,10 +951,10 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^13.15.0: - version "13.19.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.19.0.tgz#7a42de8e6ad4f7242fbcca27ea5b23aca367b5c8" - integrity sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ== +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== dependencies: type-fest "^0.20.2" @@ -981,11 +975,26 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -1017,9 +1026,9 @@ html-minifier-terser@^6.1.0: terser "^5.10.0" ignore@^5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.1.tgz#c2b1f76cb999ede1502f3a226a9310fdfe88d46c" - integrity sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA== + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" @@ -1047,10 +1056,10 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -is-core-module@^2.9.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" - integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== +is-core-module@^2.11.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== dependencies: has "^1.0.3" @@ -1086,11 +1095,6 @@ js-binary-schema-parser@^2.0.3: resolved "https://registry.yarnpkg.com/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz#3d7848748e8586e63b34e8911b643f59cfb6396e" integrity sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg== -js-sdsl@^4.1.4: - version "4.2.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.2.0.tgz#278e98b7bea589b8baaf048c20aeb19eb7ad09d0" - integrity sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ== - js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -1167,10 +1171,10 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nanoid@^3.3.4: - version "3.3.4" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" - integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== +nanoid@^3.3.6: + version "3.3.6" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" + integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== natural-compare-lite@^1.4.0: version "1.4.0" @@ -1195,6 +1199,11 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-inspect@^1.9.0: + version "1.12.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" + integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1202,17 +1211,17 @@ once@^1.3.0: dependencies: wrappy "1" -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" - word-wrap "^1.2.3" p-limit@^3.0.2: version "3.1.0" @@ -1291,12 +1300,12 @@ picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -postcss@^8.4.20: - version "8.4.20" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56" - integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g== +postcss@^8.4.23: + version "8.4.24" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.24.tgz#f714dba9b2284be3cc07dbd2fc57ee4dc972d2df" + integrity sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg== dependencies: - nanoid "^3.3.4" + nanoid "^3.3.6" picocolors "^1.0.0" source-map-js "^1.0.2" @@ -1306,35 +1315,32 @@ prelude-ls@^1.2.1: integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== promise-polyfill@^8.2.0: - version "8.2.3" - resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.2.3.tgz#2edc7e4b81aff781c88a0d577e5fe9da822107c6" - integrity sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg== + version "8.3.0" + resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.3.0.tgz#9284810268138d103807b11f4e23d5e945a4db63" + integrity sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg== -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g== +qs@^6.11.0: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - relateurl@^0.2.7: version "0.2.7" resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" @@ -1346,11 +1352,11 @@ resolve-from@^4.0.0: integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve@^1.22.1: - version "1.22.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== dependencies: - is-core-module "^2.9.0" + is-core-module "^2.11.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -1366,10 +1372,10 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" -rollup@^3.7.0: - version "3.7.5" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.7.5.tgz#db580f8eda50237b0721ddea301fb981cd992933" - integrity sha512-z0ZbqHBtS/et2EEUKMrAl2CoSdwN7ZPzL17UMiKN9RjjqHShTlv7F9J6ZJZJNREYjBh3TvBrdfjkFDIXFNeuiQ== +rollup@^3.21.0: + version "3.26.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.26.0.tgz#9f2e0316a4ca641911cefd8515c562a9124e6130" + integrity sha512-YzJH0eunH2hr3knvF3i6IkLO/jTjAEwU4HoMUbQl4//Tnl3ou0e7P5SjxdDr8HQJdeUJShlbEHXrrnEHy1l7Yg== optionalDependencies: fsevents "~2.3.2" @@ -1381,9 +1387,9 @@ run-parallel@^1.1.9: queue-microtask "^1.2.2" semver@^7.3.7: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + version "7.5.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" + integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== dependencies: lru-cache "^6.0.0" @@ -1399,6 +1405,15 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -1447,12 +1462,12 @@ supports-preserve-symlinks-flag@^1.0.0: integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== terser@^5.10.0: - version "5.16.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.16.1.tgz#5af3bc3d0f24241c7fb2024199d5c461a1075880" - integrity sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw== + version "5.18.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.18.2.tgz#ff3072a0faf21ffd38f99acc9a0ddf7b5f07b948" + integrity sha512-Ah19JS86ypbJzTzvUCX7KOsEIhDaRONungA4aYBjEP3JZRf4ocuDzTg4QWZnPn9DEMiMYGJPiSOy7aykoCc70w== dependencies: - "@jridgewell/source-map" "^0.3.2" - acorn "^8.5.0" + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" commander "^2.20.0" source-map-support "~0.5.20" @@ -1474,9 +1489,9 @@ tslib@^1.8.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.3, tslib@^2.3.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" - integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + version "2.6.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" + integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== tsutils@^3.21.0: version "3.21.0" @@ -1510,12 +1525,12 @@ uri-js@^4.2.2: punycode "^2.1.0" url@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ== + version "0.11.1" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.1.tgz#26f90f615427eca1b9f4d6a28288c147e2302a32" + integrity sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA== dependencies: - punycode "1.3.2" - querystring "0.2.0" + punycode "^1.4.1" + qs "^6.11.0" vite-plugin-minify@^1.5.2: version "1.5.2" @@ -1525,14 +1540,13 @@ vite-plugin-minify@^1.5.2: html-minifier-terser "^6.1.0" vite@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.0.2.tgz#909beb07995048fe5a83b35b5e827d79627457c4" - integrity sha512-QJaY3R+tFlTagH0exVqbgkkw45B+/bXVBzF2ZD1KB5Z8RiAoiKo60vSUf6/r4c2Vh9jfGBKM4oBI9b4/1ZJYng== + version "4.3.9" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.3.9.tgz#db896200c0b1aa13b37cdc35c9e99ee2fdd5f96d" + integrity sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg== dependencies: - esbuild "^0.16.3" - postcss "^8.4.20" - resolve "^1.22.1" - rollup "^3.7.0" + esbuild "^0.17.5" + postcss "^8.4.23" + rollup "^3.21.0" optionalDependencies: fsevents "~2.3.2" @@ -1543,11 +1557,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"