From 76d1d11af700c20b77927e4593b216b47d880cfe Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 3 Nov 2022 01:39:10 -0400 Subject: [PATCH] More changes --- src/api/nitro/avatar/structure/ISetType.ts | 4 +- src/core/utils/AdvancedMap.ts | 24 ++--- src/nitro/avatar/AvatarImage.ts | 4 +- src/nitro/avatar/structure/figure/Palette.ts | 6 +- src/nitro/avatar/structure/figure/SetType.ts | 6 +- .../parser/inventory/badges/BadgesParser.ts | 12 +-- .../parser/notifications/UnseenItemsParser.ts | 10 +-- .../UserSongDisksInventoryMessageParser.ts | 10 +-- .../RelationshipStatusInfoMessageParser.ts | 10 +-- .../avatar/AvatarVisualization.ts | 6 +- .../FurnitureFireworksVisualization.ts | 32 +++---- .../furniture/FurnitureParticleSystem.ts | 70 +++++++-------- .../events/RoomSessionWordQuizEvent.ts | 8 +- .../session/events/UserNameUpdateEvent.ts | 4 +- src/nitro/sound/SoundManager.ts | 8 +- src/room/RoomObjectManager.ts | 32 +++---- src/room/utils/RoomGeometry.ts | 88 +++++++++---------- src/room/utils/RoomId.ts | 10 +-- 18 files changed, 172 insertions(+), 172 deletions(-) diff --git a/src/api/nitro/avatar/structure/ISetType.ts b/src/api/nitro/avatar/structure/ISetType.ts index 0df7f939..89ceb548 100644 --- a/src/api/nitro/avatar/structure/ISetType.ts +++ b/src/api/nitro/avatar/structure/ISetType.ts @@ -1,4 +1,4 @@ -import { AdvancedMap } from '../../../../core'; +import { IAdvancedMap } from '../../../IAdvancedMap'; import { IFigurePartSet } from './IFigurePartSet'; export interface ISetType @@ -8,5 +8,5 @@ export interface ISetType optionalFromClubLevel(_arg_1: string): number; type: string; paletteID: number; - partSets: AdvancedMap; + partSets: IAdvancedMap; } diff --git a/src/core/utils/AdvancedMap.ts b/src/core/utils/AdvancedMap.ts index cbb18d11..3be0f412 100644 --- a/src/core/utils/AdvancedMap.ts +++ b/src/core/utils/AdvancedMap.ts @@ -14,7 +14,7 @@ export class AdvancedMap implements IAdvancedMap this._array = []; this._keys = []; - if(map) for(const [key, value] of map.entries()) this.add(key, value); + if (map) for (const [key, value] of map.entries()) this.add(key, value); } public get length(): number @@ -29,9 +29,9 @@ export class AdvancedMap implements IAdvancedMap public dispose(): void { - if(!this._dictionary) + if (!this._dictionary) { - for(const key of this._dictionary.keys()) this._dictionary.delete(key); + for (const key of this._dictionary.keys()) this._dictionary.delete(key); this._dictionary = null; } @@ -43,7 +43,7 @@ export class AdvancedMap implements IAdvancedMap public reset(): void { - for(const key of this._dictionary.keys()) this._dictionary.delete(key); + for (const key of this._dictionary.keys()) this._dictionary.delete(key); this._length = 0; this._array = []; @@ -52,7 +52,7 @@ export class AdvancedMap implements IAdvancedMap public unshift(key: T, value: U): boolean { - if(this._dictionary.get(key) !== null) return false; + if (this._dictionary.get(key) !== null) return false; this._dictionary.set(key, value); @@ -66,7 +66,7 @@ export class AdvancedMap implements IAdvancedMap public add(key: T, value: U): boolean { - if(this._dictionary.get(key) !== undefined) return false; + if (this._dictionary.get(key) !== undefined) return false; this._dictionary.set(key, value); @@ -82,11 +82,11 @@ export class AdvancedMap implements IAdvancedMap { const value = this._dictionary.get(key); - if(!value) return null; + if (!value) return null; const index = this._array.indexOf(value); - if(index >= 0) + if (index >= 0) { this._array.splice(index, 1); this._keys.splice(index, 1); @@ -101,14 +101,14 @@ export class AdvancedMap implements IAdvancedMap public getWithIndex(index: number): U { - if((index < 0) || (index >= this._length)) return null; + if ((index < 0) || (index >= this._length)) return null; return this._array[index]; } public getKey(index: number): T { - if((index < 0) || (index >= this._length)) return null; + if ((index < 0) || (index >= this._length)) return null; return this._keys[index]; } @@ -143,9 +143,9 @@ export class AdvancedMap implements IAdvancedMap return this._array.indexOf(value); } - public concatenate(newValues: AdvancedMap): void + public concatenate(newValues: IAdvancedMap): void { - for(const k of newValues._keys) this.add(k, newValues.getValue(k)); + for (const k of (newValues as AdvancedMap)._keys) this.add(k, newValues.getValue(k)); } public clone(): IAdvancedMap diff --git a/src/nitro/avatar/AvatarImage.ts b/src/nitro/avatar/AvatarImage.ts index a022e81e..bf4ecefe 100644 --- a/src/nitro/avatar/AvatarImage.ts +++ b/src/nitro/avatar/AvatarImage.ts @@ -3,7 +3,7 @@ import { Container } from '@pixi/display'; import { ColorMatrixFilter } from '@pixi/filter-color-matrix'; import { Rectangle } from '@pixi/math'; import { Sprite } from '@pixi/sprite'; -import { AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api'; +import { AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAdvancedMap, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api'; import { AdvancedMap } from '../../core'; import { GetTickerTime, NitroContainer, NitroSprite, PaletteMapFilter, PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; import { ActiveActionData } from './actions'; @@ -51,7 +51,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private _sortedActions: IActiveActionData[]; private _lastActionsString: string; private _currentActionsString: string; - private _fullImageCache: AdvancedMap; + private _fullImageCache: IAdvancedMap; private _fullImageCacheSize: number = 5; protected _isCachedImage: boolean = false; private _useFullImageCache: boolean = false; diff --git a/src/nitro/avatar/structure/figure/Palette.ts b/src/nitro/avatar/structure/figure/Palette.ts index 43a13b71..8e0613be 100644 --- a/src/nitro/avatar/structure/figure/Palette.ts +++ b/src/nitro/avatar/structure/figure/Palette.ts @@ -1,11 +1,11 @@ -import { IFigureDataPalette, IPalette, IPartColor } from '../../../../api'; +import { IAdvancedMap, IFigureDataPalette, IPalette, IPartColor } from '../../../../api'; import { AdvancedMap } from '../../../../core'; import { PartColor } from './PartColor'; export class Palette implements IPalette { private _id: number; - private _colors: AdvancedMap; + private _colors: IAdvancedMap; constructor(data: IFigureDataPalette) { @@ -39,7 +39,7 @@ export class Palette implements IPalette return this._id; } - public get colors(): AdvancedMap + public get colors(): IAdvancedMap { return this._colors; } diff --git a/src/nitro/avatar/structure/figure/SetType.ts b/src/nitro/avatar/structure/figure/SetType.ts index 85ca5a3b..d1da89a8 100644 --- a/src/nitro/avatar/structure/figure/SetType.ts +++ b/src/nitro/avatar/structure/figure/SetType.ts @@ -1,4 +1,4 @@ -import { IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api'; +import { IAdvancedMap, IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api'; import { AdvancedMap } from '../../../../core'; import { FigurePartSet } from './FigurePartSet'; @@ -7,7 +7,7 @@ export class SetType implements ISetType private _type: string; private _paletteId: number; private _isMandatory: { [index: string]: boolean[] }; - private _partSets: AdvancedMap; + private _partSets: IAdvancedMap; constructor(data: IFigureDataSetType) { @@ -97,7 +97,7 @@ export class SetType implements ISetType return _local_2.indexOf(false); } - public get partSets(): AdvancedMap + public get partSets(): IAdvancedMap { return this._partSets; } diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts index 7105f96a..306c7463 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts @@ -1,11 +1,11 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; import { AdvancedMap } from '../../../../../../core'; export class BadgesParser implements IMessageParser { private _allBadgeCodes: string[]; - private _activeBadgeCodes: AdvancedMap; - private _badgeIds: AdvancedMap; + private _activeBadgeCodes: IAdvancedMap; + private _badgeIds: IAdvancedMap; public flush(): boolean { @@ -18,7 +18,7 @@ export class BadgesParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if(!wrapper) return false; + if (!wrapper) return false; this._allBadgeCodes = []; this._activeBadgeCodes = new AdvancedMap(); @@ -26,7 +26,7 @@ export class BadgesParser implements IMessageParser let count = wrapper.readInt(); - while(count > 0) + while (count > 0) { const badgeId = wrapper.readInt(); const badgeCode = wrapper.readString(); @@ -40,7 +40,7 @@ export class BadgesParser implements IMessageParser count = wrapper.readInt(); - while(count > 0) + while (count > 0) { const badgeSlot = wrapper.readInt(); const badgeCode = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts index 88faa4af..ec6852b5 100644 --- a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts +++ b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts @@ -1,9 +1,9 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; export class UnseenItemsParser implements IMessageParser { - private _items: AdvancedMap; + private _items: IAdvancedMap; public flush(): boolean { @@ -14,18 +14,18 @@ export class UnseenItemsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if(!wrapper) return false; + if (!wrapper) return false; let totalUnseen = wrapper.readInt(); - while(totalUnseen > 0) + while (totalUnseen > 0) { const category = wrapper.readInt(); let totalItems = wrapper.readInt(); const itemIds: number[] = []; - while(totalItems > 0) + while (totalItems > 0) { itemIds.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts index a9d302d6..4e5e1940 100644 --- a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts @@ -1,9 +1,9 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; export class UserSongDisksInventoryMessageParser implements IMessageParser { - private _songDiskInventory: AdvancedMap = new AdvancedMap(); + private _songDiskInventory: IAdvancedMap = new AdvancedMap(); flush(): boolean { @@ -15,7 +15,7 @@ export class UserSongDisksInventoryMessageParser implements IMessageParser { const count = wrapper.readInt(); - for(let i = 0; i < count; i++) + for (let i = 0; i < count; i++) { this._songDiskInventory.add(wrapper.readInt(), wrapper.readInt()); } @@ -24,7 +24,7 @@ export class UserSongDisksInventoryMessageParser implements IMessageParser public getDiskId(k: number): number { - if(((k >= 0) && (k < this._songDiskInventory.length))) + if (((k >= 0) && (k < this._songDiskInventory.length))) { return this._songDiskInventory.getKey(k); } @@ -33,7 +33,7 @@ export class UserSongDisksInventoryMessageParser implements IMessageParser public getSongId(k: number): number { - if(((k >= 0) && (k < this._songDiskInventory.length))) + if (((k >= 0) && (k < this._songDiskInventory.length))) { return this._songDiskInventory.getWithIndex(k); } diff --git a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts index cf70f9ae..d77d1dcb 100644 --- a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts @@ -1,11 +1,11 @@ -import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; import { AdvancedMap } from '../../../../../../core'; import { RelationshipStatusInfo } from './RelationshipStatusInfo'; export class RelationshipStatusInfoMessageParser implements IMessageParser { private _userId: number; - private _relationshipStatusMap: AdvancedMap; + private _relationshipStatusMap: IAdvancedMap; public flush(): boolean { @@ -17,14 +17,14 @@ export class RelationshipStatusInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if(!wrapper) return false; + if (!wrapper) return false; this._userId = wrapper.readInt(); this._relationshipStatusMap = new AdvancedMap(); const relationshipsCount = wrapper.readInt(); - for(let i = 0; i < relationshipsCount; i++) + for (let i = 0; i < relationshipsCount; i++) { const relationship = new RelationshipStatusInfo(wrapper); @@ -39,7 +39,7 @@ export class RelationshipStatusInfoMessageParser implements IMessageParser return this._userId; } - public get relationshipStatusMap(): AdvancedMap + public get relationshipStatusMap(): IAdvancedMap { return this._relationshipStatusMap; } diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts index 959bb12c..17835ea8 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts @@ -1,6 +1,6 @@ import { BLEND_MODES } from '@pixi/constants'; import { Resource, Texture } from '@pixi/core'; -import { AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api'; +import { AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; import { RoomObjectSpriteVisualization } from '../../../../../room'; import { ExpressionAdditionFactory, FloatingIdleZAddition, GameClickTargetAddition, GuideStatusBubbleAddition, IAvatarAddition, MutedBubbleAddition, NumberBubbleAddition, TypingBubbleAddition } from './additions'; @@ -34,8 +34,8 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement protected _data: AvatarVisualizationData; private _avatarImage: IAvatarImage; - private _cachedAvatars: AdvancedMap; - private _cachedAvatarEffects: AdvancedMap; + private _cachedAvatars: IAdvancedMap; + private _cachedAvatarEffects: IAdvancedMap; private _shadow: IGraphicAsset; private _lastUpdate: number; private _disposed: boolean; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts index e980c75a..6c9fc70e 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts @@ -1,11 +1,11 @@ -import { IParticleSystem, RoomObjectVariable } from '../../../../../api'; +import { IAdvancedMap, IParticleSystem, RoomObjectVariable } from '../../../../../api'; import { AdvancedMap, NitroLogger } from '../../../../../core'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; import { FurnitureParticleSystem } from './FurnitureParticleSystem'; export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualization { - private _particleSystems: AdvancedMap; + private _particleSystems: IAdvancedMap; private _currentParticleSystem: FurnitureParticleSystem; public dispose(): void @@ -14,9 +14,9 @@ export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualizat this._currentParticleSystem = null; - if(this._particleSystems) + if (this._particleSystems) { - for(const particleSystem of this._particleSystems.getValues()) particleSystem.dispose(); + for (const particleSystem of this._particleSystems.getValues()) particleSystem.dispose(); this._particleSystems = null; } @@ -24,25 +24,25 @@ export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualizat protected updateObject(scale: number, direction: number): boolean { - if(super.updateObject(scale, direction)) + if (super.updateObject(scale, direction)) { - if(!this._particleSystems) + if (!this._particleSystems) { this._Str_18684(); - if(this._particleSystems) this._currentParticleSystem = this._particleSystems.getValue(scale); + if (this._particleSystems) this._currentParticleSystem = this._particleSystems.getValue(scale); else NitroLogger.log('ERROR Particle systems could not be read!', this.object.type); } else { - if((scale !== this._scale) || (this._particleSystems.getValue(scale) !== this._currentParticleSystem)) + if ((scale !== this._scale) || (this._particleSystems.getValue(scale) !== this._currentParticleSystem)) { const particleSystem = this._particleSystems.getValue(scale); particleSystem._Str_17988(this._currentParticleSystem); - if(this._currentParticleSystem) this._currentParticleSystem.reset(); + if (this._currentParticleSystem) this._currentParticleSystem.reset(); this._currentParticleSystem = particleSystem; } @@ -58,26 +58,26 @@ export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualizat { super.updateSprites(scale, update, animation); - if(this._currentParticleSystem) this._currentParticleSystem.updateSprites(); + if (this._currentParticleSystem) this._currentParticleSystem.updateSprites(); } protected updateAnimation(scale: number): number { - if(this._currentParticleSystem) this._currentParticleSystem.updateAnimation(); + if (this._currentParticleSystem) this._currentParticleSystem.updateAnimation(); return super.updateAnimation(scale); } protected setAnimation(id: number): void { - if(this._currentParticleSystem) this._currentParticleSystem.setAnimation(id); + if (this._currentParticleSystem) this._currentParticleSystem.setAnimation(id); super.setAnimation(id); } protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if(this._currentParticleSystem && this._currentParticleSystem.controlsSprite(layerId)) + if (this._currentParticleSystem && this._currentParticleSystem.controlsSprite(layerId)) { return this._currentParticleSystem.getLayerYOffset(scale, direction, layerId); } @@ -87,15 +87,15 @@ export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualizat private _Str_18684(): boolean { - if(!this.object || !this.object.model) return false; + if (!this.object || !this.object.model) return false; const fireworksData = this.object.model.getValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA); - if(!fireworksData || !fireworksData.length) return false; + if (!fireworksData || !fireworksData.length) return false; this._particleSystems = new AdvancedMap(); - for(const particleData of fireworksData) + for (const particleData of fireworksData) { const size = particleData.size; const particleSystem = new FurnitureParticleSystem(this); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 30a6e346..8f6e352b 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -2,7 +2,7 @@ import { RenderTexture, Texture } from '@pixi/core'; import { AlphaFilter } from '@pixi/filter-alpha'; import { Graphics } from '@pixi/graphics'; import { Matrix } from '@pixi/math'; -import { IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; +import { IAdvancedMap, IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; import { NitroPoint, NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; import { Vector3D } from '../../../../avatar'; @@ -11,7 +11,7 @@ import { FurnitureParticleSystemEmitter } from './FurnitureParticleSystemEmitter export class FurnitureParticleSystem { - private _emitters: AdvancedMap; + private _emitters: IAdvancedMap; private _visualization: FurnitureAnimatedVisualization; private _size: number; private _canvasId: number = -1; @@ -46,23 +46,23 @@ export class FurnitureParticleSystem public dispose(): void { - for(const emitter of this._emitters.getValues()) emitter.dispose(); + for (const emitter of this._emitters.getValues()) emitter.dispose(); this._emitters = null; - if(this._canvasTexture) + if (this._canvasTexture) { this._canvasTexture.destroy(); this._canvasTexture = null; } - if(this._blackOverlay) + if (this._blackOverlay) { this._blackOverlay.destroy(); this._blackOverlay = null; } - if(this._emptySprite) + if (this._emptySprite) { this._emptySprite.destroy(); this._emptySprite = null; @@ -76,7 +76,7 @@ export class FurnitureParticleSystem public reset(): void { - if(this._currentEmitter) this._currentEmitter.reset(); + if (this._currentEmitter) this._currentEmitter.reset(); this._currentEmitter = null; this._hasIgnited = false; @@ -87,7 +87,7 @@ export class FurnitureParticleSystem public setAnimation(id: number): void { - if(this._currentEmitter) this._currentEmitter.reset(); + if (this._currentEmitter) this._currentEmitter.reset(); this._currentEmitter = this._emitters.getValue(id); this._hasIgnited = false; @@ -98,15 +98,15 @@ export class FurnitureParticleSystem private updateCanvas(): void { - if(!this._currentEmitter || (this._canvasId === -1)) return; + if (!this._currentEmitter || (this._canvasId === -1)) return; this._roomSprite = this._visualization.getSprite(this._canvasId); - if(this._roomSprite && this._roomSprite.texture) + if (this._roomSprite && this._roomSprite.texture) { - if((this._roomSprite.width <= 1) || (this._roomSprite.height <= 1)) return; + if ((this._roomSprite.width <= 1) || (this._roomSprite.height <= 1)) return; - if(this._canvasTexture && ((this._canvasTexture.width !== this._roomSprite.width) || (this._canvasTexture.height !== this._roomSprite.height))) this._canvasTexture = null; + if (this._canvasTexture && ((this._canvasTexture.width !== this._roomSprite.width) || (this._canvasTexture.height !== this._roomSprite.height))) this._canvasTexture = null; this.clearCanvas(); @@ -118,7 +118,7 @@ export class FurnitureParticleSystem public getLayerYOffset(scale: number, direction: number, layerId: number): number { - if(this._currentEmitter && (this._currentEmitter.roomObjectSpriteId === layerId)) + if (this._currentEmitter && (this._currentEmitter.roomObjectSpriteId === layerId)) { return this._currentEmitter.y * this._scaleMultiplier; } @@ -128,58 +128,58 @@ export class FurnitureParticleSystem public controlsSprite(k: number): boolean { - if(this._currentEmitter) return this._currentEmitter.roomObjectSpriteId == k; + if (this._currentEmitter) return this._currentEmitter.roomObjectSpriteId == k; return false; } public updateSprites(): void { - if(!this._currentEmitter || !this._roomSprite) return; + if (!this._currentEmitter || !this._roomSprite) return; - if(this._canvasTexture && (this._roomSprite.texture !== this._canvasTexture)) + if (this._canvasTexture && (this._roomSprite.texture !== this._canvasTexture)) { this._roomSprite.texture = this._canvasTexture; } - if(this._hasIgnited) + if (this._hasIgnited) { - if(this._currentEmitter.roomObjectSpriteId >= 0) this._visualization.getSprite(this._currentEmitter.roomObjectSpriteId).visible = false; + if (this._currentEmitter.roomObjectSpriteId >= 0) this._visualization.getSprite(this._currentEmitter.roomObjectSpriteId).visible = false; } } public updateAnimation(): void { - if(!this._currentEmitter || !this._roomSprite || this._isDone) return; + if (!this._currentEmitter || !this._roomSprite || this._isDone) return; const k = 10; - if(!this._hasIgnited && this._currentEmitter.hasIgnited) this._hasIgnited = true; + if (!this._hasIgnited && this._currentEmitter.hasIgnited) this._hasIgnited = true; const offsetY = (this._offsetY * this._scaleMultiplier); this._currentEmitter.update(); - if(this._hasIgnited) + if (this._hasIgnited) { - if(this._currentEmitter.roomObjectSpriteId >= 0) + if (this._currentEmitter.roomObjectSpriteId >= 0) { this._visualization.getSprite(this._currentEmitter.roomObjectSpriteId).visible = false; } - if(!this._canvasTexture) this.updateCanvas(); + if (!this._canvasTexture) this.updateCanvas(); this.clearCanvas(); - for(const particle of this._currentEmitter.particles) + for (const particle of this._currentEmitter.particles) { const tx = (this._centerX + ((((particle.x - particle.z) * k) / 10) * this._scaleMultiplier)); const ty = ((this._centerY - offsetY) + ((((particle.y + ((particle.x + particle.z) / 2)) * k) / 10) * this._scaleMultiplier)); const asset = particle.getAsset(); - if(asset && asset.texture) + if (asset && asset.texture) { - if(particle.fade && (particle.alphaMultiplier < 1)) + if (particle.fade && (particle.alphaMultiplier < 1)) { this._translationMatrix.identity(); this._translationMatrix.translate((tx + asset.offsetX), (ty + asset.offsetY)); @@ -227,7 +227,7 @@ export class FurnitureParticleSystem } } - if(!this._currentEmitter.particles.length) + if (!this._currentEmitter.particles.length) { this._isDone = true; @@ -251,9 +251,9 @@ export class FurnitureParticleSystem this._bgColor = (parseInt(bgColor, 16) || 0x000000); - if(!particleSystem.emitters || !particleSystem.emitters.length) return; + if (!particleSystem.emitters || !particleSystem.emitters.length) return; - for(const emitter of particleSystem.emitters) + for (const emitter of particleSystem.emitters) { const emitterId = emitter.id; const emitterName = emitter.name; @@ -274,7 +274,7 @@ export class FurnitureParticleSystem const simulationShape = emitter.simulation.shape; const simulationEnergy = emitter.simulation.energy; - for(const particle of emitter.particles) + for (const particle of emitter.particles) { const lifeTime = particle.lifeTime; const isEmitter = (particle.isEmitter || false); @@ -282,7 +282,7 @@ export class FurnitureParticleSystem const frames: IGraphicAsset[] = []; - for(const name of particle.frames) frames.push(this._visualization.asset.getAsset(name)); + for (const name of particle.frames) frames.push(this._visualization.asset.getAsset(name)); particleEmitter.configureParticle(lifeTime, isEmitter, frames, fade); } @@ -295,28 +295,28 @@ export class FurnitureParticleSystem { let emitterId = 0; - if(particleSystem._emitters && particleSystem._currentEmitter) + if (particleSystem._emitters && particleSystem._currentEmitter) { emitterId = particleSystem._emitters.getKey(particleSystem._emitters.getValues().indexOf(particleSystem._currentEmitter)); } this.setAnimation(emitterId); - if(this._currentEmitter) this._currentEmitter.copyStateFrom(particleSystem._currentEmitter, (particleSystem._size / this._size)); + if (this._currentEmitter) this._currentEmitter.copyStateFrom(particleSystem._currentEmitter, (particleSystem._size / this._size)); this._canvasTexture = null; } private clearCanvas(): void { - if(!this._emptySprite) + if (!this._emptySprite) { this._emptySprite = new NitroSprite(Texture.EMPTY); this._emptySprite.alpha = 0; } - if(!this._canvasTexture) + if (!this._canvasTexture) { this._canvasTexture = RenderTexture.create({ width: this._roomSprite.width, diff --git a/src/nitro/session/events/RoomSessionWordQuizEvent.ts b/src/nitro/session/events/RoomSessionWordQuizEvent.ts index e0328d18..3c35f189 100644 --- a/src/nitro/session/events/RoomSessionWordQuizEvent.ts +++ b/src/nitro/session/events/RoomSessionWordQuizEvent.ts @@ -35,9 +35,9 @@ export class RoomSessionWordQuizEvent extends RoomSessionEvent return this._pollType; } - public set pollType(k: string) + public set pollType(pollType: string) { - this._pollType = k; + this._pollType = pollType; } public get pollId(): number @@ -95,9 +95,9 @@ export class RoomSessionWordQuizEvent extends RoomSessionEvent return this._value; } - public set value(k: string) + public set value(value: string) { - this._value = k; + this._value = value; } public get answerCounts(): Map diff --git a/src/nitro/session/events/UserNameUpdateEvent.ts b/src/nitro/session/events/UserNameUpdateEvent.ts index ec2f62d0..97b9402d 100644 --- a/src/nitro/session/events/UserNameUpdateEvent.ts +++ b/src/nitro/session/events/UserNameUpdateEvent.ts @@ -6,11 +6,11 @@ export class UserNameUpdateEvent extends NitroEvent private _name: string; - constructor(k: string) + constructor(name: string) { super(UserNameUpdateEvent.UNUE_NAME_UPDATED); - this._name = k; + this._name = name; } public get name(): string diff --git a/src/nitro/sound/SoundManager.ts b/src/nitro/sound/SoundManager.ts index f03cd3b0..3296b61b 100644 --- a/src/nitro/sound/SoundManager.ts +++ b/src/nitro/sound/SoundManager.ts @@ -1,4 +1,4 @@ -import { IMusicManager, ISoundManager } from '../../api'; +import { IAdvancedMap, IMusicManager, ISoundManager } from '../../api'; import { AdvancedMap, NitroEvent, NitroManager } from '../../core'; import { NitroSettingsEvent, NitroSoundEvent } from '../events'; import { Nitro } from '../Nitro'; @@ -11,9 +11,9 @@ export class SoundManager extends NitroManager implements ISoundManager private _volumeFurni: number; private _volumeTrax: number; - private _internalSamples: AdvancedMap; - private _furniSamples: AdvancedMap; - private _furnitureBeingPlayed: AdvancedMap; + private _internalSamples: IAdvancedMap; + private _furniSamples: IAdvancedMap; + private _furnitureBeingPlayed: IAdvancedMap; private _musicManager: MusicManager; diff --git a/src/room/RoomObjectManager.ts b/src/room/RoomObjectManager.ts index 56136995..41edf413 100644 --- a/src/room/RoomObjectManager.ts +++ b/src/room/RoomObjectManager.ts @@ -1,11 +1,11 @@ -import { IRoomObjectController, IRoomObjectManager } from '../api'; +import { IAdvancedMap, IRoomObjectController, IRoomObjectManager } from '../api'; import { AdvancedMap } from '../core'; import { RoomObject } from './object'; export class RoomObjectManager implements IRoomObjectManager { - private _objects: AdvancedMap; - private _objectsPerType: AdvancedMap>; + private _objects: IAdvancedMap; + private _objectsPerType: IAdvancedMap>; constructor() { @@ -22,7 +22,7 @@ export class RoomObjectManager implements IRoomObjectManager { const object = this._objects.getValue(id); - if(!object) return null; + if (!object) return null; return object; } @@ -31,7 +31,7 @@ export class RoomObjectManager implements IRoomObjectManager { const object = this._objects.getWithIndex(index); - if(!object) return null; + if (!object) return null; return object; } @@ -45,7 +45,7 @@ export class RoomObjectManager implements IRoomObjectManager private addObject(id: number, type: string, object: IRoomObjectController): IRoomObjectController { - if(this._objects.getValue(id)) + if (this._objects.getValue(id)) { object.dispose(); @@ -56,7 +56,7 @@ export class RoomObjectManager implements IRoomObjectManager const typeMap = this.getTypeMap(type); - if(typeMap) typeMap.add(id, object); + if (typeMap) typeMap.add(id, object); return object; } @@ -65,11 +65,11 @@ export class RoomObjectManager implements IRoomObjectManager { const object = this._objects.remove(id); - if(object) + if (object) { const typeMap = this.getTypeMap(object.type); - if(typeMap) typeMap.remove(object.id); + if (typeMap) typeMap.remove(object.id); object.dispose(); } @@ -79,11 +79,11 @@ export class RoomObjectManager implements IRoomObjectManager { let i = 0; - while(i < this._objects.length) + while (i < this._objects.length) { const object = this._objects.getWithIndex(i); - if(object) object.dispose(); + if (object) object.dispose(); i++; } @@ -92,11 +92,11 @@ export class RoomObjectManager implements IRoomObjectManager i = 0; - while(i < this._objectsPerType.length) + while (i < this._objectsPerType.length) { const typeMap = this._objectsPerType.getWithIndex(i); - if(typeMap) typeMap.dispose(); + if (typeMap) typeMap.dispose(); i++; } @@ -104,11 +104,11 @@ export class RoomObjectManager implements IRoomObjectManager this._objectsPerType.reset(); } - private getTypeMap(k: string, _arg_2: boolean = true): AdvancedMap + private getTypeMap(k: string, _arg_2: boolean = true): IAdvancedMap { let existing = this._objectsPerType.getValue(k); - if(!existing && _arg_2) + if (!existing && _arg_2) { existing = new AdvancedMap(); @@ -118,7 +118,7 @@ export class RoomObjectManager implements IRoomObjectManager return existing; } - public get objects(): AdvancedMap + public get objects(): IAdvancedMap { return this._objects; } diff --git a/src/room/utils/RoomGeometry.ts b/src/room/utils/RoomGeometry.ts index cfef44a0..595218a3 100644 --- a/src/room/utils/RoomGeometry.ts +++ b/src/room/utils/RoomGeometry.ts @@ -45,7 +45,7 @@ export class RoomGeometry implements IRoomGeometry this.z_scale = 1; this.location = new Vector3d(location.x, location.y, location.z); this.direction = new Vector3d(direction.x, direction.y, direction.z); - if(_arg_4 != null) + if (_arg_4 != null) { this.setDepthVector(_arg_4); } @@ -59,7 +59,7 @@ export class RoomGeometry implements IRoomGeometry public static getIntersectionVector(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D): IVector3D { const _local_5: number = Vector3d.dotProduct(_arg_2, _arg_4); - if(Math.abs(_local_5) < 1E-5) + if (Math.abs(_local_5) < 1E-5) { return null; } @@ -80,16 +80,16 @@ export class RoomGeometry implements IRoomGeometry return this._scale / Math.sqrt(0.5); } - public set scale(k: number) + public set scale(scale: number) { - if(k <= 1) + if (scale <= 1) { - k = 1; + scale = 1; } - k = (k * Math.sqrt(0.5)); - if(k != this._scale) + scale = (scale * Math.sqrt(0.5)); + if (scale != this._scale) { - this._scale = k; + this._scale = scale; this._updateId++; } } @@ -108,24 +108,24 @@ export class RoomGeometry implements IRoomGeometry return this._location; } - public set location(k: IVector3D) + public set location(location: IVector3D) { - if(k == null) + if (location == null) { return; } - if(this._loc == null) + if (this._loc == null) { this._loc = new Vector3d(); } const _local_2: number = this._loc.x; const _local_3: number = this._loc.y; const _local_4: number = this._loc.z; - this._loc.assign(k); + this._loc.assign(location); this._loc.x = (this._loc.x / this._x_scale); this._loc.y = (this._loc.y / this._y_scale); this._loc.z = (this._loc.z / this._z_scale); - if((((!(this._loc.x == _local_2)) || (!(this._loc.y == _local_3))) || (!(this._loc.z == _local_4)))) + if ((((!(this._loc.x == _local_2)) || (!(this._loc.y == _local_3))) || (!(this._loc.z == _local_4)))) { this._updateId++; } @@ -136,36 +136,36 @@ export class RoomGeometry implements IRoomGeometry return this._direction; } - public set direction(k: IVector3D) + public set direction(direction: IVector3D) { let _local_21: number; let _local_22: number; let _local_23: IVector3D; let _local_24: IVector3D; let _local_25: IVector3D; - if(k == null) + if (direction == null) { return; } - if(this._dir == null) + if (this._dir == null) { this._dir = new Vector3d(); } const _local_2: number = this._dir.x; const _local_3: number = this._dir.y; const _local_4: number = this._dir.z; - this._dir.assign(k); - this._direction.assign(k); - if((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) + this._dir.assign(direction); + this._direction.assign(direction); + if ((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) { this._updateId++; } const _local_5: IVector3D = new Vector3d(0, 1, 0); const _local_6: IVector3D = new Vector3d(0, 0, 1); const _local_7: IVector3D = new Vector3d(1, 0, 0); - const _local_8: number = ((k.x / 180) * Math.PI); - const _local_9: number = ((k.y / 180) * Math.PI); - const _local_10: number = ((k.z / 180) * Math.PI); + const _local_8: number = ((direction.x / 180) * Math.PI); + const _local_9: number = ((direction.y / 180) * Math.PI); + const _local_10: number = ((direction.z / 180) * Math.PI); const _local_11: number = Math.cos(_local_8); const _local_12: number = Math.sin(_local_8); const _local_13: IVector3D = Vector3d.sum(Vector3d.product(_local_5, _local_11), Vector3d.product(_local_7, -(_local_12))); @@ -176,7 +176,7 @@ export class RoomGeometry implements IRoomGeometry const _local_18: IVector3D = new Vector3d(_local_13.x, _local_13.y, _local_13.z); const _local_19: IVector3D = Vector3d.sum(Vector3d.product(_local_14, _local_16), Vector3d.product(_local_15, _local_17)); const _local_20: IVector3D = Vector3d.sum(Vector3d.product(_local_14, -(_local_17)), Vector3d.product(_local_15, _local_16)); - if(_local_10 != 0) + if (_local_10 != 0) { _local_21 = Math.cos(_local_10); _local_22 = Math.sin(_local_10); @@ -197,29 +197,29 @@ export class RoomGeometry implements IRoomGeometry } } - public set x_scale(k: number) + public set x_scale(xScale: number) { - if(this._x_scale != (k * this._x_scale_internal)) + if (this._x_scale != (xScale * this._x_scale_internal)) { - this._x_scale = (k * this._x_scale_internal); + this._x_scale = (xScale * this._x_scale_internal); this._updateId++; } } - public set y_scale(k: number) + public set y_scale(yScale: number) { - if(this._y_scale != (k * this._y_scale_internal)) + if (this._y_scale != (yScale * this._y_scale_internal)) { - this._y_scale = (k * this._y_scale_internal); + this._y_scale = (yScale * this._y_scale_internal); this._updateId++; } } - public set z_scale(k: number) + public set z_scale(zScale: number) { - if(this._z_scale != (k * this._z_scale_internal)) + if (this._z_scale != (zScale * this._z_scale_internal)) { - this._z_scale = (k * this._z_scale_internal); + this._z_scale = (zScale * this._z_scale_internal); this._updateId++; } } @@ -233,7 +233,7 @@ export class RoomGeometry implements IRoomGeometry this._dir = null; this._directionAxis = null; this._location = null; - if(this._displacements != null) + if (this._displacements != null) { this._displacements.clear(); this._displacements = null; @@ -244,11 +244,11 @@ export class RoomGeometry implements IRoomGeometry { let _local_3: string; let _local_4: IVector3D; - if(((k == null) || (_arg_2 == null))) + if (((k == null) || (_arg_2 == null))) { return; } - if(this._displacements != null) + if (this._displacements != null) { _local_3 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); this._displacements.delete(_local_3); @@ -262,7 +262,7 @@ export class RoomGeometry implements IRoomGeometry private getDisplacenent(k: IVector3D): IVector3D { let _local_2: string; - if(this._displacements != null) + if (this._displacements != null) { _local_2 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); return this._displacements.get(_local_2); @@ -293,7 +293,7 @@ export class RoomGeometry implements IRoomGeometry const _local_15: IVector3D = new Vector3d(_local_10.x, _local_10.y, _local_10.z); const _local_16: IVector3D = Vector3d.sum(Vector3d.product(_local_11, _local_13), Vector3d.product(_local_12, _local_14)); const _local_17: IVector3D = Vector3d.sum(Vector3d.product(_local_11, -(_local_14)), Vector3d.product(_local_12, _local_13)); - if(_local_7 != 0) + if (_local_7 != 0) { _local_18 = Math.cos(_local_7); _local_19 = Math.sin(_local_7); @@ -311,7 +311,7 @@ export class RoomGeometry implements IRoomGeometry public adjustLocation(k: IVector3D, _arg_2: number): void { - if(((k == null) || (this._z == null))) + if (((k == null) || (this._z == null))) { return; } @@ -322,7 +322,7 @@ export class RoomGeometry implements IRoomGeometry public getCoordinatePosition(k: IVector3D): IVector3D { - if(k == null) + if (k == null) { return null; } @@ -340,7 +340,7 @@ export class RoomGeometry implements IRoomGeometry _local_2.y = (_local_2.y * this._y_scale); _local_2.z = (_local_2.z * this._z_scale); let _local_3: number = Vector3d.scalarProjection(_local_2, this._depth); - if(((_local_3 < this._clipNear) || (_local_3 > this._clipFar))) + if (((_local_3 < this._clipNear) || (_local_3 > this._clipFar))) { return null; } @@ -349,7 +349,7 @@ export class RoomGeometry implements IRoomGeometry _local_4 = (_local_4 * this._scale); _local_5 = (_local_5 * this._scale); const _local_6: IVector3D = this.getDisplacenent(k); - if(_local_6 != null) + if (_local_6 != null) { _local_2 = Vector3d.dif(k, this._loc); _local_2.add(_local_6); @@ -367,7 +367,7 @@ export class RoomGeometry implements IRoomGeometry public getScreenPoint(k: IVector3D): Point { const _local_2: IVector3D = this.getScreenPosition(k); - if(_local_2 == null) + if (_local_2 == null) { return null; } @@ -392,7 +392,7 @@ export class RoomGeometry implements IRoomGeometry const _local_13: IVector3D = Vector3d.crossProduct(_local_11, _local_12); const _local_14: IVector3D = new Vector3d(); _local_14.assign(RoomGeometry.getIntersectionVector(_local_8, _local_9, _local_10, _local_13)); - if(_local_14 != null) + if (_local_14 != null) { _local_14.subtract(_local_10); _local_15 = ((Vector3d.scalarProjection(_local_14, _arg_3) / _local_11.length) * _arg_3.length); @@ -404,7 +404,7 @@ export class RoomGeometry implements IRoomGeometry public performZoom(): void { - if(this.isZoomedIn()) + if (this.isZoomedIn()) { this.scale = RoomGeometry.SCALE_ZOOMED_OUT; } diff --git a/src/room/utils/RoomId.ts b/src/room/utils/RoomId.ts index c14edbfe..8df53a0b 100644 --- a/src/room/utils/RoomId.ts +++ b/src/room/utils/RoomId.ts @@ -2,13 +2,13 @@ { private static PREVIEW_ROOM_ID_BASE: number = 0x7FFF0000; - public static makeRoomPreviewerId(k: number): number + public static makeRoomPreviewerId(roomId: number): number { - return (k & 0xFFFF) + RoomId.PREVIEW_ROOM_ID_BASE; + return (roomId & 0xFFFF) + RoomId.PREVIEW_ROOM_ID_BASE; } - public static isRoomPreviewerId(k: number): boolean + public static isRoomPreviewerId(roomId: number): boolean { - return (k >= RoomId.PREVIEW_ROOM_ID_BASE); + return (roomId >= RoomId.PREVIEW_ROOM_ID_BASE); } -} \ No newline at end of file +}