diff --git a/src/api/nitro/communication/INitroCommunicationDemo.ts b/src/api/nitro/communication/INitroCommunicationDemo.ts index dd1f468c..cab1521a 100644 --- a/src/api/nitro/communication/INitroCommunicationDemo.ts +++ b/src/api/nitro/communication/INitroCommunicationDemo.ts @@ -1,6 +1,3 @@ import { INitroManager } from '../../common'; -export interface INitroCommunicationDemo extends INitroManager -{ - -} +export type INitroCommunicationDemo = INitroManager diff --git a/src/api/nitro/room/object/data/ObjectDataBase.ts b/src/api/nitro/room/object/data/ObjectDataBase.ts index d2972959..25ddfcc3 100644 --- a/src/api/nitro/room/object/data/ObjectDataBase.ts +++ b/src/api/nitro/room/object/data/ObjectDataBase.ts @@ -19,7 +19,7 @@ export class ObjectDataBase implements IObjectData public parseWrapper(wrapper: IMessageDataWrapper): void { - if ((this._flags & ObjectDataFlags.UNIQUE_SET) > 0) + if((this._flags & ObjectDataFlags.UNIQUE_SET) > 0) { this._uniqueNumber = wrapper.readInt(); this._uniqueSeries = wrapper.readInt(); @@ -34,7 +34,7 @@ export class ObjectDataBase implements IObjectData public writeRoomObjectModel(model: IRoomObjectModel): void { - if (!model) return; + if(!model) return; model.setValue(RoomObjectVariable.FURNITURE_UNIQUE_SERIAL_NUMBER, this._uniqueNumber); model.setValue(RoomObjectVariable.FURNITURE_UNIQUE_EDITION_SIZE, this._uniqueSeries); diff --git a/src/api/nitro/room/object/data/ObjectDataFactory.ts b/src/api/nitro/room/object/data/ObjectDataFactory.ts index 5f456bbc..b6f3e5d6 100644 --- a/src/api/nitro/room/object/data/ObjectDataFactory.ts +++ b/src/api/nitro/room/object/data/ObjectDataFactory.ts @@ -7,7 +7,7 @@ export class ObjectDataFactory { let objectData: IObjectData = null; - switch (flags & 0xFF) + switch(flags & 0xFF) { case CrackableDataType.FORMAT_KEY: objectData = new CrackableDataType(); @@ -35,7 +35,7 @@ export class ObjectDataFactory break; } - if (!objectData) return null; + if(!objectData) return null; objectData.flags = (flags & 0xFF00); diff --git a/src/api/nitro/room/object/data/type/CrackableDataType.ts b/src/api/nitro/room/object/data/type/CrackableDataType.ts index b030242c..8fd96fda 100644 --- a/src/api/nitro/room/object/data/type/CrackableDataType.ts +++ b/src/api/nitro/room/object/data/type/CrackableDataType.ts @@ -24,7 +24,7 @@ export class CrackableDataType extends ObjectDataBase implements IObjectData public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._state = wrapper.readString(); this._hits = wrapper.readInt(); diff --git a/src/api/nitro/room/object/data/type/EmptyDataType.ts b/src/api/nitro/room/object/data/type/EmptyDataType.ts index 8909854d..62d9d031 100644 --- a/src/api/nitro/room/object/data/type/EmptyDataType.ts +++ b/src/api/nitro/room/object/data/type/EmptyDataType.ts @@ -13,7 +13,7 @@ export class EmptyDataType extends ObjectDataBase implements IObjectData public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._state = ''; diff --git a/src/api/nitro/room/object/data/type/HighScoreDataType.ts b/src/api/nitro/room/object/data/type/HighScoreDataType.ts index 01cc5693..205c2e89 100644 --- a/src/api/nitro/room/object/data/type/HighScoreDataType.ts +++ b/src/api/nitro/room/object/data/type/HighScoreDataType.ts @@ -27,7 +27,7 @@ export class HighScoreDataType extends ObjectDataBase implements IObjectData public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._state = wrapper.readString(); this._scoreType = wrapper.readInt(); @@ -35,7 +35,7 @@ export class HighScoreDataType extends ObjectDataBase implements IObjectData let totalScores = wrapper.readInt(); - while (totalScores > 0) + while(totalScores > 0) { const data = new HighScoreData(); @@ -43,7 +43,7 @@ export class HighScoreDataType extends ObjectDataBase implements IObjectData let totalUsers = wrapper.readInt(); - while (totalUsers > 0) + while(totalUsers > 0) { data.addUsername(wrapper.readString()); @@ -68,7 +68,7 @@ export class HighScoreDataType extends ObjectDataBase implements IObjectData let i = 0; - while (i < totalEntries) + while(i < totalEntries) { const data = new HighScoreData(); @@ -91,13 +91,13 @@ export class HighScoreDataType extends ObjectDataBase implements IObjectData model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_SCORE_TYPE, this._scoreType); model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_CLEAR_TYPE, this._clearType); - if (this._entries) + if(this._entries) { model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_COUNT, this._entries.length); let i = 0; - while (i < this._entries.length) + while(i < this._entries.length) { const entry = this._entries[i]; diff --git a/src/api/nitro/room/object/data/type/LegacyDataType.ts b/src/api/nitro/room/object/data/type/LegacyDataType.ts index 25bda6fe..29eb592f 100644 --- a/src/api/nitro/room/object/data/type/LegacyDataType.ts +++ b/src/api/nitro/room/object/data/type/LegacyDataType.ts @@ -20,7 +20,7 @@ export class LegacyDataType extends ObjectDataBase implements IObjectData public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._data = wrapper.readString(); diff --git a/src/api/nitro/room/object/data/type/MapDataType.ts b/src/api/nitro/room/object/data/type/MapDataType.ts index f5aa98d2..4d457949 100644 --- a/src/api/nitro/room/object/data/type/MapDataType.ts +++ b/src/api/nitro/room/object/data/type/MapDataType.ts @@ -23,13 +23,13 @@ export class MapDataType extends ObjectDataBase public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._data = {}; const totalSets = wrapper.readInt(); - if (totalSets) for (let i = 0; i < totalSets; i++) this._data[wrapper.readString()] = wrapper.readString(); + if(totalSets) for(let i = 0; i < totalSets; i++) this._data[wrapper.readString()] = wrapper.readString(); super.parseWrapper(wrapper); } @@ -51,11 +51,11 @@ export class MapDataType extends ObjectDataBase public getLegacyString(): string { - if (!this._data) return ''; + if(!this._data) return ''; const state = this._data[MapDataType.STATE]; - if (state === undefined || state === null) return ''; + if(state === undefined || state === null) return ''; return state; } @@ -72,11 +72,11 @@ export class MapDataType extends ObjectDataBase public get rarityLevel(): number { - if (!this._data) return -1; + if(!this._data) return -1; const state = this._data[MapDataType.RARITY]; - if (state === undefined || state === null) return -1; + if(state === undefined || state === null) return -1; return parseInt(state); } diff --git a/src/api/nitro/room/object/data/type/NumberDataType.ts b/src/api/nitro/room/object/data/type/NumberDataType.ts index 366da692..2790189f 100644 --- a/src/api/nitro/room/object/data/type/NumberDataType.ts +++ b/src/api/nitro/room/object/data/type/NumberDataType.ts @@ -22,13 +22,13 @@ export class NumberDataType extends ObjectDataBase public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._data = []; const totalNumbers = wrapper.readInt(); - if (totalNumbers) for (let i = 0; i < totalNumbers; i++) this._data.push(wrapper.readInt()); + if(totalNumbers) for(let i = 0; i < totalNumbers; i++) this._data.push(wrapper.readInt()); super.parseWrapper(wrapper); } @@ -50,26 +50,26 @@ export class NumberDataType extends ObjectDataBase public getLegacyString(): string { - if (!this._data || !this._data.length) return ''; + if(!this._data || !this._data.length) return ''; return this._data[NumberDataType.STATE].toString(); } public compare(data: IObjectData): boolean { - if (!(data instanceof NumberDataType)) return false; + if(!(data instanceof NumberDataType)) return false; let i = 0; - while (i < this._data.length) + while(i < this._data.length) { - if (i === 0) + if(i === 0) { // } else { - if (this._data[i] !== data.getValue(i)) return false; + if(this._data[i] !== data.getValue(i)) return false; } i++; @@ -80,11 +80,11 @@ export class NumberDataType extends ObjectDataBase public getValue(index: number): number { - if (!this._data || !this._data.length) return -1; + if(!this._data || !this._data.length) return -1; const value = this._data[index]; - if (value === undefined || value === null) return -1; + if(value === undefined || value === null) return -1; return value; } diff --git a/src/api/nitro/room/object/data/type/StringDataType.ts b/src/api/nitro/room/object/data/type/StringDataType.ts index f706f0eb..71018546 100644 --- a/src/api/nitro/room/object/data/type/StringDataType.ts +++ b/src/api/nitro/room/object/data/type/StringDataType.ts @@ -22,13 +22,13 @@ export class StringDataType extends ObjectDataBase public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._data = []; const totalStrings = wrapper.readInt(); - if (totalStrings) for (let i = 0; i < totalStrings; i++) this._data.push(wrapper.readString()); + if(totalStrings) for(let i = 0; i < totalStrings; i++) this._data.push(wrapper.readString()); super.parseWrapper(wrapper); } @@ -50,26 +50,26 @@ export class StringDataType extends ObjectDataBase public getLegacyString(): string { - if (!this._data || !this._data.length) return ''; + if(!this._data || !this._data.length) return ''; return this._data[StringDataType.STATE]; } public compare(data: IObjectData): boolean { - if (!(data instanceof StringDataType)) return false; + if(!(data instanceof StringDataType)) return false; let i = 0; - while (i < this._data.length) + while(i < this._data.length) { - if (i === 0) + if(i === 0) { // } else { - if (this._data[i] !== data.getValue(i)) return false; + if(this._data[i] !== data.getValue(i)) return false; } i++; diff --git a/src/api/nitro/room/object/data/type/VoteDataType.ts b/src/api/nitro/room/object/data/type/VoteDataType.ts index 6c19afb3..5650361b 100644 --- a/src/api/nitro/room/object/data/type/VoteDataType.ts +++ b/src/api/nitro/room/object/data/type/VoteDataType.ts @@ -22,7 +22,7 @@ export class VoteDataType extends ObjectDataBase public parseWrapper(wrapper: IMessageDataWrapper): void { - if (!wrapper) return; + if(!wrapper) return; this._state = wrapper.readString(); this._result = wrapper.readInt(); diff --git a/src/api/nitro/session/IIgnoredUsersManager.ts b/src/api/nitro/session/IIgnoredUsersManager.ts index 9d8a6a2e..85ee7e50 100644 --- a/src/api/nitro/session/IIgnoredUsersManager.ts +++ b/src/api/nitro/session/IIgnoredUsersManager.ts @@ -1,4 +1,4 @@ -export interface IIgnoredUsersManager +export interface IIgnoredUsersManager { init(): void; requestIgnoredUsers(): void; diff --git a/src/api/room/Vector3d.ts b/src/api/room/Vector3d.ts index f1300950..0ee362aa 100644 --- a/src/api/room/Vector3d.ts +++ b/src/api/room/Vector3d.ts @@ -17,46 +17,46 @@ export class Vector3d implements IVector3D public static sum(vector1: IVector3D, vector2: IVector3D): Vector3d { - if (!vector1 || !vector2) return null; + if(!vector1 || !vector2) return null; return new Vector3d((vector1.x + vector2.x), (vector1.y + vector2.y), (vector1.z + vector2.z)); } public static dif(vector1: IVector3D, vector2: IVector3D): Vector3d { - if (!vector1 || !vector2) return null; + if(!vector1 || !vector2) return null; return new Vector3d((vector1.x - vector2.x), (vector1.y - vector2.y), (vector1.z - vector2.z)); } public static product(vector: IVector3D, value: number): Vector3d { - if (!vector) return null; + if(!vector) return null; return new Vector3d((vector.x * value), (vector.y * value), (vector.z * value)); } public static dotProduct(vector1: IVector3D, vector2: IVector3D): number { - if (!vector1 || !vector2) return 0; + if(!vector1 || !vector2) return 0; return (vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z); } public static crossProduct(vector1: IVector3D, vector2: IVector3D): Vector3d { - if (!vector1 || !vector2) return null; + if(!vector1 || !vector2) return null; return new Vector3d(((vector1.y * vector2.z) - (vector1.z * vector2.y)), ((vector1.z * vector2.x) - (vector1.x * vector2.z)), ((vector1.x * vector2.y) - (vector1.y * vector2.x))); } public static scalarProjection(vector1: IVector3D, vector2: IVector3D): number { - if (!vector1 || !vector2) return -1; + if(!vector1 || !vector2) return -1; const length = vector2.length; - if (length > 0) + if(length > 0) { return ((vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z)) / length; } @@ -66,20 +66,20 @@ export class Vector3d implements IVector3D public static cosAngle(vector1: IVector3D, vector2: IVector3D): number { - if (!vector1 || !vector2) return 0; + if(!vector1 || !vector2) return 0; const totalLength = (vector1.length * vector2.length); - if (!totalLength) return 0; + if(!totalLength) return 0; return (Vector3d.dotProduct(vector1, vector2) / totalLength); } public static isEqual(vector1: IVector3D, vector2: IVector3D): boolean { - if (!vector1 || !vector2) return false; + if(!vector1 || !vector2) return false; - if ((vector1.x !== vector2.x) || (vector1.y !== vector2.y) || (vector1.z !== vector2.z)) return false; + if((vector1.x !== vector2.x) || (vector1.y !== vector2.y) || (vector1.z !== vector2.z)) return false; return true; } @@ -93,7 +93,7 @@ export class Vector3d implements IVector3D public add(vector: IVector3D): void { - if (!vector) return; + if(!vector) return; this._x += vector.x; this._y += vector.y; @@ -103,7 +103,7 @@ export class Vector3d implements IVector3D public subtract(vector: IVector3D): void { - if (!vector) return; + if(!vector) return; this._x -= vector.x; this._y -= vector.y; @@ -121,7 +121,7 @@ export class Vector3d implements IVector3D public divide(amount: number): void { - if (!amount) return; + if(!amount) return; this._x /= amount; this._y /= amount; @@ -131,7 +131,7 @@ export class Vector3d implements IVector3D public assign(vector: IVector3D): void { - if (!vector) return; + if(!vector) return; this._x = vector.x; this._y = vector.y; @@ -174,7 +174,7 @@ export class Vector3d implements IVector3D public get length(): number { - if (isNaN(this._length)) + if(isNaN(this._length)) { this._length = Math.sqrt(((this._x * this._x) + (this._y * this._y)) + (this._z * this._z)); } diff --git a/src/core/NitroCore.ts b/src/core/NitroCore.ts index d7113946..16785aa4 100644 --- a/src/core/NitroCore.ts +++ b/src/core/NitroCore.ts @@ -24,14 +24,14 @@ export class NitroCore extends Disposable implements INitroCore protected onDispose(): void { - if (this._asset) + if(this._asset) { this._asset.dispose(); this._asset = null; } - if (this._communication) + if(this._communication) { this._communication.dispose(); diff --git a/src/core/asset/AssetManager.ts b/src/core/asset/AssetManager.ts index c090304b..88e83496 100644 --- a/src/core/asset/AssetManager.ts +++ b/src/core/asset/AssetManager.ts @@ -24,33 +24,33 @@ export class AssetManager extends Disposable implements IAssetManager public getTexture(name: string): Texture { - if (!name) return null; + if(!name) return null; const existing = this._textures.get(name); - if (!existing) return null; + if(!existing) return null; return existing; } public setTexture(name: string, texture: Texture): void { - if (!name || !texture) return; + if(!name || !texture) return; this._textures.set(name, texture); } public getAsset(name: string): IGraphicAsset { - if (!name) return null; + if(!name) return null; - for (const collection of this._collections.values()) + for(const collection of this._collections.values()) { - if (!collection) continue; + if(!collection) continue; const existing = collection.getAsset(name); - if (!existing) continue; + if(!existing) continue; return existing; } @@ -60,24 +60,24 @@ export class AssetManager extends Disposable implements IAssetManager public getCollection(name: string): IGraphicAssetCollection { - if (!name) return null; + if(!name) return null; const existing = this._collections.get(name); - if (!existing) return null; + if(!existing) return null; return existing; } public createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection { - if (!data) return null; + if(!data) return null; const collection = new GraphicAssetCollection(data, spritesheet); - if (collection) + if(collection) { - for (const [name, texture] of collection.textures.entries()) this.setTexture(name, texture); + for(const [name, texture] of collection.textures.entries()) this.setTexture(name, texture); this._collections.set(collection.name, collection); } @@ -92,7 +92,7 @@ export class AssetManager extends Disposable implements IAssetManager public downloadAssets(assetUrls: string[], cb: (status: boolean) => void): void { - if (!assetUrls || !assetUrls.length) + if(!assetUrls || !assetUrls.length) { cb(true); @@ -101,9 +101,9 @@ export class AssetManager extends Disposable implements IAssetManager const loader = new Loader(); - for (const url of assetUrls) + for(const url of assetUrls) { - if (!url) continue; + if(!url) continue; loader .add({ @@ -118,7 +118,7 @@ export class AssetManager extends Disposable implements IAssetManager const onDownloaded = (status: boolean, url: string) => { - if (!status) + if(!status) { this._logger.error('Failed to download asset', url); @@ -131,7 +131,7 @@ export class AssetManager extends Disposable implements IAssetManager remaining--; - if (!remaining) + if(!remaining) { loader.destroy(); @@ -143,11 +143,11 @@ export class AssetManager extends Disposable implements IAssetManager loader.load((loader, resources) => { - for (const key in resources) + for(const key in resources) { const resource = resources[key]; - if (!resource || resource.error || !resource.xhr) + if(!resource || resource.error || !resource.xhr) { onDownloaded(false, resource.url); @@ -156,7 +156,7 @@ export class AssetManager extends Disposable implements IAssetManager const resourceType = (resource.xhr.getResponseHeader('Content-Type') || 'application/octet-stream'); - if (resourceType === 'application/octet-stream') + if(resourceType === 'application/octet-stream') { const nitroBundle = new NitroBundle(resource.data); @@ -168,12 +168,12 @@ export class AssetManager extends Disposable implements IAssetManager continue; } - if ((resourceType === 'image/png') || (resourceType === 'image/jpeg') || (resourceType === 'image/gif')) + if((resourceType === 'image/png') || (resourceType === 'image/jpeg') || (resourceType === 'image/gif')) { const base64 = ArrayBufferToBase64(resource.data); const baseTexture = new BaseTexture(`data:${resourceType};base64,${base64}`); - if (baseTexture.valid) + if(baseTexture.valid) { const texture = new Texture(baseTexture); @@ -205,7 +205,7 @@ export class AssetManager extends Disposable implements IAssetManager { const spritesheetData = data.spritesheet; - if (!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) + if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) { this.createCollection(data, null); @@ -226,7 +226,7 @@ export class AssetManager extends Disposable implements IAssetManager }); }; - if (baseTexture.valid) + if(baseTexture.valid) { createAsset(); } diff --git a/src/core/asset/GraphicAsset.ts b/src/core/asset/GraphicAsset.ts index a29e57b6..d5c116fe 100644 --- a/src/core/asset/GraphicAsset.ts +++ b/src/core/asset/GraphicAsset.ts @@ -26,7 +26,7 @@ export class GraphicAsset implements IGraphicAsset graphicAsset._name = name; graphicAsset._source = source || null; - if (texture) + if(texture) { graphicAsset._texture = texture; graphicAsset._initialized = false; @@ -56,7 +56,7 @@ export class GraphicAsset implements IGraphicAsset private initialize(): void { - if (this._initialized || !this._texture) return; + if(this._initialized || !this._texture) return; this._width = this._texture.width; this._height = this._texture.height; @@ -110,14 +110,14 @@ export class GraphicAsset implements IGraphicAsset public get offsetX(): number { - if (!this._flipH) return this._x; + if(!this._flipH) return this._x; return (-(this._x)); } public get offsetY(): number { - if (!this._flipV) return this._y; + if(!this._flipV) return this._y; return (-(this._y)); } @@ -134,7 +134,7 @@ export class GraphicAsset implements IGraphicAsset public get rectangle(): Rectangle { - if (!this._rectangle) this._rectangle = new Rectangle(0, 0, this.width, this.height); + if(!this._rectangle) this._rectangle = new Rectangle(0, 0, this.width, this.height); return this._rectangle; } diff --git a/src/core/asset/GraphicAssetCollection.ts b/src/core/asset/GraphicAssetCollection.ts index eea72b97..050faec0 100644 --- a/src/core/asset/GraphicAssetCollection.ts +++ b/src/core/asset/GraphicAssetCollection.ts @@ -22,7 +22,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection constructor(data: IAssetData, spritesheet: Spritesheet) { - if (!data) throw new Error('invalid_collection'); + if(!data) throw new Error('invalid_collection'); this._name = data.name; this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null); @@ -32,7 +32,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection this._palettes = new Map(); this._paletteAssetNames = []; - if (spritesheet) this.addLibraryAsset(spritesheet.textures); + if(spritesheet) this.addLibraryAsset(spritesheet.textures); this.define(data); } @@ -44,23 +44,23 @@ export class GraphicAssetCollection implements IGraphicAssetCollection public dispose(): void { - if (this._palettes) + if(this._palettes) { - for (const palette of this._palettes.values()) palette.dispose(); + for(const palette of this._palettes.values()) palette.dispose(); this._palettes.clear(); } - if (this._paletteAssetNames) + if(this._paletteAssetNames) { this.disposePaletteAssets(); this._paletteAssetNames = null; } - if (this._assets) + if(this._assets) { - for (const asset of this._assets.values()) asset.recycle(); + for(const asset of this._assets.values()) asset.recycle(); this._assets.clear(); } @@ -76,7 +76,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection { this._referenceCount--; - if (this._referenceCount <= 0) + if(this._referenceCount <= 0) { this._referenceCount = 0; //this._referenceTimestamp = Nitro.instance.time; @@ -90,20 +90,20 @@ export class GraphicAssetCollection implements IGraphicAssetCollection const assets = data.assets; const palettes = data.palettes; - if (assets) this.defineAssets(assets); + if(assets) this.defineAssets(assets); - if (palettes) this.definePalettes(palettes); + if(palettes) this.definePalettes(palettes); } private defineAssets(assets: { [index: string]: IAsset }): void { - if (!assets) return; + if(!assets) return; - for (const name in assets) + for(const name in assets) { const asset = assets[name]; - if (!asset) continue; + if(!asset) continue; const x = (-(asset.x) || 0); const y = (-(asset.y) || 0); @@ -112,23 +112,23 @@ export class GraphicAssetCollection implements IGraphicAssetCollection const usesPalette = (asset.usesPalette || false); let source = (asset.source || ''); - if (asset.flipH && source.length) flipH = true; + if(asset.flipH && source.length) flipH = true; // if(asset.flipV && source.length) flipV = true; - if (!source.length) source = name; + if(!source.length) source = name; const texture = this.getLibraryAsset(source); - if (!texture) continue; + if(!texture) continue; let didAddAsset = this.createAsset(name, source, texture, flipH, flipV, x, y, usesPalette); - if (!didAddAsset) + if(!didAddAsset) { const existingAsset = this.getAsset(name); - if (existingAsset && (existingAsset.name !== existingAsset.source)) + if(existingAsset && (existingAsset.name !== existingAsset.source)) { didAddAsset = this.replaceAsset(name, source, texture, flipH, flipV, x, y, usesPalette); } @@ -138,28 +138,28 @@ export class GraphicAssetCollection implements IGraphicAssetCollection private definePalettes(palettes: { [index: string]: IAssetPalette }): void { - if (!palettes) return; + if(!palettes) return; - for (const name in palettes) + for(const name in palettes) { const palette = palettes[name]; - if (!palette) continue; + if(!palette) continue; const id = palette.id.toString(); - if (this._palettes.get(id)) continue; + if(this._palettes.get(id)) continue; let colorOne = 0xFFFFFF; let colorTwo = 0xFFFFFF; let color = palette.color1; - if (color && color.length > 0) colorOne = parseInt(color, 16); + if(color && color.length > 0) colorOne = parseInt(color, 16); color = palette.color2; - if (color && color.length > 0) colorTwo = parseInt(color, 16); + if(color && color.length > 0) colorTwo = parseInt(color, 16); this._palettes.set(id, new GraphicAssetPalette(palette.rgb, colorOne, colorTwo)); } @@ -167,7 +167,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection private createAsset(name: string, source: string, texture: Texture, flipH: boolean, flipV: boolean, x: number, y: number, usesPalette: boolean): boolean { - if (this._assets.get(name)) return false; + if(this._assets.get(name)) return false; const graphicAsset = GraphicAsset.createAsset(name, source, texture, x, y, flipH, flipV, usesPalette); @@ -180,7 +180,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection { const existing = this._assets.get(name); - if (existing) + if(existing) { this._assets.delete(name); @@ -192,11 +192,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection public getAsset(name: string): IGraphicAsset { - if (!name) return null; + if(!name) return null; const existing = this._assets.get(name); - if (!existing) return null; + if(!existing) return null; return existing; } @@ -207,19 +207,19 @@ export class GraphicAssetCollection implements IGraphicAssetCollection let asset = this.getAsset(saveName); - if (!asset) + if(!asset) { asset = this.getAsset(name); - if (!asset || !asset.usesPalette) return asset; + if(!asset || !asset.usesPalette) return asset; const palette = this.getPalette(paletteName); - if (palette) + if(palette) { const texture = palette.applyPalette(asset.texture); - if (texture) + if(texture) { this._paletteAssetNames.push(saveName); @@ -247,36 +247,36 @@ export class GraphicAssetCollection implements IGraphicAssetCollection { const palette = this.getPalette(paletteName); - if (palette) return [palette.primaryColor, palette.secondaryColor]; + if(palette) return [palette.primaryColor, palette.secondaryColor]; return null; } public getPalette(name: string): GraphicAssetPalette { - if (!name) return null; + if(!name) return null; const existing = this._palettes.get(name); - if (!existing) return null; + if(!existing) return null; return existing; } public addAsset(name: string, texture: Texture, override: boolean, x: number = 0, y: number = 0, flipH: boolean = false, flipV: boolean = false): boolean { - if (!name || !texture) return false; + if(!name || !texture) return false; const existingTexture = this.getLibraryAsset(name); - if (!existingTexture) + if(!existingTexture) { this._textures.set(name, texture); return this.createAsset(name, name, texture, flipH, flipV, x, y, false); } - if (override) + if(override) { existingTexture.baseTexture = texture.baseTexture; existingTexture.frame = texture.frame; @@ -294,13 +294,13 @@ export class GraphicAssetCollection implements IGraphicAssetCollection { const existing = this._assets.get(name); - if (!existing) return; + if(!existing) return; this._assets.delete(name); const texture = this.getLibraryAsset(existing.source); - if (texture) + if(texture) { this._textures.delete(existing.source); @@ -312,26 +312,26 @@ export class GraphicAssetCollection implements IGraphicAssetCollection public getLibraryAsset(name: string): Texture { - if (!name) return null; + if(!name) return null; name = this._name + '_' + name; const texture = this._textures.get(name); - if (!texture) return null; + if(!texture) return null; return texture; } private addLibraryAsset(textures: Dict>): void { - if (!textures) return; + if(!textures) return; - for (const name in textures) + for(const name in textures) { const texture = textures[name]; - if (!texture) continue; + if(!texture) continue; this._textures.set(GraphicAssetCollection.removeFileExtension(name), texture); } @@ -339,11 +339,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection private disposePaletteAssets(disposeAll: boolean = true): void { - if (this._paletteAssetNames) + if(this._paletteAssetNames) { - if (disposeAll || (this._paletteAssetNames.length > GraphicAssetCollection.PALETTE_ASSET_DISPOSE_THRESHOLD)) + if(disposeAll || (this._paletteAssetNames.length > GraphicAssetCollection.PALETTE_ASSET_DISPOSE_THRESHOLD)) { - for (const name of this._paletteAssetNames) this.disposeAsset(name); + for(const name of this._paletteAssetNames) this.disposeAsset(name); this._paletteAssetNames = []; } diff --git a/src/core/asset/GraphicAssetPalette.ts b/src/core/asset/GraphicAssetPalette.ts index c5bf8cae..cf8aec8b 100644 --- a/src/core/asset/GraphicAssetPalette.ts +++ b/src/core/asset/GraphicAssetPalette.ts @@ -11,7 +11,7 @@ export class GraphicAssetPalette { this._palette = palette; - while (this._palette.length < 256) this._palette.push([0, 0, 0]); + while(this._palette.length < 256) this._palette.push([0, 0, 0]); this._primaryColor = primaryColor; this._secondaryColor = secondaryColor; @@ -30,11 +30,11 @@ export class GraphicAssetPalette const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height); const data = textureImageData.data; - for (let i = 0; i < data.length; i += 4) + for(let i = 0; i < data.length; i += 4) { let paletteColor = this._palette[data[i + 1]]; - if (paletteColor === undefined) paletteColor = [0, 0, 0]; + if(paletteColor === undefined) paletteColor = [0, 0, 0]; data[i] = paletteColor[0]; data[i + 1] = paletteColor[1]; diff --git a/src/core/asset/NitroBundle.ts b/src/core/asset/NitroBundle.ts index 56f3b279..9152f335 100644 --- a/src/core/asset/NitroBundle.ts +++ b/src/core/asset/NitroBundle.ts @@ -22,14 +22,14 @@ export class NitroBundle let fileCount = binaryReader.readShort(); - while (fileCount > 0) + while(fileCount > 0) { const fileNameLength = binaryReader.readShort(); const fileName = binaryReader.readBytes(fileNameLength).toString(); const fileLength = binaryReader.readInt(); const buffer = binaryReader.readBytes(fileLength); - if (fileName.endsWith('.json')) + if(fileName.endsWith('.json')) { const decompressed = inflate((buffer.toArrayBuffer() as Data)); diff --git a/src/core/common/Disposable.ts b/src/core/common/Disposable.ts index df3872ee..bb65b2db 100644 --- a/src/core/common/Disposable.ts +++ b/src/core/common/Disposable.ts @@ -13,7 +13,7 @@ export class Disposable implements IDisposable public dispose(): void { - if (this._isDisposed || this._isDisposing) return; + if(this._isDisposed || this._isDisposing) return; this._isDisposing = true; diff --git a/src/core/common/EventDispatcher.ts b/src/core/common/EventDispatcher.ts index 3be83da2..a65df3c3 100644 --- a/src/core/common/EventDispatcher.ts +++ b/src/core/common/EventDispatcher.ts @@ -25,11 +25,11 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi public addEventListener(type: string, callback: Function): void { - if (!type || !callback) return; + if(!type || !callback) return; const existing = this._listeners.get(type); - if (!existing) + if(!existing) { this._listeners.set(type, [callback]); @@ -41,19 +41,19 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi public removeEventListener(type: string, callback: any): void { - if (!type || !callback) return; + if(!type || !callback) return; const existing = this._listeners.get(type); - if (!existing || !existing.length) return; + if(!existing || !existing.length) return; - for (const [i, cb] of existing.entries()) + for(const [i, cb] of existing.entries()) { - if (!cb || (cb !== callback)) continue; + if(!cb || (cb !== callback)) continue; existing.splice(i, 1); - if (!existing.length) this._listeners.delete(type); + if(!existing.length) this._listeners.delete(type); return; } @@ -61,7 +61,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi public dispatchEvent(event: NitroEvent): boolean { - if (!event) return false; + if(!event) return false; //if (Nitro.instance.getConfiguration('system.dispatcher.log')) this._logger.log('Dispatched Event', event.type); @@ -74,18 +74,18 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi { const existing = this._listeners.get(event.type); - if (!existing || !existing.length) return; + if(!existing || !existing.length) return; const callbacks = []; - for (const callback of existing) + for(const callback of existing) { - if (!callback) continue; + if(!callback) continue; callbacks.push(callback); } - while (callbacks.length) + while(callbacks.length) { const callback = callbacks.shift(); diff --git a/src/core/common/NitroLogger.ts b/src/core/common/NitroLogger.ts index 29a41955..3d754a2d 100644 --- a/src/core/common/NitroLogger.ts +++ b/src/core/common/NitroLogger.ts @@ -30,7 +30,7 @@ export class NitroLogger implements INitroLogger public printMessage(modus: string, ...message: any[]): void { - if (!this._print) return; + if(!this._print) return; NitroLogger.log(this._name, modus, ...message); } @@ -39,7 +39,7 @@ export class NitroLogger implements INitroLogger { const logPrefix = `[Nitro] [${name}]`; - switch (modus) + switch(modus) { case 'error': console.error(logPrefix, ...message); diff --git a/src/core/common/NitroManager.ts b/src/core/common/NitroManager.ts index 65a582b5..fbbd06d7 100644 --- a/src/core/common/NitroManager.ts +++ b/src/core/common/NitroManager.ts @@ -26,7 +26,7 @@ export class NitroManager extends Disposable implements INitroManager public init(): void { - if (this._isLoaded || this._isLoading || this.isDisposing) return; + if(this._isLoaded || this._isLoading || this.isDisposing) return; this._isLoading = true; @@ -43,7 +43,7 @@ export class NitroManager extends Disposable implements INitroManager protected onDispose(): void { - if (this._events) this._events.dispose(); + if(this._events) this._events.dispose(); super.onDispose(); } diff --git a/src/core/communication/CommunicationManager.ts b/src/core/communication/CommunicationManager.ts index 365d112c..8e0c0d8a 100644 --- a/src/core/communication/CommunicationManager.ts +++ b/src/core/communication/CommunicationManager.ts @@ -15,16 +15,16 @@ export class CommunicationManager extends Disposable implements ICommunicationMa protected onDispose(): void { - if (!this._connections || !this._connections.length) return; + if(!this._connections || !this._connections.length) return; - for (const connection of this._connections.values()) connection && connection.dispose(); + for(const connection of this._connections.values()) connection && connection.dispose(); } public createConnection(stateListener: IConnectionStateListener = null): IConnection { const connection = new SocketConnection(this, stateListener); - if (!connection) return; + if(!connection) return; this._connections.push(connection); @@ -35,15 +35,15 @@ export class CommunicationManager extends Disposable implements ICommunicationMa { let index = 0; - while (index < this._connections.length) + while(index < this._connections.length) { const connection = this._connections[index]; connection.processReceivedData(); - if (this.disposed) return; + if(this.disposed) return; - if (connection.disposed) this._connections.splice(index, 1); + if(connection.disposed) this._connections.splice(index, 1); else index++; } } diff --git a/src/core/communication/SocketConnection.ts b/src/core/communication/SocketConnection.ts index ff25a882..51a97485 100644 --- a/src/core/communication/SocketConnection.ts +++ b/src/core/communication/SocketConnection.ts @@ -44,7 +44,7 @@ export class SocketConnection extends EventDispatcher implements IConnection public init(socketUrl: string): void { - if (this._stateListener) + if(this._stateListener) { this._stateListener.connectionInit(socketUrl); } @@ -67,13 +67,13 @@ export class SocketConnection extends EventDispatcher implements IConnection public onReady(): void { - if (this._isReady) return; + if(this._isReady) return; this._isReady = true; - if (this._pendingServerMessages && this._pendingServerMessages.length) this.processWrappers(...this._pendingServerMessages); + if(this._pendingServerMessages && this._pendingServerMessages.length) this.processWrappers(...this._pendingServerMessages); - if (this._pendingClientMessages && this._pendingClientMessages.length) this.send(...this._pendingClientMessages); + if(this._pendingClientMessages && this._pendingClientMessages.length) this.send(...this._pendingClientMessages); this._pendingServerMessages = []; this._pendingClientMessages = []; @@ -81,7 +81,7 @@ export class SocketConnection extends EventDispatcher implements IConnection private createSocket(socketUrl: string): void { - if (!socketUrl) return; + if(!socketUrl) return; this.destroySocket(); @@ -96,14 +96,14 @@ export class SocketConnection extends EventDispatcher implements IConnection private destroySocket(): void { - if (!this._socket) return; + 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(); + if(this._socket.readyState === WebSocket.OPEN) this._socket.close(); this._socket = null; } @@ -125,7 +125,7 @@ export class SocketConnection extends EventDispatcher implements IConnection private onMessage(event: MessageEvent): void { - if (!event) return; + if(!event) return; //this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_MESSAGE, event); @@ -153,26 +153,26 @@ export class SocketConnection extends EventDispatcher implements IConnection public send(...composers: IMessageComposer[]): boolean { - if (this.disposed || !composers) return false; + if(this.disposed || !composers) return false; composers = [...composers]; - if (this._isAuthenticated && !this._isReady) + if(this._isAuthenticated && !this._isReady) { - if (!this._pendingClientMessages) this._pendingClientMessages = []; + if(!this._pendingClientMessages) this._pendingClientMessages = []; this._pendingClientMessages.push(...composers); return false; } - for (const composer of composers) + for(const composer of composers) { - if (!composer) continue; + if(!composer) continue; const header = this._messages.getComposerId(composer); - if (header === -1) + if(header === -1) { //if (Nitro.instance.getConfiguration('system.packet.log')) this.logger.log(`Unknown Composer: ${composer.constructor.name}`); @@ -182,7 +182,7 @@ export class SocketConnection extends EventDispatcher implements IConnection const message = composer.getMessageArray(); const encoded = this._codec.encode(header, message); - if (!encoded) + if(!encoded) { //if (Nitro.instance.getConfiguration('system.packet.log')) this.logger.log('Encoding Failed', composer.constructor.name); @@ -199,7 +199,7 @@ export class SocketConnection extends EventDispatcher implements IConnection private write(buffer: ArrayBuffer): void { - if (this._socket.readyState !== WebSocket.OPEN) return; + if(this._socket.readyState !== WebSocket.OPEN) return; this._socket.send(buffer); } @@ -221,11 +221,11 @@ export class SocketConnection extends EventDispatcher implements IConnection { const wrappers = this.splitReceivedMessages(); - if (!wrappers || !wrappers.length) return; + if(!wrappers || !wrappers.length) return; - if (this._isAuthenticated && !this._isReady) + if(this._isAuthenticated && !this._isReady) { - if (!this._pendingServerMessages) this._pendingServerMessages = []; + if(!this._pendingServerMessages) this._pendingServerMessages = []; this._pendingServerMessages.push(...wrappers); @@ -237,15 +237,15 @@ export class SocketConnection extends EventDispatcher implements IConnection private processWrappers(...wrappers: IMessageDataWrapper[]): void { - if (!wrappers || !wrappers.length) return; + if(!wrappers || !wrappers.length) return; - for (const wrapper of wrappers) + for(const wrapper of wrappers) { - if (!wrapper) continue; + if(!wrapper) continue; const messages = this.getMessagesForWrapper(wrapper); - if (!messages || !messages.length) continue; + if(!messages || !messages.length) continue; //if (Nitro.instance.getConfiguration('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, messages[0].constructor.name, messages[0].parser); @@ -255,7 +255,7 @@ export class SocketConnection extends EventDispatcher implements IConnection private splitReceivedMessages(): IMessageDataWrapper[] { - if (!this._dataBuffer || !this._dataBuffer.byteLength) return null; + if(!this._dataBuffer || !this._dataBuffer.byteLength) return null; return this._codec.decode(this); } @@ -272,11 +272,11 @@ export class SocketConnection extends EventDispatcher implements IConnection private getMessagesForWrapper(wrapper: IMessageDataWrapper): IMessageEvent[] { - if (!wrapper) return null; + if(!wrapper) return null; const events = this._messages.getEvents(wrapper.header); - if (!events || !events.length) + if(!events || !events.length) { //if (Nitro.instance.getConfiguration('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper); @@ -288,9 +288,9 @@ export class SocketConnection extends EventDispatcher implements IConnection //@ts-ignore const parser = new events[0].parserClass(); - if (!parser || !parser.flush() || !parser.parse(wrapper)) return null; + if(!parser || !parser.flush() || !parser.parse(wrapper)) return null; - for (const event of events) (event.parser = parser); + for(const event of events) (event.parser = parser); } catch (e) @@ -307,33 +307,33 @@ export class SocketConnection extends EventDispatcher implements IConnection { messages = [...messages]; - for (const message of messages) + for(const message of messages) { - if (!message) continue; + if(!message) continue; message.connection = this; - if (message.callBack) message.callBack(message); + if(message.callBack) message.callBack(message); } } public registerMessages(configuration: IMessageConfiguration): void { - if (!configuration) return; + if(!configuration) return; this._messages.registerMessages(configuration); } public addMessageEvent(event: IMessageEvent): void { - if (!event || !this._messages) return; + if(!event || !this._messages) return; this._messages.registerMessageEvent(event); } public removeMessageEvent(event: IMessageEvent): void { - if (!event || !this._messages) return; + if(!event || !this._messages) return; this._messages.removeMessageEvent(event); } diff --git a/src/core/communication/codec/evawire/EvaWireDataWrapper.ts b/src/core/communication/codec/evawire/EvaWireDataWrapper.ts index c1ed4e85..60eca85e 100644 --- a/src/core/communication/codec/evawire/EvaWireDataWrapper.ts +++ b/src/core/communication/codec/evawire/EvaWireDataWrapper.ts @@ -13,14 +13,14 @@ export class EvaWireDataWrapper implements IMessageDataWrapper public readBytes(length: number): IBinaryReader { - if (!this._buffer) return null; + if(!this._buffer) return null; return this._buffer.readBytes(length); } public readByte(): number { - if (!this._buffer) return -1; + if(!this._buffer) return -1; return this._buffer.readByte(); } @@ -32,28 +32,28 @@ export class EvaWireDataWrapper implements IMessageDataWrapper public readShort(): number { - if (!this._buffer) return -1; + if(!this._buffer) return -1; return this._buffer.readShort(); } public readInt(): number { - if (!this._buffer) return -1; + if(!this._buffer) return -1; return this._buffer.readInt(); } public readFloat(): number { - if (!this._buffer) return -1; + if(!this._buffer) return -1; return this._buffer.readFloat(); } public readDouble(): number { - if (!this._buffer) return -1; + if(!this._buffer) return -1; return this._buffer.readDouble(); } diff --git a/src/core/communication/codec/evawire/EvaWireFormat.ts b/src/core/communication/codec/evawire/EvaWireFormat.ts index 9e555862..758f6c8b 100644 --- a/src/core/communication/codec/evawire/EvaWireFormat.ts +++ b/src/core/communication/codec/evawire/EvaWireFormat.ts @@ -12,19 +12,19 @@ export class EvaWireFormat implements ICodec writer.writeShort(header); - for (const value of messages) + for(const value of messages) { let type: string = typeof value; - if (type === 'object') + if(type === 'object') { - if (value === null) type = 'null'; - else if (value instanceof Byte) type = 'byte'; - else if (value instanceof Short) type = 'short'; - else if (value instanceof ArrayBuffer) type = 'arraybuffer'; + if(value === null) type = 'null'; + else if(value instanceof Byte) type = 'byte'; + else if(value instanceof Short) type = 'short'; + else if(value instanceof ArrayBuffer) type = 'arraybuffer'; } - switch (type) + switch(type) { case 'undefined': case 'null': @@ -43,7 +43,7 @@ export class EvaWireFormat implements ICodec writer.writeByte(value ? 1 : 0); break; case 'string': - if (!value) writer.writeShort(0); + if(!value) writer.writeShort(0); else { writer.writeString(value, true); @@ -57,25 +57,25 @@ export class EvaWireFormat implements ICodec const buffer = writer.getBuffer(); - if (!buffer) return null; + if(!buffer) return null; return new BinaryWriter().writeInt(buffer.byteLength).writeBytes(buffer); } public decode(connection: IConnection): IMessageDataWrapper[] { - if (!connection || !connection.dataBuffer || !connection.dataBuffer.byteLength) return null; + if(!connection || !connection.dataBuffer || !connection.dataBuffer.byteLength) return null; const wrappers: IMessageDataWrapper[] = []; - while (connection.dataBuffer.byteLength) + while(connection.dataBuffer.byteLength) { - if (connection.dataBuffer.byteLength < 4) break; + if(connection.dataBuffer.byteLength < 4) break; const container = new BinaryReader(connection.dataBuffer); const length = container.readInt(); - if (length > (connection.dataBuffer.byteLength - 4)) break; + if(length > (connection.dataBuffer.byteLength - 4)) break; const extracted = container.readBytes(length); diff --git a/src/core/communication/messages/MessageClassManager.ts b/src/core/communication/messages/MessageClassManager.ts index 42b5c1bb..b3a740f8 100644 --- a/src/core/communication/messages/MessageClassManager.ts +++ b/src/core/communication/messages/MessageClassManager.ts @@ -23,36 +23,36 @@ export class MessageClassManager public registerMessages(configuration: IMessageConfiguration): void { - for (const [header, handler] of configuration.events) this.registerMessageEventClass(header, handler); + for(const [header, handler] of configuration.events) this.registerMessageEventClass(header, handler); - for (const [header, handler] of configuration.composers) this.registerMessageComposerClass(header, handler); + for(const [header, handler] of configuration.composers) this.registerMessageComposerClass(header, handler); } private registerMessageEventClass(header: number, handler: Function): void { - if (!header || !handler) return; + if(!header || !handler) return; this._messageIdByEvent.set(handler, header); } private registerMessageComposerClass(header: number, handler: Function): void { - if (!header || !handler) return; + if(!header || !handler) return; this._messageIdByComposer.set(handler, header); } public registerMessageEvent(event: IMessageEvent): void { - if (!event) return; + if(!event) return; const header = this.getEventId(event); - if (!header) return; + if(!header) return; let existing = this._messageInstancesById.get(header); - if (!existing || !existing.length) + if(!existing || !existing.length) { existing = []; @@ -64,25 +64,25 @@ export class MessageClassManager public removeMessageEvent(event: IMessageEvent): void { - if (!event) return; + if(!event) return; const header = this.getEventId(event); - if (!header) return; + if(!header) return; const existing = this._messageInstancesById.get(header); - if (!existing) return; + if(!existing) return; - for (const [index, message] of existing.entries()) + for(const [index, message] of existing.entries()) { - if (!message) continue; + if(!message) continue; - if (message !== event) continue; + if(message !== event) continue; existing.splice(index, 1); - if (existing.length === 0) this._messageInstancesById.delete(header); + if(existing.length === 0) this._messageInstancesById.delete(header); message.dispose(); @@ -92,36 +92,36 @@ export class MessageClassManager public getEvents(header: number): IMessageEvent[] { - if (!header) return; + if(!header) return; const existing = this._messageInstancesById.get(header); - if (!existing) return; + if(!existing) return; return existing; } public getEventId(event: IMessageEvent): number { - if (!event) return -1; + if(!event) return -1; //@ts-ignore const name = (event instanceof MessageEvent ? event.constructor : event) as Function; const existing = this._messageIdByEvent.get(name); - if (!existing) return -1; + if(!existing) return -1; return existing; } public getComposerId(composer: IMessageComposer): number { - if (!composer) return -1; + if(!composer) return -1; const existing = this._messageIdByComposer.get(composer.constructor); - if (!existing) return -1; + if(!existing) return -1; return existing; } diff --git a/src/core/configuration/ConfigurationManager.ts b/src/core/configuration/ConfigurationManager.ts index 1a210de9..631c40ba 100644 --- a/src/core/configuration/ConfigurationManager.ts +++ b/src/core/configuration/ConfigurationManager.ts @@ -32,7 +32,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration private loadNextConfiguration(): void { - if (!this._pendingUrls.length) + if(!this._pendingUrls.length) { this.dispatchConfigurationEvent(ConfigurationEvent.LOADED); @@ -44,7 +44,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration public loadConfigurationFromUrl(url: string): void { - if (!url || (url === '')) + if(!url || (url === '')) { this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); @@ -59,13 +59,13 @@ export class ConfigurationManager extends NitroManager implements IConfiguration private onConfigurationLoaded(data: { [index: string]: any }, url: string): void { - if (!data) return; + if(!data) return; - if (this.parseConfiguration(data)) + if(this.parseConfiguration(data)) { const index = this._pendingUrls.indexOf(url); - if (index >= 0) this._pendingUrls.splice(index, 1); + if(index >= 0) this._pendingUrls.splice(index, 1); this.loadNextConfiguration(); @@ -87,21 +87,21 @@ export class ConfigurationManager extends NitroManager implements IConfiguration private parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean { - if (!data) return false; + if(!data) return false; try { const regex = new RegExp(/\${(.*?)}/g); - for (const key in data) + for(const key in data) { let value = data[key]; - if (typeof value === 'string') value = this.interpolate((value as string), regex); + if(typeof value === 'string') value = this.interpolate((value as string), regex); - if (this._definitions.has(key)) + if(this._definitions.has(key)) { - if (overrides) this.setValue(key, value); + if(overrides) this.setValue(key, value); } else { @@ -122,17 +122,17 @@ export class ConfigurationManager extends NitroManager implements IConfiguration public interpolate(value: string, regex: RegExp = null): string { - if (!regex) regex = new RegExp(/\${(.*?)}/g); + if(!regex) regex = new RegExp(/\${(.*?)}/g); const pieces = value.match(regex); - if (pieces && pieces.length) + if(pieces && pieces.length) { - for (const piece of pieces) + for(const piece of pieces) { const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string); - if (existing) (value = value.replace(piece, existing)); + if(existing) (value = value.replace(piece, existing)); } } @@ -148,9 +148,9 @@ export class ConfigurationManager extends NitroManager implements IConfiguration { let existing = this._definitions.get(key); - if (existing === undefined) + if(existing === undefined) { - if (this._missingKeys.indexOf(key) >= 0) return value; + if(this._missingKeys.indexOf(key) >= 0) return value; this._missingKeys.push(key); this.logger.warn(`Missing configuration key: ${key}`); @@ -167,13 +167,13 @@ export class ConfigurationManager extends NitroManager implements IConfiguration let last = this._config; - for (let i = 0; i < parts.length; i++) + for(let i = 0; i < parts.length; i++) { const part = parts[i].toString(); - if (i !== (parts.length - 1)) + if(i !== (parts.length - 1)) { - if (!last[part]) last[part] = {}; + if(!last[part]) last[part] = {}; last = last[part]; diff --git a/src/core/utils/AdvancedMap.ts b/src/core/utils/AdvancedMap.ts index a5fee252..cbb18d11 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]; } @@ -145,7 +145,7 @@ export class AdvancedMap implements IAdvancedMap public concatenate(newValues: AdvancedMap): void { - for (const k of newValues._keys) this.add(k, newValues.getValue(k)); + for(const k of newValues._keys) this.add(k, newValues.getValue(k)); } public clone(): IAdvancedMap diff --git a/src/core/utils/BinaryWriter.ts b/src/core/utils/BinaryWriter.ts index 6d63e21e..44dfee88 100644 --- a/src/core/utils/BinaryWriter.ts +++ b/src/core/utils/BinaryWriter.ts @@ -61,7 +61,7 @@ export class BinaryWriter implements IBinaryWriter { const array = new TextEncoder().encode(string); - if (includeLength) + if(includeLength) { this.writeShort(array.length); this.appendArray(array); @@ -76,7 +76,7 @@ export class BinaryWriter implements IBinaryWriter private appendArray(array: Uint8Array): void { - if (!array) return; + if(!array) return; const mergedArray = new Uint8Array(((this.position + array.length) > this._buffer.length) ? (this.position + array.length) : this._buffer.length); diff --git a/src/core/utils/SayHello.ts b/src/core/utils/SayHello.ts index 2681e617..05bb5ade 100644 --- a/src/core/utils/SayHello.ts +++ b/src/core/utils/SayHello.ts @@ -2,7 +2,7 @@ import { NitroVersion } from '../NitroVersion'; export const SayHello = () => { - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) + if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { const args = [ `\n %c %c %c Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} %c %c %c https://discord.nitrodev.co %c %c \n\n`, @@ -19,7 +19,7 @@ export const SayHello = () => self.console.log(...args); } - else if (self.console) + else if(self.console) { self.console.log(`Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} `); } diff --git a/src/nitro/Nitro.ts b/src/nitro/Nitro.ts index de1ac1e1..d59f4837 100644 --- a/src/nitro/Nitro.ts +++ b/src/nitro/Nitro.ts @@ -57,7 +57,7 @@ export class Nitro implements INitro constructor(core: INitroCore, options?: IApplicationOptions) { - if (!Nitro.INSTANCE) Nitro.INSTANCE = this; + if(!Nitro.INSTANCE) Nitro.INSTANCE = this; this._worker = null; this._application = new PixiApplicationProxy(options); @@ -81,12 +81,12 @@ export class Nitro implements INitro this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this)); this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this)); - if (this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this); + if(this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this); } public static bootstrap(): void { - if (Nitro.INSTANCE) + if(Nitro.INSTANCE) { Nitro.INSTANCE.dispose(); @@ -108,25 +108,25 @@ export class Nitro implements INitro public init(): void { - if (this._isReady || this._isDisposed) return; + if(this._isReady || this._isDisposed) return; - if (this._avatar) this._avatar.init(); + if(this._avatar) this._avatar.init(); - if (this._soundManager) this._soundManager.init(); + if(this._soundManager) this._soundManager.init(); - if (this._roomEngine) + if(this._roomEngine) { this._roomEngine.sessionDataManager = this._sessionDataManager; this._roomEngine.roomSessionManager = this._roomSessionManager; this._roomEngine.roomManager = this._roomManager; - if (this._sessionDataManager) this._sessionDataManager.init(); - if (this._roomSessionManager) this._roomSessionManager.init(); + if(this._sessionDataManager) this._sessionDataManager.init(); + if(this._roomSessionManager) this._roomSessionManager.init(); this._roomEngine.init(); } - if (!this._communication.connection) + if(!this._communication.connection) { throw new Error('No connection found'); } @@ -138,58 +138,58 @@ export class Nitro implements INitro public dispose(): void { - if (this._isDisposed) return; + if(this._isDisposed) return; - if (this._roomManager) + if(this._roomManager) { this._roomManager.dispose(); this._roomManager = null; } - if (this._roomSessionManager) + if(this._roomSessionManager) { this._roomSessionManager.dispose(); this._roomSessionManager = null; } - if (this._sessionDataManager) + if(this._sessionDataManager) { this._sessionDataManager.dispose(); this._sessionDataManager = null; } - if (this._roomEngine) + if(this._roomEngine) { this._roomEngine.dispose(); this._roomEngine = null; } - if (this._avatar) + if(this._avatar) { this._avatar.dispose(); this._avatar = null; } - if (this._soundManager) + if(this._soundManager) { this._soundManager.dispose(); this._soundManager = null; } - if (this._communication) + if(this._communication) { this._communication.dispose(); this._communication = null; } - if (this._application) + if(this._application) { this._application.destroy(); @@ -205,7 +205,7 @@ export class Nitro implements INitro const animationFPS = this.getConfiguration('system.animation.fps', 24); const limitsFPS = this.getConfiguration('system.limits.fps', true); - if (limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS; + if(limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS; } private onRoomEngineReady(event: RoomEngineEvent): void @@ -235,7 +235,7 @@ export class Nitro implements INitro public addWorkerEventTracker(tracker: IWorkerEventTracker): void { - if (this._workerTrackers.indexOf(tracker) >= 0) return; + if(this._workerTrackers.indexOf(tracker) >= 0) return; this._workerTrackers.push(tracker); } @@ -244,20 +244,20 @@ export class Nitro implements INitro { const index = this._workerTrackers.indexOf(tracker); - if (index === -1) return; + if(index === -1) return; this._workerTrackers.splice(index, 1); } public createWorkerEvent(message: MessageEvent): void { - if (!message) return; + if(!message) return; const data: { [index: string]: any } = message.data; - for (const tracker of this._workerTrackers) + for(const tracker of this._workerTrackers) { - if (!tracker) continue; + if(!tracker) continue; tracker.workerMessageReceived(data); } @@ -265,14 +265,14 @@ export class Nitro implements INitro public sendWorkerEvent(message: { [index: string]: any }): void { - if (!message || !this._worker) return; + if(!message || !this._worker) return; this._worker.postMessage(message); } public addLinkEventTracker(tracker: ILinkEventTracker): void { - if (this._linkTrackers.indexOf(tracker) >= 0) return; + if(this._linkTrackers.indexOf(tracker) >= 0) return; this._linkTrackers.push(tracker); } @@ -281,24 +281,24 @@ export class Nitro implements INitro { const index = this._linkTrackers.indexOf(tracker); - if (index === -1) return; + if(index === -1) return; this._linkTrackers.splice(index, 1); } public createLinkEvent(link: string): void { - if (!link || (link === '')) return; + if(!link || (link === '')) return; - for (const tracker of this._linkTrackers) + for(const tracker of this._linkTrackers) { - if (!tracker) continue; + if(!tracker) continue; const prefix = tracker.eventUrlPrefix; - if (prefix.length > 0) + if(prefix.length > 0) { - if (link.substr(0, prefix.length) === prefix) tracker.linkReceived(link); + if(link.substr(0, prefix.length) === prefix) tracker.linkReceived(link); } else { diff --git a/src/nitro/avatar/AvatarAssetDownloadLibrary.ts b/src/nitro/avatar/AvatarAssetDownloadLibrary.ts index 6c21ac94..7586537f 100644 --- a/src/nitro/avatar/AvatarAssetDownloadLibrary.ts +++ b/src/nitro/avatar/AvatarAssetDownloadLibrary.ts @@ -31,16 +31,16 @@ export class AvatarAssetDownloadLibrary extends EventDispatcher const asset = this._assets.getCollection(this._libraryName); - if (asset) this._state = AvatarAssetDownloadLibrary.LOADED; + if(asset) this._state = AvatarAssetDownloadLibrary.LOADED; } public downloadAsset(): void { - if (!this._assets || (this._state === AvatarAssetDownloadLibrary.LOADING) || (this._state === AvatarAssetDownloadLibrary.LOADED)) return; + if(!this._assets || (this._state === AvatarAssetDownloadLibrary.LOADING) || (this._state === AvatarAssetDownloadLibrary.LOADED)) return; const asset = this._assets.getCollection(this._libraryName); - if (asset) + if(asset) { this._state = AvatarAssetDownloadLibrary.LOADED; @@ -53,7 +53,7 @@ export class AvatarAssetDownloadLibrary extends EventDispatcher this._assets.downloadAsset(this._downloadUrl, (flag: boolean) => { - if (flag) + if(flag) { this._state = AvatarAssetDownloadLibrary.LOADED; diff --git a/src/nitro/avatar/AvatarAssetDownloadManager.ts b/src/nitro/avatar/AvatarAssetDownloadManager.ts index a6f783d0..a65e7032 100644 --- a/src/nitro/avatar/AvatarAssetDownloadManager.ts +++ b/src/nitro/avatar/AvatarAssetDownloadManager.ts @@ -64,7 +64,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher request.onloadend = e => { - if (request.responseText) + if(request.responseText) { const data = JSON.parse(request.responseText); @@ -92,16 +92,16 @@ export class AvatarAssetDownloadManager extends EventDispatcher private processFigureMap(data: any): void { - if (!data) return; + if(!data) return; - for (const library of data) + for(const library of data) { - if (!library) continue; + if(!library) continue; const id = (library.id as string); const revision = (library.revision || ''); - if (this._libraryNames.indexOf(id) >= 0) continue; + if(this._libraryNames.indexOf(id) >= 0) continue; this._libraryNames.push(id); @@ -109,7 +109,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); - for (const part of library.parts) + for(const part of library.parts) { const id = (part.id as string); const type = (part.type as string); @@ -117,7 +117,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher let existing = this._figureMap.get(partString); - if (!existing) existing = []; + if(!existing) existing = []; existing.push(downloadLibrary); @@ -128,9 +128,9 @@ export class AvatarAssetDownloadManager extends EventDispatcher private onAvatarRenderReady(event: NitroEvent): void { - if (!event) return; + if(!event) return; - for (const [container, listener] of this._pendingContainers) + for(const [container, listener] of this._pendingContainers) { this.downloadAvatarFigure(container, listener); } @@ -140,34 +140,34 @@ export class AvatarAssetDownloadManager extends EventDispatcher private onLibraryLoaded(event: AvatarRenderLibraryEvent): void { - if (!event || !event.library) return; + if(!event || !event.library) return; const loadedFigures: string[] = []; - for (const [figure, libraries] of this._incompleteFigures.entries()) + for(const [figure, libraries] of this._incompleteFigures.entries()) { let isReady = true; - for (const library of libraries) + for(const library of libraries) { - if (!library || library.isLoaded) continue; + if(!library || library.isLoaded) continue; isReady = false; break; } - if (isReady) + if(isReady) { loadedFigures.push(figure); const listeners = this._figureListeners.get(figure); - if (listeners) + if(listeners) { - for (const listener of listeners) + for(const listener of listeners) { - if (!listener || listener.disposed) continue; + if(!listener || listener.disposed) continue; listener.resetFigure(figure); } @@ -179,22 +179,22 @@ export class AvatarAssetDownloadManager extends EventDispatcher } } - for (const figure of loadedFigures) + for(const figure of loadedFigures) { - if (!figure) continue; + if(!figure) continue; this._incompleteFigures.delete(figure); } let index = 0; - while (index < this._currentDownloads.length) + while(index < this._currentDownloads.length) { const download = this._currentDownloads[index]; - if (download) + if(download) { - if (download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); + if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); } index++; @@ -205,19 +205,19 @@ export class AvatarAssetDownloadManager extends EventDispatcher { const libraries = this._missingMandatoryLibs.slice(); - for (const library of libraries) + for(const library of libraries) { - if (!library) continue; + if(!library) continue; const map = this._figureMap.get(library); - if (map) for (const avatar of map) avatar && this.downloadLibrary(avatar); + if(map) for(const avatar of map) avatar && this.downloadLibrary(avatar); } } public isAvatarFigureContainerReady(container: IAvatarFigureContainer): boolean { - if (!this._isReady || !this._structure.renderManager.isReady) + if(!this._isReady || !this._structure.renderManager.isReady) { return false; } @@ -231,38 +231,38 @@ export class AvatarAssetDownloadManager extends EventDispatcher { const pendingLibraries: AvatarAssetDownloadLibrary[] = []; - if (!container || !this._structure) return pendingLibraries; + if(!container || !this._structure) return pendingLibraries; const figureData = this._structure.figureData; - if (!figureData) return pendingLibraries; + if(!figureData) return pendingLibraries; const setKeys = container.getPartTypeIds(); - for (const key of setKeys) + for(const key of setKeys) { const set = figureData.getSetType(key); - if (!set) continue; + if(!set) continue; const figurePartSet = set.getPartSet(container.getPartSetId(key)); - if (!figurePartSet) continue; + if(!figurePartSet) continue; - for (const part of figurePartSet.parts) + for(const part of figurePartSet.parts) { - if (!part) continue; + if(!part) continue; const name = (part.type + ':' + part.id); const existing = this._figureMap.get(name); - if (existing === undefined) continue; + if(existing === undefined) continue; - for (const library of existing) + for(const library of existing) { - if (!library || library.isLoaded) continue; + if(!library || library.isLoaded) continue; - if (pendingLibraries.indexOf(library) >= 0) continue; + if(pendingLibraries.indexOf(library) >= 0) continue; pendingLibraries.push(library); } @@ -274,7 +274,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void { - if (!this._isReady || !this._structure.renderManager.isReady) + if(!this._isReady || !this._structure.renderManager.isReady) { this._pendingContainers.push([container, listener]); @@ -284,13 +284,13 @@ export class AvatarAssetDownloadManager extends EventDispatcher const figure = container.getFigureString(); const pendingLibraries = this.getAvatarFigurePendingLibraries(container); - if (pendingLibraries && pendingLibraries.length) + if(pendingLibraries && pendingLibraries.length) { - if (listener && !listener.disposed) + if(listener && !listener.disposed) { let listeners = this._figureListeners.get(figure); - if (!listeners) + if(!listeners) { listeners = []; @@ -302,24 +302,24 @@ export class AvatarAssetDownloadManager extends EventDispatcher this._incompleteFigures.set(figure, pendingLibraries); - for (const library of pendingLibraries) + for(const library of pendingLibraries) { - if (!library) continue; + if(!library) continue; this.downloadLibrary(library); } } else { - if (listener && !listener.disposed) listener.resetFigure(figure); + if(listener && !listener.disposed) listener.resetFigure(figure); } } private downloadLibrary(library: AvatarAssetDownloadLibrary): void { - if (!library || library.isLoaded) return; + if(!library || library.isLoaded) return; - if ((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; + if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; this._pendingDownloadQueue.push(library); @@ -328,7 +328,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher private processDownloadQueue(): void { - while (this._pendingDownloadQueue.length) + while(this._pendingDownloadQueue.length) { const library = this._pendingDownloadQueue[0]; diff --git a/src/nitro/avatar/AvatarImage.ts b/src/nitro/avatar/AvatarImage.ts index 03fbc981..11fe28ee 100644 --- a/src/nitro/avatar/AvatarImage.ts +++ b/src/nitro/avatar/AvatarImage.ts @@ -90,11 +90,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._assets = _arg_2; this._scale = _arg_4; this._effectListener = _arg_6; - if (this._scale == null) + if(this._scale == null) { this._scale = AvatarScaleType.LARGE; } - if (_arg_3 == null) + if(_arg_3 == null) { _arg_3 = new AvatarFigureContainer('hr-893-45.hd-180-2.ch-210-66.lg-270-82.sh-300-91.wa-2007-.ri-1-'); } @@ -118,7 +118,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; this._structure = null; this._assets = null; @@ -127,22 +127,22 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._avatarSpriteData = null; this._actions = null; - if (this._image) + if(this._image) { this._image.destroy(); this._image = null; } - if (this._cache) + if(this._cache) { this._cache.dispose(); this._cache = null; } - if (this._fullImageCache) + if(this._fullImageCache) { - for (const k of this._fullImageCache.getValues()) (k && k.destroy()); + for(const k of this._fullImageCache.getValues()) (k && k.destroy()); this._fullImageCache = null; } @@ -176,24 +176,24 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener { _arg_2 = (_arg_2 + this._directionOffset); - if (_arg_2 < AvatarDirectionAngle.MIN_DIRECTION) + if(_arg_2 < AvatarDirectionAngle.MIN_DIRECTION) { _arg_2 = (AvatarDirectionAngle.MAX_DIRECTION + (_arg_2 + 1)); } - if (_arg_2 > AvatarDirectionAngle.MAX_DIRECTION) + if(_arg_2 > AvatarDirectionAngle.MAX_DIRECTION) { _arg_2 = (_arg_2 - (AvatarDirectionAngle.MAX_DIRECTION + 1)); } - if (this._structure.isMainAvatarSet(k)) + if(this._structure.isMainAvatarSet(k)) { this._mainDirection = _arg_2; } - if ((k === AvatarSetType.HEAD) || (k === AvatarSetType.FULL)) + if((k === AvatarSetType.HEAD) || (k === AvatarSetType.FULL)) { - if ((k === AvatarSetType.HEAD) && (this.isHeadTurnPreventedByAction())) + if((k === AvatarSetType.HEAD) && (this.isHeadTurnPreventedByAction())) { _arg_2 = this._mainDirection; } @@ -239,34 +239,34 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private getFullImageCacheKey(): string { - if (!this._useFullImageCache) return null; + if(!this._useFullImageCache) return null; - if (((this._sortedActions.length == 1) && (this._mainDirection == this._headDirection))) + if(((this._sortedActions.length == 1) && (this._mainDirection == this._headDirection))) { return (this._mainDirection + this._currentActionsString) + (this._frameCounter % 4); } - if (this._sortedActions.length == 2) + if(this._sortedActions.length == 2) { - for (const k of this._sortedActions) + for(const k of this._sortedActions) { - if (((k.actionType == 'fx') && ((((k.actionParameter == '33') || (k.actionParameter == '34')) || (k.actionParameter == '35')) || (k.actionParameter == '36')))) + if(((k.actionType == 'fx') && ((((k.actionParameter == '33') || (k.actionParameter == '34')) || (k.actionParameter == '35')) || (k.actionParameter == '36')))) { return (this._mainDirection + this._currentActionsString) + 0; } - if (((k.actionType == 'fx') && ((k.actionParameter == '38') || (k.actionParameter == '39')))) + if(((k.actionType == 'fx') && ((k.actionParameter == '38') || (k.actionParameter == '39')))) { return (((this._mainDirection + '_') + this._headDirection) + this._currentActionsString) + (this._frameCounter % 11); } - if ((k.actionType === 'dance') && ((k.actionParameter === '1') || (k.actionParameter === '2') || (k.actionParameter === '3') || (k.actionParameter === '4'))) + if((k.actionType === 'dance') && ((k.actionParameter === '1') || (k.actionParameter === '2') || (k.actionParameter === '3') || (k.actionParameter === '4'))) { let frame = (this._frameCounter % 8); - if ((k.actionParameter === '3')) frame = (this._frameCounter % 10); + if((k.actionParameter === '3')) frame = (this._frameCounter % 10); - if ((k.actionParameter === '4')) frame = (this._frameCounter % 16); + if((k.actionParameter === '4')) frame = (this._frameCounter % 16); return (((this._mainDirection + k.actionType) + k.actionParameter) + frame); } @@ -278,7 +278,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private getBodyParts(k: string, _arg_2: string, _arg_3: number): string[] { - if ((((!(_arg_3 == this._cachedBodyPartsDirection)) || (!(_arg_2 == this._cachedBodyPartsGeometryType))) || (!(k == this._cachedBodyPartsAvatarSet)))) + if((((!(_arg_3 == this._cachedBodyPartsDirection)) || (!(_arg_2 == this._cachedBodyPartsGeometryType))) || (!(k == this._cachedBodyPartsAvatarSet)))) { this._cachedBodyPartsDirection = _arg_3; this._cachedBodyPartsGeometryType = _arg_2; @@ -291,18 +291,18 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public getAvatarPartsForCamera(k: string): void { let _local_4: string; - if (this._mainAction == null) + if(this._mainAction == null) { return; } const _local_2 = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); - if (_local_2 == null) + if(_local_2 == null) { return; } const _local_3 = this.getBodyParts(k, this._mainAction.definition.geometryType, this._mainDirection); let _local_6 = (_local_3.length - 1); - while (_local_6 >= 0) + while(_local_6 >= 0) { _local_4 = _local_3[_local_6]; const _local_5 = this._cache.getImageContainer(_local_4, this._frameCounter, true); @@ -312,19 +312,19 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public getImage(setType: string, hightlight: boolean, scale: number = 1, cache: boolean = true): RenderTexture { - if (!this._changes) return this._image; + if(!this._changes) return this._image; - if (!this._mainAction) return null; + if(!this._mainAction) return null; - if (!this._actionsSorted) this.endActionAppends(); + if(!this._actionsSorted) this.endActionAppends(); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); - if (!avatarCanvas) return null; + if(!avatarCanvas) return null; - if (this._image && ((this._image.width !== avatarCanvas.width) || (this._image.height !== avatarCanvas.height))) + if(this._image && ((this._image.width !== avatarCanvas.width) || (this._image.height !== avatarCanvas.height))) { - if (this._reusableTexture) + if(this._reusableTexture) { this._reusableTexture.destroy(true); @@ -344,16 +344,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener let isCachable = true; let partCount = (_local_6.length - 1); - while (partCount >= 0) + while(partCount >= 0) { const set = _local_6[partCount]; const part = this._cache.getImageContainer(set, this._frameCounter); - if (part) + if(part) { const partCacheContainer = part.image; - if (!partCacheContainer) + if(!partCacheContainer) { container.destroy({ children: true @@ -366,7 +366,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const point = part.regPoint.clone(); - if (point) + if(point) { point.x += avatarCanvas.offset.x; point.y += avatarCanvas.offset.y; @@ -378,7 +378,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener partContainer.addChild(partCacheContainer); - if (partContainer) + if(partContainer) { partContainer.position.set(point.x, point.y); @@ -390,13 +390,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener partCount--; } - if (this._avatarSpriteData) + if(this._avatarSpriteData) { - if (!container.filters) container.filters = []; + if(!container.filters) container.filters = []; - if (this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform); + if(this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform); - if (this._avatarSpriteData.paletteIsGrayscale) + if(this._avatarSpriteData.paletteIsGrayscale) { this.convertToGrayscale(container); @@ -404,12 +404,12 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener } } - if (!cache) + if(!cache) { return TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); } - if (this._reusableTexture) + if(this._reusableTexture) { PixiApplicationProxy.instance.renderer.render(container, { renderTexture: this._reusableTexture, @@ -421,7 +421,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._reusableTexture = TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); } - if (!this._reusableTexture) return null; + if(!this._reusableTexture) return null; /* if(this._avatarSpriteData) @@ -446,31 +446,31 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height); const data = textureImageData.data; - for (let i = 0; i < data.length; i += 4) + for(let i = 0; i < data.length; i += 4) { - if (reds.length == 256) + if(reds.length == 256) { let paletteColor = reds[data[i]]; - if (paletteColor === undefined) paletteColor = 0; + if(paletteColor === undefined) paletteColor = 0; data[i] = ((paletteColor >> 16) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF); data[i + 2] = (paletteColor & 0xFF); } - if (greens.length == 256) + if(greens.length == 256) { let paletteColor = greens[data[i + 1]]; - if (paletteColor === undefined) paletteColor = 0; + if(paletteColor === undefined) paletteColor = 0; data[i] = ((paletteColor >> 16) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF); data[i + 2] = (paletteColor & 0xFF); } - if (blues.length == 256) + if(blues.length == 256) { let paletteColor = greens[data[i + 2]]; - if (paletteColor === undefined) paletteColor = 0; + if(paletteColor === undefined) paletteColor = 0; data[i] = ((paletteColor >> 16) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF); @@ -492,13 +492,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public getImageAsSprite(setType: string, scale: number = 1): Sprite { - if (!this._mainAction) return null; + if(!this._mainAction) return null; - if (!this._actionsSorted) this.endActionAppends(); + if(!this._actionsSorted) this.endActionAppends(); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); - if (!avatarCanvas) return null; + if(!avatarCanvas) return null; const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const container = new NitroSprite(); @@ -511,16 +511,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener let partCount = (setTypes.length - 1); - while (partCount >= 0) + while(partCount >= 0) { const set = setTypes[partCount]; const part = this._cache.getImageContainer(set, this._frameCounter); - if (part) + if(part) { const partCacheContainer = part.image; - if (!partCacheContainer) + if(!partCacheContainer) { container.destroy({ children: true @@ -531,7 +531,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const point = part.regPoint.clone(); - if (point) + if(point) { point.x += avatarCanvas.offset.x; point.y += avatarCanvas.offset.y; @@ -557,29 +557,29 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public getCroppedImage(setType: string, scale: number = 1): HTMLImageElement { - if (!this._mainAction) return null; + if(!this._mainAction) return null; - if (!this._actionsSorted) this.endActionAppends(); + if(!this._actionsSorted) this.endActionAppends(); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); - if (!avatarCanvas) return null; + if(!avatarCanvas) return null; const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const container = new NitroContainer(); let partCount = (setTypes.length - 1); - while (partCount >= 0) + while(partCount >= 0) { const set = setTypes[partCount]; const part = this._cache.getImageContainer(set, this._frameCounter); - if (part) + if(part) { const partCacheContainer = part.image; - if (!partCacheContainer) + if(!partCacheContainer) { container.destroy({ children: true @@ -590,7 +590,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const point = part.regPoint.clone(); - if (point) + if(point) { point.x += avatarCanvas.offset.x; point.y += avatarCanvas.offset.y; @@ -602,7 +602,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener partContainer.addChild(partCacheContainer); - if (partContainer) + if(partContainer) { partContainer.position.set(point.x, point.y); @@ -618,7 +618,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const image = TextureUtils.generateImage(texture); - if (!image) return null; + if(!image) return null; return image; } @@ -627,9 +627,9 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener { const existing = this._fullImageCache.getValue(k); - if (existing) + if(existing) { - if (!existing.valid) + if(!existing.valid) { this._fullImageCache.remove(k); @@ -646,18 +646,18 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener { const existing = this._fullImageCache.getValue(k); - if (existing) + if(existing) { this._fullImageCache.remove(k); existing.destroy(true); } - if (this._fullImageCache.length === this._fullImageCacheSize) + if(this._fullImageCache.length === this._fullImageCacheSize) { const oldestKey = this._fullImageCache.getKey(0); - if (oldestKey) + if(oldestKey) { const removed = this._fullImageCache.remove(oldestKey); @@ -690,13 +690,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener { let k: ActiveActionData; - if (!this.sortActions()) return; + if(!this.sortActions()) return; - for (const k of this._sortedActions) + for(const k of this._sortedActions) { - if (k.actionType === AvatarAction.EFFECT) + if(k.actionType === AvatarAction.EFFECT) { - if (!this._effectManager.isAvatarEffectReady(parseInt(k.actionParameter))) this._effectManager.downloadAvatarEffect(parseInt(k.actionParameter), this); + if(!this._effectManager.isAvatarEffectReady(parseInt(k.actionParameter))) this._effectManager.downloadAvatarEffect(parseInt(k.actionParameter), this); } } @@ -710,14 +710,14 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._actionsSorted = false; - if (_args && (_args.length > 0)) _local_3 = _args[0]; + if(_args && (_args.length > 0)) _local_3 = _args[0]; - if ((_local_3 !== undefined) && (_local_3 !== null)) _local_3 = _local_3.toString(); + if((_local_3 !== undefined) && (_local_3 !== null)) _local_3 = _local_3.toString(); - switch (k) + switch(k) { case AvatarAction.POSTURE: - switch (_local_3) + switch(_local_3) { case AvatarAction.POSTURE_LAY: case AvatarAction.POSTURE_WALK: @@ -730,11 +730,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener case AvatarAction.SNOWWAR_DIE_BACK: case AvatarAction.SNOWWAR_PICK: case AvatarAction.SNOWWAR_THROW: - if ((_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY)) + if((_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY)) { - if (_local_3 === AvatarAction.POSTURE_LAY) + if(_local_3 === AvatarAction.POSTURE_LAY) { - if (this._mainDirection == 0) + if(this._mainDirection == 0) { this.setDirection(AvatarSetType.FULL, 4); } @@ -753,7 +753,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener } break; case AvatarAction.GESTURE: - switch (_local_3) + switch(_local_3) { case AvatarAction.GESTURE_AGGRAVATED: case AvatarAction.GESTURE_SAD: @@ -777,9 +777,9 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener case AvatarAction.EXPRESSION_SNOWBOARD_OLLIE: case AvatarAction.EXPRESSION_SNOWBORD_360: case AvatarAction.EXPRESSION_RIDE_JUMP: - if (_local_3 === AvatarAction.EFFECT) + if(_local_3 === AvatarAction.EFFECT) { - if ((((((_local_3 === '33') || (_local_3 === '34')) || (_local_3 === '35')) || (_local_3 === '36')) || (_local_3 === '38')) || (_local_3 === '39')) + if((((((_local_3 === '33') || (_local_3 === '34')) || (_local_3 === '35')) || (_local_3 === '36')) || (_local_3 === '38')) || (_local_3 === '39')) { this._useFullImageCache = true; } @@ -790,7 +790,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener case AvatarAction.CARRY_OBJECT: case AvatarAction.USE_OBJECT: { const _local_4 = this._structure.getActionDefinitionWithState(k); - if (_local_4) _local_3 = _local_4.getParameterValue(_local_3); + if(_local_4) _local_3 = _local_4.getParameterValue(_local_3); this.addActionData(k, _local_3); break; } @@ -802,13 +802,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener protected addActionData(k: string, _arg_2: string = ''): void { let _local_3: ActiveActionData; - if (!this._actions) this._actions = []; + if(!this._actions) this._actions = []; let _local_4 = 0; - while (_local_4 < this._actions.length) + while(_local_4 < this._actions.length) { _local_3 = this._actions[_local_4]; - if (((_local_3.actionType == k) && (_local_3.actionParameter == _arg_2))) + if(((_local_3.actionType == k) && (_local_3.actionParameter == _arg_2))) { return; } @@ -841,14 +841,14 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener let _local_2: IActionDefinition; let _local_3: ActiveActionData; let k: boolean; - if (this._sortedActions == null) + if(this._sortedActions == null) { return false; } - for (const _local_3 of this._sortedActions) + for(const _local_3 of this._sortedActions) { _local_2 = this._structure.getActionDefinitionWithState(_local_3.actionType); - if (((!(_local_2 == null)) && (_local_2.getPreventHeadTurn(_local_3.actionParameter)))) + if(((!(_local_2 == null)) && (_local_2.getPreventHeadTurn(_local_3.actionParameter)))) { k = true; } @@ -868,11 +868,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._sortedActions = this._structure.sortActions(this._actions); this._animationFrameCount = this._structure.maxFrames(this._sortedActions); - if (!this._sortedActions) + if(!this._sortedActions) { this._canvasOffsets = [0, 0, 0]; - if (this._lastActionsString !== '') + if(this._lastActionsString !== '') { k = true; @@ -883,15 +883,15 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener { this._canvasOffsets = this._structure.getCanvasOffsets(this._sortedActions, this._scale, this._mainDirection); - for (const _local_4 of this._sortedActions) + for(const _local_4 of this._sortedActions) { this._currentActionsString = (this._currentActionsString + (_local_4.actionType + _local_4.actionParameter)); - if (_local_4.actionType === AvatarAction.EFFECT) + if(_local_4.actionType === AvatarAction.EFFECT) { const _local_5 = parseInt(_local_4.actionParameter); - if (this._effectIdInUse !== _local_5) _local_2 = true; + if(this._effectIdInUse !== _local_5) _local_2 = true; this._effectIdInUse = _local_5; @@ -899,16 +899,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener } } - if (!_local_3) + if(!_local_3) { - if (this._effectIdInUse > -1) _local_2 = true; + if(this._effectIdInUse > -1) _local_2 = true; this._effectIdInUse = -1; } - if (_local_2) this._cache.disposeInactiveActions(0); + if(_local_2) this._cache.disposeInactiveActions(0); - if (this._lastActionsString != this._currentActionsString) + if(this._lastActionsString != this._currentActionsString) { k = true; @@ -923,60 +923,60 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private setActionsToParts(): void { - if (!this._sortedActions == null) return; + if(!this._sortedActions == null) return; const _local_3: number = Nitro.instance.time; const _local_4: string[] = []; - for (const k of this._sortedActions) _local_4.push(k.actionType); + for(const k of this._sortedActions) _local_4.push(k.actionType); - for (const k of this._sortedActions) + for(const k of this._sortedActions) { - if ((k && k.definition) && k.definition.isAnimation) + if((k && k.definition) && k.definition.isAnimation) { const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); - if (_local_2 && _local_2.hasOverriddenActions()) + if(_local_2 && _local_2.hasOverriddenActions()) { const _local_5 = _local_2.overriddenActionNames(); - if (_local_5) + if(_local_5) { - for (const _local_6 of _local_5) + for(const _local_6 of _local_5) { - if (_local_4.indexOf(_local_6) >= 0) k.overridingAction = _local_2.overridingAction(_local_6); + if(_local_4.indexOf(_local_6) >= 0) k.overridingAction = _local_2.overridingAction(_local_6); } } } - if (_local_2 && _local_2.resetOnToggle) + if(_local_2 && _local_2.resetOnToggle) { this._animationHasResetOnToggle = true; } } } - for (const k of this._sortedActions) + for(const k of this._sortedActions) { - if (!((!(k)) || (!(k.definition)))) + if(!((!(k)) || (!(k.definition)))) { - if (k.definition.isAnimation && (k.actionParameter === '')) k.actionParameter = '1'; + if(k.definition.isAnimation && (k.actionParameter === '')) k.actionParameter = '1'; this.setActionToParts(k, _local_3); - if (k.definition.isAnimation) + if(k.definition.isAnimation) { this._isAnimating = k.definition.isAnimated(k.actionParameter); const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); - if (_local_2) + if(_local_2) { this._sprites = this._sprites.concat(_local_2.spriteData); - if (_local_2.hasDirectionData()) this._directionOffset = _local_2.directionData.offset; + if(_local_2.hasDirectionData()) this._directionOffset = _local_2.directionData.offset; - if (_local_2.hasAvatarData()) this._avatarSpriteData = _local_2.avatarData; + if(_local_2.hasAvatarData()) this._avatarSpriteData = _local_2.avatarData; } } } @@ -985,15 +985,15 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private setActionToParts(k: IActiveActionData, _arg_2: number): void { - if (((k == null) || (k.definition == null))) + if(((k == null) || (k.definition == null))) { return; } - if (k.definition.assetPartDefinition == '') + if(k.definition.assetPartDefinition == '') { return; } - if (k.definition.isMain) + if(k.definition.isMain) { this._mainAction = k; this._cache.setGeometryType(k.definition.geometryType); @@ -1004,11 +1004,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener private resetBodyPartCache(k: IActiveActionData): void { - if (!k) return; + if(!k) return; - if (k.definition.assetPartDefinition === '') return; + if(k.definition.assetPartDefinition === '') return; - if (k.definition.isMain) + if(k.definition.isMain) { this._mainAction = k; this._cache.setGeometryType(k.definition.geometryType); @@ -1030,7 +1030,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener let _local_5 = 0.33; const _local_6 = 1; - switch (channel) + switch(channel) { case AvatarImage.CHANNELS_UNIQUE: _local_3 = 0.3; @@ -1098,7 +1098,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener public resetEffect(effect: number): void { - if (effect === this._effectIdInUse) + if(effect === this._effectIdInUse) { this.resetActions(); this.setActionsToParts(); @@ -1106,7 +1106,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._animationHasResetOnToggle = true; this._changes = true; - if (this._effectListener) this._effectListener.resetEffect(effect); + if(this._effectListener) this._effectListener.resetEffect(effect); } } } diff --git a/src/nitro/avatar/AvatarRenderManager.ts b/src/nitro/avatar/AvatarRenderManager.ts index b2259e3d..3ba09eb4 100644 --- a/src/nitro/avatar/AvatarRenderManager.ts +++ b/src/nitro/avatar/AvatarRenderManager.ts @@ -84,7 +84,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa this._aliasCollection.init(); - if (!this._avatarAssetDownloadManager) + if(!this._avatarAssetDownloadManager) { this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(Nitro.instance.core.asset, this._structure); @@ -92,7 +92,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); } - if (!this._effectAssetDownloadManager) + if(!this._effectAssetDownloadManager) { this._effectAssetDownloadManager = new EffectAssetDownloadManager(Nitro.instance.core.asset, this._structure); @@ -105,14 +105,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public onDispose(): void { - if (this._avatarAssetDownloadManager) + if(this._avatarAssetDownloadManager) { this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); } - if (this._effectAssetDownloadManager) + if(this._effectAssetDownloadManager) { this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); @@ -122,7 +122,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private loadGeometry(): void { - if (!this._structure) return; + if(!this._structure) return; this._structure.initGeometry(HabboAvatarGeometry.geometry); @@ -133,7 +133,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private loadPartSets(): void { - if (!this._structure) return; + if(!this._structure) return; this._structure.initPartSets(HabboAvatarPartSets.partSets); @@ -146,7 +146,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa { const defaultActions = Nitro.instance.getConfiguration('avatar.default.actions'); - if (defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions); + if(defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions); const request = new XMLHttpRequest(); @@ -158,7 +158,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa request.onloadend = e => { - if (!this._structure) return; + if(!this._structure) return; this._structure.updateActions(JSON.parse(request.responseText)); @@ -181,7 +181,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private loadAnimations(): void { - if (!this._structure) return; + if(!this._structure) return; this._structure.initAnimation(HabboAvatarAnimations.animations); @@ -194,14 +194,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa { const defaultFigureData = Nitro.instance.getConfiguration('avatar.default.figuredata'); - if (!defaultFigureData || (typeof defaultFigureData === 'string')) + if(!defaultFigureData || (typeof defaultFigureData === 'string')) { this.logger.error('XML figuredata is no longer supported'); return; } - if (this._structure) this._structure.initFigureData(defaultFigureData); + if(this._structure) this._structure.initFigureData(defaultFigureData); const structureDownloader = new AvatarStructureDownload(Nitro.instance.getConfiguration('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData)); @@ -219,7 +219,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private onAvatarAssetDownloaderReady(event: NitroEvent): void { - if (!event) return; + if(!event) return; this._figureMapReady = true; @@ -228,14 +228,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private onAvatarAssetDownloaded(event: NitroEvent): void { - if (!event) return; + if(!event) return; this._aliasCollection.reset(); } private onEffectAssetDownloaderReady(event: NitroEvent): void { - if (!event) return; + if(!event) return; this._effectMapReady = true; @@ -244,20 +244,20 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa private onEffectAssetDownloaded(event: NitroEvent): void { - if (!event) return; + if(!event) return; this._aliasCollection.reset(); } private checkReady(): void { - if (this._isReady) return; + if(this._isReady) return; - if (!this._geometryReady || !this._partSetsReady || !this._actionsReady || !this._animationsReady || !this._figureMapReady || !this._effectMapReady || !this._structureReady) 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)); + if(this.events) this.events.dispatchEvent(new NitroEvent(AvatarRenderEvent.AVATAR_RENDER_READY)); } public createFigureContainer(figure: string): IAvatarFigureContainer @@ -267,25 +267,25 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public isFigureContainerReady(container: IAvatarFigureContainer): boolean { - if (!this._avatarAssetDownloadManager) return false; + if(!this._avatarAssetDownloadManager) return false; return this._avatarAssetDownloadManager.isAvatarFigureContainerReady(container); } public createAvatarImage(figure: string, size: string, gender: string, listener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage { - if (!this._structure || !this._avatarAssetDownloadManager) return null; + if(!this._structure || !this._avatarAssetDownloadManager) return null; const figureContainer = new AvatarFigureContainer(figure); - if (gender) this.validateAvatarFigure(figureContainer, gender); + if(gender) this.validateAvatarFigure(figureContainer, gender); - if (this._avatarAssetDownloadManager.isAvatarFigureContainerReady(figureContainer)) + if(this._avatarAssetDownloadManager.isAvatarFigureContainerReady(figureContainer)) { return new AvatarImage(this._structure, this._aliasCollection, figureContainer, size, this._effectAssetDownloadManager, effectListener); } - if (!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); + if(!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); this._avatarAssetDownloadManager.downloadAvatarFigure(figureContainer, listener); @@ -294,7 +294,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void { - if (!this._avatarAssetDownloadManager) return; + if(!this._avatarAssetDownloadManager) return; this._avatarAssetDownloadManager.downloadAvatarFigure(container, listener); } @@ -305,17 +305,17 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa const typeIds = this._structure.getMandatorySetTypeIds(gender, 2); - if (typeIds) + if(typeIds) { const figureData = this._structure.figureData; - for (const id of typeIds) + for(const id of typeIds) { - if (!container.hasPartType(id)) + if(!container.hasPartType(id)) { const figurePartSet = this._structure.getDefaultPartSet(id, gender); - if (figurePartSet) + if(figurePartSet) { container.updatePart(id, figurePartSet.id, [0]); @@ -326,15 +326,15 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa { const setType = figureData.getSetType(id); - if (setType) + if(setType) { const figurePartSet = setType.getPartSet(container.getPartSetId(id)); - if (!figurePartSet) + if(!figurePartSet) { const partSet = this._structure.getDefaultPartSet(id, gender); - if (partSet) + if(partSet) { container.updatePart(id, partSet.id, [0]); @@ -351,49 +351,49 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number { - if (!this._structure) return 0; + if(!this._structure) return 0; const figureData = this._structure.figureData; const parts = Array.from(container.getPartTypeIds()); let clubLevel = 0; - for (const part of parts) + for(const part of parts) { const set = figureData.getSetType(part); - if (!set) continue; + if(!set) continue; const setId = container.getPartSetId(part); const partSet = set.getPartSet(setId); - if (partSet) + if(partSet) { clubLevel = Math.max(partSet.clubLevel, clubLevel); const palette = figureData.getPalette(set.paletteID); const colors = container.getPartColorIds(part); - for (const colorId of colors) + for(const colorId of colors) { const color = palette.getColor(colorId); - if (!color) continue; + if(!color) continue; clubLevel = Math.max(color.clubLevel, clubLevel); } } } - if (!searchParts) searchParts = this._structure.getBodyPartsUnordered(AvatarSetType.FULL); + if(!searchParts) searchParts = this._structure.getBodyPartsUnordered(AvatarSetType.FULL); - for (const part of searchParts) + for(const part of searchParts) { const set = figureData.getSetType(part); - if (!set) continue; + if(!set) continue; - if (parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel); + if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel); } return clubLevel; @@ -415,7 +415,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa const partSets: IFigurePartSet[] = this.resolveFigureSets(_arg_3); - for (const partSet of partSets) + for(const partSet of partSets) { container.savePartData(partSet.type, partSet.id, container.getColourIds(partSet.type)); } @@ -428,11 +428,11 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa const structure = this.structureData; const partSets: IFigurePartSet[] = []; - for (const _local_4 of k) + for(const _local_4 of k) { const partSet = structure.getFigurePartSet(_local_4); - if (partSet) partSets.push(partSet); + if(partSet) partSets.push(partSet); } return partSets; @@ -440,7 +440,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[] { - if (!this._structure) return null; + if(!this._structure) return null; return this._structure.getMandatorySetTypeIds(k, _arg_2); } @@ -467,7 +467,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public get structureData(): IStructureData { - if (this._structure) return this._structure.figureData; + if(this._structure) return this._structure.figureData; return null; } diff --git a/src/nitro/avatar/AvatarStructure.ts b/src/nitro/avatar/AvatarStructure.ts index f9e3c480..6fde8683 100644 --- a/src/nitro/avatar/AvatarStructure.ts +++ b/src/nitro/avatar/AvatarStructure.ts @@ -60,7 +60,7 @@ export class AvatarStructure extends EventDispatcher public dispose(): void { - if (this.disposed) return; + if(this.disposed) return; super.dispose(); @@ -73,14 +73,14 @@ export class AvatarStructure extends EventDispatcher public initGeometry(k: any): void { - if (!k) return; + if(!k) return; this._geometry = new AvatarModelGeometry(k); } public initActions(k: IAssetManager, _arg_2: any): void { - if (!_arg_2) return; + if(!_arg_2) return; this._actionManager = new AvatarActionManager(k, _arg_2); this._defaultAction = this._actionManager.getDefaultAction(); @@ -95,9 +95,9 @@ export class AvatarStructure extends EventDispatcher public initPartSets(k: any): boolean { - if (!k) return false; + if(!k) return false; - if (this._partSetsData.parse(k)) + if(this._partSetsData.parse(k)) { this._partSetsData.getPartDefinition('ri').appendToFigure = true; this._partSetsData.getPartDefinition('li').appendToFigure = true; @@ -110,14 +110,14 @@ export class AvatarStructure extends EventDispatcher public initAnimation(k: any): boolean { - if (!k) return false; + if(!k) return false; return this._animationData.parse(k); } public initFigureData(k: IFigureData): boolean { - if (!k) return false; + if(!k) return false; return this._figureData.parse(k); } @@ -131,11 +131,11 @@ export class AvatarStructure extends EventDispatcher { let index = 0; - while (index < _arg_3) + while(index < _arg_3) { const collection = k.getCollection((_arg_2 + index)); - if (collection) + if(collection) { const animationData = collection.data; @@ -155,15 +155,15 @@ export class AvatarStructure extends EventDispatcher { const _local_4 = k.getPartColorIds(_arg_2); - if ((!(_local_4)) || (_local_4.length < _arg_3)) return null; + if((!(_local_4)) || (_local_4.length < _arg_3)) return null; const _local_5 = this._figureData.getSetType(_arg_2); - if (_local_5 == null) return null; + if(_local_5 == null) return null; const _local_6 = this._figureData.getPalette(_local_5.paletteID); - if (!_local_6) return null; + if(!_local_6) return null; return _local_6.getColor(_local_4[_arg_3]); } @@ -202,7 +202,7 @@ export class AvatarStructure extends EventDispatcher { let _local_2 = 0; - for (const _local_3 of k) + for(const _local_3 of k) { _local_2 = Math.max(_local_2, this._animationData.getFrameCount(_local_3.definition)); } @@ -211,12 +211,12 @@ export class AvatarStructure extends EventDispatcher public getMandatorySetTypeIds(k: string, _arg_2: number): string[] { - if (!this._mandatorySetTypeIds[k]) + if(!this._mandatorySetTypeIds[k]) { this._mandatorySetTypeIds[k] = []; } - if (this._mandatorySetTypeIds[k][_arg_2]) + if(this._mandatorySetTypeIds[k][_arg_2]) { return this._mandatorySetTypeIds[k][_arg_2]; } @@ -253,16 +253,16 @@ export class AvatarStructure extends EventDispatcher const _local_4: string[] = []; const _local_5 = k.definition.geometryType; - if (k.definition.isAnimation) + if(k.definition.isAnimation) { const _local_7 = ((k.definition.state + '.') + k.actionParameter); const _local_8 = this._animationManager.getAnimation(_local_7); - if (_local_8) + if(_local_8) { _local_3 = _local_8.getAnimatedBodyPartIds(0, k.overridingAction); - if (_local_8.hasAddData()) + if(_local_8.hasAddData()) { const _local_11 = { id: '', @@ -280,11 +280,11 @@ export class AvatarStructure extends EventDispatcher setType: '' }; - for (const _local_13 of _local_8.addData) + for(const _local_13 of _local_8.addData) { const _local_6 = this._geometry.getBodyPart(_local_5, _local_13.align); - if (_local_6) + if(_local_6) { _local_11.id = _local_13.id; _local_6.addPart(_local_11, _arg_2); @@ -294,30 +294,30 @@ export class AvatarStructure extends EventDispatcher const _local_10 = this._partSetsData.addPartDefinition(_local_12); _local_10.appendToFigure = true; - if (_local_13.base === '') _local_10.staticId = 1; + if(_local_13.base === '') _local_10.staticId = 1; - if (_local_4.indexOf(_local_6.id) === -1) _local_4.push(_local_6.id); + if(_local_4.indexOf(_local_6.id) === -1) _local_4.push(_local_6.id); } } } } - for (const _local_9 of _local_3) + for(const _local_9 of _local_3) { const _local_6 = this._geometry.getBodyPart(_local_5, _local_9); - if (_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); + if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); } } else { _local_3 = this._partSetsData.getActiveParts(k.definition); - for (const _local_14 of _local_3) + for(const _local_14 of _local_3) { const _local_6 = this._geometry.getBodyPartOfItem(_local_5, _local_14, _arg_2); - if (_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); + if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); } } @@ -340,7 +340,7 @@ export class AvatarStructure extends EventDispatcher { const _local_5 = this._animationData.getAction(k.definition); - if (_local_5) return _local_5.getFrameBodyPartOffset(_arg_2, _arg_3, _arg_4); + if(_local_5) return _local_5.getFrameBodyPartOffset(_arg_2, _arg_3, _arg_4); return AnimationAction.DEFAULT_OFFSET; } @@ -353,31 +353,31 @@ export class AvatarStructure extends EventDispatcher let _local_20: AvatarAnimationFrame[] = []; let _local_36: IPartColor = null; - if (!_arg_3 == null) return []; + if(!_arg_3 == null) return []; const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition); const _local_11: AvatarImagePartContainer[] = []; let _local_14: any[] = [0]; const _local_15 = this._animationData.getAction(_arg_3.definition); - if (_arg_3.definition.isAnimation) + if(_arg_3.definition.isAnimation) { const _local_24 = ((_arg_3.definition.state + '.') + _arg_3.actionParameter); const _local_10 = this._animationManager.getAnimation(_local_24); - if (_local_10) + if(_local_10) { _local_14 = this.getPopulatedArray(_local_10.frameCount(_arg_3.overridingAction)); - for (const _local_25 of _local_10.getAnimatedBodyPartIds(0, _arg_3.overridingAction)) + for(const _local_25 of _local_10.getAnimatedBodyPartIds(0, _arg_3.overridingAction)) { - if (_local_25 === k) + if(_local_25 === k) { const _local_26 = this._geometry.getBodyPart(_arg_4, _local_25); - if (_local_26) + if(_local_26) { - for (const _local_27 of _local_26.getDynamicParts(_arg_7)) + for(const _local_27 of _local_26.getDynamicParts(_arg_7)) { _local_9.push(_local_27.id); } @@ -390,11 +390,11 @@ export class AvatarStructure extends EventDispatcher const _local_16 = this._geometry.getParts(_arg_4, k, _arg_5, _local_9, _arg_7); const _local_21 = _arg_2.getPartTypeIds(); - for (const _local_17 of _local_21) + for(const _local_17 of _local_21) { - if (_arg_8) + if(_arg_8) { - if (_arg_8.get(_local_17)) continue; + if(_arg_8.get(_local_17)) continue; } const _local_28 = _arg_2.getPartSetId(_local_17); @@ -403,27 +403,27 @@ export class AvatarStructure extends EventDispatcher - if (_local_30) + if(_local_30) { const _local_31 = this._figureData.getPalette(_local_30.paletteID); - if (_local_31) + if(_local_31) { const _local_32 = _local_30.getPartSet(_local_28); - if (_local_32) + if(_local_32) { removes = removes.concat(_local_32.hiddenLayers); - for (const _local_33 of _local_32.parts) + for(const _local_33 of _local_32.parts) { - if (_local_16.indexOf(_local_33.type) > -1) + if(_local_16.indexOf(_local_33.type) > -1) { - if (_local_15) + if(_local_15) { const _local_19 = _local_15.getPart(_local_33.type); - if (_local_19) + if(_local_19) { _local_20 = _local_19.frames; } @@ -439,15 +439,15 @@ export class AvatarStructure extends EventDispatcher _local_34 = _arg_3.definition; - if (_local_9.indexOf(_local_33.type) === -1) _local_34 = this._defaultAction; + if(_local_9.indexOf(_local_33.type) === -1) _local_34 = this._defaultAction; const _local_13 = this._partSetsData.getPartDefinition(_local_33.type); let _local_35 = (!_local_13) ? _local_33.type : _local_13.flippedSetType; - if (!_local_35 || (_local_35 === '')) _local_35 = _local_33.type; + if(!_local_35 || (_local_35 === '')) _local_35 = _local_33.type; - if (_local_29 && (_local_29.length > (_local_33.colorLayerIndex - 1))) + if(_local_29 && (_local_29.length > (_local_33.colorLayerIndex - 1))) { _local_36 = _local_31.getColor(_local_29[(_local_33.colorLayerIndex - 1)]); } @@ -465,18 +465,18 @@ export class AvatarStructure extends EventDispatcher const _local_22: AvatarImagePartContainer[] = []; - for (const _local_12 of _local_16) + for(const _local_12 of _local_16) { let _local_39: IPartColor = null; let _local_38 = false; const _local_40 = ((_arg_8) && (_arg_8.get(_local_12))); - for (const _local_23 of _local_11) + for(const _local_23 of _local_11) { - if (_local_23.partType === _local_12) + if(_local_23.partType === _local_12) { - if (_local_40) + if(_local_40) { _local_39 = _local_23.color; } @@ -484,31 +484,31 @@ export class AvatarStructure extends EventDispatcher { _local_38 = true; - if (removes.indexOf(_local_12) === -1) _local_22.push(_local_23); + if(removes.indexOf(_local_12) === -1) _local_22.push(_local_23); } } } - if (!_local_38) + if(!_local_38) { - if (_local_40) + if(_local_40) { const _local_41 = _arg_8.get(_local_12); let _local_42 = 0; let _local_43 = 0; - while (_local_43 < _local_41.length) + while(_local_43 < _local_41.length) { _local_42 = (_local_42 + _local_41.charCodeAt(_local_43)); _local_43++; } - if (_local_15) + if(_local_15) { const _local_19 = _local_15.getPart(_local_12); - if (_local_19) + if(_local_19) { _local_20 = _local_19.frames; } @@ -528,11 +528,11 @@ export class AvatarStructure extends EventDispatcher } else { - if (_local_9.indexOf(_local_12) > -1) + if(_local_9.indexOf(_local_12) > -1) { const _local_44 = this._geometry.getBodyPartOfItem(_arg_4, _local_12, _arg_7); - if (k !== _local_44.id) + if(k !== _local_44.id) { // } @@ -543,36 +543,36 @@ export class AvatarStructure extends EventDispatcher let _local_45 = false; let _local_46 = 1; - if (_local_13.appendToFigure) + if(_local_13.appendToFigure) { let _local_47 = '1'; - if (_arg_3.actionParameter !== '') + if(_arg_3.actionParameter !== '') { _local_47 = _arg_3.actionParameter; } - if (_local_13.hasStaticId()) + if(_local_13.hasStaticId()) { _local_47 = _local_13.staticId.toString(); } - if (_local_10 != null) + if(_local_10 != null) { const _local_48 = _local_10.getAddData(_local_12); - if (_local_48) + if(_local_48) { _local_45 = _local_48.isBlended; _local_46 = _local_48.blend; } } - if (_local_15) + if(_local_15) { const _local_19 = _local_15.getPart(_local_12); - if (_local_19) + if(_local_19) { _local_20 = _local_19.frames; } @@ -605,7 +605,7 @@ export class AvatarStructure extends EventDispatcher let index = 0; - while (index < k) + while(index < k) { _local_2.push(index); @@ -617,13 +617,13 @@ export class AvatarStructure extends EventDispatcher public getItemIds(): string[] { - if (this._actionManager) + if(this._actionManager) { const k = this._actionManager.getActionDefinition('CarryItem').params; const _local_2 = []; - for (const _local_3 of k.values()) _local_2.push(_local_3); + for(const _local_3 of k.values()) _local_2.push(_local_3); return _local_2; } diff --git a/src/nitro/avatar/EffectAssetDownloadLibrary.ts b/src/nitro/avatar/EffectAssetDownloadLibrary.ts index efd54c09..06e08cf4 100644 --- a/src/nitro/avatar/EffectAssetDownloadLibrary.ts +++ b/src/nitro/avatar/EffectAssetDownloadLibrary.ts @@ -33,16 +33,16 @@ export class EffectAssetDownloadLibrary extends EventDispatcher const asset = this._assets.getCollection(this._libraryName); - if (asset) this._state = EffectAssetDownloadLibrary.LOADED; + if(asset) this._state = EffectAssetDownloadLibrary.LOADED; } public downloadAsset(): void { - if (!this._assets || (this._state === EffectAssetDownloadLibrary.LOADING) || (this._state === EffectAssetDownloadLibrary.LOADED)) return; + if(!this._assets || (this._state === EffectAssetDownloadLibrary.LOADING) || (this._state === EffectAssetDownloadLibrary.LOADED)) return; const asset = this._assets.getCollection(this._libraryName); - if (asset) + if(asset) { this._state = EffectAssetDownloadLibrary.LOADED; @@ -55,13 +55,13 @@ export class EffectAssetDownloadLibrary extends EventDispatcher this._assets.downloadAsset(this._downloadUrl, (flag: boolean) => { - if (flag) + if(flag) { this._state = EffectAssetDownloadLibrary.LOADED; const collection = this._assets.getCollection(this._libraryName); - if (collection) this._animation = collection.data.animations; + if(collection) this._animation = collection.data.animations; this.dispatchEvent(new AvatarRenderEffectLibraryEvent(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this)); } diff --git a/src/nitro/avatar/EffectAssetDownloadManager.ts b/src/nitro/avatar/EffectAssetDownloadManager.ts index cfd26cad..c9758987 100644 --- a/src/nitro/avatar/EffectAssetDownloadManager.ts +++ b/src/nitro/avatar/EffectAssetDownloadManager.ts @@ -63,7 +63,7 @@ export class EffectAssetDownloadManager extends EventDispatcher request.onloadend = e => { - if (request.responseText) + if(request.responseText) { const data = JSON.parse(request.responseText); @@ -91,17 +91,17 @@ export class EffectAssetDownloadManager extends EventDispatcher private processEffectMap(data: any): void { - if (!data) return; + if(!data) return; - for (const effect of data) + for(const effect of data) { - if (!effect) continue; + if(!effect) continue; const id = (effect.id as string); const lib = (effect.lib as string); const revision = (effect.revision || ''); - if (this._libraryNames.indexOf(lib) >= 0) continue; + if(this._libraryNames.indexOf(lib) >= 0) continue; this._libraryNames.push(lib); @@ -111,7 +111,7 @@ export class EffectAssetDownloadManager extends EventDispatcher let existing = this._effectMap.get(id); - if (!existing) existing = []; + if(!existing) existing = []; existing.push(downloadLibrary); @@ -121,7 +121,7 @@ export class EffectAssetDownloadManager extends EventDispatcher public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void { - if (!this._isReady || !this._structure.renderManager.isReady) + if(!this._isReady || !this._structure.renderManager.isReady) { this._initDownloadBuffer.push([id, listener]); @@ -130,13 +130,13 @@ export class EffectAssetDownloadManager extends EventDispatcher const pendingLibraries = this.getAvatarEffectPendingLibraries(id); - if (pendingLibraries && pendingLibraries.length) + if(pendingLibraries && pendingLibraries.length) { - if (listener && !listener.disposed) + if(listener && !listener.disposed) { let listeners = this._effectListeners.get(id.toString()); - if (!listeners) listeners = []; + if(!listeners) listeners = []; listeners.push(listener); @@ -145,24 +145,24 @@ export class EffectAssetDownloadManager extends EventDispatcher this._incompleteEffects.set(id.toString(), pendingLibraries); - for (const library of pendingLibraries) + for(const library of pendingLibraries) { - if (!library) continue; + if(!library) continue; this.downloadLibrary(library); } } else { - if (listener && !listener.disposed) listener.resetEffect(id); + if(listener && !listener.disposed) listener.resetEffect(id); } } private onAvatarRenderReady(event: NitroEvent): void { - if (!event) return; + if(!event) return; - for (const [id, listener] of this._initDownloadBuffer) + for(const [id, listener] of this._initDownloadBuffer) { this.downloadAvatarEffect(id, listener); } @@ -172,34 +172,34 @@ export class EffectAssetDownloadManager extends EventDispatcher private onLibraryLoaded(event: AvatarRenderEffectLibraryEvent): void { - if (!event || !event.library) return; + if(!event || !event.library) return; const loadedEffects: string[] = []; this._structure.registerAnimation(event.library.animation); - for (const [id, libraries] of this._incompleteEffects.entries()) + for(const [id, libraries] of this._incompleteEffects.entries()) { let isReady = true; - for (const library of libraries) + for(const library of libraries) { - if (!library || library.isLoaded) continue; + if(!library || library.isLoaded) continue; isReady = false; break; } - if (isReady) + if(isReady) { loadedEffects.push(id); const listeners = this._effectListeners.get(id); - for (const listener of listeners) + for(const listener of listeners) { - if (!listener || listener.disposed) continue; + if(!listener || listener.disposed) continue; listener.resetEffect(parseInt(id)); } @@ -210,17 +210,17 @@ export class EffectAssetDownloadManager extends EventDispatcher } } - for (const id of loadedEffects) this._incompleteEffects.delete(id); + for(const id of loadedEffects) this._incompleteEffects.delete(id); let index = 0; - while (index < this._currentDownloads.length) + while(index < this._currentDownloads.length) { const download = this._currentDownloads[index]; - if (download) + if(download) { - if (download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); + if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); } index++; @@ -231,19 +231,19 @@ export class EffectAssetDownloadManager extends EventDispatcher { const libraries = this._missingMandatoryLibs.slice(); - for (const library of libraries) + for(const library of libraries) { - if (!library) continue; + if(!library) continue; const map = this._effectMap.get(library); - if (map) for (const effect of map) effect && this.downloadLibrary(effect); + if(map) for(const effect of map) effect && this.downloadLibrary(effect); } } public isAvatarEffectReady(effect: number): boolean { - if (!this._isReady || !this._structure.renderManager.isReady) + if(!this._isReady || !this._structure.renderManager.isReady) { return false; } @@ -257,17 +257,17 @@ export class EffectAssetDownloadManager extends EventDispatcher { const pendingLibraries: EffectAssetDownloadLibrary[] = []; - if (!this._structure) return pendingLibraries; + if(!this._structure) return pendingLibraries; const libraries = this._effectMap.get(id.toString()); - if (libraries) + if(libraries) { - for (const library of libraries) + for(const library of libraries) { - if (!library || library.isLoaded) continue; + if(!library || library.isLoaded) continue; - if (pendingLibraries.indexOf(library) === -1) pendingLibraries.push(library); + if(pendingLibraries.indexOf(library) === -1) pendingLibraries.push(library); } } @@ -276,9 +276,9 @@ export class EffectAssetDownloadManager extends EventDispatcher private downloadLibrary(library: EffectAssetDownloadLibrary): void { - if (!library || library.isLoaded) return; + if(!library || library.isLoaded) return; - if ((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; + if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; this._pendingDownloadQueue.push(library); @@ -287,7 +287,7 @@ export class EffectAssetDownloadManager extends EventDispatcher private processDownloadQueue(): void { - while (this._pendingDownloadQueue.length) + while(this._pendingDownloadQueue.length) { const library = this._pendingDownloadQueue[0]; diff --git a/src/nitro/avatar/actions/AvatarActionManager.ts b/src/nitro/avatar/actions/AvatarActionManager.ts index 4dd0bbcd..de0563f7 100644 --- a/src/nitro/avatar/actions/AvatarActionManager.ts +++ b/src/nitro/avatar/actions/AvatarActionManager.ts @@ -19,36 +19,36 @@ export class AvatarActionManager public updateActions(data: any): void { - if (!data) return; + if(!data) return; - for (const action of data.actions) + for(const action of data.actions) { - if (!action || !action.state) continue; + if(!action || !action.state) continue; const definition = new ActionDefinition(action); this._actions.set(definition.state, definition); } - if (data.actionOffsets) this.parseActionOffsets(data.actionOffsets); + if(data.actionOffsets) this.parseActionOffsets(data.actionOffsets); } private parseActionOffsets(offsets: any): void { - if (!offsets || !offsets.length) return; + if(!offsets || !offsets.length) return; - for (const offset of offsets) + for(const offset of offsets) { const action = this._actions.get(offset.action); - if (!action) continue; + if(!action) continue; - for (const canvasOffset of offset.offsets) + for(const canvasOffset of offset.offsets) { const size = (canvasOffset.size || ''); const direction = canvasOffset.direction; - if ((size === '') || (direction === undefined)) continue; + if((size === '') || (direction === undefined)) continue; const x = (canvasOffset.x || 0); const y = (canvasOffset.y || 0); @@ -61,11 +61,11 @@ export class AvatarActionManager public getActionDefinition(id: string): ActionDefinition { - if (!id) return null; + if(!id) return null; - for (const action of this._actions.values()) + for(const action of this._actions.values()) { - if (!action || (action.id !== id)) continue; + if(!action || (action.id !== id)) continue; return action; } @@ -77,18 +77,18 @@ export class AvatarActionManager { const existing = this._actions.get(state); - if (!existing) return null; + if(!existing) return null; return existing; } public getDefaultAction(): ActionDefinition { - if (this._defaultAction) return this._defaultAction; + if(this._defaultAction) return this._defaultAction; - for (const action of this._actions.values()) + for(const action of this._actions.values()) { - if (!action || !action.isDefault) continue; + if(!action || !action.isDefault) continue; this._defaultAction = action; @@ -102,14 +102,14 @@ export class AvatarActionManager { let canvasOffsets: number[] = []; - for (const activeAction of k) + for(const activeAction of k) { - if (!activeAction) continue; + if(!activeAction) continue; const action = this._actions.get(activeAction.actionType); const offsets = action && action.getOffsets(_arg_2, _arg_3); - if (offsets) canvasOffsets = offsets; + if(offsets) canvasOffsets = offsets; } return canvasOffsets; @@ -117,19 +117,19 @@ export class AvatarActionManager public sortActions(actions: IActiveActionData[]): IActiveActionData[] { - if (!actions) return null; + if(!actions) return null; actions = this.filterActions(actions); const validatedActions: IActiveActionData[] = []; - for (const action of actions) + for(const action of actions) { - if (!action) continue; + if(!action) continue; const definition = this._actions.get(action.actionType); - if (!definition) continue; + if(!definition) continue; action.definition = definition; @@ -146,24 +146,24 @@ export class AvatarActionManager let preventions: string[] = []; const activeActions: IActiveActionData[] = []; - for (const action of actions) + for(const action of actions) { - if (!action) continue; + if(!action) continue; const localAction = this._actions.get(action.actionType); - if (localAction) preventions = preventions.concat(localAction.getPrevents(action.actionParameter)); + if(localAction) preventions = preventions.concat(localAction.getPrevents(action.actionParameter)); } - for (const action of actions) + for(const action of actions) { - if (!action) continue; + if(!action) continue; let actionType = action.actionType; - if (action.actionType === 'fx') actionType = (actionType + ('.' + action.actionParameter)); + if(action.actionType === 'fx') actionType = (actionType + ('.' + action.actionParameter)); - if (preventions.indexOf(actionType) >= 0) continue; + if(preventions.indexOf(actionType) >= 0) continue; activeActions.push(action); } @@ -173,14 +173,14 @@ export class AvatarActionManager private sortByPrecedence(actionOne: IActiveActionData, actionTwo: IActiveActionData): number { - if (!actionOne || !actionTwo) return 0; + if(!actionOne || !actionTwo) return 0; const precedenceOne = actionOne.definition.precedence; const precedenceTwo = actionTwo.definition.precedence; - if (precedenceOne < precedenceTwo) return 1; + if(precedenceOne < precedenceTwo) return 1; - if (precedenceOne > precedenceTwo) return -1; + if(precedenceOne > precedenceTwo) return -1; return 0; } diff --git a/src/nitro/avatar/alias/AssetAliasCollection.ts b/src/nitro/avatar/alias/AssetAliasCollection.ts index 467a434a..80e5c7ef 100644 --- a/src/nitro/avatar/alias/AssetAliasCollection.ts +++ b/src/nitro/avatar/alias/AssetAliasCollection.ts @@ -30,19 +30,19 @@ export class AssetAliasCollection public init(): void { - for (const collection of this._assets.collections.values()) + for(const collection of this._assets.collections.values()) { - if (!collection) continue; + if(!collection) continue; const aliases = collection.data && collection.data.aliases; - if (!aliases) continue; + if(!aliases) continue; - for (const name in aliases) + for(const name in aliases) { const alias = aliases[name]; - if (!alias) continue; + if(!alias) continue; this._aliases.set(name, new AssetAlias(name, alias)); } @@ -53,7 +53,7 @@ export class AssetAliasCollection { const alias = this._aliases.get(k); - if (alias) return true; + if(alias) return true; return false; } @@ -63,7 +63,7 @@ export class AssetAliasCollection let _local_2 = k; let _local_3 = 5; - while (this.hasAlias(_local_2) && (_local_3 >= 0)) + while(this.hasAlias(_local_2) && (_local_3 >= 0)) { const _local_4 = this._aliases.get(_local_2); @@ -76,13 +76,13 @@ export class AssetAliasCollection public getAsset(name: string): IGraphicAsset { - if (!this._assets) return null; + if(!this._assets) return null; name = this.getAssetName(name); const asset = this._assets.getAsset(name); - if (!asset) return null; + if(!asset) return null; return asset; } diff --git a/src/nitro/avatar/animation/AddDataContainer.ts b/src/nitro/avatar/animation/AddDataContainer.ts index 1c7ee335..b20d1f44 100644 --- a/src/nitro/avatar/animation/AddDataContainer.ts +++ b/src/nitro/avatar/animation/AddDataContainer.ts @@ -18,13 +18,13 @@ export class AddDataContainer const _local_2 = k.blend; - if (_local_2) + if(_local_2) { - if (_local_2.length > 0) + if(_local_2.length > 0) { this._blend = parseInt(_local_2); - if (this._blend > 1) this._blend = (this._blend / 100); + if(this._blend > 1) this._blend = (this._blend / 100); } } } diff --git a/src/nitro/avatar/animation/Animation.ts b/src/nitro/avatar/animation/Animation.ts index 1e2c6ca3..a99b758c 100644 --- a/src/nitro/avatar/animation/Animation.ts +++ b/src/nitro/avatar/animation/Animation.ts @@ -37,37 +37,37 @@ export class Animation implements IAnimation this._overrideFrames = null; this._resetOnToggle = (_arg_2.resetOnToggle || false); - if (_arg_2.sprites && _arg_2.sprites.length) + if(_arg_2.sprites && _arg_2.sprites.length) { this._spriteData = []; - for (const sprite of _arg_2.sprites) this._spriteData.push(new SpriteDataContainer(this, sprite)); + for(const sprite of _arg_2.sprites) this._spriteData.push(new SpriteDataContainer(this, sprite)); } - if (_arg_2.avatars && _arg_2.avatars.length) this._avatarData = new AvatarDataContainer(_arg_2.avatars[0]); + if(_arg_2.avatars && _arg_2.avatars.length) this._avatarData = new AvatarDataContainer(_arg_2.avatars[0]); - if (_arg_2.directions && _arg_2.directions.length) this._directionData = new DirectionDataContainer(_arg_2.directions[0]); + if(_arg_2.directions && _arg_2.directions.length) this._directionData = new DirectionDataContainer(_arg_2.directions[0]); - if (_arg_2.removes && _arg_2.removes.length) + if(_arg_2.removes && _arg_2.removes.length) { this._removeData = []; - for (const remove of _arg_2.removes) this._removeData.push(remove.id); + for(const remove of _arg_2.removes) this._removeData.push(remove.id); } - if (_arg_2.adds && _arg_2.adds.length) + if(_arg_2.adds && _arg_2.adds.length) { this._addData = []; - for (const add of _arg_2.adds) this._addData.push(new AddDataContainer(add)); + for(const add of _arg_2.adds) this._addData.push(new AddDataContainer(add)); } - if (_arg_2.overrides && _arg_2.overrides.length) + if(_arg_2.overrides && _arg_2.overrides.length) { this._overrideFrames = new Map(); this._overriddenActions = new Map(); - for (const override of _arg_2.overrides) + for(const override of _arg_2.overrides) { const name = override.name; const value = override.override; @@ -87,23 +87,23 @@ export class Animation implements IAnimation private parseFrames(frames: AvatarAnimationLayerData[][], _arg_2: IAssetAnimationFrame[], _arg_3: AvatarStructure): void { - if (!_arg_2 || !_arg_2.length) return; + if(!_arg_2 || !_arg_2.length) return; - for (const frame of _arg_2) + for(const frame of _arg_2) { let repeats = 1; - if (frame.repeats && (frame.repeats > 1)) repeats = frame.repeats; + if(frame.repeats && (frame.repeats > 1)) repeats = frame.repeats; let index = 0; - while (index < repeats) + while(index < repeats) { const layers: AvatarAnimationLayerData[] = []; - if (frame.bodyparts && frame.bodyparts.length) + if(frame.bodyparts && frame.bodyparts.length) { - for (const bodyPart of frame.bodyparts) + for(const bodyPart of frame.bodyparts) { const definition = _arg_3.getActionDefinition(bodyPart.action); const layer = new AvatarAnimationLayerData(bodyPart, AvatarAnimationLayerData.BODYPART, definition); @@ -112,9 +112,9 @@ export class Animation implements IAnimation } } - if (frame.fxs && frame.fxs.length) + if(frame.fxs && frame.fxs.length) { - for (const fx of frame.fxs) + for(const fx of frame.fxs) { const definition = _arg_3.getActionDefinition(fx.action); const layer = new AvatarAnimationLayerData(fx, AvatarAnimationLayerData.FX, definition); @@ -132,13 +132,13 @@ export class Animation implements IAnimation public frameCount(k: string = null): number { - if (!k) return this._frames.length; + if(!k) return this._frames.length; - if (this._overrideFrames) + if(this._overrideFrames) { const _local_2 = this._overrideFrames.get(k); - if (_local_2) return _local_2.length; + if(_local_2) return _local_2.length; } return 0; @@ -146,38 +146,38 @@ export class Animation implements IAnimation public hasOverriddenActions(): boolean { - if (!this._overriddenActions) return false; + if(!this._overriddenActions) return false; return (this._overriddenActions.size > 0); } public overriddenActionNames(): string[] { - if (!this._overriddenActions) return null; + if(!this._overriddenActions) return null; const keys: string[] = []; - for (const key of this._overriddenActions.keys()) keys.push(key); + for(const key of this._overriddenActions.keys()) keys.push(key); return keys; } public overridingAction(k: string): string { - if (!this._overriddenActions) return null; + if(!this._overriddenActions) return null; return this._overriddenActions.get(k); } private getFrame(frameCount: number, _arg_2: string = null): AvatarAnimationLayerData[] { - if (frameCount < 0) frameCount = 0; + if(frameCount < 0) frameCount = 0; let layers: AvatarAnimationLayerData[] = []; - if (!_arg_2) + if(!_arg_2) { - if (this._frames.length > 0) + if(this._frames.length > 0) { layers = this._frames[(frameCount % this._frames.length)]; } @@ -186,7 +186,7 @@ export class Animation implements IAnimation { const overrideLayers = this._overrideFrames.get(_arg_2); - if (overrideLayers && (overrideLayers.length > 0)) + if(overrideLayers && (overrideLayers.length > 0)) { layers = overrideLayers[(frameCount % overrideLayers.length)]; } @@ -199,20 +199,20 @@ export class Animation implements IAnimation { const _local_3: string[] = []; - for (const layer of this.getFrame(k, _arg_2)) + for(const layer of this.getFrame(k, _arg_2)) { - if (layer.type === AvatarAnimationLayerData.BODYPART) + if(layer.type === AvatarAnimationLayerData.BODYPART) { _local_3.push(layer.id); } - else if (layer.type === AvatarAnimationLayerData.FX) + else if(layer.type === AvatarAnimationLayerData.FX) { - if (this._addData && this._addData.length) + if(this._addData && this._addData.length) { - for (const _local_5 of this._addData) + for(const _local_5 of this._addData) { - if (_local_5.id === layer.id) _local_3.push(_local_5.align); + if(_local_5.id === layer.id) _local_3.push(_local_5.align); } } } @@ -223,17 +223,17 @@ export class Animation implements IAnimation public getLayerData(frameCount: number, spriteId: string, _arg_3: string = null): AvatarAnimationLayerData { - for (const layer of this.getFrame(frameCount, _arg_3)) + for(const layer of this.getFrame(frameCount, _arg_3)) { - if (layer.id === spriteId) return layer; + if(layer.id === spriteId) return layer; - if (layer.type === AvatarAnimationLayerData.FX) + if(layer.type === AvatarAnimationLayerData.FX) { - if (this._addData && this._addData.length) + if(this._addData && this._addData.length) { - for (const addData of this._addData) + for(const addData of this._addData) { - if (((addData.align === spriteId) && (addData.id === layer.id))) return layer; + if(((addData.align === spriteId) && (addData.id === layer.id))) return layer; } } } @@ -259,11 +259,11 @@ export class Animation implements IAnimation public getAddData(k: string): AddDataContainer { - if (this._addData) + if(this._addData) { - for (const _local_2 of this._addData) + for(const _local_2 of this._addData) { - if (_local_2.id === k) return _local_2; + if(_local_2.id === k) return _local_2; } } diff --git a/src/nitro/avatar/animation/AnimationManager.ts b/src/nitro/avatar/animation/AnimationManager.ts index 3f8b0e69..c612d8e2 100644 --- a/src/nitro/avatar/animation/AnimationManager.ts +++ b/src/nitro/avatar/animation/AnimationManager.ts @@ -29,7 +29,7 @@ export class AnimationManager implements IAnimationManager { const existing = this._animations.get(animation); - if (!existing) return null; + if(!existing) return null; return existing; } @@ -38,7 +38,7 @@ export class AnimationManager implements IAnimationManager { const existing = this.getAnimation(animation); - if (!existing) return null; + if(!existing) return null; return existing.getLayerData(frameCount, spriteId); } diff --git a/src/nitro/avatar/animation/AvatarAnimationLayerData.ts b/src/nitro/avatar/animation/AvatarAnimationLayerData.ts index 4ee3929d..02d2d728 100644 --- a/src/nitro/avatar/animation/AvatarAnimationLayerData.ts +++ b/src/nitro/avatar/animation/AvatarAnimationLayerData.ts @@ -32,13 +32,13 @@ export class AvatarAnimationLayerData implements IAnimationLayerData this._base = (k.base || ''); this._items = new Map(); - if (k.items) for (const _local_4 of k.items) this._items.set(_local_4.id, _local_4.base); + if(k.items) for(const _local_4 of k.items) this._items.set(_local_4.id, _local_4.base); let _local_5 = ''; - if (this._base !== '') _local_5 = this.baseAsInt().toString(); + if(this._base !== '') _local_5 = this.baseAsInt().toString(); - if (_arg_3) + if(_arg_3) { this._action = new ActiveActionData(_arg_3.state, this.base); this._action.definition = _arg_3; @@ -55,7 +55,7 @@ export class AvatarAnimationLayerData implements IAnimationLayerData let k = 0; let index = 0; - while (index < this._base.length) + while(index < this._base.length) { k = (k + this._base.charCodeAt(index)); diff --git a/src/nitro/avatar/animation/AvatarDataContainer.ts b/src/nitro/avatar/animation/AvatarDataContainer.ts index 999e2e3c..814c0d85 100644 --- a/src/nitro/avatar/animation/AvatarDataContainer.ts +++ b/src/nitro/avatar/animation/AvatarDataContainer.ts @@ -42,7 +42,7 @@ export class AvatarDataContainer implements IAvatarDataContainer this._alphaMultiplier = 1; this._paletteIsGrayscale = true; - if (this._ink === 37) + if(this._ink === 37) { this._alphaMultiplier = 0.5; this._paletteIsGrayscale = false; @@ -111,9 +111,9 @@ export class AvatarDataContainer implements IAvatarDataContainer let _local_22 = greenBackground; let _local_23 = blueBackground; - for (let i = 0; i < 256; i++) + for(let i = 0; i < 256; i++) { - if ((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground))) + if((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground))) { _local_20 = 0; } diff --git a/src/nitro/avatar/animation/SpriteDataContainer.ts b/src/nitro/avatar/animation/SpriteDataContainer.ts index 06744065..94461d06 100644 --- a/src/nitro/avatar/animation/SpriteDataContainer.ts +++ b/src/nitro/avatar/animation/SpriteDataContainer.ts @@ -28,13 +28,13 @@ export class SpriteDataContainer implements ISpriteDataContainer const directions = _arg_2.directionList; - if (directions && directions.length) + if(directions && directions.length) { - for (const direction of directions) + for(const direction of directions) { const id = direction.id; - if (id === undefined) continue; + if(id === undefined) continue; this._dx[id] = (direction.dx || 0); this._dy[id] = (direction.dy || 0); @@ -45,21 +45,21 @@ export class SpriteDataContainer implements ISpriteDataContainer public getDirectionOffsetX(k: number): number { - if (k < this._dx.length) return this._dx[k]; + if(k < this._dx.length) return this._dx[k]; return 0; } public getDirectionOffsetY(k: number): number { - if (k < this._dy.length) return this._dy[k]; + if(k < this._dy.length) return this._dy[k]; return 0; } public getDirectionOffsetZ(k: number): number { - if (k < this._dz.length) return this._dz[k]; + if(k < this._dz.length) return this._dz[k]; return 0; } diff --git a/src/nitro/avatar/cache/AvatarImageCache.ts b/src/nitro/avatar/cache/AvatarImageCache.ts index 8834e1e5..7b64a84e 100644 --- a/src/nitro/avatar/cache/AvatarImageCache.ts +++ b/src/nitro/avatar/cache/AvatarImageCache.ts @@ -51,7 +51,7 @@ export class AvatarImageCache public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; this._structure = null; this._avatar = null; @@ -59,11 +59,11 @@ export class AvatarImageCache this._canvas = null; this._disposed = true; - if (this._cache) + if(this._cache) { - for (const cache of this._cache.values()) + for(const cache of this._cache.values()) { - if (!cache) continue; + if(!cache) continue; cache.dispose(); } @@ -71,11 +71,11 @@ export class AvatarImageCache this._cache = null; } - if (this._unionImages) + if(this._unionImages) { - for (const image of this._unionImages) + for(const image of this._unionImages) { - if (!image) continue; + if(!image) continue; image.dispose(); } @@ -88,11 +88,11 @@ export class AvatarImageCache { const time = PixiApplicationProxy.instance.ticker.lastTime; - if (this._cache) + if(this._cache) { - for (const cache of this._cache.values()) + for(const cache of this._cache.values()) { - if (!cache) continue; + if(!cache) continue; cache.disposeActions(k, time); } @@ -101,11 +101,11 @@ export class AvatarImageCache public resetBodyPartCache(k: IActiveActionData): void { - if (this._cache) + if(this._cache) { - for (const cache of this._cache.values()) + for(const cache of this._cache.values()) { - if (!cache) continue; + if(!cache) continue; cache.setAction(k, 0); } @@ -116,13 +116,13 @@ export class AvatarImageCache { const parts = this._structure.getBodyPartsUnordered(k); - if (parts) + if(parts) { - for (const part of parts) + for(const part of parts) { const actionCache = this.getBodyPartCache(part); - if (!actionCache) continue; + if(!actionCache) continue; actionCache.setDirection(_arg_2); } @@ -133,19 +133,19 @@ export class AvatarImageCache { const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar); - for (const _local_4 of _local_3) + for(const _local_4 of _local_3) { const _local_5 = this.getBodyPartCache(_local_4); - if (_local_5) _local_5.setAction(k, _arg_2); + if(_local_5) _local_5.setAction(k, _arg_2); } } public setGeometryType(k: string): void { - if (this._geometryType === k) return; + if(this._geometryType === k) return; - if ((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL)))) + if((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL)))) { this._geometryType = k; this._canvas = null; @@ -163,7 +163,7 @@ export class AvatarImageCache { let _local_4 = this.getBodyPartCache(k); - if (!_local_4) + if(!_local_4) { _local_4 = new AvatarImageBodyPartCache(); @@ -174,48 +174,48 @@ export class AvatarImageCache let _local_7 = _local_4.getAction(); let frameCount = frameNumber; - if (_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame; + if(_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame; let _local_8 = _local_7; let _local_9: string[] = []; let _local_10: Map = new Map(); const _local_11 = new Point(); - if (!((!(_local_7)) || (!(_local_7.definition)))) + if(!((!(_local_7)) || (!(_local_7.definition)))) { - if (_local_7.definition.isAnimation) + if(_local_7.definition.isAnimation) { let _local_15 = _local_5; const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter)); const _local_17 = (frameNumber - _local_7.startFrame); - if (_local_16) + if(_local_16) { const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction); - if (_local_18) + if(_local_18) { _local_15 = (_local_5 + _local_18.dd); - if (_local_18.dd < 0) + if(_local_18.dd < 0) { - if (_local_15 < 0) + if(_local_15 < 0) { _local_15 = (8 + _local_15); } - else if (_local_15 > 7) _local_15 = (8 - _local_15); + else if(_local_15 > 7) _local_15 = (8 - _local_15); } else { - if (_local_15 < 0) + if(_local_15 < 0) { _local_15 = (_local_15 + 8); } - else if (_local_15 > 7) _local_15 = (_local_15 - 8); + else if(_local_15 > 7) _local_15 = (_local_15 - 8); } - if (this._scale === AvatarScaleType.LARGE) + if(this._scale === AvatarScaleType.LARGE) { _local_11.x = _local_18.dx; _local_11.y = _local_18.dy; @@ -228,21 +228,21 @@ export class AvatarImageCache frameCount = _local_18.animationFrame; - if (_local_18.action) + if(_local_18.action) { _local_7 = _local_18.action; } - if (_local_18.type === AvatarAnimationLayerData.BODYPART) + if(_local_18.type === AvatarAnimationLayerData.BODYPART) { - if (_local_18.action != null) + if(_local_18.action != null) { _local_8 = _local_18.action; } _local_5 = _local_15; } - else if (_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15; + else if(_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15; _local_10 = _local_18.items; } @@ -254,7 +254,7 @@ export class AvatarImageCache let _local_12 = _local_4.getActionCache(_local_8); - if (!_local_12 || _arg_3) + if(!_local_12 || _arg_3) { _local_12 = new AvatarImageActionCache(); _local_4.updateActionCache(_local_8, _local_12); @@ -262,7 +262,7 @@ export class AvatarImageCache let _local_13 = _local_12.getDirectionCache(_local_5); - if (!_local_13 || _arg_3) + if(!_local_13 || _arg_3) { const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10); @@ -273,15 +273,15 @@ export class AvatarImageCache let _local_14 = _local_13.getImageContainer(frameCount); - if (!_local_14 || _arg_3) + if(!_local_14 || _arg_3) { const _local_20 = _local_13.getPartList(); _local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3); - if (_local_14 && !_arg_3) + if(_local_14 && !_arg_3) { - if (_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount); + if(_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount); } else { @@ -310,7 +310,7 @@ export class AvatarImageCache { let existing = this._cache.get(k); - if (!existing) + if(!existing) { existing = new AvatarImageBodyPartCache(); @@ -322,13 +322,13 @@ export class AvatarImageCache private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer { - if (!containers || !containers.length) return null; + if(!containers || !containers.length) return null; - if (!this._canvas) + if(!this._canvas) { this._canvas = this._structure.getCanvas(this._scale, this._geometryType); - if (!this._canvas) return null; + if(!this._canvas) return null; } const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false; @@ -336,15 +336,15 @@ export class AvatarImageCache let isCacheable = true; let containerIndex = (containers.length - 1); - while (containerIndex >= 0) + while(containerIndex >= 0) { const container = containers[containerIndex]; let color = 16777215; - if (!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey')))) + if(!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey')))) { - if (!((container.partType === 'ri') && !container.partId)) + if(!((container.partType === 'ri') && !container.partId)) { const partId = container.partId; const animationFrame = container.getFrameDefinition(frameCount); @@ -352,59 +352,59 @@ export class AvatarImageCache let partType = container.partType; let frameNumber = 0; - if (animationFrame) + if(animationFrame) { frameNumber = animationFrame.number; - if ((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition; + if((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition; } else frameNumber = container.getFrameIndex(frameCount); let assetDirection = direction; let flipH = false; - if (isFlipped) + if(isFlipped) { - if (((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT)) + if(((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT)) { flipH = true; } else { - if (direction === 4) assetDirection = 2; - else if (direction === 5) assetDirection = 1; - else if (direction === 6) assetDirection = 0; + if(direction === 4) assetDirection = 2; + else if(direction === 5) assetDirection = 1; + else if(direction === 6) assetDirection = 0; - if (container.flippedPartType !== partType) partType = container.flippedPartType; + if(container.flippedPartType !== partType) partType = container.flippedPartType; } } let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber); let asset = this._assets.getAsset(assetName); - if (!asset) + if(!asset) { assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0'); asset = this._assets.getAsset(assetName); } - if (asset) + if(asset) { const texture = asset.texture; - if (!texture || !texture.valid || !texture.baseTexture) + if(!texture || !texture.valid || !texture.baseTexture) { isCacheable = false; } else { - if (container.isColorable && container.color) color = container.color.rgb; + if(container.isColorable && container.color) color = container.color.rgb; const offset = new Point(-(asset.x), -(asset.y)); - if (flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31)); + if(flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31)); - if (renderServerData) + if(renderServerData) { const spriteData = new RoomObjectSpriteData(); @@ -416,17 +416,17 @@ export class AvatarImageCache spriteData.height = asset.rectangle.height; spriteData.flipH = flipH; - if (assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53); + if(assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53); - if (isFlipped) + if(isFlipped) { spriteData.flipH = (!(spriteData.flipH)); - if (spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width); + if(spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width); else spriteData.x = (spriteData.x + 65); } - if (container.isColorable) spriteData.color = `${color}`; + if(container.isColorable) spriteData.color = `${color}`; this._serverRenderData.push(spriteData); } @@ -440,21 +440,21 @@ export class AvatarImageCache containerIndex--; } - if (!this._unionImages.length) return null; + if(!this._unionImages.length) return null; const imageData = this.createUnionImage(this._unionImages, isFlipped); const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8)); const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y)); - if (isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31)); + if(isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31)); let imageIndex = (this._unionImages.length - 1); - while (imageIndex >= 0) + while(imageIndex >= 0) { const _local_17 = this._unionImages.pop(); - if (_local_17) _local_17.dispose(); + if(_local_17) _local_17.dispose(); imageIndex--; } @@ -465,7 +465,7 @@ export class AvatarImageCache private convertColorToHex(k: number): string { let _local_2: string = (k * 0xFF).toString(16); - if (_local_2.length < 2) + if(_local_2.length < 2) { _local_2 = ('0' + _local_2); } @@ -476,7 +476,7 @@ export class AvatarImageCache { const bounds = new Rectangle(); - for (const data of k) data && bounds.enlarge(data.offsetRect); + for(const data of k) data && bounds.enlarge(data.offsetRect); const point = new Point(-(bounds.x), -(bounds.y)); const container = new NitroContainer(); @@ -488,9 +488,9 @@ export class AvatarImageCache container.addChild(sprite); - for (const data of k) + for(const data of k) { - if (!data) continue; + if(!data) continue; const texture = data.texture; const color = data.colorTransform; @@ -500,9 +500,9 @@ export class AvatarImageCache regPoint.x -= data.regPoint.x; regPoint.y -= data.regPoint.y; - if (isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width)); + if(isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width)); - if (flipH) + if(flipH) { this._matrix.a = -1; this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x); diff --git a/src/nitro/avatar/pets/PetFigureData.ts b/src/nitro/avatar/pets/PetFigureData.ts index 39763b01..fe59699b 100644 --- a/src/nitro/avatar/pets/PetFigureData.ts +++ b/src/nitro/avatar/pets/PetFigureData.ts @@ -29,7 +29,7 @@ export class PetFigureData let i = 0; - while (i < this._customLayerIds.length) + while(i < this._customLayerIds.length) { this._customParts.push(new PetCustomPart(this._customLayerIds[i], this._customPartIds[i], this._customPaletteIds[i])); @@ -74,11 +74,11 @@ export class PetFigureData public getCustomPart(k: number): IPetCustomPart { - if (this._customParts) + if(this._customParts) { - for (const _local_2 of this._customParts) + for(const _local_2 of this._customParts) { - if (_local_2.layerId === k) return _local_2; + if(_local_2.layerId === k) return _local_2; } } @@ -101,7 +101,7 @@ export class PetFigureData figure = (figure + (' ' + this.customParts.length)); - for (const _local_2 of this.customParts) + for(const _local_2 of this.customParts) { figure = (figure + (((((' ' + _local_2.layerId) + ' ') + _local_2.partId) + ' ') + _local_2.paletteId)); } @@ -113,13 +113,13 @@ export class PetFigureData { let _local_2: string[] = []; - if (k) + if(k) { const _local_3 = k.split(' '); const _local_4 = ((this._headOnly) ? 1 : 0); const _local_5 = (4 + _local_4); - if (_local_3.length > _local_5) + if(_local_3.length > _local_5) { const _local_6 = (3 + _local_4); const _local_7 = parseInt(_local_3[_local_6]); @@ -137,7 +137,7 @@ export class PetFigureData let i = 0; - while (i < data.length) + while(i < data.length) { layerIds.push(parseInt(data[(i + 0)])); @@ -153,7 +153,7 @@ export class PetFigureData let i = 0; - while (i < data.length) + while(i < data.length) { partIds.push(parseInt(data[(i + 1)])); @@ -169,7 +169,7 @@ export class PetFigureData let i = 0; - while (i < data.length) + while(i < data.length) { paletteIds.push(parseInt(data[(i + 2)])); @@ -181,11 +181,11 @@ export class PetFigureData private getTypeId(data: string): number { - if (data) + if(data) { const parts = data.split(' '); - if (parts.length >= 1) return parseInt(parts[0]); + if(parts.length >= 1) return parseInt(parts[0]); } return 0; @@ -193,11 +193,11 @@ export class PetFigureData private getPaletteId(data: string): number { - if (data) + if(data) { const parts = data.split(' '); - if (parts.length >= 2) return parseInt(parts[1]); + if(parts.length >= 2) return parseInt(parts[1]); } return 0; @@ -205,11 +205,11 @@ export class PetFigureData private getColor(data: string): number { - if (data) + if(data) { const parts = data.split(' '); - if (parts.length >= 3) return parseInt(parts[2], 16); + if(parts.length >= 3) return parseInt(parts[2], 16); } return 0xFFFFFF; @@ -217,11 +217,11 @@ export class PetFigureData private getHeadOnly(data: string): boolean { - if (data) + if(data) { const parts = data.split(' '); - if (parts.length >= 4) return parts[3] === 'head'; + if(parts.length >= 4) return parts[3] === 'head'; } return false; diff --git a/src/nitro/avatar/structure/AvatarStructureDownload.ts b/src/nitro/avatar/structure/AvatarStructureDownload.ts index 9738bb72..322e634a 100644 --- a/src/nitro/avatar/structure/AvatarStructureDownload.ts +++ b/src/nitro/avatar/structure/AvatarStructureDownload.ts @@ -30,9 +30,9 @@ export class AvatarStructureDownload extends EventDispatcher { const response = request.responseText; - if (!response || !response.length) throw new Error('invalid_figure_data'); + if(!response || !response.length) throw new Error('invalid_figure_data'); - if (this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response)); + if(this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response)); this.dispatchEvent(new NitroEvent(AvatarStructureDownload.AVATAR_STRUCTURE_DONE)); }; diff --git a/src/nitro/avatar/structure/figure/SetType.ts b/src/nitro/avatar/structure/figure/SetType.ts index b665ad8a..471dc66b 100644 --- a/src/nitro/avatar/structure/figure/SetType.ts +++ b/src/nitro/avatar/structure/figure/SetType.ts @@ -13,7 +13,7 @@ export class SetType implements ISetType constructor(data: IFigureDataSetType) { - if (!data) throw new Error('invalid_data'); + if(!data) throw new Error('invalid_data'); this._type = data.type; this._paletteId = data.paletteId; @@ -27,7 +27,7 @@ export class SetType implements ISetType public dispose(): void { - for (const set of this._partSets.getValues()) + for(const set of this._partSets.getValues()) { const partSet = set as FigurePartSet; @@ -39,12 +39,12 @@ export class SetType implements ISetType public cleanUp(data: IFigureDataSetType): void { - for (const set of data.sets) + for(const set of data.sets) { const setId = set.id.toString(); const partSet = (this._partSets.getValue(setId) as FigurePartSet); - if (partSet) + if(partSet) { partSet.dispose(); @@ -55,18 +55,18 @@ export class SetType implements ISetType public append(setType: IFigureDataSetType): void { - if (!setType || !setType.sets) return; + if(!setType || !setType.sets) return; - for (const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set)); + for(const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set)); } public getDefaultPartSet(gender: string): IFigurePartSet { - for (const set of this._partSets.getValues()) + for(const set of this._partSets.getValues()) { - if (!set) continue; + if(!set) continue; - if ((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set; + if((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set; } return null; diff --git a/src/nitro/camera/RoomCameraWidgetManager.ts b/src/nitro/camera/RoomCameraWidgetManager.ts index e6731736..dfb5bee7 100644 --- a/src/nitro/camera/RoomCameraWidgetManager.ts +++ b/src/nitro/camera/RoomCameraWidgetManager.ts @@ -22,20 +22,20 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager public init(): void { - if (this._isLoaded) return; + if(this._isLoaded) return; this._isLoaded = true; const imagesUrl = Nitro.instance.getConfiguration('image.library.url') + 'Habbo-Stories/'; const effects = Nitro.instance.getConfiguration<{ name: string, colorMatrix?: ColorMatrix, minLevel: number, blendMode?: number, enabled: boolean }[]>('camera.available.effects'); - for (const effect of effects) + for(const effect of effects) { - if (!effect.enabled) continue; + if(!effect.enabled) continue; const cameraEffect = new RoomCameraWidgetEffect(effect.name, effect.minLevel); - if (effect.colorMatrix.length) + if(effect.colorMatrix.length) { cameraEffect.colorMatrix = effect.colorMatrix; } @@ -58,22 +58,22 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager container.addChild(sprite); - if (isZoomed) sprite.scale.set(2); + if(isZoomed) sprite.scale.set(2); - for (const selectedEffect of selectedEffects) + for(const selectedEffect of selectedEffects) { const effect = selectedEffect.effect; - if (!effect) continue; + if(!effect) continue; - if (effect.colorMatrix) + if(effect.colorMatrix) { const filter = new ColorMatrixFilter(); filter.matrix = effect.colorMatrix; filter.alpha = selectedEffect.alpha; - if (!sprite.filters) sprite.filters = []; + if(!sprite.filters) sprite.filters = []; sprite.filters.push(filter); } diff --git a/src/nitro/communication/NitroCommunicationManager.ts b/src/nitro/communication/NitroCommunicationManager.ts index 1a01671e..6b1cff98 100644 --- a/src/nitro/communication/NitroCommunicationManager.ts +++ b/src/nitro/communication/NitroCommunicationManager.ts @@ -30,7 +30,7 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom protected onInit(): void { - if (this._connection) return; + if(this._connection) return; Nitro.instance.events.addEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); @@ -42,16 +42,16 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom this._connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); this._connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); - if (this._demo) this._demo.init(); + if(this._demo) this._demo.init(); this._connection.init(Nitro.instance.getConfiguration('socket.url')); } protected onDispose(): void { - if (this._demo) this._demo.dispose(); + if(this._demo) this._demo.dispose(); - if (this._connection) + if(this._connection) { this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); @@ -82,7 +82,7 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom { this.logger.log('Connection Authenticated'); - if (this._connection) this._connection.authenticated(); + if(this._connection) this._connection.authenticated(); } public connectionInit(socketUrl: string): void @@ -92,14 +92,14 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom public registerMessageEvent(event: IMessageEvent): IMessageEvent { - if (this._connection) this._connection.addMessageEvent(event); + if(this._connection) this._connection.addMessageEvent(event); return event; } public removeMessageEvent(event: IMessageEvent): void { - if (!this._connection) return; + if(!this._connection) return; this._connection.removeMessageEvent(event); } diff --git a/src/nitro/communication/demo/NitroCommunicationDemo.ts b/src/nitro/communication/demo/NitroCommunicationDemo.ts index 686ca176..b4fb66b2 100644 --- a/src/nitro/communication/demo/NitroCommunicationDemo.ts +++ b/src/nitro/communication/demo/NitroCommunicationDemo.ts @@ -34,7 +34,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun { const connection = this._communication.connection; - if (connection) + if(connection) { connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); @@ -49,7 +49,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun { const connection = this._communication.connection; - if (connection) + if(connection) { connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); @@ -67,13 +67,13 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun { const connection = this._communication.connection; - if (!connection) return; + if(!connection) return; this._didConnect = true; this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection); - if (Nitro.instance.getConfiguration('system.pong.manually', false)) this.startPonging(); + if(Nitro.instance.getConfiguration('system.pong.manually', false)) this.startPonging(); this.startHandshake(connection); @@ -86,18 +86,18 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun { const connection = this._communication.connection; - if (!connection) return; + if(!connection) return; this.stopPonging(); - if (this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); + if(this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); } private onConnectionErrorEvent(event: CloseEvent): void { const connection = this._communication.connection; - if (!connection) return; + if(!connection) return; this.stopPonging(); @@ -106,9 +106,9 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun private tryAuthentication(connection: IConnection): void { - if (!connection || !this.getSSO()) + if(!connection || !this.getSSO()) { - if (!this.getSSO()) + if(!this.getSSO()) { this.logger.error('Login without an SSO ticket is not supported'); } @@ -123,14 +123,14 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun private onClientPingEvent(event: ClientPingEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; this.sendPong(event.connection); } private onAuthenticatedEvent(event: AuthenticatedEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; this.completeHandshake(event.connection); @@ -162,7 +162,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun private stopPonging(): void { - if (!this._pongInterval) return; + if(!this._pongInterval) return; clearInterval(this._pongInterval); @@ -173,7 +173,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun { connection = ((connection || this._communication.connection) || null); - if (!connection) return; + if(!connection) return; connection.send(new PongMessageComposer()); } diff --git a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts index 2d11748d..940b731b 100644 --- a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts @@ -25,7 +25,7 @@ export class RenderRoomMessageComposer implements IMessageComposer c.charCodeAt(0)); diff --git a/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts b/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts index 45402d7a..d5402be3 100644 --- a/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts @@ -9,11 +9,11 @@ export class AuthenticationMessageComposer implements IMessageComposer { this._type = type; - if (keys.length !== values.length) return; + if(keys.length !== values.length) return; this._data = []; - for (let i = 0; i < keys.length; i++) + for(let i = 0; i < keys.length; i++) { this._data.push(keys[i]); this._data.push(values[i]); diff --git a/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts b/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts index a8a459fc..787f5311 100644 --- a/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts +++ b/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts @@ -8,9 +8,9 @@ export class SetActivatedBadgesComposer implements IMessageComposer { const data = []; - for (let i = 0; i < this._badges.length; i++) + for(let i = 0; i < this._badges.length; i++) { - if (i <= this._badges.length) + if(i <= this._badges.length) { data.push(i + 1); data.push(this._badges[i]); diff --git a/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts b/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts index 9a811b67..207b0814 100644 --- a/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts @@ -8,7 +8,7 @@ export class DefaultSanctionMessageComposer implements IMessageComposer this._data.push(''); this._data.push(''); this._data.push(arg3); - if (arg4 != ModBanMessageComposer.NO_ISSUE_ID) + if(arg4 != ModBanMessageComposer.NO_ISSUE_ID) { this._data.push(arg4); } diff --git a/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts b/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts index 603c4609..4ccdf7f6 100644 --- a/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts @@ -8,7 +8,7 @@ export class ModMuteMessageComposer implements IMessageComposer > diff --git a/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts b/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts index 51a33791..9ffb7b06 100644 --- a/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts @@ -8,7 +8,7 @@ export class SetObjectDataMessageComposer implements IMessageComposer { this._data = [objectId, (data.size * 2)]; - for (const [key, value] of data.entries()) this._data.push(key, value); + for(const [key, value] of data.entries()) this._data.push(key, value); } public getMessageArray() diff --git a/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts b/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts index 7e6328f5..66d9d0bb 100644 --- a/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts +++ b/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts @@ -21,7 +21,7 @@ export class FurniturePlaceComposer implements IMessageComposer public getMessageArray() { - switch (this._category) + switch(this._category) { case RoomObjectCategory.FLOOR: return [`${this._itemId} ${this._x} ${this._y} ${this._direction}`]; diff --git a/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts b/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts index 96340814..bccb04d7 100644 --- a/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts +++ b/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts @@ -13,7 +13,7 @@ export class InterstitialMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._canShowInterstitial = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts b/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts index f28a0982..8b248bbc 100644 --- a/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts +++ b/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts @@ -15,7 +15,7 @@ export class RoomAdErrorMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); this._filteredText = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts b/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts index 97c42e0e..0c6593f6 100644 --- a/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts @@ -17,12 +17,12 @@ export class AvailabilityStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isOpen = wrapper.readBoolean(); this._onShutdown = wrapper.readBoolean(); - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { this._isAuthenticUser = wrapper.readBoolean(); } diff --git a/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts b/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts index 249c0cf2..6744f7d2 100644 --- a/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts @@ -15,7 +15,7 @@ export class AvailabilityTimeMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isOpen = (wrapper.readInt() > 0); this._minutesUntilChange = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts b/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts index d761d239..8f1b67a9 100644 --- a/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts @@ -15,7 +15,7 @@ export class HotelClosedAndOpensMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._openHour = wrapper.readInt(); this._openMinute = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts b/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts index 3c47665d..53f1334c 100644 --- a/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts @@ -17,7 +17,7 @@ export class HotelClosesAndWillOpenAtMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._openHour = wrapper.readInt(); this._openMinute = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts b/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts index 623414cc..af5cba36 100644 --- a/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts @@ -13,7 +13,7 @@ export class HotelWillCloseInMinutesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._minutes = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts b/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts index 98784368..8e3c2bd9 100644 --- a/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts @@ -17,12 +17,12 @@ export class MaintenanceStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isInMaintenance = wrapper.readBoolean(); this._minutesUntilMaintenance = wrapper.readInt(); - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { this._duration = wrapper.readInt(); } diff --git a/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts b/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts index e84334b4..1eb94eef 100644 --- a/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts @@ -17,14 +17,14 @@ export class ChangeUserNameResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._resultCode = wrapper.readInt(); this._name = wrapper.readString(); let totalSuggestions = wrapper.readInt(); - while (totalSuggestions > 0) + while(totalSuggestions > 0) { this._nameSuggestions.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts b/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts index fa200b0b..0296bf2e 100644 --- a/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts @@ -17,14 +17,14 @@ export class CheckUserNameResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._resultCode = wrapper.readInt(); this._name = wrapper.readString(); let totalSuggestions = wrapper.readInt(); - while (totalSuggestions > 0) + while(totalSuggestions > 0) { this._nameSuggestions.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts b/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts index ae01d152..f60ea356 100644 --- a/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts +++ b/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts @@ -15,12 +15,12 @@ export class FigureUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._figure = wrapper.readString(); this._gender = wrapper.readString(); - if (this._gender) this._gender = this._gender.toUpperCase(); + if(this._gender) this._gender = this._gender.toUpperCase(); return true; } diff --git a/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts b/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts index 8b59378a..4a0103f2 100644 --- a/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts +++ b/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts @@ -16,13 +16,13 @@ export class WardrobeMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._state = wrapper.readInt(); let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._outfits.push(new OutfitData(wrapper)); diff --git a/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts b/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts index 02f7db95..312b6f35 100644 --- a/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts +++ b/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts @@ -16,7 +16,7 @@ export class BotAddedToInventoryParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._item = new BotData(wrapper); this._openInventory = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/bots/BotData.ts b/src/nitro/communication/messages/parser/bots/BotData.ts index 5e519551..b6ef3d0b 100644 --- a/src/nitro/communication/messages/parser/bots/BotData.ts +++ b/src/nitro/communication/messages/parser/bots/BotData.ts @@ -10,7 +10,7 @@ export class BotData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_parser'); + if(!wrapper) throw new Error('invalid_parser'); this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts b/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts index 4f9c9e18..243c6b79 100644 --- a/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts +++ b/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts @@ -18,7 +18,7 @@ export class BotInventoryMessageParser implements IMessageParser let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { const data = new BotData(wrapper); diff --git a/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts b/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts index 55b1997f..336d076d 100644 --- a/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts +++ b/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts @@ -16,7 +16,7 @@ export class BotReceivedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._boughtAsGift = wrapper.readBoolean(); this._item = new BotData(wrapper); diff --git a/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts b/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts index fcb10797..31249568 100644 --- a/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts +++ b/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts @@ -13,7 +13,7 @@ export class BotRemovedFromInventoryParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts b/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts index 74c7bc11..c6f3d4ae 100644 --- a/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts +++ b/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts @@ -15,7 +15,7 @@ export class CallForHelpCategoryData implements INamed, IDisposable let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._topics.push(new CallForHelpTopicData(wrapper)); @@ -25,7 +25,7 @@ export class CallForHelpCategoryData implements INamed, IDisposable public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; this._disposed = true; this._topics = null; diff --git a/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts b/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts index 40cccad6..489db85f 100644 --- a/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts +++ b/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts @@ -18,7 +18,7 @@ export class CfhSanctionMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._issueId = wrapper.readInt(); this._accountId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts b/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts index 9290b4d1..c77e4e46 100644 --- a/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts +++ b/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts @@ -17,9 +17,9 @@ export class CfhSanctionTypeData implements INamed this._probationDays = wrapper.readInt(); this._avatarOnly = wrapper.readBoolean(); - if (wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString(); + if(wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString(); - if (wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString(); + if(wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString(); } public get name(): string diff --git a/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts b/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts index e1179a36..8d4bfb0b 100644 --- a/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts +++ b/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts @@ -14,13 +14,13 @@ export class CfhTopicsInitMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._callForHelpCategories = []; let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._callForHelpCategories.push(new CallForHelpCategoryData(wrapper)); diff --git a/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts b/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts index 17c0ba41..c280eb54 100644 --- a/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts @@ -33,7 +33,7 @@ export class SanctionStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isSanctionNew = wrapper.readBoolean(); this._isSanctionActive = wrapper.readBoolean(); @@ -52,7 +52,7 @@ export class SanctionStatusMessageParser implements IMessageParser this._hasCustomMute = wrapper.readBoolean(); - if (wrapper.bytesAvailable) this._tradeLockExpiryTime = wrapper.readString(); + if(wrapper.bytesAvailable) this._tradeLockExpiryTime = wrapper.readString(); return true; } diff --git a/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts b/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts index e8e6be8e..a1fbcbc1 100644 --- a/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts @@ -17,12 +17,12 @@ export class CameraPublishStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._ok = wrapper.readBoolean(); this._secondsToWait = wrapper.readInt(); - if (this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString(); + if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString(); return true; } diff --git a/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts b/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts index bab980e4..036e334f 100644 --- a/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts @@ -9,7 +9,7 @@ export class CameraPurchaseOKMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts b/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts index c4101814..973eb2b7 100644 --- a/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts @@ -13,7 +13,7 @@ export class CameraStorageUrlMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._url = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts b/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts index 104e3efb..594ea8be 100644 --- a/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts @@ -15,7 +15,7 @@ export class CompetitionStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._ok = wrapper.readBoolean(); this._errorReason = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts b/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts index 9fe81f31..eb195c1a 100644 --- a/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts @@ -17,12 +17,12 @@ export class InitCameraMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._creditPrice = wrapper.readInt(); this._ducketPrice = wrapper.readInt(); - if (wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt(); + if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt(); return true; } diff --git a/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts b/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts index 021bb6eb..837dd125 100644 --- a/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts @@ -14,9 +14,9 @@ export class ThumbnailStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { this._ok = wrapper.readBoolean(); this._renderLimitHit = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts index cc93af23..f27dad1e 100644 --- a/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts @@ -11,7 +11,7 @@ export class CampaignCalendarData public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._campaignName = wrapper.readString(); this._campaignImage = wrapper.readString(); @@ -21,7 +21,7 @@ export class CampaignCalendarData let count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._openedDays.push(wrapper.readInt()); } @@ -30,7 +30,7 @@ export class CampaignCalendarData count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._missedDays.push(wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts index 920deff0..4c65292f 100644 --- a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts @@ -14,7 +14,7 @@ export class CampaignCalendarDataMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._calendarData = new CampaignCalendarData(); this._calendarData.parse(wrapper); diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts index c297bd5c..4c06ffc5 100644 --- a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts @@ -19,7 +19,7 @@ export class CampaignCalendarDoorOpenedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._doorOpened = wrapper.readBoolean(); this._productName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts b/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts index b24250ef..5feca2e2 100644 --- a/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts @@ -18,7 +18,7 @@ export class BonusRareInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._productType = wrapper.readString(); this._productClassId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts b/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts index a37a6c45..7b899828 100644 --- a/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts @@ -13,7 +13,7 @@ export class BuildersClubFurniCountMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._furniCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts b/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts index b32d6c3e..c8283f19 100644 --- a/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts @@ -19,13 +19,13 @@ export class BuildersClubSubscriptionStatusMessageParser implements IMessagePars public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._Str_16456 = wrapper.readInt(); this._Str_12494 = wrapper.readInt(); this._Str_19123 = wrapper.readInt(); - if (wrapper.bytesAvailable) this._Str_17298 = wrapper.readInt(); + if(wrapper.bytesAvailable) this._Str_17298 = wrapper.readInt(); else this._Str_17298 = this._Str_16456; return true; diff --git a/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts b/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts index 9ec7b9c7..0eaeaaab 100644 --- a/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts +++ b/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts @@ -18,7 +18,7 @@ export class BundleDiscountRuleset let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._Str_16144.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts b/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts index 408e4ce7..ca739854 100644 --- a/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts @@ -14,7 +14,7 @@ export class BundleDiscountRulesetMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._bundleDiscountRuleset = new BundleDiscountRuleset(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts index 2803afa4..b291f647 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts @@ -16,7 +16,7 @@ export class CatalogIndexMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._root = new NodeData(wrapper); this._newAdditionsAvailable = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts b/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts index b0379ce0..793e6baa 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts @@ -12,7 +12,7 @@ export class CatalogLocalizationData let totalImages = wrapper.readInt(); - while (totalImages > 0) + while(totalImages > 0) { this._images.push(wrapper.readString()); @@ -21,7 +21,7 @@ export class CatalogLocalizationData let totalTexts = wrapper.readInt(); - while (totalTexts > 0) + while(totalTexts > 0) { this._texts.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts index 3144d267..d84faea3 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts @@ -19,7 +19,7 @@ export class CatalogPageExpirationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._pageId = wrapper.readInt(); this._pageName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts index 51f9f981..085a866e 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts @@ -30,7 +30,7 @@ export class CatalogPageMessageOfferData let totalProducts = wrapper.readInt(); - while (totalProducts > 0) + while(totalProducts > 0) { this._products.push(new CatalogPageMessageProductData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts index a1725d2f..387f2c93 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts @@ -30,7 +30,7 @@ export class CatalogPageMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._pageId = wrapper.readInt(); this._catalogType = wrapper.readString(); @@ -39,7 +39,7 @@ export class CatalogPageMessageParser implements IMessageParser let totalOffers = wrapper.readInt(); - while (totalOffers > 0) + while(totalOffers > 0) { this._offers.push(new CatalogPageMessageOfferData(wrapper)); @@ -49,11 +49,11 @@ export class CatalogPageMessageParser implements IMessageParser this._offerId = wrapper.readInt(); this._acceptSeasonCurrencyAsCredits = wrapper.readBoolean(); - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { let totalFrontPageItems = wrapper.readInt(); - while (totalFrontPageItems > 0) + while(totalFrontPageItems > 0) { this._frontPageItems.push(new FrontPageItem(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts index b0dcb09b..c686a808 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts @@ -17,7 +17,7 @@ export class CatalogPageMessageProductData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -40,7 +40,7 @@ export class CatalogPageMessageProductData { this._productType = wrapper.readString(); - switch (this._productType) + switch(this._productType) { case CatalogPageMessageProductData.B: this._extraParam = wrapper.readString(); @@ -52,7 +52,7 @@ export class CatalogPageMessageProductData this._productCount = wrapper.readInt(); this._uniqueLimitedItem = wrapper.readBoolean(); - if (this._uniqueLimitedItem) + if(this._uniqueLimitedItem) { this._uniqueLimitedItemSeriesSize = wrapper.readInt(); this._uniqueLimitedItemsLeft = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts index bdd8b597..271e6c56 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts @@ -17,7 +17,7 @@ export class CatalogPageWithEarliestExpiryMessageParser implements IMessageParse public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._pageName = wrapper.readString(); this._Str_5158 = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts index a17a8234..c90d46d4 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts @@ -15,11 +15,11 @@ export class CatalogPublishedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._instantlyRefreshCatalogue = wrapper.readBoolean(); - if (wrapper.bytesAvailable) this._newFurniDataHash = wrapper.readString(); + if(wrapper.bytesAvailable) this._newFurniDataHash = wrapper.readString(); return true; } diff --git a/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts b/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts index 42b41c5f..6b57c937 100644 --- a/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts +++ b/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts @@ -17,7 +17,7 @@ export class ClubGiftInfoParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offers = []; this._giftData = new Map(); @@ -26,14 +26,14 @@ export class ClubGiftInfoParser implements IMessageParser const offerCount = wrapper.readInt(); - for (let i = 0; i < offerCount; i++) + for(let i = 0; i < offerCount; i++) { this._offers.push(new CatalogPageMessageOfferData(wrapper)); } const giftDataCount = wrapper.readInt(); - for (let i = 0; i < giftDataCount; i++) + for(let i = 0; i < giftDataCount; i++) { const item = new ClubGiftData(wrapper); this._giftData.set(item.offerId, item); @@ -64,7 +64,7 @@ export class ClubGiftInfoParser implements IMessageParser public getOfferExtraData(offerId: number): ClubGiftData { - if (!offerId) return null; + if(!offerId) return null; return this._giftData.get(offerId); } diff --git a/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts b/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts index 3ee5b438..176ea134 100644 --- a/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts +++ b/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts @@ -16,13 +16,13 @@ export class ClubGiftSelectedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._productCode = wrapper.readString(); let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._products.push(new CatalogPageMessageProductData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts b/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts index 6bce2ac7..89498e2c 100644 --- a/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts +++ b/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts @@ -18,7 +18,7 @@ export class ClubOfferData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._offerId = wrapper.readInt(); this._productCode = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts b/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts index 963e7bcc..bf768e2a 100644 --- a/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts @@ -19,11 +19,11 @@ export class DirectSMSClubBuyAvailableMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._Str_16515 = wrapper.readString(); - if (this._Str_16515 !== '') this._available = true; + if(this._Str_16515 !== '') this._available = true; this._Str_22121 = wrapper.readString(); this._Str_21897 = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts b/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts index 68863f11..24254803 100644 --- a/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts +++ b/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts @@ -18,7 +18,7 @@ export class FrontPageItem constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -40,14 +40,14 @@ export class FrontPageItem public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._position = wrapper.readInt(); this._itemName = wrapper.readString(); this._itemPromoImage = wrapper.readString(); this._type = wrapper.readInt(); - switch (this._type) + switch(this._type) { case FrontPageItem.ITEM_CATALOGUE_PAGE: this._catalogPageLocation = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts b/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts index 63ad5d1f..4ca147d1 100644 --- a/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts +++ b/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts @@ -11,7 +11,7 @@ export class GiftReceiverNotFoundParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts b/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts index 1758dd97..085c601a 100644 --- a/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts +++ b/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts @@ -22,7 +22,7 @@ export class GiftWrappingConfigurationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const giftWrappers = []; const boxTypes = []; @@ -36,7 +36,7 @@ export class GiftWrappingConfigurationParser implements IMessageParser let _local_3 = wrapper.readInt(); let i = 0; - while (i < _local_3) + while(i < _local_3) { giftWrappers.push(wrapper.readInt()); i++; @@ -44,7 +44,7 @@ export class GiftWrappingConfigurationParser implements IMessageParser _local_3 = wrapper.readInt(); i = 0; - while (i < _local_3) + while(i < _local_3) { boxTypes.push(wrapper.readInt()); i++; @@ -52,7 +52,7 @@ export class GiftWrappingConfigurationParser implements IMessageParser _local_3 = wrapper.readInt(); i = 0; - while (i < _local_3) + while(i < _local_3) { ribbonTypes.push(wrapper.readInt()); i++; @@ -60,7 +60,7 @@ export class GiftWrappingConfigurationParser implements IMessageParser _local_3 = wrapper.readInt(); i = 0; - while (i < _local_3) + while(i < _local_3) { giftFurnis.push(wrapper.readInt()); i++; diff --git a/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts b/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts index 61540eb1..d86606f0 100644 --- a/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts @@ -14,7 +14,7 @@ export class HabboClubExtendOfferMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offer = new ClubOfferExtendedData(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts b/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts index 0ab86821..6aabdf34 100644 --- a/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts @@ -14,11 +14,11 @@ export class HabboClubOffersMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalOffers = wrapper.readInt(); - while (totalOffers > 0) + while(totalOffers > 0) { this._offers.push(new ClubOfferData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts b/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts index 714086c6..0d874d5b 100644 --- a/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts @@ -15,7 +15,7 @@ export class IsOfferGiftableMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offerId = wrapper.readInt(); this._Str_21271 = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts b/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts index b865f528..4b4e3a80 100644 --- a/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts +++ b/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts @@ -9,7 +9,7 @@ export class LimitedEditionSoldOutParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts b/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts index 030e6b64..0202cbbf 100644 --- a/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts @@ -19,7 +19,7 @@ export class LimitedOfferAppearingNextMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._Str_6800 = wrapper.readInt(); this._pageId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/NodeData.ts b/src/nitro/communication/messages/parser/catalog/NodeData.ts index cc6ecda9..ba441ebd 100644 --- a/src/nitro/communication/messages/parser/catalog/NodeData.ts +++ b/src/nitro/communication/messages/parser/catalog/NodeData.ts @@ -12,7 +12,7 @@ export class NodeData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -33,7 +33,7 @@ export class NodeData public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._visible = wrapper.readBoolean(); this._icon = wrapper.readInt(); @@ -43,7 +43,7 @@ export class NodeData let totalOffers = wrapper.readInt(); - while (totalOffers > 0) + while(totalOffers > 0) { this._offerIds.push(wrapper.readInt()); @@ -52,7 +52,7 @@ export class NodeData let totalChildren = wrapper.readInt(); - while (totalChildren > 0) + while(totalChildren > 0) { this._children.push(new NodeData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts b/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts index 5e2d1a54..06ebe50c 100644 --- a/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts @@ -17,12 +17,12 @@ export class NotEnoughBalanceMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._Str_17433 = wrapper.readBoolean(); this._Str_19031 = wrapper.readBoolean(); - if (wrapper.bytesAvailable) this._activityPointType = wrapper.readInt(); + if(wrapper.bytesAvailable) this._activityPointType = wrapper.readInt(); return true; } diff --git a/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts b/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts index 7f4c5a81..c920ba6d 100644 --- a/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts @@ -14,7 +14,7 @@ export class ProductOfferMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offer = new CatalogPageMessageOfferData(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts b/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts index a4812523..a09a23c3 100644 --- a/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts @@ -13,7 +13,7 @@ export class PurchaseErrorMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts b/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts index 671a87f9..e47268f7 100644 --- a/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts @@ -13,7 +13,7 @@ export class PurchaseNotAllowedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts b/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts index 5a928599..16bb49bb 100644 --- a/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts +++ b/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts @@ -16,7 +16,7 @@ export class PurchaseOKMessageOfferData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -40,7 +40,7 @@ export class PurchaseOKMessageOfferData public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offerId = wrapper.readInt(); this._localizationId = wrapper.readString(); @@ -52,7 +52,7 @@ export class PurchaseOKMessageOfferData let totalProducts = wrapper.readInt(); - while (totalProducts > 0) + while(totalProducts > 0) { this._products.push(new CatalogPageMessageProductData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts b/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts index a6e5a635..99690c99 100644 --- a/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts @@ -14,7 +14,7 @@ export class PurchaseOKMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offer = new PurchaseOKMessageOfferData(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts b/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts index 326ce09b..227d56d0 100644 --- a/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts +++ b/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts @@ -16,13 +16,13 @@ export class RoomAdPurchaseInfoEventParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isVip = wrapper.readBoolean(); let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._rooms.push(new RoomEntryData(wrapper.readInt(), wrapper.readString(), wrapper.readBoolean())); diff --git a/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts b/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts index 7d9fdd61..67370a31 100644 --- a/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts @@ -16,7 +16,7 @@ export class SeasonalCalendarDailyOfferMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._pageId = wrapper.readInt(); this._data = new CatalogPageMessageOfferData(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts b/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts index f0c59e0f..cc2dfde1 100644 --- a/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts +++ b/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts @@ -10,7 +10,7 @@ export class SellablePetPaletteData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -29,7 +29,7 @@ export class SellablePetPaletteData public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readInt(); this._breedId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts b/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts index 1a9393f3..64b0afad 100644 --- a/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts +++ b/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts @@ -16,13 +16,13 @@ export class SellablePetPalettesParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._productCode = wrapper.readString(); let totalPalettes = wrapper.readInt(); - while (totalPalettes > 0) + while(totalPalettes > 0) { this._palettes.push(new SellablePetPaletteData(wrapper)); diff --git a/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts b/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts index a01d4af5..eb91e46a 100644 --- a/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts +++ b/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts @@ -42,7 +42,7 @@ export class TargetedOfferData let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._Str_11962.push(wrapper.readString()); @@ -53,7 +53,7 @@ export class TargetedOfferData public populate(offerData: TargetedOfferData) { - if (!offerData) return; + if(!offerData) return; this._id = offerData.id; this._identifier = offerData.identifier; diff --git a/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts b/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts index a4bcb3f4..c072a1e4 100644 --- a/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts +++ b/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts @@ -9,7 +9,7 @@ export class TargetedOfferNotFoundParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts b/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts index 27d591e4..5b0f4475 100644 --- a/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts +++ b/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts @@ -14,7 +14,7 @@ export class TargetedOfferParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new TargetedOfferData(wrapper); diff --git a/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts b/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts index b66dc707..84f871a1 100644 --- a/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts @@ -12,7 +12,7 @@ export class VoucherRedeemErrorMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts b/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts index 25216d1f..c82e8fd2 100644 --- a/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts @@ -14,7 +14,7 @@ export class VoucherRedeemOkMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._productDescription = wrapper.readString(); this._productName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/client/ClientPingParser.ts b/src/nitro/communication/messages/parser/client/ClientPingParser.ts index 758445ad..f8dbc6cc 100644 --- a/src/nitro/communication/messages/parser/client/ClientPingParser.ts +++ b/src/nitro/communication/messages/parser/client/ClientPingParser.ts @@ -9,7 +9,7 @@ export class ClientPingParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts b/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts index 146103ed..815b6822 100644 --- a/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts @@ -36,7 +36,7 @@ export class CompetitionEntrySubmitResultMessageParser implements IMessageParser let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._requiredFurnis.push(wrapper.readString()); @@ -46,7 +46,7 @@ export class CompetitionEntrySubmitResultMessageParser implements IMessageParser count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._missingFurnis[wrapper.readString()] = ''; diff --git a/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts b/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts index af122ae2..88396989 100644 --- a/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts +++ b/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts @@ -21,14 +21,14 @@ export class CraftableProductsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const craftingResultCount = wrapper.readInt(); - for (let i = 0; i < craftingResultCount; i++) + for(let i = 0; i < craftingResultCount; i++) { this._recipes.push(new CraftingResultObjectParser(wrapper)); } const ingredientCount = wrapper.readInt(); - for (let i = 0; i < ingredientCount; i++) + for(let i = 0; i < ingredientCount; i++) { this._ingredients.push(wrapper.readString()); } diff --git a/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts b/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts index 3bb2761d..5f77fc1d 100644 --- a/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts +++ b/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts @@ -12,9 +12,9 @@ export class CraftingRecipeMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const ingredientCount = wrapper.readInt(); - for (let i = 0; i < ingredientCount; i++) + for(let i = 0; i < ingredientCount; i++) { this._ingredients.push(new CraftingRecipeIngredientParser(wrapper)); } diff --git a/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts b/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts index 5cc33b52..7b15bcde 100644 --- a/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts +++ b/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts @@ -7,7 +7,7 @@ export class CraftingRecipesAvailableMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._count = wrapper.readInt(); this._hasRecipes = wrapper.readBoolean(); return true; diff --git a/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts b/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts index 6695bac3..01d42977 100644 --- a/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts @@ -8,9 +8,9 @@ export class CraftingResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._success = wrapper.readBoolean(); - if (this._success) + if(this._success) { this._result = new CraftingResultObjectParser(wrapper); } diff --git a/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts b/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts index d46f50e9..97e00a2b 100644 --- a/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts +++ b/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts @@ -9,7 +9,7 @@ export class DesktopViewParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts b/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts index 2adb76c6..8963b60e 100644 --- a/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts +++ b/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts @@ -7,7 +7,7 @@ export class AcceptFriendFailerData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._senderId = wrapper.readInt(); this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts b/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts index ee28a4cd..7201a284 100644 --- a/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts @@ -14,11 +14,11 @@ export class AcceptFriendResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalFailures = wrapper.readInt(); - while (totalFailures > 0) + while(totalFailures > 0) { this._failuers.push(new AcceptFriendFailerData(wrapper)); diff --git a/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts b/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts index 1cc6ccd8..b4247861 100644 --- a/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts @@ -13,7 +13,7 @@ export class FindFriendsProcessResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._success = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts b/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts index 99cc2303..89710240 100644 --- a/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts @@ -13,7 +13,7 @@ export class FollowFriendFailedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts b/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts index 218b9bcd..a68b98c8 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts @@ -7,7 +7,7 @@ export class FriendCategoryData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts b/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts index eeb2e40b..55c3ee67 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts @@ -18,14 +18,14 @@ export class FriendListFragmentParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._totalFragments = wrapper.readInt(); this._fragmentNumber = wrapper.readInt(); let totalFriends = wrapper.readInt(); - while (totalFriends > 0) + while(totalFriends > 0) { this._fragment.push(new FriendParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts b/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts index 8817bea7..e97c2519 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts @@ -21,11 +21,11 @@ export class FriendListUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCategories = wrapper.readInt(); - while (totalCategories > 0) + while(totalCategories > 0) { this._categories.push(new FriendCategoryData(wrapper)); @@ -34,21 +34,21 @@ export class FriendListUpdateParser implements IMessageParser let totalUpdates = wrapper.readInt(); - while (totalUpdates > 0) + while(totalUpdates > 0) { const type = wrapper.readInt(); - if (type === -1) + if(type === -1) { this._removedFriendIds.push(wrapper.readInt()); } - else if (type === 0) + else if(type === 0) { this._updatedFriends.push(new FriendParser(wrapper)); } - else if (type === 1) + else if(type === 1) { this._addedFriends.push(new FriendParser(wrapper)); } diff --git a/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts b/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts index fa5b4d20..4441a78c 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts @@ -17,7 +17,7 @@ export class FriendNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._typeCode = wrapper.readInt(); this._avatarId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendParser.ts b/src/nitro/communication/messages/parser/friendlist/FriendParser.ts index 0936bde5..be7f1ce9 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendParser.ts @@ -19,7 +19,7 @@ export class FriendParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts b/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts index 6ddb0930..7601cec7 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts @@ -9,7 +9,7 @@ export class FriendRequestData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._requestId = wrapper.readInt(); this._requesterName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts b/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts index 140fe05a..58c9a591 100644 --- a/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts @@ -16,13 +16,13 @@ export class FriendRequestsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._totalRequests = wrapper.readInt(); let totalRequests = wrapper.readInt(); - while (totalRequests > 0) + while(totalRequests > 0) { this._requests.push(new FriendRequestData(wrapper)); diff --git a/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts b/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts index 66588bef..272fe20a 100644 --- a/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts +++ b/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts @@ -14,7 +14,7 @@ export class HabboSearchResultData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._avatarId = wrapper.readInt(); this._avatarName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts b/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts index 646927b9..6de6001f 100644 --- a/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts @@ -16,11 +16,11 @@ export class HabboSearchResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalFriends = wrapper.readInt(); - while (totalFriends > 0) + while(totalFriends > 0) { this._friends.push(new HabboSearchResultData(wrapper)); @@ -29,7 +29,7 @@ export class HabboSearchResultParser implements IMessageParser let totalOthers = wrapper.readInt(); - while (totalOthers > 0) + while(totalOthers > 0) { this._others.push(new HabboSearchResultData(wrapper)); diff --git a/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts b/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts index 988a5f13..928c3c8b 100644 --- a/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts @@ -17,7 +17,7 @@ export class InstantMessageErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); this._userId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts b/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts index 89391791..f1144116 100644 --- a/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts @@ -15,7 +15,7 @@ export class MessageErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._clientMessageId = wrapper.readInt(); this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts b/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts index 8b722b83..9abfb30d 100644 --- a/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts @@ -19,7 +19,7 @@ export class MessengerInitParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userFriendLimit = wrapper.readInt(); this._normalFriendLimit = wrapper.readInt(); @@ -27,7 +27,7 @@ export class MessengerInitParser implements IMessageParser let totalCategories = wrapper.readInt(); - while (totalCategories > 0) + while(totalCategories > 0) { this._categories.push(new FriendCategoryData(wrapper)); diff --git a/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts b/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts index 6cc63549..bbaa6470 100644 --- a/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts @@ -9,7 +9,7 @@ export class MiniMailNewMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts b/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts index 1edf2a8e..f5c722bd 100644 --- a/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts @@ -13,7 +13,7 @@ export class MiniMailUnreadCountParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._count = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts b/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts index feaea52d..030ba17b 100644 --- a/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts @@ -19,13 +19,13 @@ export class NewConsoleMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._senderId = wrapper.readInt(); this._messageText = wrapper.readString(); this._secondsSinceSent = wrapper.readInt(); - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { this._extraData = wrapper.readString(); } diff --git a/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts b/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts index e18b5a1b..8e51bc85 100644 --- a/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts @@ -14,7 +14,7 @@ export class NewFriendRequestParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._request = new FriendRequestData(wrapper); diff --git a/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts b/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts index 583be91d..3f4dc135 100644 --- a/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts @@ -15,13 +15,13 @@ export class RoomInviteErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); let totalFailed = wrapper.readInt(); - while (totalFailed > 0) + while(totalFailed > 0) { this._failedRecipients.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts b/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts index a073050d..849312ab 100644 --- a/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts +++ b/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts @@ -15,7 +15,7 @@ export class RoomInviteParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._senderId = wrapper.readInt(); this._messageText = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/game/LoadGameUrlParser.ts b/src/nitro/communication/messages/parser/game/LoadGameUrlParser.ts index 8d1ee8f3..6fee19fb 100644 --- a/src/nitro/communication/messages/parser/game/LoadGameUrlParser.ts +++ b/src/nitro/communication/messages/parser/game/LoadGameUrlParser.ts @@ -17,7 +17,7 @@ export class LoadGameUrlParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._gameTypeId = wrapper.readInt(); this._gameClientId = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts b/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts index 86fe3413..cf6bae16 100644 --- a/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts +++ b/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts @@ -12,7 +12,7 @@ export class GenericErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts b/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts index 578aba06..b416022f 100644 --- a/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts @@ -21,11 +21,11 @@ export class GroupBadgePartsParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let basesCount = wrapper.readInt(); - while (basesCount > 0) + while(basesCount > 0) { const id = wrapper.readInt(); const valueA = wrapper.readString(); @@ -37,7 +37,7 @@ export class GroupBadgePartsParser implements IMessageParser let symbolsCount = wrapper.readInt(); - while (symbolsCount > 0) + while(symbolsCount > 0) { const id = wrapper.readInt(); const valueA = wrapper.readString(); @@ -49,7 +49,7 @@ export class GroupBadgePartsParser implements IMessageParser let partColorsCount = wrapper.readInt(); - while (partColorsCount > 0) + while(partColorsCount > 0) { const id = wrapper.readInt(); const color = wrapper.readString(); @@ -60,7 +60,7 @@ export class GroupBadgePartsParser implements IMessageParser let colorsACount = wrapper.readInt(); - while (colorsACount > 0) + while(colorsACount > 0) { const id = wrapper.readInt(); const color = wrapper.readString(); @@ -71,7 +71,7 @@ export class GroupBadgePartsParser implements IMessageParser let colorsBCount = wrapper.readInt(); - while (colorsBCount > 0) + while(colorsBCount > 0) { const id = wrapper.readInt(); const color = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts b/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts index 5f58160c..5ae44b45 100644 --- a/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts @@ -15,12 +15,12 @@ export class GroupBuyDataParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupCost = wrapper.readInt(); let availableRoomsCount = wrapper.readInt(); - while (availableRoomsCount > 0) + while(availableRoomsCount > 0) { const roomId = wrapper.readInt(); const roomName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts b/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts index 2cea33af..58db6e01 100644 --- a/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts @@ -15,7 +15,7 @@ export class GroupConfirmMemberRemoveParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); this._furnitureCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/group/GroupInformationParser.ts b/src/nitro/communication/messages/parser/group/GroupInformationParser.ts index de35d7e7..8a2dbb01 100644 --- a/src/nitro/communication/messages/parser/group/GroupInformationParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupInformationParser.ts @@ -45,7 +45,7 @@ export class GroupInformationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/group/GroupMembersParser.ts b/src/nitro/communication/messages/parser/group/GroupMembersParser.ts index 26247c7d..c25db112 100644 --- a/src/nitro/communication/messages/parser/group/GroupMembersParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupMembersParser.ts @@ -34,7 +34,7 @@ export class GroupMembersParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._groupTitle = wrapper.readString(); @@ -44,7 +44,7 @@ export class GroupMembersParser implements IMessageParser let resultCount = wrapper.readInt(); - while (resultCount > 0) + while(resultCount > 0) { this._result.push(new GroupMemberParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts b/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts index 24fcf80f..98e7deaf 100644 --- a/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts @@ -15,7 +15,7 @@ export class GroupPurchasedParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._groupId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts b/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts index 9b03d189..ceb6576a 100644 --- a/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts +++ b/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts @@ -36,11 +36,11 @@ export class GroupSettingsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const hasRoomData = wrapper.readInt(); - if (hasRoomData === 1) + if(hasRoomData === 1) { this._roomId = wrapper.readInt(); this._roomName = wrapper.readString(); @@ -65,7 +65,7 @@ export class GroupSettingsParser implements IMessageParser const badgePartsCount = wrapper.readInt(); - for (let i = 0; i < badgePartsCount; i++) + for(let i = 0; i < badgePartsCount; i++) { const part = new GroupDataBadgePart(i === 0); @@ -73,7 +73,7 @@ export class GroupSettingsParser implements IMessageParser part.color = wrapper.readInt(); part.position = wrapper.readInt(); - if (part.key === 0) + if(part.key === 0) { part.position = 4; } diff --git a/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts b/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts index c5bf12e5..9ebb9808 100644 --- a/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts +++ b/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts @@ -19,7 +19,7 @@ export class GroupMemberParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -38,7 +38,7 @@ export class GroupMemberParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._rank = wrapper.readInt(); this._id = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/groupforums/ForumData.ts b/src/nitro/communication/messages/parser/groupforums/ForumData.ts index 6ebeff7d..543536f8 100644 --- a/src/nitro/communication/messages/parser/groupforums/ForumData.ts +++ b/src/nitro/communication/messages/parser/groupforums/ForumData.ts @@ -119,7 +119,7 @@ export class ForumData { this._unreadMessages = (this._totalMessages - k); - if (this._unreadMessages < 0) this._unreadMessages = 0; + if(this._unreadMessages < 0) this._unreadMessages = 0; } public _Str_23783(thread: GuildForumThread): void diff --git a/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts index b0419624..a53d951c 100644 --- a/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts @@ -14,7 +14,7 @@ export class ForumDataMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._extendedForumData = ExtendedForumData.parse(wrapper); diff --git a/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts index 7ad9351d..980f0cf5 100644 --- a/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts @@ -22,7 +22,7 @@ export class GetForumsListMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._listCode = wrapper.readInt(); this._totalAmount = wrapper.readInt(); @@ -32,7 +32,7 @@ export class GetForumsListMessageParser implements IMessageParser let i = 0; - while (i < this._amount) + while(i < this._amount) { this._forums.push(ForumData.parse(wrapper)); diff --git a/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts b/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts index 9896aa8b..ac3dcf72 100644 --- a/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts @@ -20,7 +20,7 @@ export class GuildForumThreadsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._startIndex = wrapper.readInt(); @@ -29,7 +29,7 @@ export class GuildForumThreadsParser implements IMessageParser let i = 0; - while (i < this._amount) + while(i < this._amount) { this._threads.push(GuildForumThread.parse(wrapper)); diff --git a/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts index 3e317c4e..67dda7bc 100644 --- a/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts @@ -18,7 +18,7 @@ export class PostMessageMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._threadId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts index 7bbe3e13..8393ab97 100644 --- a/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts @@ -16,7 +16,7 @@ export class PostThreadMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._thread = GuildForumThread.parse(wrapper); diff --git a/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts index 0a4381fd..fe0e017a 100644 --- a/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts @@ -22,7 +22,7 @@ export class ThreadMessagesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._threadId = wrapper.readInt(); @@ -32,7 +32,7 @@ export class ThreadMessagesMessageParser implements IMessageParser let i = 0; - while (i < this._amount) + while(i < this._amount) { const message = MessageData.parse(wrapper); diff --git a/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts index 68e210be..87447b84 100644 --- a/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts @@ -13,7 +13,7 @@ export class UnreadForumsCountMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._count = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts index cdfc608c..5bbb0467 100644 --- a/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts @@ -18,7 +18,7 @@ export class UpdateMessageMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._threadId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts b/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts index 0b9cf593..f2d798ef 100644 --- a/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts +++ b/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts @@ -16,7 +16,7 @@ export class UpdateThreadMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._groupId = wrapper.readInt(); this._thread = GuildForumThread.parse(wrapper); diff --git a/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts b/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts index 7dca4c9a..05be0d8e 100644 --- a/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts +++ b/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts @@ -13,7 +13,7 @@ export class NoobnessLevelMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._noobnessLevel = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts b/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts index dbd4db10..f7b1591c 100644 --- a/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts @@ -11,7 +11,7 @@ export class CallForHelpDisabledNotifyMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._infoUrl = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts b/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts index ac8e40fb..76415a41 100644 --- a/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts @@ -16,7 +16,7 @@ export class CallForHelpPendingCallsMessageParser implements IMessageParser const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const callId = wrapper.readString(); const timestamp = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts b/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts index 2bb7de6e..964f929a 100644 --- a/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts @@ -15,7 +15,7 @@ export class CallForHelpResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._resultType = wrapper.readInt(); this._messageText = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts b/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts index 29d1241a..4369e93d 100644 --- a/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts @@ -21,7 +21,7 @@ export class ChatReviewSessionResultsMessageParser implements IMessageParser this._ownVoteCode = wrapper.readInt(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._finalStatus.push(wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts b/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts index ebce19f7..190674de 100644 --- a/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts @@ -23,7 +23,7 @@ export class ChatReviewSessionVotingStatusMessageParser implements IMessageParse const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._status.push(wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts index 6a80efcd..8da445ac 100644 --- a/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts @@ -19,7 +19,7 @@ export class GuideOnDutyStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._onDuty = wrapper.readBoolean(); this._guidesOnDuty = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts index 1ea03626..78cdd7d5 100644 --- a/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts @@ -21,7 +21,7 @@ export class GuideReportingStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._statusCode = wrapper.readInt(); this._pendingTicket = new PendingGuideTicketData( diff --git a/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts index a2a46d3e..e09f4b90 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts @@ -19,7 +19,7 @@ export class GuideSessionAttachedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._asGuide = wrapper.readBoolean(); this._helpRequestType = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts index 26945a54..cb6f9345 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts @@ -9,7 +9,7 @@ export class GuideSessionDetachedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts index dfccc3c4..0e546543 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts @@ -13,7 +13,7 @@ export class GuideSessionEndedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._endReason = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts index 76f0ccd2..d23cc352 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts @@ -19,7 +19,7 @@ export class GuideSessionErrorMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts index ff1c1cfa..2f14e83b 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts @@ -15,7 +15,7 @@ export class GuideSessionInvitedToGuideRoomMessageParser implements IMessagePars public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._roomName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts index 19c9084f..c69e2618 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts @@ -15,7 +15,7 @@ export class GuideSessionMessageMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._chatMessage = wrapper.readString(); this._senderId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts index 32daa9f8..59848d2b 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts @@ -13,7 +13,7 @@ export class GuideSessionPartnerIsTypingMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isTyping = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts index 911a6a56..c1bb2328 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts @@ -13,7 +13,7 @@ export class GuideSessionRequesterRoomMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._requesterRoomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts index 59fc6f2f..b0dac740 100644 --- a/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts @@ -23,7 +23,7 @@ export class GuideSessionStartedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._requesterUserId = wrapper.readInt(); this._requesterName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts index e8d44d95..8671368a 100644 --- a/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts @@ -18,7 +18,7 @@ export class GuideTicketCreationResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts b/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts index b941589d..338a510d 100644 --- a/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts @@ -17,7 +17,7 @@ export class GuideTicketResolutionMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._resolution = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts b/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts index a9bf1c60..5695bab4 100644 --- a/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts +++ b/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts @@ -9,7 +9,7 @@ export class HotelMergeNameChangeParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts b/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts index 489045ae..eb78dbb9 100644 --- a/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts @@ -14,7 +14,7 @@ export class IssueCloseNotificationMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._closeReason = wrapper.readInt(); this._messageText = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts b/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts index 6e5e316b..695d75a9 100644 --- a/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts @@ -15,7 +15,7 @@ export class QuizDataMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._quizCode = wrapper.readString(); @@ -23,7 +23,7 @@ export class QuizDataMessageParser implements IMessageParser this._questionIds = []; - for (let i = 0; i < size; i++) this._questionIds.push(wrapper.readInt()); + for(let i = 0; i < size; i++) this._questionIds.push(wrapper.readInt()); return true; } diff --git a/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts b/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts index d84ea2a5..9be25246 100644 --- a/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts +++ b/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts @@ -15,7 +15,7 @@ export class QuizResultsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._quizCode = wrapper.readString(); @@ -23,7 +23,7 @@ export class QuizResultsMessageParser implements IMessageParser this._questionIdsForWrongAnswers = []; - for (let i = 0; i < size; i++) this._questionIdsForWrongAnswers.push(wrapper.readInt()); + for(let i = 0; i < size; i++) this._questionIdsForWrongAnswers.push(wrapper.readInt()); return true; } diff --git a/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts b/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts index 4ce02bcf..aab6fb47 100644 --- a/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts +++ b/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts @@ -25,7 +25,7 @@ export class AchievementData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_parser'); + if(!wrapper) throw new Error('invalid_parser'); this._achievementId = wrapper.readInt(); this._level = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts b/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts index c59bd8b0..31228234 100644 --- a/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts +++ b/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts @@ -14,7 +14,7 @@ export class AchievementParser implements IMessageParser public parse(k: IMessageDataWrapper): boolean { - if (!k) return false; + if(!k) return false; this._achievement = new AchievementData(k); diff --git a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts index 83866560..ececb390 100644 --- a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts +++ b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts @@ -16,13 +16,13 @@ export class AchievementsParser implements IMessageParser public parse(k: IMessageDataWrapper): boolean { - if (!k) return false; + if(!k) return false; this._achievements = []; let totalCount = k.readInt(); - while (totalCount > 0) + while(totalCount > 0) { this._achievements.push(new AchievementData(k)); diff --git a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts index a3d35447..ddf4a9bf 100644 --- a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts +++ b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts @@ -13,7 +13,7 @@ export class AchievementsScoreParser implements IMessageParser public parse(k: IMessageDataWrapper): boolean { - if (!k) return false; + if(!k) return false; this._score = k.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts index cb0a24c7..6e84a843 100644 --- a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts @@ -17,7 +17,7 @@ export class AvatarEffectActivatedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readInt(); this._duration = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts index f30e296c..32bb0af7 100644 --- a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts @@ -19,7 +19,7 @@ export class AvatarEffectAddedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readInt(); this._subType = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts index 00b54c6c..1773082c 100644 --- a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts +++ b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts @@ -13,7 +13,7 @@ export class AvatarEffectExpiredParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts index af233a86..bc24b0f1 100644 --- a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts @@ -13,7 +13,7 @@ export class AvatarEffectSelectedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts index 411a6a3f..e3364f42 100644 --- a/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts +++ b/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts @@ -14,11 +14,11 @@ export class AvatarEffectsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalEffects = wrapper.readInt(); - while (totalEffects > 0) + while(totalEffects > 0) { const effect = new AvatarEffect(); diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts index c84b79e5..65dcad44 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts @@ -7,7 +7,7 @@ export class BadgeAndPointLimit constructor(k: string, _arg_2: IMessageDataWrapper) { - if (!_arg_2) throw new Error('invalid_parser'); + if(!_arg_2) throw new Error('invalid_parser'); this._badgeId = (('ACH_' + k) + _arg_2.readInt()); this._limit = _arg_2.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts index c715fda7..3dac3784 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts @@ -14,18 +14,18 @@ export class BadgePointLimitsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let _local_2 = wrapper.readInt(); - while (_local_2 > 0) + while(_local_2 > 0) { const _local_4 = wrapper.readString(); const _local_5 = wrapper.readInt(); let _local_6 = 0; - while (_local_6 < _local_5) + while(_local_6 < _local_5) { this._data.push(new BadgeAndPointLimit(_local_4, wrapper)); diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts index c80a7a6e..a967211c 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts @@ -15,7 +15,7 @@ export class BadgeReceivedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._badgeId = wrapper.readInt(); this._badgeCode = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts index 6e28ac51..7105f96a 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts @@ -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/inventory/badges/IsBadgeRequestFulfilledParser.ts b/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts index 752c7d0f..3bd6eb24 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts @@ -12,7 +12,7 @@ export class IsBadgeRequestFulfilledParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._requestCode = wrapper.readString(); this._fulfilled = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts b/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts index 5d032cc5..b3bbbc5a 100644 --- a/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts +++ b/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts @@ -15,11 +15,11 @@ export class FigureSetIdsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalSetIds = wrapper.readInt(); - while (totalSetIds > 0) + while(totalSetIds > 0) { this._figureSetIds.push(wrapper.readInt()); @@ -28,7 +28,7 @@ export class FigureSetIdsMessageParser implements IMessageParser let totalFurnitureNames = wrapper.readInt(); - while (totalFurnitureNames > 0) + while(totalFurnitureNames > 0) { this._boundFurnitureNames.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts b/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts index 7958c030..d3da666f 100644 --- a/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts +++ b/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts @@ -13,7 +13,7 @@ export class _Str_8728 implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts b/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts index 849e9254..44f2a59e 100644 --- a/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts +++ b/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts @@ -13,7 +13,7 @@ export class _Str_9021 implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts index 2cef26b3..10429711 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts @@ -14,7 +14,7 @@ export class FurnitureListAddOrUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._items.push(new FurnitureListItemParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts index 77676d93..4d67e1cc 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts @@ -9,7 +9,7 @@ export class FurnitureListInvalidateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts index 983a3fc7..5546c669 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts @@ -30,7 +30,7 @@ export class FurnitureListItemParser implements IFurnitureItemData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -63,7 +63,7 @@ export class FurnitureListItemParser implements IFurnitureItemData public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._furniType = wrapper.readString(); @@ -78,7 +78,7 @@ export class FurnitureListItemParser implements IFurnitureItemData this._secondsToExpiration = wrapper.readInt(); this._expirationTimeStamp = PixiApplicationProxy.instance.ticker.lastTime; - if (this.secondsToExpiration > -1) + if(this.secondsToExpiration > -1) { this._rentable = true; } @@ -92,7 +92,7 @@ export class FurnitureListItemParser implements IFurnitureItemData this._flatId = wrapper.readInt(); this._isWallItem = (this._furniType === FurnitureListItemParser.WALL_ITEM); - if (this._furniType === FurnitureListItemParser.FLOOR_ITEM) + if(this._furniType === FurnitureListItemParser.FLOOR_ITEM) { this._slotId = wrapper.readString(); this._extra = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts index 2d09d24c..c986119d 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts @@ -18,18 +18,18 @@ export class FurnitureListParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._totalFragments = wrapper.readInt(); this._fragmentNumber = wrapper.readInt(); let totalItems = wrapper.readInt(); - while (totalItems > 0) + while(totalItems > 0) { const item = new FurnitureListItemParser(wrapper); - if (item) this._fragment.set(item.itemId, item); + if(item) this._fragment.set(item.itemId, item); totalItems--; } diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts index 68279fc0..310b6cfa 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts @@ -13,7 +13,7 @@ export class FurnitureListRemovedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts index 7a93dd65..7fffc3a6 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts @@ -15,7 +15,7 @@ export class FurniturePostItPlacedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._itemsLeft = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts b/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts index f29d9a82..472733be 100644 --- a/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts +++ b/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts @@ -21,7 +21,7 @@ export class PresentOpenedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemType = wrapper.readString(); this._classId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts b/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts index a219bd0b..0f1b9f27 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts @@ -13,19 +13,19 @@ export class ConfirmBreedingRequestParser implements IMessageParser { this._nestId = 0; - if (this._pet1) + if(this._pet1) { this._pet1.dispose(); this._pet1 = null; } - if (this._pet2) + if(this._pet2) { this._pet2.dispose(); this._pet2 = null; } - for (const k of this._rarityCategories) k && k.dispose(); + for(const k of this._rarityCategories) k && k.dispose(); this._rarityCategories = []; @@ -34,7 +34,7 @@ export class ConfirmBreedingRequestParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._nestId = wrapper.readInt(); this._pet1 = new BreedingPetInfo(wrapper); @@ -42,7 +42,7 @@ export class ConfirmBreedingRequestParser implements IMessageParser let totalCount = wrapper.readInt(); - while (totalCount > 0) + while(totalCount > 0) { this._rarityCategories.push(new RarityCategoryData(wrapper)); diff --git a/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts b/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts index d767f293..4111e1ca 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts @@ -15,7 +15,7 @@ export class ConfirmBreedingResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._breedingNestStuffId = wrapper.readInt(); this._result = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts b/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts index d4be7051..21c3b721 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts @@ -21,7 +21,7 @@ export class PetBreedingMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._state = wrapper.readInt(); this._ownPetId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/pets/PetData.ts b/src/nitro/communication/messages/parser/inventory/pets/PetData.ts index e55d1877..2d014e08 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/PetData.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/PetData.ts @@ -10,7 +10,7 @@ export class PetData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts b/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts index 3b74be27..54d15f13 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts @@ -20,7 +20,7 @@ export class PetFigureDataParser let i = 0; - while (i < this._customPartCount) + while(i < this._customPartCount) { this._customParts.push(wrapper.readInt()); this._customParts.push(wrapper.readInt()); @@ -56,7 +56,7 @@ export class PetFigureDataParser figure = (figure + (' ' + this.custompartCount)); - for (const _local_2 of this.customParts) figure = (figure + (' ' + _local_2)); + for(const _local_2 of this.customParts) figure = (figure + (' ' + _local_2)); return figure; } diff --git a/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts b/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts index c080e39e..f37f72ce 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts @@ -23,7 +23,7 @@ export class PetInventoryParser implements IMessageParser this._fragment = new Map(); - while (totalCount > 0) + while(totalCount > 0) { const petData = new PetData(wrapper); diff --git a/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts b/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts index 1a302c20..6ca82917 100644 --- a/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts +++ b/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts @@ -11,7 +11,7 @@ export class PetRemovedFromInventoryParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._petId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts b/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts index 802e628f..7aafca29 100644 --- a/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts +++ b/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts @@ -6,7 +6,7 @@ export class UserCreditsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._balance = parseFloat(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts index 1d716885..89fbae2c 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts @@ -15,7 +15,7 @@ export class TradingAcceptParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userID = wrapper.readInt(); this._userAccepts = (wrapper.readInt() > 0); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts index 7620cc29..3fb2322d 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts @@ -14,7 +14,7 @@ export class TradingCloseParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); this._reason = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts index 12f643da..bb3e99d6 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts @@ -9,7 +9,7 @@ export class TradingCompletedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts index bf3431f1..86657e40 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts @@ -9,7 +9,7 @@ export class TradingConfirmationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts index a8c53b64..b0a18573 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts @@ -28,12 +28,12 @@ export class TradingListItemParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._firstUserID = wrapper.readInt(); this._firstUserItemArray = []; - if (!this.parseItems(wrapper, this._firstUserItemArray)) return false; + if(!this.parseItems(wrapper, this._firstUserItemArray)) return false; this._firstUserNumItems = wrapper.readInt(); this._firstUserNumCredits = wrapper.readInt(); @@ -41,7 +41,7 @@ export class TradingListItemParser implements IMessageParser this._secondUserID = wrapper.readInt(); this._secondUserItemArray = []; - if (!this.parseItems(wrapper, this._secondUserItemArray)) return false; + if(!this.parseItems(wrapper, this._secondUserItemArray)) return false; this._secondUserNumItems = wrapper.readInt(); this._secondUserNumCredits = wrapper.readInt(); @@ -53,7 +53,7 @@ export class TradingListItemParser implements IMessageParser { let count = k.readInt(); - while (count > 0) + while(count > 0) { itemArray.push(new ItemDataStructure(k)); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts index 19827443..07082a53 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts @@ -9,7 +9,7 @@ export class TradingNotOpenParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts index f5a3142b..f28af5d5 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts @@ -15,7 +15,7 @@ export class TradingOpenFailedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._reason = wrapper.readInt(); this._otherUserName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts index 07443695..0717ccec 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts @@ -19,7 +19,7 @@ export class TradingOpenParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); this._userCanTrade = (wrapper.readInt() === 1); diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts index 441f30d8..8db36da0 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts @@ -9,7 +9,7 @@ export class TradingOtherNotAllowedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts b/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts index 81208690..854dc72c 100644 --- a/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts +++ b/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts @@ -9,7 +9,7 @@ export class TradingYouAreNotAllowedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts b/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts index f4db272a..d430b464 100644 --- a/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts +++ b/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts @@ -13,11 +13,11 @@ export class PromoArticlesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._articles.push(new PromoArticleData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts b/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts index cd744030..4c3a8d19 100644 --- a/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts +++ b/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts @@ -11,7 +11,7 @@ export class CommunityVoteReceivedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._acknowledged = wrapper.readBoolean(); return true; } diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts index a512cc73..7ca6931e 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts @@ -18,7 +18,7 @@ export class MarketplaceBuyOfferResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); this._newOfferId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts index c6d6a350..375f0bc2 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts @@ -15,7 +15,7 @@ export class MarketplaceCanMakeOfferResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); this._tokenCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts index a9d9cac1..5891af31 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts @@ -15,7 +15,7 @@ export class MarketplaceCancelOfferResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offerId = wrapper.readInt(); this._success = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts index 3430f924..5d4b1251 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts @@ -27,7 +27,7 @@ export class MarketplaceConfigurationMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._enabled = wrapper.readBoolean(); this._commission = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts index 109bc254..e8c42d0d 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts @@ -13,7 +13,7 @@ export class MarketplaceMakeOfferResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts index fb9b8bc9..81e230a4 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts @@ -27,7 +27,7 @@ export class MarketplaceItemStatsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._averagePrice = wrapper.readInt(); this._currentOfferCount = wrapper.readInt(); @@ -35,7 +35,7 @@ export class MarketplaceItemStatsParser implements IMessageParser let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._dayOffsets.push(wrapper.readInt()); this._averagePrices.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts index 159fd31f..133ba034 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts @@ -23,13 +23,13 @@ export class MarketplaceOffersParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const count = wrapper.readInt(); let i = 0; - while (i < count) + while(i < count) { const offerId = wrapper.readInt(); const status = wrapper.readInt(); @@ -39,19 +39,19 @@ export class MarketplaceOffersParser implements IMessageParser let extraData = ''; let stuffData: IObjectData = null; - if (furniType === MarketplaceOffersParser.FURNITYPE_STUFF) + if(furniType === MarketplaceOffersParser.FURNITYPE_STUFF) { furniId = wrapper.readInt(); stuffData = FurnitureDataParser.parseObjectData(wrapper); } - else if (furniType === MarketplaceOffersParser.FURNITYPE_WALL) + else if(furniType === MarketplaceOffersParser.FURNITYPE_WALL) { furniId = wrapper.readInt(); extraData = wrapper.readString(); } - else if (furniType == MarketplaceOffersParser.FAKE_FURNITYPE_UNIQUE) + else if(furniType == MarketplaceOffersParser.FAKE_FURNITYPE_UNIQUE) { furniId = wrapper.readInt(); stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); @@ -67,7 +67,7 @@ export class MarketplaceOffersParser implements IMessageParser const offerItem = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, timeLeftMinutes, averagePrice, offerCount); - if (i < this.MAX_LIST_LENGTH) this._offers.push(offerItem); + if(i < this.MAX_LIST_LENGTH) this._offers.push(offerItem); i++; } diff --git a/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts b/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts index 077eaaee..60fd422d 100644 --- a/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts +++ b/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts @@ -17,13 +17,13 @@ export class MarketplaceOwnOffersParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._offers = []; this._creditsWaiting = wrapper.readInt(); // SoldPriceTotal const offerCount = wrapper.readInt(); - for (let i = 0; i < offerCount; i++) + for(let i = 0; i < offerCount; i++) { const offerId = wrapper.readInt(); const status = wrapper.readInt(); @@ -32,19 +32,19 @@ export class MarketplaceOwnOffersParser implements IMessageParser let furniId; let extraData; let stuffData: IObjectData; - if (furniType == 1) + if(furniType == 1) { furniId = wrapper.readInt(); stuffData = this.getStuffData(wrapper); } else { - if (furniType == 2) + if(furniType == 2) { furniId = wrapper.readInt(); extraData = wrapper.readString(); } - else if (furniType == 3) + else if(furniType == 3) { furniId = wrapper.readInt(); stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); @@ -59,7 +59,7 @@ export class MarketplaceOwnOffersParser implements IMessageParser const local10 = wrapper.readInt(); const local13 = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, local9, local10); - if (i < MarketplaceOwnOffersParser.MAX_LIST_LENGTH) + if(i < MarketplaceOwnOffersParser.MAX_LIST_LENGTH) { this._offers.push(local13); } diff --git a/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts b/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts index 53267253..40edaac6 100644 --- a/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts @@ -14,7 +14,7 @@ export class CfhChatlogMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new CfhChatlogData(wrapper); diff --git a/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts b/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts index 4414b1b3..e4c1e4d5 100644 --- a/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts +++ b/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts @@ -23,12 +23,12 @@ export class ChatRecordData this._recordType = wrapper.readByte(); const contextCount = wrapper.readShort(); - for (let i = 0; i < contextCount; i++) + for(let i = 0; i < contextCount; i++) { const key = wrapper.readString(); const type = wrapper.readByte(); - switch (type) + switch(type) { case 0: this._context.set(key, wrapper.readBoolean()); @@ -46,7 +46,7 @@ export class ChatRecordData const chatCount = wrapper.readShort(); - for (let i = 0; i < chatCount; i++) + for(let i = 0; i < chatCount; i++) { const timestamp = wrapper.readString(); const habboId = wrapper.readInt(); @@ -101,7 +101,7 @@ export class ChatRecordData private getInt(k: string): number { const value = this._context.get(k); - if (!value) + if(!value) { return 0; } diff --git a/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts b/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts index ce6446d0..766095a5 100644 --- a/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts @@ -39,7 +39,7 @@ export class IssueInfoMessageParser implements IMessageParser const patternsCount: number = k.readInt(); const patterns: PatternMatchData[] = []; - for (let i = 0; i < patternsCount; i++) + for(let i = 0; i < patternsCount; i++) { patterns.push(new PatternMatchData(k)); } diff --git a/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts b/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts index 6b5ea58d..29a21e7f 100644 --- a/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts +++ b/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts @@ -133,11 +133,11 @@ export class IssueMessageData public dispose(): void { - if (this.disposed) + if(this.disposed) { return; } - for (const k of this._patterns) + for(const k of this._patterns) { k.dispose(); } diff --git a/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts b/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts index c5787f2a..1c81cb42 100644 --- a/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts @@ -19,7 +19,7 @@ export class IssuePickFailedMessageParser implements IMessageParser const count = k.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const _local_4 = k.readInt(); const _local_5 = k.readInt(); diff --git a/src/nitro/communication/messages/parser/moderation/ModRoomData.ts b/src/nitro/communication/messages/parser/moderation/ModRoomData.ts index 494c24a1..1c67e2c2 100644 --- a/src/nitro/communication/messages/parser/moderation/ModRoomData.ts +++ b/src/nitro/communication/messages/parser/moderation/ModRoomData.ts @@ -12,7 +12,7 @@ export class ModRoomData implements IDisposable { this._tags = []; this._exists = k.readBoolean(); - if (!this.exists) + if(!this.exists) { return; } @@ -21,7 +21,7 @@ export class ModRoomData implements IDisposable const tagCount = k.readInt(); - for (let i = 0; i < tagCount; i++) + for(let i = 0; i < tagCount; i++) { this._tags.push(k.readString()); } @@ -54,7 +54,7 @@ export class ModRoomData implements IDisposable public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } diff --git a/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts b/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts index 6515bae8..a30bdeab 100644 --- a/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts +++ b/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts @@ -15,7 +15,7 @@ export class ModerationCautionParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._message = wrapper.readString(); this._url = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts b/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts index 1713cb26..cd90b59e 100644 --- a/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts +++ b/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts @@ -26,9 +26,9 @@ export class ModeratorInitData let local3 = wrapper.readInt(); let i = 0; - while (i < local3) + while(i < local3) { - if (local2.parse(wrapper)) + if(local2.parse(wrapper)) { this._issues.push(local2.issueData); } @@ -37,7 +37,7 @@ export class ModeratorInitData local3 = wrapper.readInt(); i = 0; - while (i < local3) + while(i < local3) { this._messageTemplates.push(wrapper.readString()); i++; @@ -45,7 +45,7 @@ export class ModeratorInitData local3 = wrapper.readInt(); i = 0; - while (i < local3) + while(i < local3) { wrapper.readString(); i++; @@ -60,7 +60,7 @@ export class ModeratorInitData this._roomKickPermission = wrapper.readBoolean(); local3 = wrapper.readInt(); i = 0; - while (i < local3) + while(i < local3) { this._roomMessageTemplates.push(wrapper.readString()); i++; @@ -70,7 +70,7 @@ export class ModeratorInitData } public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } diff --git a/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts b/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts index d37fe11a..8a1b0875 100644 --- a/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts @@ -15,7 +15,7 @@ export class ModeratorMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._message = wrapper.readString(); this._url = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts b/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts index 547f285f..93e55a51 100644 --- a/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts @@ -14,7 +14,7 @@ export class ModeratorRoomInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new RoomModerationData(wrapper); diff --git a/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts b/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts index b69d7d47..c195921d 100644 --- a/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts +++ b/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts @@ -41,7 +41,7 @@ export class ModeratorUserInfoData this._identityRelatedBanCount = wrapper.readInt(); this._primaryEmailAddress = wrapper.readString(); this._userClassification = wrapper.readString(); - if (wrapper.bytesAvailable) + if(wrapper.bytesAvailable) { this._lastSanctionTime = wrapper.readString(); this._sanctionAgeHours = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts b/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts index 5e9ffcd4..ae127866 100644 --- a/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts @@ -14,7 +14,7 @@ export class ModeratorUserInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new ModeratorUserInfoData(wrapper); diff --git a/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts b/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts index b0bc1a51..9bdc58cd 100644 --- a/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts @@ -13,7 +13,7 @@ export class RoomChatlogMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new ChatRecordData(wrapper); diff --git a/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts b/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts index 7692d854..5c194cfb 100644 --- a/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts +++ b/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts @@ -58,12 +58,12 @@ export class RoomModerationData implements IDisposable public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } this._disposed = true; - if (this._room != null) + if(this._room != null) { this._room.dispose(); this._room = null; diff --git a/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts b/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts index d1df7320..7fd873c1 100644 --- a/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts +++ b/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts @@ -14,7 +14,7 @@ export class RoomVisitsData this._userName = k.readString(); const _local_2 = k.readInt(); let _local_3 = 0; - while (_local_3 < _local_2) + while(_local_3 < _local_2) { this._rooms.push(new RoomVisitData(k)); _local_3++; diff --git a/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts b/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts index 79f77c55..e799c357 100644 --- a/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts @@ -13,7 +13,7 @@ export class UserBannedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._message = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts b/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts index 7be2bce5..52b21240 100644 --- a/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts +++ b/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts @@ -12,7 +12,7 @@ export class UserChatlogData this._userId = wrapper.readInt(); this._username = wrapper.readString(); const size = wrapper.readInt(); - for (let i = 0; i < size; i++) + for(let i = 0; i < size; i++) { this._roomChatlogs.push(new ChatRecordData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts b/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts index faf8e8d7..efff372f 100644 --- a/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts @@ -14,7 +14,7 @@ export class UserChatlogMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new UserChatlogData(wrapper); diff --git a/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts b/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts index dcda6c54..f6e89c22 100644 --- a/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts +++ b/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts @@ -15,7 +15,7 @@ export class MysteryBoxKeysParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._boxColor = wrapper.readString(); this._keyColor = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts b/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts index 0c19c39d..df78ecf6 100644 --- a/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts +++ b/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts @@ -15,7 +15,7 @@ export class CanCreateRoomEventParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._canCreate = wrapper.readBoolean(); this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts b/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts index 34d2f2f2..e5c00c5d 100644 --- a/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts @@ -15,7 +15,7 @@ export class CanCreateRoomMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._resultCode = wrapper.readInt(); this._roomLimit = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts b/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts index 1c2ffdd4..5f7a45a1 100644 --- a/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts +++ b/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts @@ -12,7 +12,7 @@ export class CategoriesWithVisitorCountParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new CategoriesWithVisitorCountData(wrapper); diff --git a/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts b/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts index f9b5b449..d824d14b 100644 --- a/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts @@ -12,7 +12,7 @@ export class CompetitionRoomsDataMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new CompetitionRoomsData(wrapper); diff --git a/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts b/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts index 26f70117..2519c0ba 100644 --- a/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts @@ -12,7 +12,7 @@ export class ConvertedRoomIdMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._globalId = wrapper.readString(); this._convertedId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts b/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts index ae015d95..ae6b87bb 100644 --- a/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts @@ -13,7 +13,7 @@ export class DoorbellMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts b/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts index eeeda527..392ca24b 100644 --- a/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts @@ -12,7 +12,7 @@ export class FavouriteChangedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._flatId = wrapper.readInt(); this._added = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts b/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts index 751960da..f84cb2d4 100644 --- a/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts @@ -12,14 +12,14 @@ export class FavouritesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._favouriteRoomIds = []; this._limit = wrapper.readInt(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._favouriteRoomIds.push(wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts b/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts index 03c7e239..e46f537f 100644 --- a/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts @@ -13,7 +13,7 @@ export class FlatAccessDeniedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts b/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts index 59d7687b..718f1b67 100644 --- a/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts @@ -15,7 +15,7 @@ export class FlatCreatedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._roomName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts b/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts index 9a52a384..8ae0c1f8 100644 --- a/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts @@ -27,7 +27,7 @@ export class GetGuestRoomResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomEnter = wrapper.readBoolean(); this._data = new RoomDataParser(wrapper); diff --git a/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts b/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts index d0fb2088..7d7c9029 100644 --- a/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts @@ -13,7 +13,7 @@ export class GuestRoomSearchResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new GuestRoomSearchResultData(wrapper); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts index 2ae59ddc..2d1b48f7 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts @@ -12,7 +12,7 @@ export class NavigatorCategoryDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -33,7 +33,7 @@ export class NavigatorCategoryDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts index dea64567..ce06cf0c 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts @@ -13,11 +13,11 @@ export class NavigatorCollapsedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCategories = wrapper.readInt(); - while (totalCategories > 0) + while(totalCategories > 0) { this._categories.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts index cc6764a0..5beacfe9 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts @@ -8,7 +8,7 @@ export class NavigatorEventCategoryDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -25,7 +25,7 @@ export class NavigatorEventCategoryDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts index d1725351..a3efe530 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts @@ -15,7 +15,7 @@ export class NavigatorHomeRoomParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._homeRoomId = wrapper.readInt(); this._roomIdToEnter = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts index 99a0ba5b..9c6b4693 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts @@ -9,7 +9,7 @@ export class NavigatorLiftedDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -27,7 +27,7 @@ export class NavigatorLiftedDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._areaId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts index 074a0c9e..2e5fed65 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts @@ -14,11 +14,11 @@ export class NavigatorLiftedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalRooms = wrapper.readInt(); - while (totalRooms > 0) + while(totalRooms > 0) { this._rooms.push(new NavigatorLiftedDataParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts index 828979e5..ab169609 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts @@ -14,11 +14,11 @@ export class NavigatorMetadataParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalContexts = wrapper.readInt(); - while (totalContexts > 0) + while(totalContexts > 0) { this._topLevelContexts.push(new NavigatorTopLevelContext(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts index 16274b84..dcfc6bc6 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts @@ -9,7 +9,7 @@ export class NavigatorOpenRoomCreatorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts index 925c2d3f..c0ae4a0f 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts @@ -14,7 +14,7 @@ export class NavigatorSearchParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = new NavigatorSearchResultSet(wrapper); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts index bf8c321c..0fcb4f87 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts @@ -14,11 +14,11 @@ export class NavigatorSearchesParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalSearches = wrapper.readInt(); - while (totalSearches > 0) + while(totalSearches > 0) { this._searches.push(new NavigatorSavedSearch(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts b/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts index 6840c883..66eac4ca 100644 --- a/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts +++ b/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts @@ -23,7 +23,7 @@ export class NavigatorSettingsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._windowX = wrapper.readInt(); this._windowY = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts b/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts index dce922b6..1cc74018 100644 --- a/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts +++ b/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts @@ -13,7 +13,7 @@ export class RoomSettingsUpdatedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts b/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts index f768dcda..5d866691 100644 --- a/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts @@ -14,11 +14,11 @@ export class UserEventCatsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCategories = wrapper.readInt(); - while (totalCategories > 0) + while(totalCategories > 0) { this._categories.push(new NavigatorEventCategoryDataParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts b/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts index 4c5e4ddf..821bf2d1 100644 --- a/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts +++ b/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts @@ -14,11 +14,11 @@ export class UserFlatCatsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCategories = wrapper.readInt(); - while (totalCategories > 0) + while(totalCategories > 0) { this._categories.push(new NavigatorCategoryDataParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts b/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts index 10d57de8..741a2c34 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts @@ -12,7 +12,7 @@ export class CategoriesWithVisitorCountData const count = k.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const _local_4 = k.readInt(); const _local_5 = k.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts b/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts index 4c562606..e5bbdef8 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts @@ -11,7 +11,7 @@ export class CompetitionRoomsData this._goalId = _arg_2; this._pageIndex = _arg_3; - if (k) + if(k) { this._goalId = k.readInt(); this._pageIndex = k.readInt(); diff --git a/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts b/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts index 03d49f84..b42582de 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts @@ -16,12 +16,12 @@ export class GuestRoomSearchResultData this._searchType = k.readInt(); this._searchParam = k.readString(); const count = k.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._rooms.push(new RoomDataParser(k)); } const hasAdditional = k.readBoolean(); - if (hasAdditional) + if(hasAdditional) { this._ad = new OfficialRoomEntryData(k); } @@ -29,19 +29,19 @@ export class GuestRoomSearchResultData public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } this._disposed = true; - if (this._rooms != null) + if(this._rooms != null) { - for (const k of this._rooms) + for(const k of this._rooms) { k.flush(); } } - if (this._ad != null) + if(this._ad != null) { this._ad.dispose(); this._ad = null; diff --git a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts index d5cac0b8..e954f8b6 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts @@ -9,7 +9,7 @@ export class NavigatorSavedSearch constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -27,7 +27,7 @@ export class NavigatorSavedSearch public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); this._code = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts index e720fcc1..baddfa83 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts @@ -12,7 +12,7 @@ export class NavigatorSearchResultList constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -32,7 +32,7 @@ export class NavigatorSearchResultList public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readString(); this._data = wrapper.readString(); @@ -42,7 +42,7 @@ export class NavigatorSearchResultList let totalRooms = wrapper.readInt(); - while (totalRooms > 0) + while(totalRooms > 0) { this._rooms.push(new RoomDataParser(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts index eca5a3a5..297f6170 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts @@ -9,7 +9,7 @@ export class NavigatorSearchResultSet constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -26,14 +26,14 @@ export class NavigatorSearchResultSet public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readString(); this._data = wrapper.readString(); let totalResults = wrapper.readInt(); - while (totalResults > 0) + while(totalResults > 0) { this._results.push(new NavigatorSearchResultList(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts b/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts index 07f681be..92a81b03 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts @@ -8,7 +8,7 @@ export class NavigatorTopLevelContext constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -24,13 +24,13 @@ export class NavigatorTopLevelContext public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readString(); let totalSavedSearches = wrapper.readInt(); - while (totalSavedSearches > 0) + while(totalSavedSearches > 0) { this._savedSearches.push(new NavigatorSavedSearch(wrapper)); diff --git a/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts b/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts index 4951678a..d9a32175 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts @@ -32,13 +32,13 @@ export class OfficialRoomEntryData this._Str_22099 = k.readInt(); this._userCount = k.readInt(); this._type = k.readInt(); - if (this._type == OfficialRoomEntryData._Str_14955) + if(this._type == OfficialRoomEntryData._Str_14955) { this._tag = k.readString(); } else { - if (this._type == OfficialRoomEntryData._Str_12025) + if(this._type == OfficialRoomEntryData._Str_12025) { this._Str_2567 = new RoomDataParser(k); } @@ -51,12 +51,12 @@ export class OfficialRoomEntryData public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } this._disposed = true; - if (this._Str_2567 != null) + if(this._Str_2567 != null) { this._Str_2567.flush(); this._Str_2567 = null; @@ -135,11 +135,11 @@ export class OfficialRoomEntryData public get _Str_23003(): number { - if (this.type == OfficialRoomEntryData._Str_14955) + if(this.type == OfficialRoomEntryData._Str_14955) { return 0; } - if (this.type == OfficialRoomEntryData._Str_12025) + if(this.type == OfficialRoomEntryData._Str_12025) { return this._Str_2567.maxUserCount; } diff --git a/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts b/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts index dfa75f6d..70a3c5e3 100644 --- a/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts +++ b/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper } from "../../../../../../api"; +import { IMessageDataWrapper } from '../../../../../../api'; export class RoomEventData { @@ -40,7 +40,7 @@ export class RoomEventData public dispose(): void { - if (this._disposed) + if(this._disposed) { return; } diff --git a/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts b/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts index dd09e538..ec5939ea 100644 --- a/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts +++ b/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts @@ -14,7 +14,7 @@ export class AchievementNotificationMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new AchievementLevelUpData(wrapper); diff --git a/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts b/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts index a24d585b..d060c1ce 100644 --- a/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts +++ b/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts @@ -17,7 +17,7 @@ export class ActivityPointNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._amount = wrapper.readInt(); this._amountChanged = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts b/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts index 403396ff..32b452a6 100644 --- a/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts +++ b/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts @@ -12,7 +12,7 @@ export class BotErrorEventParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts b/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts index bff1ed07..1b637f64 100644 --- a/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts +++ b/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts @@ -13,7 +13,7 @@ export class ClubGiftNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._numGifts = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts b/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts index 0521d153..511c5756 100644 --- a/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts +++ b/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts @@ -13,7 +13,7 @@ export class HabboBroadcastMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._message = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts b/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts index e04be7d9..5e0464e7 100644 --- a/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts +++ b/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts @@ -13,7 +13,7 @@ export class HotelWillShutdownParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._minutes = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts b/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts index 4fed97d1..eead5cf2 100644 --- a/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts +++ b/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts @@ -13,7 +13,7 @@ export class InfoFeedEnableMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._enabled = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts b/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts index 25462921..dd3e60ec 100644 --- a/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts +++ b/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts @@ -13,11 +13,11 @@ export class MOTDNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalMessages = wrapper.readInt(); - while (totalMessages > 0) + while(totalMessages > 0) { this._messages.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts b/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts index d4b114aa..ebc58638 100644 --- a/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts +++ b/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts @@ -15,13 +15,13 @@ export class NotificationDialogMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readString(); let totalParameters = wrapper.readInt(); - while (totalParameters > 0) + while(totalParameters > 0) { this._parameters.set(wrapper.readString(), wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts b/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts index d16a04f7..735ec0ad 100644 --- a/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts +++ b/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts @@ -20,7 +20,7 @@ export class PetLevelNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._petId = wrapper.readInt(); this._petName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts b/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts index 381bf232..83c641d5 100644 --- a/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts +++ b/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts @@ -12,7 +12,7 @@ export class PetPlacingErrorEventParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._errorCode = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts index 4753101b..88faa4af 100644 --- a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts +++ b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts @@ -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/perk/PerkAllowancesMessageParser.ts b/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts index a54bb783..aa35dfbf 100644 --- a/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts +++ b/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts @@ -14,13 +14,13 @@ export class PerkAllowancesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._perks = []; const size: number = wrapper.readInt(); - for (let i = 0; i < size; i++) this._perks.push(new PerkData( + for(let i = 0; i < size; i++) this._perks.push(new PerkData( wrapper.readString(), wrapper.readString(), wrapper.readBoolean() @@ -33,9 +33,9 @@ export class PerkAllowancesMessageParser implements IMessageParser { let allowed = false; - for (const perk of this._perks) + for(const perk of this._perks) { - if (perk.code === perkCode) + if(perk.code === perkCode) { allowed = perk.isAllowed; break; diff --git a/src/nitro/communication/messages/parser/poll/PollContentsParser.ts b/src/nitro/communication/messages/parser/poll/PollContentsParser.ts index 19298313..1240dde6 100644 --- a/src/nitro/communication/messages/parser/poll/PollContentsParser.ts +++ b/src/nitro/communication/messages/parser/poll/PollContentsParser.ts @@ -28,12 +28,12 @@ export class PollContentsParser implements IMessageParser this._endMessage = wrapper.readString(); this._numQuestions = wrapper.readInt(); - for (let i = 0; i < this._numQuestions; i++) + for(let i = 0; i < this._numQuestions; i++) { const question = this.parsePollQuestion(wrapper); const childrenCount = wrapper.readInt(); - for (let j = 0; j < childrenCount; j++) + for(let j = 0; j < childrenCount; j++) { question.children.push(this.parsePollQuestion(wrapper)); } @@ -55,9 +55,9 @@ export class PollContentsParser implements IMessageParser pollQuestion.questionCategory = k.readInt(); pollQuestion.questionAnswerType = k.readInt(); pollQuestion.questionAnswerCount = k.readInt(); - if (((pollQuestion.questionType == 1) || (pollQuestion.questionType == 2))) + if(((pollQuestion.questionType == 1) || (pollQuestion.questionType == 2))) { - for (let i = 0; i < pollQuestion.questionAnswerCount; i++) + for(let i = 0; i < pollQuestion.questionAnswerCount; i++) { pollQuestion.questionChoices.push(new PollChoice(k.readString(), k.readString(), k.readInt())); } diff --git a/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts b/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts index 09f85649..326ef199 100644 --- a/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts +++ b/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts @@ -22,7 +22,7 @@ export class QuestionAnsweredParser implements IMessageParser const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const key = wrapper.readString(); const value = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts b/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts index b9be540c..01b1026f 100644 --- a/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts +++ b/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts @@ -18,7 +18,7 @@ export class QuestionFinishedParser implements IMessageParser this._answerCounts = new Map(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const key = wrapper.readString(); const value = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/poll/QuestionParser.ts b/src/nitro/communication/messages/parser/poll/QuestionParser.ts index 9fdca7dd..2c1c2a5a 100644 --- a/src/nitro/communication/messages/parser/poll/QuestionParser.ts +++ b/src/nitro/communication/messages/parser/poll/QuestionParser.ts @@ -32,7 +32,7 @@ export class QuestionParser implements IMessageParser this._question = { id: questionId, number: questionNumber, type: questionType, content: questionContent }; - if (((this._question.type == 1) || (this._question.type == 2))) + if(((this._question.type == 1) || (this._question.type == 2))) { this._question.selection_min = wrapper.readInt(); const count = wrapper.readInt(); @@ -41,7 +41,7 @@ export class QuestionParser implements IMessageParser this._question.selection_count = count; this._question.selection_max = count; - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._question.selection_values.push(wrapper.readString()); this._question.selections.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts b/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts index 5c6898c8..073ac5b8 100644 --- a/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts +++ b/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts @@ -27,7 +27,7 @@ export class CommunityGoalData implements IDisposable this._timeRemainingInSeconds = wrapper.readInt(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._rewardUserLimits.push(wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts b/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts index e02a2863..37c8d877 100644 --- a/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts @@ -13,10 +13,10 @@ export class CommunityGoalEarnedPrizesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._prizes.push(new PrizeData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts b/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts index 5c19ed89..b57d637d 100644 --- a/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts +++ b/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts @@ -13,7 +13,7 @@ export class CommunityGoalHallOfFameData implements IDisposable const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._hof.push(new HallOfFameEntryData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts b/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts index 8a97697d..8709709a 100644 --- a/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts @@ -13,7 +13,7 @@ export class CommunityGoalHallOfFameMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new CommunityGoalHallOfFameData(wrapper); return true; diff --git a/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts b/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts index 0e84527a..6f6d26de 100644 --- a/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts @@ -13,7 +13,7 @@ export class CommunityGoalProgressMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._data = new CommunityGoalData(wrapper); return true; diff --git a/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts b/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts index a507cea4..d4eb5417 100644 --- a/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts @@ -16,7 +16,7 @@ export class ConcurrentUsersGoalProgressMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._state = wrapper.readInt(); this._userCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts b/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts index a3151d04..a09d84f7 100644 --- a/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts @@ -12,7 +12,7 @@ export class EpicPopupMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._imageUri = wrapper.readString(); return true; diff --git a/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts b/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts index e4a618a2..7c29d399 100644 --- a/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts @@ -11,7 +11,7 @@ export class QuestCancelledMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._expired = wrapper.readBoolean(); return true; diff --git a/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts b/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts index 071161d9..bdec334d 100644 --- a/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts @@ -14,7 +14,7 @@ export class QuestCompletedMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._questData = new QuestMessageData(wrapper); this._showDialog = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts b/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts index 9e3095f1..4bb30e34 100644 --- a/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts @@ -15,10 +15,10 @@ export class QuestDailyMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const _local_2 = wrapper.readBoolean(); - if (_local_2) + if(_local_2) { this._quest = new QuestMessageData(wrapper); this._easyQuestCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/quest/QuestMessageData.ts b/src/nitro/communication/messages/parser/quest/QuestMessageData.ts index eced076d..6151d795 100644 --- a/src/nitro/communication/messages/parser/quest/QuestMessageData.ts +++ b/src/nitro/communication/messages/parser/quest/QuestMessageData.ts @@ -129,7 +129,7 @@ export class QuestMessageData public get waitPeriodSeconds(): number { - if (this._waitPeriodSeconds < 1) + if(this._waitPeriodSeconds < 1) { return 0; } diff --git a/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts b/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts index b4f3153e..b817950b 100644 --- a/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts @@ -13,7 +13,7 @@ export class QuestMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._quest = new QuestMessageData(wrapper); return true; diff --git a/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts b/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts index c30c928f..aecbd125 100644 --- a/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts +++ b/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts @@ -15,11 +15,11 @@ export class QuestsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._quests.push(new QuestMessageData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts b/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts index 56250f3b..d354e2b7 100644 --- a/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts +++ b/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts @@ -13,11 +13,11 @@ export class SeasonalQuestsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._quests.push(new QuestMessageData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts b/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts index 9356a22b..373d3aad 100644 --- a/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts @@ -20,7 +20,7 @@ export class CantConnectMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._reason = wrapper.readInt(); this._parameter = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts b/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts index 1b17b20d..f80c2c9c 100644 --- a/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts +++ b/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts @@ -9,7 +9,7 @@ export class RoomEnterParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts b/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts index 88b757f3..7b523226 100644 --- a/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts +++ b/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts @@ -13,7 +13,7 @@ export class RoomFowardParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts b/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts index 6c20ffaf..c37222da 100644 --- a/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts +++ b/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts @@ -13,7 +13,7 @@ export class RoomDoorbellAcceptedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userName = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts index 995dfaf9..2f303c30 100644 --- a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts +++ b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts @@ -9,7 +9,7 @@ export class RoomRightsClearParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts index a290a04a..3dbb3e3c 100644 --- a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts +++ b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts @@ -9,7 +9,7 @@ export class RoomRightsOwnerParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts index 79300629..852612f1 100644 --- a/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts +++ b/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts @@ -13,7 +13,7 @@ export class RoomRightsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._controllerLevel = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts b/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts index c99e31a7..0145e75e 100644 --- a/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts +++ b/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts @@ -17,7 +17,7 @@ export class BotCommandConfigurationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._botId = wrapper.readInt(); this._commandId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts b/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts index 03aa79dd..2f21e9e9 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts @@ -14,7 +14,7 @@ export class RoomChatSettingsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._chat = new RoomChatSettings(wrapper); diff --git a/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts b/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts index dfa919f0..b84af5f9 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts @@ -47,7 +47,7 @@ export class RoomDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -89,7 +89,7 @@ export class RoomDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._roomName = wrapper.readString(); @@ -113,13 +113,13 @@ export class RoomDataParser private parseTags(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._tags = []; let totalTags = wrapper.readInt(); - while (totalTags > 0) + while(totalTags > 0) { this._tags.push(wrapper.readString()); @@ -131,20 +131,20 @@ export class RoomDataParser private parseBitMask(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._bitMask = wrapper.readInt(); - if (this._bitMask & RoomDataParser.THUMBNAIL_BITMASK) this._officialRoomPicRef = wrapper.readString(); + if(this._bitMask & RoomDataParser.THUMBNAIL_BITMASK) this._officialRoomPicRef = wrapper.readString(); - if (this._bitMask & RoomDataParser.GROUPDATA_BITMASK) + if(this._bitMask & RoomDataParser.GROUPDATA_BITMASK) { this._groupId = wrapper.readInt(); this._groupName = wrapper.readString(); this._groupBadge = wrapper.readString(); } - if (this._bitMask & RoomDataParser.ROOMAD_BITMASK) + if(this._bitMask & RoomDataParser.ROOMAD_BITMASK) { this._adName = wrapper.readString(); this._adDescription = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts b/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts index 06ec1d2d..57dfbee6 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts @@ -15,7 +15,7 @@ export class RoomEntryInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._isOwner = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts b/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts index 0f2e22f6..90e7064b 100644 --- a/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts +++ b/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts @@ -15,7 +15,7 @@ export class RoomScoreParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._totalLikes = wrapper.readInt(); this._canLike = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts b/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts index ebb7f288..783ac996 100644 --- a/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts @@ -19,7 +19,7 @@ export class FavoriteMembershipUpdateMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomIndex = wrapper.readInt(); this._groupId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts b/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts index 3ae67dd6..1888a760 100644 --- a/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts @@ -15,11 +15,11 @@ export class ObjectsDataUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalObjects = wrapper.readInt(); - while (totalObjects > 0) + while(totalObjects > 0) { const id = wrapper.readInt(); const stuffData = FurnitureDataParser.parseObjectData(wrapper); diff --git a/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts b/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts index 8c3023b0..1a1e41a8 100644 --- a/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts +++ b/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts @@ -18,7 +18,7 @@ export class ObjectsRollingParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const x = wrapper.readInt(); const y = wrapper.readInt(); @@ -27,7 +27,7 @@ export class ObjectsRollingParser implements IMessageParser let totalItems = wrapper.readInt(); - while (totalItems > 0) + while(totalItems > 0) { const id = wrapper.readInt(); const height = parseFloat(wrapper.readString()); @@ -41,14 +41,14 @@ export class ObjectsRollingParser implements IMessageParser this._rollerId = wrapper.readInt(); - if (!wrapper.bytesAvailable) return true; + if(!wrapper.bytesAvailable) return true; const movementType = wrapper.readInt(); const unitId = wrapper.readInt(); const height = parseFloat(wrapper.readString()); const nextHeight = parseFloat(wrapper.readString()); - switch (movementType) + switch(movementType) { case 0: break; case 1: diff --git a/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts index 89819968..dd0e4383 100644 --- a/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts @@ -13,7 +13,7 @@ export class CustomUserNotificationMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._code = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts index 7cb31998..c05b254a 100644 --- a/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts @@ -15,7 +15,7 @@ export class DiceValueMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._value = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts b/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts index bb931c44..3bc3601a 100644 --- a/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts @@ -13,11 +13,11 @@ export class FurnitureAliasesParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCount = wrapper.readInt(); - while (totalCount > 0) + while(totalCount > 0) { this._aliases.set(wrapper.readString(), wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts b/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts index 5cfa8c3d..77d23fa6 100644 --- a/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts @@ -15,7 +15,7 @@ export class FurnitureDataParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = parseInt(wrapper.readString()); this._data = FurnitureDataParser.parseObjectData(wrapper); @@ -25,11 +25,11 @@ export class FurnitureDataParser implements IMessageParser public static parseObjectData(wrapper: IMessageDataWrapper): IObjectData { - if (!wrapper) return null; + if(!wrapper) return null; const data = ObjectDataFactory.getData(wrapper.readInt()); - if (!data) return null; + if(!data) return null; data.parseWrapper(wrapper); diff --git a/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts b/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts index bdd13244..74477ba7 100644 --- a/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts @@ -15,7 +15,7 @@ export class FurnitureStackHeightParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._furniId = wrapper.readInt(); this._height = (wrapper.readInt() / 100); diff --git a/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts index 57066469..573471ea 100644 --- a/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts @@ -23,7 +23,7 @@ export class GroupFurniContextMenuInfoMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._objectId = wrapper.readInt(); this._guildId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts index cb5423d5..1ddd603d 100644 --- a/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts @@ -15,7 +15,7 @@ export class ItemDataUpdateMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = parseInt(wrapper.readString()); this._data = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts index 59e614b5..6da2b728 100644 --- a/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts @@ -15,7 +15,7 @@ export class OneWayDoorStatusMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._state = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts index dc117856..9f6c91f5 100644 --- a/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts @@ -15,7 +15,7 @@ export class RequestSpamWallPostItMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._location = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts index b2ad1d41..02e0f874 100644 --- a/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts @@ -25,7 +25,7 @@ export class RoomDimmerPresetsMessageParser implements IMessageParser this._selectedPresetId = wrapper.readInt(); - for (let i = 0; i < totalPresets; i++) + for(let i = 0; i < totalPresets; i++) { const presetId = wrapper.readInt(); const type = wrapper.readInt(); @@ -40,7 +40,7 @@ export class RoomDimmerPresetsMessageParser implements IMessageParser public getPreset(id: number): RoomDimmerPresetsMessageData { - if ((id < 0) || (id >= this.presetCount)) return null; + if((id < 0) || (id >= this.presetCount)) return null; return this._presets[id]; } diff --git a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts index 6a1c0576..75d74f19 100644 --- a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts @@ -14,7 +14,7 @@ export class FurnitureFloorAddParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._item = new FurnitureFloorDataParser(wrapper); this._item.username = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts index 43808c46..8c23f86a 100644 --- a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts @@ -21,7 +21,7 @@ export class FurnitureFloorDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -50,7 +50,7 @@ export class FurnitureFloorDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = wrapper.readInt(); this._spriteId = wrapper.readInt(); @@ -67,7 +67,7 @@ export class FurnitureFloorDataParser this._userId = wrapper.readInt(); this._username = null; - if (this._spriteId < 0) this._spriteName = wrapper.readString(); + if(this._spriteId < 0) this._spriteName = wrapper.readString(); return true; } diff --git a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts index be4d0f50..e27d3e44 100644 --- a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts @@ -16,21 +16,21 @@ export class FurnitureFloorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; - if (!this.parseOwners(wrapper)) return false; + if(!this.parseOwners(wrapper)) return false; let totalItems = wrapper.readInt(); - while (totalItems > 0) + while(totalItems > 0) { const item = new FurnitureFloorDataParser(wrapper); - if (!item) continue; + if(!item) continue; const username = this._owners.get(item.userId); - if (username) item.username = username; + if(username) item.username = username; this._items.push(item); @@ -42,11 +42,11 @@ export class FurnitureFloorParser implements IMessageParser private parseOwners(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalOwners = wrapper.readInt(); - while (totalOwners > 0) + while(totalOwners > 0) { this._owners.set(wrapper.readInt(), wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts index b1556abd..ae4d778d 100644 --- a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts @@ -19,7 +19,7 @@ export class FurnitureFloorRemoveParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = parseInt(wrapper.readString()); this._isExpired = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts index aa926ca7..c9dd10f3 100644 --- a/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts @@ -14,7 +14,7 @@ export class FurnitureFloorUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._item = new FurnitureFloorDataParser(wrapper); diff --git a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts index da59b2b9..01da8365 100644 --- a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts @@ -14,7 +14,7 @@ export class FurnitureWallAddParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._item = new FurnitureWallDataParser(wrapper); this._item.username = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts index 2142688a..255bf1db 100644 --- a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts @@ -23,7 +23,7 @@ export class FurnitureWallDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -55,7 +55,7 @@ export class FurnitureWallDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = parseInt(wrapper.readString()); this._spriteId = wrapper.readInt(); @@ -68,35 +68,35 @@ export class FurnitureWallDataParser const state = parseFloat(this._stuffData); - if (!isNaN(state)) this._state = state; + if(!isNaN(state)) this._state = state; - if (this._location.indexOf(':') === 0) + if(this._location.indexOf(':') === 0) { this._isOldFormat = false; let parts = this._location.split(' '); - if (parts.length >= 3) + if(parts.length >= 3) { let widthHeight = parts[0]; let leftRight = parts[1]; const direction = parts[2]; - if ((widthHeight.length > 3) && (leftRight.length > 2)) + if((widthHeight.length > 3) && (leftRight.length > 2)) { widthHeight = widthHeight.substr(3); leftRight = leftRight.substr(2); parts = widthHeight.split(','); - if (parts.length >= 2) + if(parts.length >= 2) { const width = parseInt(parts[0]); const height = parseInt(parts[1]); parts = leftRight.split(','); - if (parts.length >= 2) + if(parts.length >= 2) { const localX = parseInt(parts[0]); const localY = parseInt(parts[1]); diff --git a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts index f8a4d961..413e7e1c 100644 --- a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts @@ -16,21 +16,21 @@ export class FurnitureWallParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; - if (!this.parseOwners(wrapper)) return false; + if(!this.parseOwners(wrapper)) return false; let totalItems = wrapper.readInt(); - while (totalItems > 0) + while(totalItems > 0) { const item = new FurnitureWallDataParser(wrapper); - if (!item) continue; + if(!item) continue; const username = this._owners.get(item.userId); - if (username) item.username = username; + if(username) item.username = username; this._items.push(item); @@ -42,11 +42,11 @@ export class FurnitureWallParser implements IMessageParser private parseOwners(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalOwners = wrapper.readInt(); - while (totalOwners > 0) + while(totalOwners > 0) { this._owners.set(wrapper.readInt(), wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts index 91ddd506..7ccada53 100644 --- a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts @@ -15,7 +15,7 @@ export class FurnitureWallRemoveParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._itemId = parseInt(wrapper.readString()); this._userId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts index ed766477..c9b15291 100644 --- a/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts @@ -14,7 +14,7 @@ export class FurnitureWallUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._item = new FurnitureWallDataParser(wrapper); this._item.username = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts b/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts index b1083a2f..b2e01a23 100644 --- a/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts @@ -20,7 +20,7 @@ export class YoutubeDisplayPlaylistsMessageParser implements IMessageParser this._furniId = wrapper.readInt(); const count = wrapper.readInt(); this._playlists = []; - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._playlists.push(new YoutubeDisplayPlaylist(wrapper.readString(), wrapper.readString(), wrapper.readString())); } diff --git a/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts b/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts index f7080745..4b12f967 100644 --- a/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts @@ -26,7 +26,7 @@ export class FloorHeightMapMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const scale = wrapper.readBoolean(); const wallHeight = wrapper.readInt(); @@ -54,11 +54,11 @@ export class FloorHeightMapMessageParser implements IMessageParser let iterator = 0; - while (iterator < modelRows) + while(iterator < modelRows) { const row = model[iterator]; - if (row.length > width) + if(row.length > width) { width = row.length; } @@ -69,13 +69,13 @@ export class FloorHeightMapMessageParser implements IMessageParser this._heightMap = []; iterator = 0; - while (iterator < modelRows) + while(iterator < modelRows) { const heightMap: number[] = []; let subIterator = 0; - while (subIterator < width) + while(subIterator < width) { heightMap.push(FloorHeightMapMessageParser.TILE_BLOCKED); @@ -92,21 +92,21 @@ export class FloorHeightMapMessageParser implements IMessageParser iterator = 0; - while (iterator < modelRows) + while(iterator < modelRows) { const heightMap = this._heightMap[iterator]; const text = model[iterator]; - if (text.length > 0) + if(text.length > 0) { let subIterator = 0; - while (subIterator < text.length) + while(subIterator < text.length) { const char = text.charAt(subIterator); let height = FloorHeightMapMessageParser.TILE_BLOCKED; - if ((char !== 'x') && (char !== 'X')) height = parseInt(char, 36); + if((char !== 'x') && (char !== 'X')) height = parseInt(char, 36); heightMap[subIterator] = height; @@ -122,15 +122,15 @@ export class FloorHeightMapMessageParser implements IMessageParser public getHeight(x: number, y: number): number { - if ((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -110; + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -110; const row = this._heightMap[y]; - if (row === undefined) return -110; + if(row === undefined) return -110; const height = row[x]; - if (height === undefined) return -110; + if(height === undefined) return -110; return height; } diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts index a471ad23..d574ffbe 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts @@ -17,7 +17,7 @@ export class RoomEntryTileMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._x = wrapper.readInt(); this._y = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts index e650f0fb..bd0817d5 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts @@ -23,21 +23,21 @@ export class RoomHeightMapParser implements IMessageParser public getTileHeight(x: number, y: number): number { - if ((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -1; + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -1; return RoomHeightMapParser.decodeTileHeight(this._heights[((y * this._width) + x)]); } public getStackingBlocked(x: number, y: number): boolean { - if ((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return true; + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return true; return RoomHeightMapParser.decodeIsStackingBlocked(this._heights[((y * this._width) + x)]); } public isRoomTile(x: number, y: number): boolean { - if ((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return false; + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return false; return RoomHeightMapParser.decodeIsRoomTile(this._heights[((y * this._width) + x)]); } @@ -53,7 +53,7 @@ export class RoomHeightMapParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._width = wrapper.readInt(); const totalTiles = wrapper.readInt(); @@ -61,7 +61,7 @@ export class RoomHeightMapParser implements IMessageParser let i = 0; - while (i < totalTiles) + while(i < totalTiles) { this._heights[i] = wrapper.readShort(); diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts index 8fb2d864..a8b0a685 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts @@ -37,7 +37,7 @@ export class RoomHeightMapUpdateParser implements IMessageParser public next(): boolean { - if (!this._count) return false; + if(!this._count) return false; this._count--; @@ -50,7 +50,7 @@ export class RoomHeightMapUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._wrapper = wrapper; this._count = wrapper.readByte(); diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts index a1a1ac87..1ba34670 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts @@ -13,16 +13,16 @@ export class RoomOccupiedTilesMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let tilesCount = wrapper.readInt(); - while (tilesCount > 0) + while(tilesCount > 0) { const x = wrapper.readInt(); const y = wrapper.readInt(); - if (!this._blockedTilesMap[y]) this._blockedTilesMap[y] = []; + if(!this._blockedTilesMap[y]) this._blockedTilesMap[y] = []; this._blockedTilesMap[y][x] = true; diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts index 56f3428a..ce1e420c 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts @@ -19,12 +19,12 @@ export class RoomPaintParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; const type = wrapper.readString(); const value = wrapper.readString(); - switch (type) + switch(type) { case 'floor': this._floorType = value; diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts index df83099f..94b6801e 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts @@ -15,7 +15,7 @@ export class RoomReadyMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._name = wrapper.readString(); this._roomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts index 716550bc..9b09466c 100644 --- a/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts +++ b/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts @@ -17,7 +17,7 @@ export class RoomVisualizationSettingsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._hideWalls = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts b/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts index 107194b9..6c6d40fa 100644 --- a/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts +++ b/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts @@ -10,7 +10,7 @@ export class BreedingPetInfo constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._webId = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts b/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts index b1292c49..b41443cf 100644 --- a/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts +++ b/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts @@ -16,7 +16,7 @@ export class PetExperienceParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._petId = wrapper.readInt(); this._roomIndex = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts b/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts index 1fc26a18..4109bf6d 100644 --- a/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts @@ -16,7 +16,7 @@ export class PetFigureUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomIndex = wrapper.readInt(); this._petId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts b/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts index 4cda7f67..bf582f43 100644 --- a/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts +++ b/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts @@ -40,7 +40,7 @@ export class PetInfoParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); this._name = wrapper.readString(); @@ -62,7 +62,7 @@ export class PetInfoParser implements IMessageParser let total = wrapper.readInt(); - while (total > 0) + while(total > 0) { this._skillThresholds.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts b/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts index 4ebf593c..80e241fa 100644 --- a/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts +++ b/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts @@ -23,7 +23,7 @@ export class PetStatusUpdateParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomIndex = wrapper.readInt(); this._petId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts b/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts index 577603e4..4b7ade33 100644 --- a/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts +++ b/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts @@ -7,14 +7,14 @@ export class RarityCategoryData constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._chance = wrapper.readInt(); this._breeds = []; let totalCount = wrapper.readInt(); - while (totalCount > 0) + while(totalCount > 0) { this._breeds.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts b/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts index a283af06..14c6d85d 100644 --- a/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts +++ b/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts @@ -13,7 +13,7 @@ export class YouArePlayingGameParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isPlaying = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts index 0e87c0e5..79c73961 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts @@ -15,7 +15,7 @@ export class RoomUnitDanceParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._danceId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts index dd741cc2..ce60cea4 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts @@ -17,7 +17,7 @@ export class RoomUnitEffectParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._effectId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts index aa886964..c993ba72 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts @@ -15,7 +15,7 @@ export class RoomUnitExpressionParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._expression = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts index bcd77035..965089ab 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts @@ -15,7 +15,7 @@ export class RoomUnitHandItemParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._handId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts index 2df439d7..3a1b9834 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts @@ -15,7 +15,7 @@ export class RoomUnitHandItemReceivedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._giverUserId = wrapper.readInt(); this._handItemType = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts index 4e2f0fa6..43b12a19 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts @@ -15,7 +15,7 @@ export class RoomUnitIdleParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._isIdle = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts index 96336c65..f0042c12 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts @@ -21,7 +21,7 @@ export class RoomUnitInfoParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._figure = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts index c6923caa..219c378e 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts @@ -15,7 +15,7 @@ export class RoomUnitNumberParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._value = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts index acf3f297..27255879 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts @@ -14,7 +14,7 @@ export class RoomUnitParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._users = []; @@ -22,7 +22,7 @@ export class RoomUnitParser implements IMessageParser let i = 0; - while (i < totalUsers) + while(i < totalUsers) { const id = wrapper.readInt(); const username = wrapper.readString(); @@ -46,7 +46,7 @@ export class RoomUnitParser implements IMessageParser this._users.push(user); - if (type === 1) + if(type === 1) { user.webID = id; user.userType = RoomObjectType.USER; @@ -57,14 +57,14 @@ export class RoomUnitParser implements IMessageParser const swimFigure = wrapper.readString(); - if (swimFigure !== '') figure = this.convertSwimFigure(swimFigure, figure, user.sex); + if(swimFigure !== '') figure = this.convertSwimFigure(swimFigure, figure, user.sex); user.figure = figure; user.activityPoints = wrapper.readInt(); user.isModerator = wrapper.readBoolean(); } - else if (type === 2) + else if(type === 2) { user.userType = RoomObjectType.PET; user.figure = figure; @@ -83,18 +83,18 @@ export class RoomUnitParser implements IMessageParser user.petPosture = wrapper.readString(); } - else if (type === 3) + else if(type === 3) { user.userType = RoomObjectType.BOT; user.webID = (roomIndex * -1); - if (figure.indexOf('/') === -1) user.figure = figure; + if(figure.indexOf('/') === -1) user.figure = figure; else user.figure = 'hr-100-.hd-180-1.ch-876-66.lg-270-94.sh-300-64'; user.sex = UserMessageData.M; } - else if (type === 4) + else if(type === 4) { user.userType = RoomObjectType.RENTABLE_BOT; user.webID = id; @@ -105,13 +105,13 @@ export class RoomUnitParser implements IMessageParser const totalSkills = wrapper.readInt(); - if (totalSkills) + if(totalSkills) { const skills: number[] = []; let j = 0; - while (j < totalSkills) + while(j < totalSkills) { skills.push(wrapper.readShort()); @@ -130,7 +130,7 @@ export class RoomUnitParser implements IMessageParser private resolveSex(sex: string): string { - if (sex.substr(0, 1).toLowerCase() === 'f') return UserMessageData.F; + if(sex.substr(0, 1).toLowerCase() === 'f') return UserMessageData.F; return UserMessageData.M; } @@ -144,16 +144,16 @@ export class RoomUnitParser implements IMessageParser const _local_8 = 10000; let i = 0; - while (i < _local_4.length) + while(i < _local_4.length) { const _local_13 = _local_4[i]; const _local_14 = _local_13.split('-'); - if (_local_14.length > 2) + if(_local_14.length > 2) { const _local_15 = _local_14[0]; - if (_local_15 === 'hd') _local_5 = parseInt(_local_14[2]); + if(_local_15 === 'hd') _local_5 = parseInt(_local_14[2]); } i++; @@ -162,13 +162,13 @@ export class RoomUnitParser implements IMessageParser const _local_10 = ['238,238,238', '250,56,49', '253,146,160', '42,199,210', '53,51,44', '239,255,146', '198,255,152', '255,146,90', '157,89,126', '182,243,255', '109,255,51', '51,120,201', '255,182,49', '223,161,233', '249,251,50', '202,175,143', '197,198,197', '71,98,61', '138,131,97', '255,140,51', '84,198,39', '30,108,153', '152,79,136', '119,200,255', '255,192,142', '60,75,135', '124,44,71', '215,255,227', '143,63,28', '255,99,147', '31,155,121', '253,255,51']; const _local_11 = k.split('='); - if (_local_11.length > 1) + if(_local_11.length > 1) { const _local_16 = _local_11[1].split('/'); const _local_17 = _local_16[0]; const _local_18 = _local_16[1]; - if (_arg_3 === 'F') _local_7 = 10010; + if(_arg_3 === 'F') _local_7 = 10010; else _local_7 = 10011; const _local_19 = _local_10.indexOf(_local_18); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts index 9b13cb21..2329877a 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts @@ -13,7 +13,7 @@ export class RoomUnitRemoveParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = parseInt(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts b/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts index 12a1120e..c004dabd 100644 --- a/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts @@ -15,15 +15,15 @@ export class RoomUnitStatusParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalUnits = wrapper.readInt(); - while (totalUnits > 0) + while(totalUnits > 0) { const status = this.parseStatus(wrapper); - if (!status) + if(!status) { totalUnits--; @@ -40,7 +40,7 @@ export class RoomUnitStatusParser implements IMessageParser public parseStatus(wrapper: IMessageDataWrapper): RoomUnitStatusMessage { - if (!wrapper) return null; + if(!wrapper) return null; const unitId = wrapper.readInt(); const x = wrapper.readInt(); @@ -58,25 +58,25 @@ export class RoomUnitStatusParser implements IMessageParser let didMove = false; const isSlide = false; - if (actions) + if(actions) { const actionParts = actions.split('/'); const statusActions: RoomUnitStatusAction[] = []; - for (const action of actionParts) + for(const action of actionParts) { const parts = action.split(' '); - if (parts[0] === '') continue; + if(parts[0] === '') continue; - if (parts.length >= 2) + if(parts.length >= 2) { - switch (parts[0]) + switch(parts[0]) { case 'mv': { const values = parts[1].split(','); - if (values.length >= 3) + if(values.length >= 3) { targetX = parseInt(values[0]); targetY = parseInt(values[1]); @@ -89,7 +89,7 @@ export class RoomUnitStatusParser implements IMessageParser case 'sit': { const sitHeight = parseFloat(parts[1]); - if (parts.length >= 3) canStandUp = (parts[2] === '1'); + if(parts.length >= 3) canStandUp = (parts[2] === '1'); height = sitHeight; diff --git a/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts b/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts index d947234c..d57b3dd9 100644 --- a/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts @@ -13,7 +13,7 @@ export class FloodControlParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._seconds = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts b/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts index a526583b..321ca51c 100644 --- a/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts @@ -13,7 +13,7 @@ export class RemainingMuteParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._seconds = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts b/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts index ed97fb8a..f9538e56 100644 --- a/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts @@ -23,7 +23,7 @@ export class RoomUnitChatParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomIndex = wrapper.readInt(); this._message = wrapper.readString(); @@ -39,13 +39,13 @@ export class RoomUnitChatParser implements IMessageParser private parseUrls(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._urls = []; let totalUrls = wrapper.readInt(); - while (totalUrls > 0) + while(totalUrls > 0) { this._urls.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts b/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts index 25377cf5..6482cae3 100644 --- a/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts +++ b/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts @@ -15,7 +15,7 @@ export class RoomUnitTypingParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._unitId = wrapper.readInt(); this._isTyping = wrapper.readInt() === 1 ? true : false; diff --git a/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts b/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts index 77fac6f0..e226420a 100644 --- a/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts +++ b/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts @@ -15,7 +15,7 @@ export class TriggerDefinition extends Triggerable let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._conflictingActions.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/roomevents/Triggerable.ts b/src/nitro/communication/messages/parser/roomevents/Triggerable.ts index 47bebf07..fff5aab5 100644 --- a/src/nitro/communication/messages/parser/roomevents/Triggerable.ts +++ b/src/nitro/communication/messages/parser/roomevents/Triggerable.ts @@ -20,7 +20,7 @@ export class Triggerable let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._stuffIds.push(wrapper.readInt()); @@ -33,7 +33,7 @@ export class Triggerable count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._intParams.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts b/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts index d1668dd3..1a68d3cb 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts @@ -17,7 +17,7 @@ export class WiredActionDefinition extends Triggerable let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._conflictingTriggers.push(wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts index 0d18cfbb..b6cc0702 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts @@ -14,7 +14,7 @@ export class WiredFurniActionParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._definition = new WiredActionDefinition(wrapper); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts index ef9284d2..8898b812 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts @@ -14,7 +14,7 @@ export class WiredFurniConditionParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._definition = new ConditionDefinition(wrapper); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts index 1984dd4e..e43f2eab 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts @@ -14,7 +14,7 @@ export class WiredFurniTriggerParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._definition = new TriggerDefinition(wrapper); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts index de6315fc..176fbe19 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts @@ -13,7 +13,7 @@ export class WiredOpenParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._stuffId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts index a012959b..12dd05a6 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts @@ -13,7 +13,7 @@ export class WiredRewardResultMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._reason = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts index d7f544f9..ba81e3ee 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts @@ -9,7 +9,7 @@ export class WiredSaveSuccessParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts b/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts index 36f71a6b..21cbcbf7 100644 --- a/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts +++ b/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts @@ -13,7 +13,7 @@ export class WiredValidationErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._info = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts b/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts index 5cff08c1..b3406748 100644 --- a/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts @@ -16,13 +16,13 @@ export class BannedUsersFromRoomParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); let totalBans = wrapper.readInt(); - while (totalBans > 0) + while(totalBans > 0) { this._bannedUsers.push(new BannedUserData(wrapper)); diff --git a/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts index 5475b1cd..c34123c8 100644 --- a/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts @@ -16,7 +16,7 @@ export class FlatControllerAddedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._data = new FlatControllerData(wrapper); diff --git a/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts index 018b9dd0..7005e12b 100644 --- a/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts @@ -15,7 +15,7 @@ export class FlatControllerRemovedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._userId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts b/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts index 86954132..f3628436 100644 --- a/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts @@ -15,13 +15,13 @@ export class FlatControllersParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); let usersCount = wrapper.readInt(); - while (usersCount > 0) + while(usersCount > 0) { const id = wrapper.readInt(); const name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts b/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts index d0685739..beb38144 100644 --- a/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts @@ -11,7 +11,7 @@ export class MuteAllInRoomParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._isMuted = wrapper.readBoolean(); diff --git a/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts b/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts index c72dccbc..ca8255fd 100644 --- a/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts @@ -13,7 +13,7 @@ export class NoSuchFlatParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts b/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts index 6e69d61a..c19ea551 100644 --- a/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts @@ -22,7 +22,7 @@ export class RoomChatSettings constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this._mode = wrapper.readInt(); this._weight = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts index da7dd24a..238be33d 100644 --- a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts @@ -16,7 +16,7 @@ export class RoomSettingsDataParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomSettingsData = new RoomSettingsData(); @@ -31,7 +31,7 @@ export class RoomSettingsDataParser implements IMessageParser let totalTags = wrapper.readInt(); - while (totalTags > 0) + while(totalTags > 0) { this._roomSettingsData.tags.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts index b08e5e26..5b119e0c 100644 --- a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts @@ -15,7 +15,7 @@ export class RoomSettingsErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._code = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts index eacb4e95..3dc32945 100644 --- a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts @@ -31,7 +31,7 @@ export class RoomSettingsSaveErrorParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._code = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts index 9154e0f2..62d68776 100644 --- a/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts @@ -13,7 +13,7 @@ export class RoomSettingsSavedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts b/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts index 2fd40fc5..3bcbc85d 100644 --- a/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts @@ -13,7 +13,7 @@ export class ShowEnforceRoomCategoryDialogParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._selectionType = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts b/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts index f7a191ff..3dcf17d7 100644 --- a/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts +++ b/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts @@ -15,7 +15,7 @@ export class UserUnbannedFromRoomParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._roomId = wrapper.readInt(); this._userId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts b/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts index 52e87f65..c5c4f73d 100644 --- a/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts +++ b/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts @@ -9,7 +9,7 @@ export class AuthenticatedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; return true; } diff --git a/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts index d7754abf..d730833d 100644 --- a/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts @@ -17,7 +17,7 @@ export class JukeboxSongDisksMessageParser implements IMessageParser this._maxLength = wrapper.readInt(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._songDisks.set(wrapper.readInt(), wrapper.readInt()); } diff --git a/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts b/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts index b4a7ca90..a6051a4e 100644 --- a/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts @@ -18,7 +18,7 @@ export class PlayListMessageParser implements IMessageParser this._synchronizationCount = wrapper.readInt(); const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { this._playlist.push(new PlayListEntry( wrapper.readInt(), wrapper.readInt(), wrapper.readString(), wrapper.readString() diff --git a/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts b/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts index 93845bf7..d31c63bf 100644 --- a/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts @@ -14,7 +14,7 @@ export class TraxSongInfoMessageParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { const count = wrapper.readInt(); - for (let i = 0; i < count; i++) + for(let i = 0; i < count; i++) { const id = wrapper.readInt(); const _local_3 = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts index 763a7d34..a9d302d6 100644 --- a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts @@ -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/talent/TalentTrackParser.ts b/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts index 921ca812..ccf70477 100644 --- a/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts +++ b/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts @@ -18,14 +18,14 @@ export class TalentTrackParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._type = wrapper.readString(); this._levels = []; const levelsCount = wrapper.readInt(); - for (let i = 0; i < levelsCount; i++) + for(let i = 0; i < levelsCount; i++) { const levelId = wrapper.readInt(); const levelState = wrapper.readInt(); @@ -33,7 +33,7 @@ export class TalentTrackParser implements IMessageParser const levelAchievements: TalentTrackTask[] = []; const achievementsCount = wrapper.readInt(); - for (let j = 0; j < achievementsCount; j++) + for(let j = 0; j < achievementsCount; j++) { const id = wrapper.readInt(); const index = wrapper.readInt(); @@ -48,12 +48,12 @@ export class TalentTrackParser implements IMessageParser const levelPerks: string[] = []; const perksCount = wrapper.readInt(); - for (let j = 0; j < perksCount; j++) levelPerks.push(wrapper.readString()); + for(let j = 0; j < perksCount; j++) levelPerks.push(wrapper.readString()); const levelItems: TalentTrackRewardProduct[] = []; const itemsCount = wrapper.readInt(); - for (let j = 0; j < itemsCount; j++) + for(let j = 0; j < itemsCount; j++) { const name = wrapper.readString(); const unknownInt = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts b/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts index 47cf38d2..e6ddad7a 100644 --- a/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts +++ b/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts @@ -15,7 +15,7 @@ export class ApproveNameResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); this._validationInfo = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts b/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts index e239d4cf..0d5dccdd 100644 --- a/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts @@ -14,11 +14,11 @@ export class GuildMembershipsMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalOffers = wrapper.readInt(); - while (totalOffers > 0) + while(totalOffers > 0) { this._groups.push(new HabboGroupEntryData(wrapper)); diff --git a/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts b/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts index 959749cd..14071cd9 100644 --- a/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts @@ -13,11 +13,11 @@ export class HabboGroupBadgesMessageParser implements IMessageParser parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let badgesCount = wrapper.readInt(); - while (badgesCount > 0) + while(badgesCount > 0) { const id = wrapper.readInt(); const badge = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts b/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts index 280dec83..f122ced3 100644 --- a/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts +++ b/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts @@ -15,7 +15,7 @@ export class IgnoreResultParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._result = wrapper.readInt(); this._name = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts b/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts index 4c3aadfe..2821a777 100644 --- a/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts +++ b/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts @@ -13,13 +13,13 @@ export class IgnoredUsersParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._ignoredUsers = []; let count = wrapper.readInt(); - while (count > 0) + while(count > 0) { this._ignoredUsers.push(wrapper.readString()); diff --git a/src/nitro/communication/messages/parser/user/InClientLinkParser.ts b/src/nitro/communication/messages/parser/user/InClientLinkParser.ts index f340bac8..009062be 100644 --- a/src/nitro/communication/messages/parser/user/InClientLinkParser.ts +++ b/src/nitro/communication/messages/parser/user/InClientLinkParser.ts @@ -12,7 +12,7 @@ export class InClientLinkParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._link = wrapper.readString(); return true; diff --git a/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts b/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts index d42eed24..c8404c1c 100644 --- a/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts +++ b/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts @@ -18,7 +18,7 @@ export class PetRespectNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._respect = wrapper.readInt(); this._petOwnerId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts b/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts index 34131864..9aaf64b7 100644 --- a/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts +++ b/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts @@ -17,7 +17,7 @@ export class PetSupplementedNotificationParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._petId = wrapper.readInt(); this._userId = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts b/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts index 5f5394d8..0c4b0efb 100644 --- a/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts +++ b/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts @@ -15,7 +15,7 @@ export class RespectReceivedParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); this._respectsReceived = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts b/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts index 8c805c8b..f40e4065 100644 --- a/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts +++ b/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts @@ -17,7 +17,7 @@ export class UserPermissionsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._clubLevel = wrapper.readInt(); this._securityLevel = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts index e2fd16ae..04a4e01e 100644 --- a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts +++ b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts @@ -10,7 +10,7 @@ export class RelationshipStatusInfo constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -29,7 +29,7 @@ export class RelationshipStatusInfo public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._relationshipStatusType = wrapper.readInt(); this._friendCount = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts index 9739e909..cf70f9ae 100644 --- a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts @@ -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); diff --git a/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts b/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts index 8e3d595b..efa5ff5e 100644 --- a/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts @@ -15,13 +15,13 @@ export class UserCurrentBadgesParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); let totalBadges = wrapper.readInt(); - while (totalBadges > 0) + while(totalBadges > 0) { const slotId = wrapper.readInt(); const badgeCode = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts b/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts index 75f2631f..d1bdf82b 100644 --- a/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts @@ -15,7 +15,7 @@ export class UserFigureParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._figure = wrapper.readString(); this._gender = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts b/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts index 25da08ba..c6b7dfd5 100644 --- a/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts @@ -19,7 +19,7 @@ export class UserInfoDataParser constructor(wrapper: IMessageDataWrapper) { - if (!wrapper) throw new Error('invalid_wrapper'); + if(!wrapper) throw new Error('invalid_wrapper'); this.flush(); this.parse(wrapper); @@ -47,7 +47,7 @@ export class UserInfoDataParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userId = wrapper.readInt(); this._username = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts b/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts index c53097ef..27dce1f1 100644 --- a/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts @@ -14,11 +14,11 @@ export class UserInfoParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._userInfo = new UserInfoDataParser(wrapper); - if (!this._userInfo) return false; + if(!this._userInfo) return false; return true; } diff --git a/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts b/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts index 178486a7..0f77f698 100644 --- a/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts @@ -17,7 +17,7 @@ export class UserNameChangeMessageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._webId = wrapper.readInt(); this._id = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts b/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts index 5e74e629..2837394b 100644 --- a/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts @@ -38,7 +38,7 @@ export class UserProfileParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._id = wrapper.readInt(); this._username = wrapper.readString(); @@ -52,7 +52,7 @@ export class UserProfileParser implements IMessageParser this._isOnline = wrapper.readBoolean(); const groupsCount = wrapper.readInt(); - for (let i = 0; i < groupsCount; i++) + for(let i = 0; i < groupsCount; i++) { this._groups.push(new HabboGroupEntryData(wrapper)); } diff --git a/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts b/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts index 04a8c951..aa0e9731 100644 --- a/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts +++ b/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts @@ -27,7 +27,7 @@ export class UserSettingsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._volumeSystem = wrapper.readInt(); this._volumeFurni = wrapper.readInt(); diff --git a/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts b/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts index 35dff359..c3f5c7c6 100644 --- a/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts +++ b/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts @@ -13,7 +13,7 @@ export class UserCreditsParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._credits = wrapper.readString(); diff --git a/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts b/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts index 8599887b..8b64e3a5 100644 --- a/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts +++ b/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts @@ -13,11 +13,11 @@ export class UserCurrencyParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; let totalCurrencies = wrapper.readInt(); - while (totalCurrencies > 0) + while(totalCurrencies > 0) { this._currencies.set(wrapper.readInt(), wrapper.readInt()); diff --git a/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts b/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts index f7ba235d..c4103bcb 100644 --- a/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts +++ b/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts @@ -38,7 +38,7 @@ export class UserSubscriptionParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; this._productName = wrapper.readString(); this._daysToPeriodEnd = wrapper.readInt(); @@ -51,7 +51,7 @@ export class UserSubscriptionParser implements IMessageParser this._pastVipDays = wrapper.readInt(); this._minutesUntilExpiration = wrapper.readInt(); - if (wrapper.bytesAvailable) this._minutesSinceLastModified = wrapper.readInt(); + if(wrapper.bytesAvailable) this._minutesSinceLastModified = wrapper.readInt(); return true; } diff --git a/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts b/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts index f42b9518..42dc6718 100644 --- a/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts +++ b/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts @@ -13,13 +13,13 @@ export class UserWardrobePageParser implements IMessageParser public parse(wrapper: IMessageDataWrapper): boolean { - if (!wrapper) return false; + if(!wrapper) return false; wrapper.readInt(); let totalLooks = wrapper.readInt(); - while (totalLooks > 0) + while(totalLooks > 0) { const slotId = wrapper.readInt(); const look = wrapper.readString(); diff --git a/src/nitro/game/GameMessageHandler.ts b/src/nitro/game/GameMessageHandler.ts index e12dc1a1..04c6efa3 100644 --- a/src/nitro/game/GameMessageHandler.ts +++ b/src/nitro/game/GameMessageHandler.ts @@ -11,11 +11,11 @@ export class GameMessageHandler private onLoadGameUrl(event: LoadGameUrlEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; LegacyExternalInterface.callGame('showGame', parser.url); } diff --git a/src/nitro/localization/NitroLocalizationManager.ts b/src/nitro/localization/NitroLocalizationManager.ts index 6534a6f4..867308ef 100644 --- a/src/nitro/localization/NitroLocalizationManager.ts +++ b/src/nitro/localization/NitroLocalizationManager.ts @@ -32,12 +32,12 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca let urls: string[] = Nitro.instance.getConfiguration('external.texts.url'); - if (!Array.isArray(urls)) + if(!Array.isArray(urls)) { urls = [Nitro.instance.getConfiguration('external.texts.url')]; } - for (let i = 0; i < urls.length; i++) urls[i] = Nitro.instance.core.configuration.interpolate(urls[i]); + for(let i = 0; i < urls.length; i++) urls[i] = Nitro.instance.core.configuration.interpolate(urls[i]); this._pendingUrls = urls; @@ -46,7 +46,7 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca private loadNextLocalization(): void { - if (!this._pendingUrls.length) + if(!this._pendingUrls.length) { this.events && this.events.dispatchEvent(new NitroLocalizationEvent(NitroLocalizationEvent.LOADED)); @@ -66,13 +66,13 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca private onLocalizationLoaded(data: { [index: string]: any }, url: string): void { - if (!data) return; + if(!data) return; - if (!this.parseLocalization(data)) throw new Error(`Invalid json data for file ${url}`); + 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); + if(index >= 0) this._pendingUrls.splice(index, 1); this.loadNextLocalization(); } @@ -84,9 +84,9 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca private parseLocalization(data: { [index: string]: any }): boolean { - if (!data) return false; + if(!data) return false; - for (const key in data) this._definitions.set(key, data[key]); + for(const key in data) this._definitions.set(key, data[key]); return true; } @@ -95,7 +95,7 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca { const parser = event.getParser(); - for (const data of parser.data) this.setBadgePointLimit(data.badgeId, data.limit); + for(const data of parser.data) this.setBadgePointLimit(data.badgeId, data.limit); } public getBadgePointLimit(badge: string): number @@ -129,31 +129,31 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca public getValue(key: string, doParams: boolean = true): string { - if (!key || !key.length) return null; + if(!key || !key.length) return null; const keys = key.match(/\$\{.[^}]*\}/g); - if (keys && keys.length) + if(keys && keys.length) { - for (const splitKey of keys) key = key.replace(splitKey, this.getValue(splitKey.slice(2, -1), doParams)); + for(const splitKey of keys) key = key.replace(splitKey, this.getValue(splitKey.slice(2, -1), doParams)); } let value = (this._definitions.get(key) || null); - if (!value) + if(!value) { value = (Nitro.instance.core.configuration.definitions.get(key) as any); - if (value) return value; + if(value) return value; } - if (value && doParams) + if(value && doParams) { const parameters = this._parameters.get(key); - if (parameters) + if(parameters) { - for (const [parameter, replacement] of parameters) + for(const [parameter, replacement] of parameters) { value = value.replace('%' + parameter + '%', replacement); } @@ -169,7 +169,7 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca const replacedValue = value.replace('%' + parameter + '%', replacement); - if (value.startsWith('%{')) + if(value.startsWith('%{')) { // This adds support for multi-optioned texts like // catalog.vip.item.header.months=%{NUM_MONTHS|0 months|1 month|%% months} @@ -181,13 +181,13 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca const regex = new RegExp('%{' + parameter.toUpperCase() + '\\|([^|]*)\\|([^|]*)\\|([^|]*)}'); const result = value.match(regex); - if (!result) return replacedValue; + if(!result) return replacedValue; let indexKey = -1; const replacementAsNumber = Number.parseInt(replacement); let replace = false; - switch (replacementAsNumber) + switch(replacementAsNumber) { case 0: indexKey = 1; @@ -203,14 +203,14 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca } - if (indexKey == -1 || typeof result[indexKey] == 'undefined') + if(indexKey == -1 || typeof result[indexKey] == 'undefined') { return replacedValue; } const valueFromResults = result[indexKey]; - if (valueFromResults) + if(valueFromResults) { return valueFromResults.replace('%%', replacement); } @@ -223,30 +223,30 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca { let value = this.getValue(key, false); - if (parameters) + if(parameters) { - for (let i = 0; i < parameters.length; i++) + for(let i = 0; i < parameters.length; i++) { const parameter = parameters[i]; const replacement = replacements[i]; - if (replacement === undefined) continue; + if(replacement === undefined) continue; value = value.replace('%' + parameter + '%', replacement); - if (value.startsWith('%{')) + if(value.startsWith('%{')) { const regex = new RegExp('%{' + parameter.toUpperCase() + '\\|([^|]*)\\|([^|]*)\\|([^|]*)}'); const result = value.match(regex); - if (!result) continue; + if(!result) continue; const replacementAsNumber = parseInt(replacement); let indexKey = -1; let replace = false; - switch (replacementAsNumber) + switch(replacementAsNumber) { case 0: indexKey = 1; @@ -262,11 +262,11 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca } - if ((indexKey === -1) || (typeof result[indexKey] === 'undefined')) continue; + if((indexKey === -1) || (typeof result[indexKey] === 'undefined')) continue; const valueFromResults = result[indexKey]; - if (valueFromResults) + if(valueFromResults) { value = valueFromResults.replace('%%', replacement); } @@ -284,11 +284,11 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca public registerParameter(key: string, parameter: string, value: string): void { - if (!key || (key.length === 0) || !parameter || (parameter.length === 0)) return; + if(!key || (key.length === 0) || !parameter || (parameter.length === 0)) return; let existing = this._parameters.get(key); - if (!existing) + if(!existing) { existing = new Map(); @@ -319,7 +319,7 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca const limit = this.getBadgePointLimit(key); - if (limit > -1) desc = desc.replace('%limit%', limit.toString()); + if(limit > -1) desc = desc.replace('%limit%', limit.toString()); desc = desc.replace('%roman%', this.getRomanNumeral(badge.level)); @@ -328,10 +328,10 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca private getExistingKey(keys: string[]): string { - for (const entry of keys) + for(const entry of keys) { const item = this.getValue(entry); - if (item != entry) return item; + if(item != entry) return item; } return ''; diff --git a/src/nitro/room/ImageResult.ts b/src/nitro/room/ImageResult.ts index 0ebde09d..b59e4961 100644 --- a/src/nitro/room/ImageResult.ts +++ b/src/nitro/room/ImageResult.ts @@ -10,9 +10,9 @@ export class ImageResult implements IImageResult public getImage(): HTMLImageElement { - if (this.image) return this.image; + if(this.image) return this.image; - if (!this.data) return null; + if(!this.data) return null; return TextureUtils.generateImage(this.data); } diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index 77700303..3f96b111 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -81,7 +81,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo this.setFurnitureData(); - for (const [index, name] of Nitro.instance.getConfiguration('pet.types').entries()) this._pets[name] = index; + for(const [index, name] of Nitro.instance.getConfiguration('pet.types').entries()) this._pets[name] = index; } public dispose(): void @@ -93,7 +93,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { this._sessionDataManager = sessionData; - if (this._waitingForSessionDataManager) + if(this._waitingForSessionDataManager) { this._waitingForSessionDataManager = false; @@ -108,7 +108,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo private setFurnitureData(): void { - if (!this._sessionDataManager) + if(!this._sessionDataManager) { this._waitingForSessionDataManager = true; @@ -117,7 +117,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo const furnitureData = this._sessionDataManager.getAllFurnitureData(this); - if (!furnitureData) return; + if(!furnitureData) return; this._sessionDataManager.removePendingFurniDataListener(this); @@ -128,42 +128,42 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo private processFurnitureData(furnitureData: IFurnitureData[]): void { - if (!furnitureData) return; + if(!furnitureData) return; - for (const furniture of furnitureData) + for(const furniture of furnitureData) { - if (!furniture) continue; + if(!furniture) continue; const id = furniture.id; let className = furniture.className; - if (furniture.hasIndexedColor) className = ((className + '*') + furniture.colorIndex); + if(furniture.hasIndexedColor) className = ((className + '*') + furniture.colorIndex); const revision = furniture.revision; const adUrl = furniture.adUrl; - if (adUrl && adUrl.length > 0) this._objectTypeAdUrls.set(className, adUrl); + if(adUrl && adUrl.length > 0) this._objectTypeAdUrls.set(className, adUrl); let name = furniture.className; - if (furniture.type === FurnitureType.FLOOR) + if(furniture.type === FurnitureType.FLOOR) { this._activeObjectTypes.set(id, className); this._activeObjectTypeIds.set(className, id); - if (!this._activeObjects[name]) this._activeObjects[name] = 1; + if(!this._activeObjects[name]) this._activeObjects[name] = 1; } - else if (furniture.type === FurnitureType.WALL) + else if(furniture.type === FurnitureType.WALL) { - if (name === 'post.it') + if(name === 'post.it') { className = 'post_it'; name = 'post_it'; } - if (name === 'post.it.vd') + if(name === 'post.it.vd') { className = 'post_it_vd'; name = 'post_id_vd'; @@ -172,12 +172,12 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo this._wallItemTypes.set(id, className); this._wallItemTypeIds.set(className, id); - if (!this._wallItems[name]) this._wallItems[name] = 1; + if(!this._wallItems[name]) this._wallItems[name] = 1; } const existingRevision = this._furniRevisions.get(name); - if (revision > existingRevision) + if(revision > existingRevision) { this._furniRevisions.delete(name); this._furniRevisions.set(name, revision); @@ -196,7 +196,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { let type = this._wallItemTypes.get(typeId); - if ((type === 'poster') && (extra !== null)) type = (type + extra); + if((type === 'poster') && (extra !== null)) type = (type + extra); return this.removeColorIndex(type); } @@ -205,7 +205,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const type = this._activeObjectTypes.get(typeId); - if (!type) return -1; + if(!type) return -1; return this.getColorIndexFromName(type); } @@ -214,29 +214,29 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const type = this._wallItemTypes.get(typeId); - if (!type) return -1; + if(!type) return -1; return this.getColorIndexFromName(type); } private getColorIndexFromName(name: string): number { - if (!name) return -1; + if(!name) return -1; const index = name.indexOf('*'); - if (index === -1) return 0; + if(index === -1) return 0; return parseInt(name.substr(index + 1)); } private removeColorIndex(name: string): string { - if (!name) return null; + if(!name) return null; const index = name.indexOf('*'); - if (index === -1) return name; + if(index === -1) return name; return name.substr(0, index); } @@ -245,7 +245,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const value = this._objectTypeAdUrls.get(type); - if (!value) return ''; + if(!value) return ''; return value; } @@ -254,7 +254,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const colorResults = this._petColors.get(petIndex); - if (!colorResults) return null; + if(!colorResults) return null; return colorResults.get(paletteIndex); } @@ -264,11 +264,11 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo const colorResults = this._petColors.get(petIndex); const results: IPetColorResult[] = []; - if (colorResults) + if(colorResults) { - for (const result of colorResults.values()) + for(const result of colorResults.values()) { - if (result.tag === tagName) results.push(result); + if(result.tag === tagName) results.push(result); } } @@ -277,15 +277,15 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo public getCollection(name: string): IGraphicAssetCollection { - if (!name) return null; + if(!name) return null; const existing = this._collections.get(name); - if (!existing) + if(!existing) { const globalCollection = Nitro.instance.core.asset.getCollection(name); - if (globalCollection) + if(globalCollection) { this._collections.set(name, globalCollection); @@ -300,18 +300,18 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo public getGifCollection(name: string): IGraphicAssetGifCollection { - if (!name) return null; + if(!name) return null; return this._gifCollections.get(name) || null; } public getImage(name: string): HTMLImageElement { - if (!name) return null; + if(!name) return null; const existing = this._images.get(name); - if (!existing) return null; + if(!existing) return null; const image = new Image(); @@ -324,14 +324,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const collection = this.getCollection(collectionName); - if (!collection) return false; + if(!collection) return false; return collection.addAsset(assetName, texture, override, 0, 0, false, false); } public createGifCollection(collectionName: string, textures: Texture[], durations: number[]): GraphicAssetGifCollection { - if (!collectionName || !textures || !durations) return null; + if(!collectionName || !textures || !durations) return null; const collection = new GraphicAssetGifCollection(collectionName, textures, durations); @@ -342,7 +342,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo private createCollection(data: IAssetData, spritesheet: Spritesheet): GraphicAssetCollection { - if (!data || !spritesheet) return null; + if(!data || !spritesheet) return null; const collection = new GraphicAssetCollection(data, spritesheet); @@ -350,12 +350,12 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo const petIndex = this._pets[collection.name]; - if (petIndex !== undefined) + if(petIndex !== undefined) { const keys = collection.getPaletteNames(); const palettes: Map = new Map(); - for (const key of keys) + for(const key of keys) { const palette = collection.getPalette(key); const paletteData = data.palettes[key]; @@ -378,14 +378,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const category = this.getCategoryForType(type); - switch (category) + switch(category) { case RoomObjectCategory.FLOOR: return RoomContentLoader.PLACE_HOLDER; case RoomObjectCategory.WALL: return RoomContentLoader.PLACE_HOLDER_WALL; default: - if (this._pets[type] !== undefined) return RoomContentLoader.PLACE_HOLDER_PET; + if(this._pets[type] !== undefined) return RoomContentLoader.PLACE_HOLDER_PET; return RoomContentLoader.PLACE_HOLDER_DEFAULT; } @@ -393,27 +393,27 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo public getCategoryForType(type: string): number { - if (!type) return RoomObjectCategory.MINIMUM; + if(!type) return RoomObjectCategory.MINIMUM; - if (this._activeObjects[type] !== undefined) return RoomObjectCategory.FLOOR; + if(this._activeObjects[type] !== undefined) return RoomObjectCategory.FLOOR; - if (this._wallItems[type] !== undefined) return RoomObjectCategory.WALL; + if(this._wallItems[type] !== undefined) return RoomObjectCategory.WALL; - if (this._pets[type] !== undefined) return RoomObjectCategory.UNIT; + if(this._pets[type] !== undefined) return RoomObjectCategory.UNIT; - if (type.indexOf('poster') === 0) return RoomObjectCategory.WALL; + if(type.indexOf('poster') === 0) return RoomObjectCategory.WALL; - if (type === 'room') return RoomObjectCategory.ROOM; + if(type === 'room') return RoomObjectCategory.ROOM; - if (type === RoomObjectUserType.USER) return RoomObjectCategory.UNIT; + if(type === RoomObjectUserType.USER) return RoomObjectCategory.UNIT; - if (type === RoomObjectUserType.PET) return RoomObjectCategory.UNIT; + if(type === RoomObjectUserType.PET) return RoomObjectCategory.UNIT; - if (type === RoomObjectUserType.BOT) return RoomObjectCategory.UNIT; + if(type === RoomObjectUserType.BOT) return RoomObjectCategory.UNIT; - if (type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT; + if(type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT; - if ((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR; + if((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR; return RoomObjectCategory.MINIMUM; } @@ -427,7 +427,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { type = RoomObjectUserType.getRealType(type); - if (type === RoomObjectVisualizationType.USER) return false; + if(type === RoomObjectVisualizationType.USER) return false; return true; } @@ -437,13 +437,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo let typeName: string = null; let assetUrls: string[] = []; - if (type && (type.indexOf(',') >= 0)) + if(type && (type.indexOf(',') >= 0)) { typeName = type; type = typeName.split(',')[0]; } - if (typeName) + if(typeName) { assetUrls = this.getAssetUrls(typeName, param, true); } @@ -452,7 +452,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo assetUrls = this.getAssetUrls(type, param, true); } - if (assetUrls && assetUrls.length) + if(assetUrls && assetUrls.length) { const url = assetUrls[0]; @@ -488,18 +488,18 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const assetUrls: string[] = this.getAssetUrls(type); - if (!assetUrls || !assetUrls.length) return; + if(!assetUrls || !assetUrls.length) return; - if ((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return; + if((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return; this._pendingContentTypes.push(type); this._events.set(type, events); const loader = new Loader(); - for (const url of assetUrls) + for(const url of assetUrls) { - if (!url || !url.length) continue; + if(!url || !url.length) continue; loader .add({ @@ -514,7 +514,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo const onDownloaded = (status: boolean, url: string) => { - if (!status) + if(!status) { this._logger.error('Failed to download asset', url); @@ -527,13 +527,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo remaining--; - if (!remaining) + if(!remaining) { loader.destroy(); const events = this._events.get(type); - if (!events) return; + if(!events) return; events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_SUCCESS, type)); @@ -543,11 +543,11 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo loader.load((loader, resources) => { - for (const key in resources) + for(const key in resources) { const resource = resources[key]; - if (!resource || resource.error || !resource.xhr) + if(!resource || resource.error || !resource.xhr) { onDownloaded(false, resource.url); @@ -556,7 +556,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo const resourceType = (resource.xhr.getResponseHeader('Content-Type') || 'application/octet-stream'); - if (resourceType === 'application/octet-stream') + if(resourceType === 'application/octet-stream') { const nitroBundle = new NitroBundle(resource.data); @@ -575,7 +575,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const spritesheetData = data.spritesheet; - if (!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) + if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) { this.createCollection(data, null); @@ -596,7 +596,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo }); }; - if (baseTexture.valid) + if(baseTexture.valid) { createAsset(); } @@ -616,7 +616,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const existing = this._objectAliases.get(name); - if (!existing) return name; + if(!existing) return name; return existing; } @@ -625,14 +625,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const existing = this._objectOriginalNames.get(name); - if (!existing) return name; + if(!existing) return name; return existing; } public getAssetUrls(type: string, param: string = null, icon: boolean = false): string[] { - switch (type) + switch(type) { case RoomContentLoader.PLACE_HOLDER: return [this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER)]; @@ -649,13 +649,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo default: { const category = this.getCategoryForType(type); - if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) { const name = this.getAssetAliasName(type); let assetUrl = (icon ? this.getAssetUrlWithFurniIconBase(name) : this.getAssetUrlWithFurniBase(type)); - if (icon) + if(icon) { const active = (param && (param !== '') && (this._activeObjectTypeIds.has((name + '*' + param)))); @@ -665,7 +665,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo return [assetUrl]; } - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { return [this.getAssetUrlWithPetBase(type)]; } @@ -680,14 +680,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo let assetName: string = null; let assetUrls: string[] = []; - if (type && (type.indexOf(',') >= 0)) + if(type && (type.indexOf(',') >= 0)) { assetName = type; type = assetName.split(',')[0]; } - if (assetName) + if(assetName) { assetUrls = this.getAssetUrls(assetName, colorIndex, true); } @@ -696,7 +696,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo assetUrls = this.getAssetUrls(type, colorIndex, true); } - if (assetUrls && assetUrls.length) return assetUrls[0]; + if(assetUrls && assetUrls.length) return assetUrls[0]; return null; } @@ -725,7 +725,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const model = object && object.model; - if (!model) return; + if(!model) return; model.setValue(RoomObjectVariable.OBJECT_ROOM_ID, roomId); } @@ -734,7 +734,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo { const existing = this._events.get(type); - if (remove) this._events.delete(type); + if(remove) this._events.delete(type); return existing; } diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index c07471ff..0da1ebdc 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -123,14 +123,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public onInit(): void { - if (this._ready) return; + if(this._ready) return; this._imageObjectIdBank = new NumberBank(1000); this._thumbnailObjectIdBank = new NumberBank(1000); this._logicFactory.registerEventFunction(this.processRoomObjectEvent); - if (this._roomManager) + if(this._roomManager) { this._roomManager.setContentLoader(this._roomContentLoader); this._roomManager.addUpdateCategory(RoomObjectCategory.FLOOR); @@ -146,7 +146,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this._roomContentLoader.setSessionDataManager(this._sessionDataManager); this._roomContentLoader.setIconListener(this); - if (this._roomSessionManager) + if(this._roomSessionManager) { this._roomSessionManager.events.addEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); this._roomSessionManager.events.addEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); @@ -161,9 +161,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public onDispose(): void { - if (!this._ready) return; + if(!this._ready) return; - for (const [key, value] of this._roomInstanceDatas) + for(const [key, value] of this._roomInstanceDatas) { this.removeRoomInstance(key); } @@ -172,15 +172,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato Nitro.instance.ticker.remove(this.update, this); - if (this._roomObjectEventHandler) this._roomObjectEventHandler.dispose(); + if(this._roomObjectEventHandler) this._roomObjectEventHandler.dispose(); - if (this._roomMessageHandler) this._roomMessageHandler.dispose(); + if(this._roomMessageHandler) this._roomMessageHandler.dispose(); - if (this._roomContentLoader) this._roomContentLoader.dispose(); + if(this._roomContentLoader) this._roomContentLoader.dispose(); this.events.removeEventListener(RoomContentLoader.LOADER_READY, this.onRoomContentLoaderReadyEvent); - if (this._roomSessionManager) + if(this._roomSessionManager) { this._roomSessionManager.events.removeEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); this._roomSessionManager.events.removeEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); @@ -191,15 +191,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private onRoomSessionEvent(event: RoomSessionEvent): void { - if (!(event instanceof RoomSessionEvent)) return; + if(!(event instanceof RoomSessionEvent)) return; - switch (event.type) + switch(event.type) { case RoomSessionEvent.STARTED: - if (this._roomMessageHandler) this._roomMessageHandler.setRoomId(event.session.roomId); + if(this._roomMessageHandler) this._roomMessageHandler.setRoomId(event.session.roomId); return; case RoomSessionEvent.ENDED: - if (this._roomMessageHandler) + if(this._roomMessageHandler) { this._roomMessageHandler.clearRoomId(); this.removeRoomInstance(event.session.roomId); @@ -234,14 +234,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (instance) + if(instance) { this._roomManager && this._roomManager.removeRoomInstance(this.getRoomId(roomId)); } const existing = this._roomInstanceDatas.get(roomId); - if (existing) + if(existing) { this._roomInstanceDatas.delete(existing.roomId); @@ -257,11 +257,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let wallType = '201'; let landscapeType = '1'; - if (!this._ready) + if(!this._ready) { let data = this._roomDatas.get(roomId); - if (data) + if(data) { this._roomDatas.delete(roomId); @@ -283,7 +283,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato return; } - if (!roomMap) + if(!roomMap) { this.logger.warn('Room property messages'); @@ -292,22 +292,22 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const data = this._roomDatas.get(roomId); - if (data) + if(data) { this._roomDatas.delete(roomId); - if (data.floorType) floorType = data.floorType; + if(data.floorType) floorType = data.floorType; - if (data.wallType) wallType = data.wallType; + if(data.wallType) wallType = data.wallType; - if (data.landscapeType) landscapeType = data.landscapeType; + if(data.landscapeType) landscapeType = data.landscapeType; } const instance = this.setupRoomInstance(roomId, roomMap, floorType, wallType, landscapeType, this.getRoomInstanceModelName(roomId)); - if (!instance) return; + if(!instance) return; - if (roomMap.restrictsDragging) + if(roomMap.restrictsDragging) { this._roomAllowsDragging = false; } @@ -321,11 +321,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private setupRoomInstance(roomId: number, roomMap: RoomMapData, floorType: string, wallType: string, landscapeType: string, worldType: string): IRoomInstance { - if (!this._ready || !this._roomManager) return; + if(!this._ready || !this._roomManager) return; const instance = this._roomManager.createRoomInstance(this.getRoomId(roomId)); - if (!instance) return null; + if(!instance) return null; const category = RoomObjectCategory.ROOM; @@ -334,7 +334,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato instance.model.setValue(RoomVariableEnum.ROOM_IS_PUBLIC, 0); instance.model.setValue(RoomVariableEnum.ROOM_Z_SCALE, 1); - if (roomMap) + if(roomMap) { instance.model.setValue(RoomVariableEnum.RESTRICTS_DRAGGING, roomMap.restrictsDragging); instance.model.setValue(RoomVariableEnum.RESTRICTS_SCALING, roomMap.restrictsScaling); @@ -342,7 +342,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const dimensions = roomMap.dimensions; - if (dimensions) + if(dimensions) { const minX = roomMap.dimensions.minX; const maxX = roomMap.dimensions.maxX; @@ -356,44 +356,44 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const seed = ((((minX * 423) + (maxX * 671)) + (minY * 913)) + (maxY * 7509)); - if (roomObject && roomObject.model) roomObject.model.setValue(RoomObjectVariable.ROOM_RANDOM_SEED, seed); + if(roomObject && roomObject.model) roomObject.model.setValue(RoomObjectVariable.ROOM_RANDOM_SEED, seed); } } const logic = (roomObject && roomObject.logic as RoomLogic) || null; - if (logic) + if(logic) { logic.initialize(roomMap); - if (floorType) + if(floorType) { logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE, floorType)); instance.model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, floorType); } - if (wallType) + if(wallType) { logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_WALL_UPDATE, wallType)); instance.model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, wallType); } - if (landscapeType) + if(landscapeType) { logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_LANDSCAPE_UPDATE, landscapeType)); instance.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, landscapeType); } } - if (roomMap && roomMap.doors.length) + if(roomMap && roomMap.doors.length) { let doorIndex = 0; - while (doorIndex < roomMap.doors.length) + while(doorIndex < roomMap.doors.length) { const door = roomMap.doors[doorIndex]; - if (door) + if(door) { const doorX = door.x; const doorY = door.y; @@ -405,15 +405,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato logic.processUpdateMessage(new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.ADD_MASK, maskId, maskType, maskLocation, ObjectRoomMaskUpdateMessage.HOLE)); - if ((doorDir === 90) || (doorDir === 180)) + if((doorDir === 90) || (doorDir === 180)) { - if (doorDir === 90) + if(doorDir === 90) { instance.model.setValue(RoomObjectVariable.ROOM_DOOR_X, (doorX - 0.5)); instance.model.setValue(RoomObjectVariable.ROOM_DOOR_Y, doorY); } - if (doorDir === 180) + if(doorDir === 180) { instance.model.setValue(RoomObjectVariable.ROOM_DOOR_X, doorX); instance.model.setValue(RoomObjectVariable.ROOM_DOOR_Y, (doorY - 0.5)); @@ -429,7 +429,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } instance.createRoomObjectAndInitalize(RoomEngine.CURSOR_OBJECT_ID, RoomEngine.CURSOR_OBJECT_TYPE, RoomObjectCategory.CURSOR); - if (Nitro.instance.getConfiguration('enable.avatar.arrow', false)) instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR); + if(Nitro.instance.getConfiguration('enable.avatar.arrow', false)) instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR); return instance; } @@ -438,15 +438,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; let renderer = instance.renderer as IRoomRenderer; - if (!renderer) + if(!renderer) { renderer = this._roomRendererFactory.createRenderer(); - if (!renderer) return null; + if(!renderer) return null; } renderer.roomObjectVariableAccurateZ = RoomObjectVariable.OBJECT_ACCURATE_Z_VALUE; @@ -455,15 +455,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const canvas = renderer.createCanvas(id, width, height, scale); - if (!canvas) return null; + if(!canvas) return null; const restrictedScaling = instance.model.getValue(RoomVariableEnum.RESTRICTS_SCALING); - if (restrictedScaling) + if(restrictedScaling) { let restrictedScale = instance.model.getValue(RoomVariableEnum.RESTRICTED_SCALE); - if (!restrictedScale) restrictedScale = 1; + if(!restrictedScale) restrictedScale = 1; canvas.setScale(restrictedScale); @@ -476,7 +476,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato canvas.setMouseListener(this._roomObjectEventHandler); - if (canvas.geometry) + if(canvas.geometry) { canvas.geometry.z_scale = instance.model.getValue(RoomVariableEnum.ROOM_Z_SCALE); @@ -488,15 +488,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let direction: IVector3D = null; - if (doorDirection === 90) direction = new Vector3d(-2000, 0, 0); + if(doorDirection === 90) direction = new Vector3d(-2000, 0, 0); - if (doorDirection === 180) direction = new Vector3d(0, -2000, 0); + if(doorDirection === 180) direction = new Vector3d(0, -2000, 0); canvas.geometry.setDisplacement(vector, direction); const displayObject = (canvas.master as Container); - if (displayObject) + if(displayObject) { const overlay = new NitroSprite(Texture.EMPTY); @@ -514,16 +514,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (roomCanvas) roomCanvas.setMask(flag); + if(roomCanvas) roomCanvas.setMask(flag); } public setRoomInstanceRenderingCanvasScale(roomId: number, canvasId: number, scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void { const roomCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (roomCanvas) + if(roomCanvas) { - if (roomCanvas.restrictsScaling && !override) return; + if(roomCanvas.restrictsScaling && !override) return; roomCanvas.setScale(scale, point, offsetPoint, override, asDelta); @@ -535,17 +535,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; const renderer = instance.renderer as IRoomRenderer; - if (!renderer) return null; + if(!renderer) return null; - if (canvasId === -1) canvasId = this._activeRoomActiveCanvas; + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; const canvas = renderer.getCanvas(canvasId); - if (!canvas) return null; + if(!canvas) return null; return canvas; } @@ -557,11 +557,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomInstanceRenderingCanvasOffset(roomId: number, canvasId: number = -1): Point { - if (canvasId === -1) canvasId = this._activeRoomActiveCanvas; + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!renderingCanvas) return null; + if(!renderingCanvas) return null; return new Point(renderingCanvas.screenOffsetX, renderingCanvas.screenOffsetY); } @@ -570,12 +570,12 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!renderingCanvas || !point) return false; + if(!renderingCanvas || !point) return false; const x = ~~(point.x); const y = ~~(point.y); - if ((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return; + if((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return; this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y))); @@ -587,13 +587,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomInstanceRenderingCanvasScale(roomId: number = -1000, canvasId: number = -1): number { - if (roomId === -1000) roomId = this._activeRoomId; + if(roomId === -1000) roomId = this._activeRoomId; - if (canvasId === -1) canvasId = this._activeRoomActiveCanvas; + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!canvas) return 1; + if(!canvas) return 1; return canvas.scale; } @@ -602,7 +602,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!canvas) return; + if(!canvas) return; canvas.initialize(width, height); } @@ -611,17 +611,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; const renderer = instance.renderer as IRoomRenderer; - if (!renderer) return null; + if(!renderer) return null; - if (canvasId === -1) canvasId = this._activeRoomActiveCanvas; + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; const canvas = renderer.getCanvas(canvasId); - if (!canvas) return null; + if(!canvas) return null; return canvas.geometry; } @@ -630,7 +630,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; return ((instance.model && instance.model.getValue(key)) || null); } @@ -639,7 +639,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomOwnObject(roomId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectRoomPlaneVisibilityUpdateMessage(ObjectRoomPlaneVisibilityUpdateMessage.WALL_VISIBILITY, wallVisible)); object.processUpdateMessage(new ObjectRoomPlaneVisibilityUpdateMessage(ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY, floorVisible)); @@ -651,7 +651,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomOwnObject(roomId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectRoomPlanePropertyUpdateMessage(ObjectRoomPlanePropertyUpdateMessage.WALL_THICKNESS, wallThickness)); object.processUpdateMessage(new ObjectRoomPlanePropertyUpdateMessage(ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS, floorThickness)); @@ -664,43 +664,43 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const roomObject = this.getRoomOwnObject(roomId); const roomInstance = this.getRoomInstance(roomId); - if (!roomObject) + if(!roomObject) { let roomData = this._roomDatas.get(roomId); - if (!roomData) + if(!roomData) { roomData = new RoomData(roomId, null); this._roomDatas.set(roomId, roomData); } - if (floorType) roomData.floorType = floorType; + if(floorType) roomData.floorType = floorType; - if (wallType) roomData.wallType = wallType; + if(wallType) roomData.wallType = wallType; - if (landscapeType) roomData.landscapeType = landscapeType; + if(landscapeType) roomData.landscapeType = landscapeType; return true; } - if (floorType) + if(floorType) { - if (roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, floorType); + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, floorType); roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE, floorType)); } - if (wallType) + if(wallType) { - if (roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, wallType); + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, wallType); roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_WALL_UPDATE, wallType)); } - if (landscapeType) + if(landscapeType) { - if (roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, landscapeType); + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, landscapeType); roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_LANDSCAPE_UPDATE, landscapeType)); } @@ -712,7 +712,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomObject = this.getRoomOwnObject(roomId); - if (!roomObject || !roomObject.logic) return false; + if(!roomObject || !roomObject.logic) return false; const event = new ObjectRoomColorUpdateMessage(ObjectRoomColorUpdateMessage.BACKGROUND_COLOR, color, light, backgroundOnly); @@ -725,12 +725,12 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public addRoomInstanceFloorHole(roomId: number, objectId: number): void { - if (objectId < 0) return; + if(objectId < 0) return; const roomOwnObject = this.getRoomOwnObject(roomId); const roomObject = this.getRoomObjectFloor(roomId, objectId); - if (roomOwnObject && roomOwnObject.logic && roomObject && roomObject.model) + if(roomOwnObject && roomOwnObject.logic && roomObject && roomObject.model) { const location = roomObject.getLocation(); const sizeX = roomObject.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); @@ -742,11 +742,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public removeRoomInstanceFloorHole(roomId: number, objectId: number): void { - if (objectId < 0) return; + if(objectId < 0) return; const roomOwnObject = this.getRoomOwnObject(roomId); - if (roomOwnObject) + if(roomOwnObject) { roomOwnObject.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.REMOVE, objectId)); } @@ -756,13 +756,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstance = this.getRoomInstance(roomId); - if (!roomInstance) return; + if(!roomInstance) return; const mode = isPlaying ? 1 : 0; roomInstance.model.setValue(RoomVariableEnum.IS_PLAYING_GAME, mode); - if (mode === 0) + if(mode === 0) { this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.NORMAL_MODE, roomId)); } @@ -776,7 +776,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstance = this.getRoomInstance(roomId); - if (!roomInstance) return false; + if(!roomInstance) return false; return (roomInstance.model.getValue(RoomVariableEnum.IS_PLAYING_GAME) > 0); } @@ -788,7 +788,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public disableUpdate(flag: boolean): void { - if (flag) + if(flag) { Nitro.instance.ticker.remove(this.update, this); } @@ -806,12 +806,12 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public runVisibilityUpdate(): void { - if (!document.hidden) this.update(1, true); + if(!document.hidden) this.update(1, true); } public update(time: number, update: boolean = false): void { - if (!this._roomManager) return; + if(!this._roomManager) return; time = Nitro.instance.time; @@ -823,7 +823,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this.updateRoomCameras(time); - if (this._mouseCursorUpdate) this.setPointer(); + if(this._mouseCursorUpdate) this.setPointer(); RoomEnterEffect.turnVisualizationOff(); } @@ -834,7 +834,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const instanceData = this.getRoomInstanceData(this._activeRoomId); - if (instanceData && instanceData.hasButtonMouseCursorOwners()) + if(instanceData && instanceData.hasButtonMouseCursorOwners()) { document.body.style.cursor = 'pointer'; } @@ -846,7 +846,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private processPendingFurniture(): void { - if (this._skipFurnitureCreationForNextFrame) + if(this._skipFurnitureCreationForNextFrame) { this._skipFurnitureCreationForNextFrame = false; @@ -857,25 +857,25 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const furniturePerTick = 5; const hasTickLimit = true; - for (const instanceData of this._roomInstanceDatas.values()) + for(const instanceData of this._roomInstanceDatas.values()) { - if (!instanceData) continue; + if(!instanceData) continue; let pendingData: RoomFurnitureData = null; let totalFurnitureAdded = 0; let furnitureAdded = false; - while ((pendingData = instanceData.getNextPendingFurnitureFloor())) + while((pendingData = instanceData.getNextPendingFurnitureFloor())) { furnitureAdded = this.processPendingFurnitureFloor(instanceData.roomId, pendingData.id, pendingData); - if (hasTickLimit) + if(hasTickLimit) { - if (!(++totalFurnitureAdded % furniturePerTick)) + if(!(++totalFurnitureAdded % furniturePerTick)) { const time = new Date().valueOf(); - if ((time - startTime) >= 40) + if((time - startTime) >= 40) { this._skipFurnitureCreationForNextFrame = true; @@ -885,17 +885,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - while (!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall())) + while(!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall())) { furnitureAdded = this.processPendingFurnitureWall(instanceData.roomId, pendingData.id, pendingData); - if (hasTickLimit) + if(hasTickLimit) { - if (!(++totalFurnitureAdded % furniturePerTick)) + if(!(++totalFurnitureAdded % furniturePerTick)) { const time = new Date().valueOf(); - if ((time - startTime) >= 40) + if((time - startTime) >= 40) { this._skipFurnitureCreationForNextFrame = true; @@ -905,28 +905,28 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - if (furnitureAdded && this._roomManager) + if(furnitureAdded && this._roomManager) { const roomInstance = this._roomManager.getRoomInstance(this.getRoomId(instanceData.roomId)) as RoomInstance; - if (!roomInstance.hasUninitializedObjects()) this.objectsInitialized(instanceData.roomId.toString()); + if(!roomInstance.hasUninitializedObjects()) this.objectsInitialized(instanceData.roomId.toString()); } - if (this._skipFurnitureCreationForNextFrame) return; + if(this._skipFurnitureCreationForNextFrame) return; } } public onRoomEngineInitalized(flag: boolean): void { - if (!flag) return; + if(!flag) return; this._ready = true; this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, 0)); - for (const roomData of this._roomDatas.values()) + for(const roomData of this._roomDatas.values()) { - if (!roomData) continue; + if(!roomData) continue; this.createRoomInstance(roomData.roomId, roomData.data); } @@ -934,19 +934,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private processPendingFurnitureFloor(roomId: number, id: number, data: RoomFurnitureData): boolean { - if (!data) + if(!data) { const instanceData = this.getRoomInstanceData(roomId); - if (instanceData) data = instanceData.getPendingFurnitureFloor(id); + if(instanceData) data = instanceData.getPendingFurnitureFloor(id); - if (!data) return false; + if(!data) return false; } let type = data.type; let didLoad = false; - if (!type) + if(!type) { type = this.getFurnitureFloorName(data.typeId); didLoad = true; @@ -955,11 +955,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const object = this.createRoomObjectFloor(roomId, id, type); - if (!object) return false; + if(!object) return false; const model = object.model; - if (model) + if(model) { model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureFloorColorIndex(data.typeId)); model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId); @@ -972,53 +972,53 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato model.setValue(RoomObjectVariable.FURNITURE_OWNER_NAME, data.ownerName); } - if (!this.updateRoomObjectFloor(roomId, id, data.location, data.direction, data.state, data.data, data.extra)) return false; + if(!this.updateRoomObjectFloor(roomId, id, data.location, data.direction, data.state, data.data, data.extra)) return false; - if (data.sizeZ >= 0) + if(data.sizeZ >= 0) { - if (!this.updateRoomObjectFloorHeight(roomId, id, data.sizeZ)) return false; + if(!this.updateRoomObjectFloorHeight(roomId, id, data.sizeZ)) return false; } - if (this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.FLOOR)); + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.FLOOR)); const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); - if (selectedRoomObjectData && (selectedRoomObjectData.id === id) && (selectedRoomObjectData.category === RoomObjectCategory.FLOOR)) + if(selectedRoomObjectData && (selectedRoomObjectData.id === id) && (selectedRoomObjectData.category === RoomObjectCategory.FLOOR)) { this.selectRoomObject(roomId, id, RoomObjectCategory.FLOOR); } - if (object.isReady && data.synchronized) this.addObjectToTileMap(roomId, object); + if(object.isReady && data.synchronized) this.addObjectToTileMap(roomId, object); return true; } private processPendingFurnitureWall(roomId: number, id: number, data: RoomFurnitureData): boolean { - if (!data) + if(!data) { const instanceData = this.getRoomInstanceData(roomId); - if (instanceData) data = instanceData.getPendingFurnitureWall(id); + if(instanceData) data = instanceData.getPendingFurnitureWall(id); - if (!data) return false; + if(!data) return false; } let extra = ''; - if (data.data) extra = data.data.getLegacyString(); + if(data.data) extra = data.data.getLegacyString(); let type = this.getFurnitureWallName(data.typeId, extra); - if (!type) type = ''; + if(!type) type = ''; const object = this.createRoomObjectWall(roomId, id, type); - if (!object) return false; + if(!object) return false; const model = object.model; - if (model) + if(model) { model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureWallColorIndex(data.typeId)); model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId); @@ -1032,13 +1032,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato model.setValue(RoomObjectVariable.FURNITURE_OWNER_NAME, data.ownerName); } - if (!this.updateRoomObjectWall(roomId, id, data.location, data.direction, data.state, extra)) return false; + 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(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.WALL)); const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); - if (selectedRoomObjectData && (Math.abs(selectedRoomObjectData.id) === id) && (selectedRoomObjectData.category === RoomObjectCategory.WALL)) + if(selectedRoomObjectData && (Math.abs(selectedRoomObjectData.id) === id) && (selectedRoomObjectData.category === RoomObjectCategory.WALL)) { this.selectRoomObject(roomId, id, RoomObjectCategory.WALL); } @@ -1048,18 +1048,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public setRoomSessionOwnUser(roomId: number, objectId: number): void { - if (!this._roomSessionManager) return; + if(!this._roomSessionManager) return; const session = this._roomSessionManager.getSession(roomId); - if (session) + if(session) { session.setOwnRoomIndex(objectId); } const camera = this.getRoomCamera(roomId); - if (camera) + if(camera) { camera.targetId = objectId; camera.targetCategory = RoomObjectCategory.UNIT; @@ -1076,33 +1076,33 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private updateRoomCameras(time: number): void { - for (const instanceData of this._roomInstanceDatas.values()) + for(const instanceData of this._roomInstanceDatas.values()) { - if (!instanceData) continue; + if(!instanceData) continue; const camera = instanceData.roomCamera; - if (!camera) continue; + if(!camera) continue; let location: IVector3D = null; const object = this.getRoomObject(instanceData.roomId, camera.targetId, camera.targetCategory); - if (object) location = object.getLocation(); + if(object) location = object.getLocation(); - if (!location) continue; + if(!location) continue; - if ((instanceData.roomId !== this._activeRoomId) || !this._activeRoomIsDragged) + if((instanceData.roomId !== this._activeRoomId) || !this._activeRoomIsDragged) { this.updateRoomCamera(instanceData.roomId, 1, location, time); } } - if (this._activeRoomWasDragged) + if(this._activeRoomWasDragged) { const renderingCanvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, 1); - if (renderingCanvas) this.setRoomInstanceRenderingCanvasOffset(this._activeRoomId, 1, new Point((renderingCanvas.screenOffsetX + this._activeRoomDragX), (renderingCanvas.screenOffsetY + this._activeRoomDragY))); + if(renderingCanvas) this.setRoomInstanceRenderingCanvasOffset(this._activeRoomId, 1, new Point((renderingCanvas.screenOffsetX + this._activeRoomDragX), (renderingCanvas.screenOffsetY + this._activeRoomDragY))); this._activeRoomDragX = 0; this._activeRoomDragY = 0; @@ -1114,29 +1114,29 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); const instanceData = this.getRoomInstanceData(roomId); - if (!renderingCanvas || !instanceData || (renderingCanvas.scale !== 1)) return; + if(!renderingCanvas || !instanceData || (renderingCanvas.scale !== 1)) return; const roomGeometry = (renderingCanvas.geometry as RoomGeometry); const roomCamera = instanceData.roomCamera; const roomInstance = this.getRoomInstance(roomId); - if (!roomGeometry || !roomCamera || !roomInstance) return; + if(!roomGeometry || !roomCamera || !roomInstance) return; const canvasRectangle = this.getRoomCanvasRectangle(roomId, canvasId); - if (!canvasRectangle) return; + if(!canvasRectangle) return; let _local_10 = (Math.floor(objectLocation.z) + 1); const width = Math.round(canvasRectangle.width); const height = Math.round(canvasRectangle.height); const bounds = this.getCanvasBoundingRectangle(canvasId); - if (bounds && ((bounds.right < 0) || (bounds.bottom < 0) || (bounds.left >= width) || (bounds.top >= height))) + if(bounds && ((bounds.right < 0) || (bounds.bottom < 0) || (bounds.left >= width) || (bounds.top >= height))) { roomCamera.reset(); } - if ((roomCamera.screenWd !== width) || (roomCamera.screenHt !== height) || (roomCamera.scale !== roomGeometry.scale) || (roomCamera.geometryUpdateId !== roomGeometry.updateId) || !Vector3d.isEqual(objectLocation, roomCamera.targetObjectLoc) || roomCamera.isMoving) + if((roomCamera.screenWd !== width) || (roomCamera.screenHt !== height) || (roomCamera.scale !== roomGeometry.scale) || (roomCamera.geometryUpdateId !== roomGeometry.updateId) || !Vector3d.isEqual(objectLocation, roomCamera.targetObjectLoc) || roomCamera.isMoving) { roomCamera.targetObjectLoc = objectLocation; @@ -1170,17 +1170,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let _local_32 = 0; let _local_33 = roomGeometry.getScreenPoint(new Vector3d(_local_20, _local_21, _local_22)); - if (!_local_33) return; + if(!_local_33) return; _local_33.x = (_local_33.x + Math.round((canvasRectangle.width / 2))); _local_33.y = (_local_33.y + Math.round((canvasRectangle.height / 2))); - if (bounds) + if(bounds) { bounds.x += -(renderingCanvas.screenOffsetX); bounds.y += -(renderingCanvas.screenOffsetY); - if (((bounds.width > 1) && (bounds.height > 1))) + if(((bounds.width > 1) && (bounds.height > 1))) { _local_29 = (((bounds.left - _local_33.x) - (roomGeometry.scale * 0.25)) / _local_24); _local_31 = (((bounds.right - _local_33.x) + (roomGeometry.scale * 0.25)) / _local_24); @@ -1207,7 +1207,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let _local_37 = false; const _local_38 = Math.round(((_local_31 - _local_29) * _local_24)); - if (_local_38 < canvasRectangle.width) + if(_local_38 < canvasRectangle.width) { _local_10 = 2; _local_23.x = ((_local_31 + _local_29) / 2); @@ -1215,19 +1215,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } else { - if (_local_23.x > (_local_31 - _local_27)) + if(_local_23.x > (_local_31 - _local_27)) { _local_23.x = (_local_31 - _local_27); _local_34 = true; } - if (_local_23.x < (_local_29 + _local_27)) + if(_local_23.x < (_local_29 + _local_27)) { _local_23.x = (_local_29 + _local_27); _local_34 = true; } } const _local_39 = Math.round(((_local_32 - _local_30) * _local_25)); - if (_local_39 < canvasRectangle.height) + if(_local_39 < canvasRectangle.height) { _local_10 = 2; _local_23.y = ((_local_32 + _local_30) / 2); @@ -1235,17 +1235,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } else { - if (_local_23.y > (_local_32 - _local_28)) + if(_local_23.y > (_local_32 - _local_28)) { _local_23.y = (_local_32 - _local_28); _local_35 = true; } - if (_local_23.y < (_local_30 + _local_28)) + if(_local_23.y < (_local_30 + _local_28)) { _local_23.y = (_local_30 + _local_28); _local_35 = true; } - if (_local_35) + if(_local_35) { _local_23.y = (_local_23.y / (_local_25 / _local_24)); } @@ -1259,23 +1259,23 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let _local_42 = 0.2; const _local_43 = 10; const _local_44 = 10; - if ((_local_42 * width) > 100) + if((_local_42 * width) > 100) { _local_42 = (100 / width); } - if ((_local_40 * height) > 150) + if((_local_40 * height) > 150) { _local_40 = (150 / height); } - if ((_local_41 * height) > 150) + if((_local_41 * height) > 150) { _local_41 = (150 / height); } - if ((((roomCamera.limitedLocationX) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) + if((((roomCamera.limitedLocationX) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) { _local_42 = 0; } - if ((((roomCamera.limitedLocationY) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) + if((((roomCamera.limitedLocationY) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) { _local_40 = 0; _local_41 = 0; @@ -1284,17 +1284,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato canvasRectangle.width = (canvasRectangle.width * (1 - (_local_42 * 2))); canvasRectangle.height = (canvasRectangle.height * (1 - (_local_40 + _local_41))); - if (canvasRectangle.width < _local_43) + if(canvasRectangle.width < _local_43) { canvasRectangle.width = _local_43; } - if (canvasRectangle.height < _local_44) + if(canvasRectangle.height < _local_44) { canvasRectangle.height = _local_44; } - if ((_local_40 + _local_41) > 0) + if((_local_40 + _local_41) > 0) { canvasRectangle.x += (-(canvasRectangle.width) / 2); canvasRectangle.y += (-(canvasRectangle.height) * (_local_41 / (_local_40 + _local_41))); @@ -1307,19 +1307,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato _local_33 = roomGeometry.getScreenPoint(_local_15); - if (!_local_33) return; + if(!_local_33) return; - if (_local_33) + if(_local_33) { _local_33.x = (_local_33.x + renderingCanvas.screenOffsetX); _local_33.y = (_local_33.y + renderingCanvas.screenOffsetY); _local_15.z = _local_10; _local_15.x = (Math.round((_local_23.x * 2)) / 2); _local_15.y = (Math.round((_local_23.y * 2)) / 2); - if (!roomCamera.location) + if(!roomCamera.location) { roomGeometry.location = _local_15; - if (this.useOffsetScrolling) + if(this.useOffsetScrolling) { roomCamera.initializeLocation(new Vector3d(0, 0, 0)); } @@ -1330,16 +1330,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } const _local_45 = roomGeometry.getScreenPoint(_local_15); const _local_46 = new Vector3d(0, 0, 0); - if (_local_45) + if(_local_45) { _local_46.x = _local_45.x; _local_46.y = _local_45.y; } - if (((((((((_local_33.x < canvasRectangle.left) || (_local_33.x > canvasRectangle.right)) && (!(roomCamera.centeredLocX))) || (((_local_33.y < canvasRectangle.top) || (_local_33.y > canvasRectangle.bottom)) && (!(roomCamera.centeredLocY)))) || (((_local_36) && (!(roomCamera.centeredLocX))) && (!(roomCamera.screenWd == width)))) || (((_local_37) && (!(roomCamera.centeredLocY))) && (!(roomCamera.screenHt == height)))) || ((!(roomCamera.roomWd == bounds.width)) || (!(roomCamera.roomHt == bounds.height)))) || ((!(roomCamera.screenWd == width)) || (!(roomCamera.screenHt == height))))) + if(((((((((_local_33.x < canvasRectangle.left) || (_local_33.x > canvasRectangle.right)) && (!(roomCamera.centeredLocX))) || (((_local_33.y < canvasRectangle.top) || (_local_33.y > canvasRectangle.bottom)) && (!(roomCamera.centeredLocY)))) || (((_local_36) && (!(roomCamera.centeredLocX))) && (!(roomCamera.screenWd == width)))) || (((_local_37) && (!(roomCamera.centeredLocY))) && (!(roomCamera.screenHt == height)))) || ((!(roomCamera.roomWd == bounds.width)) || (!(roomCamera.roomHt == bounds.height)))) || ((!(roomCamera.screenWd == width)) || (!(roomCamera.screenHt == height))))) { roomCamera.limitedLocationX = _local_34; roomCamera.limitedLocationY = _local_35; - if (this.useOffsetScrolling) + if(this.useOffsetScrolling) { roomCamera.target = _local_46; } @@ -1350,9 +1350,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } else { - if (!_local_34) roomCamera.limitedLocationX = false; + if(!_local_34) roomCamera.limitedLocationX = false; - if (!_local_35) roomCamera.limitedLocationY = false; + if(!_local_35) roomCamera.limitedLocationY = false; } } @@ -1365,9 +1365,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato roomCamera.roomWd = bounds.width; roomCamera.roomHt = bounds.height; - if (!this._sessionDataManager.isCameraFollowDisabled) + if(!this._sessionDataManager.isCameraFollowDisabled) { - if (this.useOffsetScrolling) + if(this.useOffsetScrolling) { roomCamera.update(time, 8); } @@ -1377,7 +1377,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - if (this.useOffsetScrolling) + if(this.useOffsetScrolling) { this.setRoomInstanceRenderingCanvasOffset(this.activeRoomId, 1, new Point(-(roomCamera.location.x), -(roomCamera.location.y))); } @@ -1399,7 +1399,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!canvas) return null; + if(!canvas) return null; return new Rectangle(0, 0, canvas.width, canvas.height); } @@ -1408,22 +1408,22 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const geometry = this.getRoomInstanceGeometry(roomId, canvasId); - if (!geometry) return null; + if(!geometry) return null; const roomObject = this.getRoomObject(roomId, objectId, category); - if (!roomObject) return null; + if(!roomObject) return null; const visualization = roomObject.visualization; - if (!visualization) return null; + if(!visualization) return null; const rectangle = visualization.getBoundingRectangle(); const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); const scale = ((canvas) ? canvas.scale : 1); const screenPoint = geometry.getScreenPoint(roomObject.getLocation()); - if (!screenPoint) return null; + if(!screenPoint) return null; screenPoint.x = Math.round(screenPoint.x); screenPoint.y = Math.round(screenPoint.y); @@ -1439,7 +1439,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato rectangle.x += screenPoint.x; rectangle.y += screenPoint.y; - if (!canvas) return null; + if(!canvas) return null; rectangle.x += (Math.round(canvas.width / 2) + canvas.screenOffsetX); rectangle.y += (Math.round(canvas.height / 2) + canvas.screenOffsetY); @@ -1454,28 +1454,28 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getFurnitureFloorName(typeId: number): string { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); } public getFurnitureWallName(typeId: number, extra: string = null): string { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getFurnitureWallNameForTypeId(typeId, extra); } public getFurnitureFloorColorIndex(typeId: number): number { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getFurnitureFloorColorIndex(typeId); } public getFurnitureWallColorIndex(typeId: number): number { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getFurnitureWallColorIndex(typeId); } @@ -1484,7 +1484,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const existing = this._roomInstanceDatas.get(roomId); - if (existing) return existing; + if(existing) return existing; const data = new RoomInstanceData(roomId); @@ -1497,7 +1497,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.modelName; } @@ -1506,7 +1506,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return; + if(!instanceData) return; instanceData.setModelName(name); } @@ -1515,7 +1515,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstance = this.getRoomInstanceData(k); - if (!roomInstance) return null; + if(!roomInstance) return null; return roomInstance.tileObjectMap; } @@ -1529,7 +1529,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.roomCamera; } @@ -1538,7 +1538,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.selectedObject; } @@ -1547,18 +1547,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; instanceData.setSelectedObject(data); - if (data) instanceData.setPlacedObject(null); + if(data) instanceData.setPlacedObject(null); } public getPlacedRoomObjectData(roomId: number): ISelectedRoomObjectData { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.placedObject; } @@ -1567,14 +1567,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; instanceData.setPlacedObject(data); } public cancelRoomObjectPlacement(): void { - if (!this._roomObjectEventHandler) return; + if(!this._roomObjectEventHandler) return; this._roomObjectEventHandler.cancelRoomObjectPlacement(this._activeRoomId); } @@ -1583,7 +1583,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.furnitureStackingHeightMap; } @@ -1592,7 +1592,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; instanceData.setFurnitureStackingHeightMap(heightMap); } @@ -1601,7 +1601,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return null; + if(!instanceData) return null; return instanceData.legacyGeometry; } @@ -1610,7 +1610,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; return instance.createRoomObjectAndInitalize(objectId, type, category) as IRoomObjectController; } @@ -1619,18 +1619,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return 0; + if(!instance) return 0; return instance.getTotalObjectsForManager(category); } public getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController { - if (!this._ready) return null; + if(!this._ready) return null; let roomIdString = this.getRoomId(roomId); - if (roomId === 0) roomIdString = RoomEngine.TEMPORARY_ROOM; + if(roomId === 0) roomIdString = RoomEngine.TEMPORARY_ROOM; return this.getObject(roomIdString, objectId, category); } @@ -1639,15 +1639,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { let roomInstance: IRoomInstance = null; - if (this._roomManager) roomInstance = this._roomManager.getRoomInstance(roomId); + if(this._roomManager) roomInstance = this._roomManager.getRoomInstance(roomId); - if (!roomInstance) return null; + if(!roomInstance) return null; let roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); - if (!roomObject) + if(!roomObject) { - switch (category) + switch(category) { case RoomObjectCategory.FLOOR: this.processPendingFurnitureFloor(this.getRoomIdFromString(roomId), objectId, null); @@ -1669,14 +1669,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; return instance.getRoomObjectByIndex(index, category) as IRoomObjectController; } public getRoomObjectCategoryForType(type: string): number { - if (!type || !this._roomContentLoader) return RoomObjectCategory.MINIMUM; + if(!type || !this._roomContentLoader) return RoomObjectCategory.MINIMUM; return this._roomContentLoader.getCategoryForType(type); } @@ -1725,21 +1725,21 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstanceData = this.getRoomInstanceData(roomId); - if (roomInstanceData) roomInstanceData.removePendingFunitureFloor(objectId); + if(roomInstanceData) roomInstanceData.removePendingFunitureFloor(objectId); - if (this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) + if(this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) { const roomObject = this.getRoomObject(roomId, objectId, RoomObjectCategory.FLOOR); - if (roomObject) + if(roomObject) { const screenLocation = this.getRoomObjectScreenLocation(roomId, objectId, RoomObjectCategory.FLOOR, this._activeRoomActiveCanvas); - if (screenLocation) + if(screenLocation) { const disabledPickingAnimation = (roomObject.model.getValue(RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION) === 1); - if (!disabledPickingAnimation) + if(!disabledPickingAnimation) { const typeId = roomObject.model.getValue(RoomObjectVariable.FURNITURE_TYPE_ID); const extras = roomObject.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); @@ -1747,11 +1747,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const objectData = ObjectDataFactory.getData(dataKey); const icon = this.getFurnitureFloorIcon(typeId, null, extras, objectData).data; - if (icon) + if(icon) { const image = TextureUtils.generateImage(icon); - if (this.events) + if(this.events) { const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); @@ -1768,7 +1768,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this.removeRoomObject(roomId, objectId, RoomObjectCategory.FLOOR); this.setMouseDefault(roomId, RoomObjectCategory.FLOOR, objectId); - if (_arg_4) this.refreshTileObjectMap(roomId, 'RoomEngine.disposeObjectFurniture()'); + if(_arg_4) this.refreshTileObjectMap(roomId, 'RoomEngine.disposeObjectFurniture()'); } public getRoomObjectWall(roomId: number, objectId: number): IRoomObjectController @@ -1778,25 +1778,25 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public removeRoomObjectWall(roomId: number, objectId: number, userId: number = -1): void { - if (this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) + if(this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) { const roomObject = this.getRoomObject(roomId, objectId, RoomObjectCategory.WALL); - if (roomObject && (roomObject.type.indexOf('post_it') === -1) && (roomObject.type.indexOf('external_image_wallitem') === -1)) + if(roomObject && (roomObject.type.indexOf('post_it') === -1) && (roomObject.type.indexOf('external_image_wallitem') === -1)) { const screenLocation = this.getRoomObjectScreenLocation(roomId, objectId, RoomObjectCategory.WALL, this._activeRoomActiveCanvas); - if (screenLocation) + if(screenLocation) { const typeId = roomObject.model.getValue(RoomObjectVariable.FURNITURE_TYPE_ID); const objectData = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA); const icon = this.getFurnitureWallIcon(typeId, null, objectData).data; - if (icon) + if(icon) { const image = TextureUtils.generateImage(icon); - if (this.events) + if(this.events) { const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); @@ -1823,18 +1823,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; instance.removeRoomObject(objectId, category); - if (this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REMOVED, roomId, objectId, category)); + if(this.events) this.events.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 { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return false; + if(!instanceData) return false; const furnitureData = new RoomFurnitureData(id, typeId, null, location, direction, state, objectData, extra, expires, usagePolicy, ownerId, ownerName, synchronized, realRoomObject, sizeZ); @@ -1847,7 +1847,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return false; + if(!instanceData) return false; const furnitureData = new RoomFurnitureData(id, 0, typeName, location, direction, state, objectData, extra, expires, usagePolicy, ownerId, ownerName, synchronized, realRoomObject, sizeZ); @@ -1860,7 +1860,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const instanceData = this.getRoomInstanceData(roomId); - if (!instanceData) return false; + if(!instanceData) return false; const objectData = new LegacyDataType(); @@ -1877,7 +1877,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectFloor(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new RoomObjectUpdateMessage(location, direction)); object.processUpdateMessage(new ObjectDataUpdateMessage(state, data, extra)); @@ -1889,7 +1889,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectWall(roomId, objectId); - if (!object || !object.logic) return false; + if(!object || !object.logic) return false; const updateMessage = new RoomObjectUpdateMessage(location, direction); const data = new LegacyDataType(); @@ -1909,7 +1909,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectWall(roomId, objectId); - if (!object || !object.logic) return false; + if(!object || !object.logic) return false; object.logic.processUpdateMessage(new ObjectItemDataUpdateMessage(data)); @@ -1920,7 +1920,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectFloor(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectHeightUpdateMessage(null, null, height)); @@ -1931,7 +1931,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectFloor(roomId, objectId); - if (!object) return false; + if(!object) return false; object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, expires); object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, Nitro.instance.time); @@ -1943,7 +1943,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectWall(roomId, objectId); - if (!object) return false; + if(!object) return false; object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, expires); object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, Nitro.instance.time); @@ -1958,14 +1958,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let maskUpdate: ObjectRoomMaskUpdateMessage = null; - if (roomObject && roomObject.model) + if(roomObject && roomObject.model) { - if (roomObject.model.getValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK) > 0) + if(roomObject.model.getValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK) > 0) { const maskType = roomObject.model.getValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE); const location = roomObject.getLocation(); - if (_arg_3) maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.ADD_MASK, maskName, maskType, location); + if(_arg_3) maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.ADD_MASK, maskName, maskType, location); else maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.REMOVE_MASK, maskName); } } @@ -1976,14 +1976,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const roomOwnObject = this.getRoomOwnObject(roomId); - if (roomOwnObject && roomOwnObject.logic && maskUpdate) roomOwnObject.logic.processUpdateMessage(maskUpdate); + if(roomOwnObject && roomOwnObject.logic && maskUpdate) roomOwnObject.logic.processUpdateMessage(maskUpdate); } public rollRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D): void { const object = this.getRoomObjectFloor(roomId, objectId); - if (!object) return; + if(!object) return; object.processUpdateMessage(new ObjectMoveUpdateMessage(location, targetLocation, null, !!targetLocation)); } @@ -1992,9 +1992,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomObject = this.getRoomObjectWall(roomId, objectId); - if (!roomObject) return false; + if(!roomObject) return false; - if (roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectMoveUpdateMessage(location, null, null)); + if(roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectMoveUpdateMessage(location, null, null)); this.updateRoomObjectMask(roomId, objectId); @@ -2005,23 +2005,23 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const existing = this.getRoomObjectUser(roomId, objectId); - if (existing) return false; + if(existing) return false; let objectType = RoomObjectUserType.getTypeString(type); - if (objectType === RoomObjectUserType.PET) objectType = this.getPetType(figure); + if(objectType === RoomObjectUserType.PET) objectType = this.getPetType(figure); const object = this.createRoomObjectUser(roomId, objectId, objectType); - if (!object) return false; + if(!object) return false; //object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE, 1); object.processUpdateMessage(new ObjectAvatarUpdateMessage(this.fixedUserLocation(roomId, location), null, direction, headDirection, false, 0)); - if (figure) object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure)); + if(figure) object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure)); - if (this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, objectId, RoomObjectCategory.UNIT)); + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, objectId, RoomObjectCategory.UNIT)); return true; } @@ -2030,19 +2030,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; - if (!location) location = object.getLocation(); + if(!location) location = object.getLocation(); - if (!direction) direction = object.getDirection(); + if(!direction) direction = object.getDirection(); - if (isNaN(headDirection)) headDirection = object.model.getValue(RoomObjectVariable.HEAD_DIRECTION); + if(isNaN(headDirection)) headDirection = object.model.getValue(RoomObjectVariable.HEAD_DIRECTION); object.processUpdateMessage(new ObjectAvatarUpdateMessage(this.fixedUserLocation(roomId, location), this.fixedUserLocation(roomId, targetLocation), direction, headDirection, canStandUp, baseY)); const roomSession = ((this._roomSessionManager && this._roomSessionManager.getSession(roomId)) || null); - if (roomSession && (roomSession.ownRoomIndex === objectId)) + if(roomSession && (roomSession.ownRoomIndex === objectId)) { this._logicFactory.events.dispatchEvent(new RoomToObjectOwnAvatarMoveEvent(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, targetLocation)); } @@ -2052,18 +2052,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private fixedUserLocation(roomId: number, location: IVector3D): IVector3D { - if (!location) return null; + if(!location) return null; const heightMap = this.getFurnitureStackingHeightMap(roomId); const wallGeometry = this.getLegacyWallGeometry(roomId); - if (!heightMap || !wallGeometry) return location; + if(!heightMap || !wallGeometry) return location; let _local_5 = location.z; const _local_6 = heightMap.getTileHeight(location.x, location.y); const _local_7 = wallGeometry.getHeight(location.x, location.y); - if ((Math.abs((_local_5 - _local_6)) < 0.1) && (Math.abs((_local_6 - _local_7)) < 0.1)) + if((Math.abs((_local_5 - _local_6)) < 0.1) && (Math.abs((_local_6 - _local_7)) < 0.1)) { _local_5 = wallGeometry.getFloorAltitude(location.x, location.y); } @@ -2075,11 +2075,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; let message: ObjectStateUpdateMessage = null; - switch (action) + switch(action) { case RoomObjectVariable.FIGURE_TALK: message = new ObjectAvatarChatUpdateMessage(value); @@ -2122,7 +2122,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato break; } - if (!message) return false; + if(!message) return false; object.processUpdateMessage(message); @@ -2133,7 +2133,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure, gender, subType, isRiding)); @@ -2144,7 +2144,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarFlatControlUpdateMessage(parseInt(level))); @@ -2155,7 +2155,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarEffectUpdateMessage(effectId, delay)); @@ -2166,7 +2166,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarGestureUpdateMessage(gestureId)); @@ -2177,7 +2177,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarPetGestureUpdateMessage(gesture)); @@ -2188,7 +2188,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return false; + if(!object) return false; object.processUpdateMessage(new ObjectAvatarPostureUpdateMessage(type, parameter)); @@ -2199,7 +2199,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const object = this.getRoomObjectUser(roomId, objectId); - if (!object) return; + if(!object) return; object.processUpdateMessage(new ObjectAvatarOwnMessage()); } @@ -2208,11 +2208,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomObject = this.getRoomObject(this._activeRoomId, objectId, category); - if (roomObject) + if(roomObject) { const eventHandler = roomObject.logic; - if (eventHandler) + if(eventHandler) { eventHandler.useObject(); @@ -2227,18 +2227,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const id = this.getRoomIdFromString(roomId); - if (category === RoomObjectCategory.WALL) + if(category === RoomObjectCategory.WALL) { this.updateRoomObjectMask(id, objectId); } const object = this.getRoomObject(id, objectId, category); - if (object && object.model && object.logic) + if(object && object.model && object.logic) { const dataFormat = object.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); - if (!isNaN(dataFormat)) + if(!isNaN(dataFormat)) { const data = ObjectDataFactory.getData(dataFormat); @@ -2250,14 +2250,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.CONTENT_UPDATED, id, objectId, category)); } - if (roomId !== RoomEngine.TEMPORARY_ROOM) this.addObjectToTileMap(id, object); + if(roomId !== RoomEngine.TEMPORARY_ROOM) this.addObjectToTileMap(id, object); } public changeObjectModelData(roomId: number, objectId: number, category: number, numberKey: string, numberValue: number): boolean { const roomObject = this.getObject(this.getRoomId(roomId), objectId, category); - if (!roomObject || !roomObject.logic) return false; + if(!roomObject || !roomObject.logic) return false; const message = new ObjectModelDataUpdateMessage(numberKey, numberValue); @@ -2270,11 +2270,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomObject = this.getObject(this.getRoomId(roomId), objectId, category); - if (!roomObject || !roomObject.model) return; + if(!roomObject || !roomObject.model) return; let stateIndex = roomObject.model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); - if (isNaN(stateIndex)) stateIndex = 1; + if(isNaN(stateIndex)) stateIndex = 1; else stateIndex = (stateIndex + 1); roomObject.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, stateIndex); @@ -2284,44 +2284,44 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato objectData.initializeFromRoomObjectModel(roomObject.model); - if (roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(stateIndex, objectData)); + if(roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(stateIndex, objectData)); } public loadRoomObjectBadgeImage(roomId: number, objectId: number, objectCategory: number, badgeId: string, groupBadge: boolean = true): void { - if (!this._sessionDataManager) return; + if(!this._sessionDataManager) return; let roomObject: IRoomObjectController = null; - if (roomId === 0) + if(roomId === 0) { const room = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (room) roomObject = (room.getRoomObject(objectId, objectCategory) as IRoomObjectController); + if(room) roomObject = (room.getRoomObject(objectId, objectCategory) as IRoomObjectController); } else { roomObject = this.getRoomObjectFloor(roomId, objectId); } - if (!roomObject || !roomObject.logic) return; + if(!roomObject || !roomObject.logic) return; let badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId); - if (!badgeName) + if(!badgeName) { badgeName = 'loading_icon'; - if (!this._badgeListenerObjects) this._badgeListenerObjects = new Map(); + if(!this._badgeListenerObjects) this._badgeListenerObjects = new Map(); - if (!this._badgeListenerObjects.size) + if(!this._badgeListenerObjects.size) { this._sessionDataManager.events.addEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); } let listeners = this._badgeListenerObjects.get(badgeId); - if (!listeners) listeners = []; + if(!listeners) listeners = []; listeners.push(new RoomObjectBadgeImageAssetListener(roomObject, groupBadge)); @@ -2337,26 +2337,26 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private onBadgeImageReadyEvent(k: BadgeImageReadyEvent): void { - if (!this._sessionDataManager) return; + if(!this._sessionDataManager) return; const listeners = this._badgeListenerObjects && this._badgeListenerObjects.get(k.badgeId); - if (!listeners) return; + if(!listeners) return; - for (const listener of listeners) + for(const listener of listeners) { - if (!listener) continue; + if(!listener) continue; this.putBadgeInObjectAssets(listener.object, k.badgeId, listener.groupBadge); const badgeName = (listener.groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(k.badgeId) : this._sessionDataManager.loadBadgeImage(k.badgeId); - if (listener.object && listener.object.logic) listener.object.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(k.badgeId, badgeName)); + if(listener.object && listener.object.logic) listener.object.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(k.badgeId, badgeName)); } this._badgeListenerObjects.delete(k.badgeId); - if (!this._badgeListenerObjects.size) + if(!this._badgeListenerObjects.size) { this._sessionDataManager.events.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); } @@ -2364,24 +2364,24 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private putBadgeInObjectAssets(object: IRoomObjectController, badgeId: string, groupBadge: boolean = false): void { - if (!this._roomContentLoader || !this._sessionDataManager) return; + if(!this._roomContentLoader || !this._sessionDataManager) return; const badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId); const badgeImage = (groupBadge) ? this._sessionDataManager.getGroupBadgeImage(badgeId) : this._sessionDataManager.getBadgeImage(badgeId); - if (badgeImage) this._roomContentLoader.addAssetToCollection(object.type, badgeName, badgeImage, false); + if(badgeImage) this._roomContentLoader.addAssetToCollection(object.type, badgeName, badgeImage, false); } public dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void { const canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); - if (!canvas) return; + if(!canvas) return; const overlay = this.getRenderingCanvasOverlay(canvas); const sprite = this.getOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE); - if (sprite) + if(sprite) { const rectangle = sprite.getLocalBounds(); @@ -2389,15 +2389,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato sprite.y = (y - (rectangle.height / 2)); } - if (!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey)) + if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey)) { - if (!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown)) + if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown)) { let eventType: string = null; - if (type === MouseEventType.MOUSE_CLICK) + if(type === MouseEventType.MOUSE_CLICK) { - if (this.events) + if(this.events) { this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM)); } @@ -2406,13 +2406,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } else { - if (type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE; - else if (type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; + else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; - else if (type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG; + else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG; - else if (type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP; + else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP; } this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId); @@ -2429,11 +2429,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let offsetX = (x - this._activeRoomActiveCanvasMouseX); let offsetY = (y - this._activeRoomActiveCanvasMouseY); - if (type === MouseEventType.MOUSE_DOWN) + if(type === MouseEventType.MOUSE_DOWN) { - if (!altKey && !ctrlKey && !shiftKey && !this.isDecorating) + if(!altKey && !ctrlKey && !shiftKey && !this.isDecorating) { - if (this._roomAllowsDragging) + if(this._roomAllowsDragging) { this._activeRoomIsDragged = true; this._activeRoomWasDragged = false; @@ -2443,25 +2443,25 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - else if (type === MouseEventType.MOUSE_UP) + else if(type === MouseEventType.MOUSE_UP) { - if (this._activeRoomIsDragged) + if(this._activeRoomIsDragged) { this._activeRoomIsDragged = false; - if (this._activeRoomWasDragged) + if(this._activeRoomWasDragged) { const instanceData = this.getRoomInstanceData(this._activeRoomId); - if (instanceData) + if(instanceData) { const camera = instanceData.roomCamera; - if (camera) + if(camera) { - if (this.useOffsetScrolling) + if(this.useOffsetScrolling) { - if (!camera.isMoving) + if(!camera.isMoving) { camera.centeredLocX = false; camera.centeredLocY = false; @@ -2470,23 +2470,23 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato camera.resetLocation(new Vector3d(-(canvas.screenOffsetX), -(canvas.screenOffsetY))); } - if (this._roomDraggingAlwaysCenters) camera.reset(); + if(this._roomDraggingAlwaysCenters) camera.reset(); } } } } } - else if (type === MouseEventType.MOUSE_MOVE) + else if(type === MouseEventType.MOUSE_MOVE) { - if (this._activeRoomIsDragged) + if(this._activeRoomIsDragged) { - if (!this._activeRoomWasDragged) + if(!this._activeRoomWasDragged) { offsetX = (x - this._activeRoomDragStartX); offsetY = (y - this._activeRoomDragStartY); - if (((((offsetX <= -(RoomEngine.DRAG_THRESHOLD)) || (offsetX >= RoomEngine.DRAG_THRESHOLD)) || (offsetY <= -(RoomEngine.DRAG_THRESHOLD))) || (offsetY >= RoomEngine.DRAG_THRESHOLD))) + if(((((offsetX <= -(RoomEngine.DRAG_THRESHOLD)) || (offsetX >= RoomEngine.DRAG_THRESHOLD)) || (offsetY <= -(RoomEngine.DRAG_THRESHOLD))) || (offsetY >= RoomEngine.DRAG_THRESHOLD))) { this._activeRoomWasDragged = true; } @@ -2495,7 +2495,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato offsetY = 0; } - if (((!(offsetX == 0)) || (!(offsetY == 0)))) + if(((!(offsetX == 0)) || (!(offsetY == 0)))) { this._activeRoomDragX += offsetX; this._activeRoomDragY += offsetY; @@ -2505,11 +2505,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - else if ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)) + else if((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)) { this._activeRoomIsDragged = false; - if (this._activeRoomWasDragged) + if(this._activeRoomWasDragged) { this._activeRoomWasDragged = false; @@ -2524,7 +2524,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const category = this.getRoomObjectCategoryForType(objectType); - switch (type) + switch(type) { case RoomObjectFurnitureActionEvent.MOUSE_BUTTON: this.setMouseButton(this._activeRoomId, category, objectId); @@ -2537,67 +2537,67 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private setMouseButton(roomId: number, category: number, objectId: number): void { - if (!this._roomSessionManager) return; + if(!this._roomSessionManager) return; const session = this._roomSessionManager.getSession(roomId); - if (!session) return; + if(!session) return; - if (((category !== RoomObjectCategory.FLOOR) && (category !== RoomObjectCategory.WALL)) || ((session.controllerLevel >= RoomControllerLevel.GUEST))) + if(((category !== RoomObjectCategory.FLOOR) && (category !== RoomObjectCategory.WALL)) || ((session.controllerLevel >= RoomControllerLevel.GUEST))) { const instanceData = this.getRoomInstanceData(roomId); - if (instanceData) + if(instanceData) { - if (instanceData.addButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; + if(instanceData.addButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; } } } private setMouseDefault(roomId: number, category: number, objectId: number): void { - if (!this._roomSessionManager) return; + if(!this._roomSessionManager) return; const instanceData = this.getRoomInstanceData(roomId); - if (instanceData) + if(instanceData) { - if (instanceData.removeButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; + if(instanceData.removeButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; } } public processRoomObjectOperation(objectId: number, category: number, operation: string): boolean { - if (!this._roomObjectEventHandler) return false; + if(!this._roomObjectEventHandler) return false; this._roomObjectEventHandler.modifyRoomObject(this._activeRoomId, objectId, category, operation); } public modifyRoomObjectDataWithMap(objectId: number, category: number, operation: string, data: Map): boolean { - if (!this._roomObjectEventHandler) return false; + if(!this._roomObjectEventHandler) return false; - if (category !== RoomObjectCategory.FLOOR) return; + if(category !== RoomObjectCategory.FLOOR) return; this._roomObjectEventHandler.modifyRoomObjectDataWithMap(this._activeRoomId, objectId, category, operation, data); } public modifyRoomObjectData(objectId: number, category: number, colorHex: string, data: string): boolean { - if (!this._roomObjectEventHandler) return false; + if(!this._roomObjectEventHandler) return false; - if (category !== RoomObjectCategory.WALL) return; + if(category !== RoomObjectCategory.WALL) return; this._roomObjectEventHandler.modifyWallItemData(this._activeRoomId, objectId, colorHex, data); } private processRoomObjectEvent(event: RoomObjectEvent): void { - if (!this._roomObjectEventHandler) return; + if(!this._roomObjectEventHandler) return; const roomIdString = this.getRoomObjectRoomId(event.object); - if (!roomIdString) return; + if(!roomIdString) return; const roomId = this.getRoomIdFromString(roomIdString); @@ -2608,32 +2608,32 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstance = this.getRoomInstance(this._activeRoomId); - if (!roomInstance || (roomInstance.model.getValue(RoomVariableEnum.ROOM_IS_PUBLIC) !== 0)) return false; + if(!roomInstance || (roomInstance.model.getValue(RoomVariableEnum.ROOM_IS_PUBLIC) !== 0)) return false; - if (!this._roomObjectEventHandler) return false; + if(!this._roomObjectEventHandler) return false; return this._roomObjectEventHandler.processRoomObjectPlacement(placementSource, this._activeRoomId, id, category, typeId, extra, stuffData, state, frameNumber, posture); } public getRoomObjectScreenLocation(roomId: number, objectId: number, objectType: number, canvasId: number = -1): Point { - if (canvasId == -1) canvasId = this._activeRoomActiveCanvas; + if(canvasId == -1) canvasId = this._activeRoomActiveCanvas; const geometry = this.getRoomInstanceGeometry(roomId, canvasId); - if (!geometry) return null; + if(!geometry) return null; const roomObject = this.getRoomObject(roomId, objectId, objectType); - if (!roomObject) return null; + if(!roomObject) return null; const screenPoint = geometry.getScreenPoint(roomObject.getLocation()); - if (!screenPoint) return null; + if(!screenPoint) return null; const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); - if (!renderingCanvas) return null; + if(!renderingCanvas) return null; screenPoint.x = (screenPoint.x * renderingCanvas.scale); screenPoint.y = (screenPoint.y * renderingCanvas.scale); @@ -2649,32 +2649,32 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public selectRoomObject(roomId: number, objectId: number, objectCategory: number): void { - if (!this._roomObjectEventHandler) return; + if(!this._roomObjectEventHandler) return; this._roomObjectEventHandler.setSelectedObject(roomId, objectId, objectCategory); } public setSelectedAvatar(roomId: number, objectId: number): void { - if (this._roomObjectEventHandler) return; + if(this._roomObjectEventHandler) return; this._roomObjectEventHandler.setSelectedAvatar(roomId, objectId, true); } public cancelRoomObjectInsert(): void { - if (!this._roomObjectEventHandler) return; + if(!this._roomObjectEventHandler) return; this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId); } private addOverlayIconSprite(k: NitroSprite, _arg_2: string, _arg_3: Texture, scale: number = 1): NitroSprite { - if (!k || !_arg_3) return; + if(!k || !_arg_3) return; let sprite = this.getOverlayIconSprite(k, _arg_2); - if (sprite) return null; + if(sprite) return null; sprite = new NitroSprite(_arg_3); @@ -2689,23 +2689,23 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public onRoomContentLoaded(id: number, assetName: string, success: boolean): void { - if (!this._roomContentLoader || (id === -1)) return; + if(!this._roomContentLoader || (id === -1)) return; this._thumbnailObjectIdBank.freeNumber((id - 1)); const listeners = this._thumbnailCallbacks.get(assetName); - if (listeners) + if(listeners) { this._thumbnailCallbacks.delete(assetName); const image = this._roomContentLoader.getImage(assetName); - if (image) + if(image) { - for (const listener of listeners) + for(const listener of listeners) { - if (!listener) continue; + if(!listener) continue; listener.imageReady(id, null, image); } @@ -2720,31 +2720,31 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let imageResult: IImageResult = null; const scale = 1; - if (_arg_3) + if(_arg_3) { imageResult = this.getRoomObjectImage(this._activeRoomId, objectId, category, new Vector3d(), 1, null); } else { - if (this._roomContentLoader) + if(this._roomContentLoader) { - if (category === RoomObjectCategory.FLOOR) + if(category === RoomObjectCategory.FLOOR) { type = this._roomContentLoader.getFurnitureFloorNameForTypeId(objectId); colorIndex = this._roomContentLoader.getFurnitureFloorColorIndex(objectId); } - else if (category === RoomObjectCategory.WALL) + else if(category === RoomObjectCategory.WALL) { type = this._roomContentLoader.getFurnitureWallNameForTypeId(objectId, instanceData); colorIndex = this._roomContentLoader.getFurnitureWallColorIndex(objectId); } - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { type = RoomObjectUserType.getTypeString(objectId); - if (type === 'pet') + if(type === 'pet') { type = this.getPetType(instanceData); @@ -2764,11 +2764,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - if (!imageResult || !imageResult.data) return; + if(!imageResult || !imageResult.data) return; const canvas = this.getActiveRoomInstanceRenderingCanvas(); - if (!canvas) return; + if(!canvas) return; const overlay = this.getRenderingCanvasOverlay(canvas); @@ -2776,7 +2776,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const _local_15 = this.addOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE, imageResult.data, scale); - if (_local_15) + if(_local_15) { _local_15.x = (this._activeRoomActiveCanvasMouseX - (imageResult.data.width / 2)); _local_15.y = (this._activeRoomActiveCanvasMouseY - (imageResult.data.height / 2)); @@ -2785,7 +2785,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomObjectImage(roomId: number, objectId: number, category: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): IImageResult { - if (!this._roomManager) return null; + if(!this._roomManager) return null; let id = -1; let type: string = null; @@ -2796,16 +2796,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const roomIdString = this.getRoomId(roomId); const roomInstance = this._roomManager.getRoomInstance(roomIdString); - if (roomInstance) + if(roomInstance) { const roomObject = roomInstance.getRoomObject(objectId, category); - if (roomObject && roomObject.model) + if(roomObject && roomObject.model) { id = roomObject.id; type = roomObject.type; - switch (category) + switch(category) { case RoomObjectCategory.FLOOR: case RoomObjectCategory.WALL: { @@ -2814,7 +2814,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const dataFormat = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); - if (dataFormat !== LegacyDataType.FORMAT_KEY) + if(dataFormat !== LegacyDataType.FORMAT_KEY) { data = ObjectDataFactory.getData(dataFormat); @@ -2838,7 +2838,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let type: string = null; let color = ''; - if (this._roomContentLoader) + if(this._roomContentLoader) { type = this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); color = (this._roomContentLoader.getFurnitureFloorColorIndex(typeId).toString()); @@ -2859,7 +2859,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let type: string = null; let color = ''; - if (this._roomContentLoader) + if(this._roomContentLoader) { type = this._roomContentLoader.getFurnitureWallNameForTypeId(typeId, extra); color = (this._roomContentLoader.getFurnitureWallColorIndex(typeId).toString()); @@ -2880,13 +2880,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let type: string = null; let color = ''; - if (this._roomContentLoader) + if(this._roomContentLoader) { type = this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); color = (this._roomContentLoader.getFurnitureFloorColorIndex(typeId).toString()); } - if ((scale === 1) && listener) + if((scale === 1) && listener) { return this.getGenericRoomObjectThumbnail(type, color, listener, extras, objectData); } @@ -2899,13 +2899,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let type: string = null; let color = ''; - if (this._roomContentLoader) + if(this._roomContentLoader) { type = this._roomContentLoader.getFurnitureWallNameForTypeId(typeId); color = this._roomContentLoader.getFurnitureWallColorIndex(typeId).toString(); } - if ((scale === 1) && listener) + if((scale === 1) && listener) { return this.getGenericRoomObjectThumbnail(type, color, listener, extras, null); } @@ -2918,56 +2918,56 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let type: string = null; let value = ((((typeId + ' ') + paletteId) + ' ') + color.toString(16)); - if (headOnly) value = (value + (' ' + 'head')); + if(headOnly) value = (value + (' ' + 'head')); - if (customParts) + if(customParts) { value = (value + (' ' + customParts.length)); - for (const _local_13 of customParts) + for(const _local_13 of customParts) { value = (value + (((((' ' + _local_13.layerId) + ' ') + _local_13.partId) + ' ') + _local_13.paletteId)); } } - if (this._roomContentLoader) type = this._roomContentLoader.getPetNameForType(typeId); + if(this._roomContentLoader) type = this._roomContentLoader.getPetNameForType(typeId); return this.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, null, null, -1, -1, posture); } public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frameCount: number = -1, posture: string = null, originalId: number = -1): IImageResult { - if (!this._roomManager) return null; + if(!this._roomManager) return null; const imageResult = new ImageResult(); imageResult.id = -1; - if (!this._ready || !type) return imageResult; + if(!this._ready || !type) return imageResult; let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (!roomInstance) + if(!roomInstance) { roomInstance = this._roomManager.createRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (!roomInstance) return imageResult; + if(!roomInstance) return imageResult; } let objectId = this._imageObjectIdBank.reserveNumber(); const objectCategory = this.getRoomObjectCategoryForType(type); - if (objectId < 0) return imageResult; + if(objectId < 0) return imageResult; objectId++; const roomObject = (roomInstance.createRoomObjectAndInitalize(objectId, type, objectCategory) as IRoomObjectController); - if (!roomObject || !roomObject.model || !roomObject.logic) return imageResult; + if(!roomObject || !roomObject.model || !roomObject.logic) return imageResult; const model = roomObject.model; - switch (objectCategory) + switch(objectCategory) { case RoomObjectCategory.FLOOR: case RoomObjectCategory.WALL: @@ -2975,7 +2975,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extras); break; case RoomObjectCategory.UNIT: - if ((type === RoomObjectUserType.USER) || (type === RoomObjectUserType.BOT) || (type === RoomObjectUserType.RENTABLE_BOT) || (type === RoomObjectUserType.PET)) + if((type === RoomObjectUserType.USER) || (type === RoomObjectUserType.BOT) || (type === RoomObjectUserType.RENTABLE_BOT) || (type === RoomObjectUserType.PET)) { model.setValue(RoomObjectVariable.FIGURE, value); } @@ -2986,16 +2986,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato model.setValue(RoomObjectVariable.PET_PALETTE_INDEX, figureData.paletteId); model.setValue(RoomObjectVariable.PET_COLOR, figureData.color); - if (figureData.headOnly) model.setValue(RoomObjectVariable.PET_HEAD_ONLY, 1); + if(figureData.headOnly) model.setValue(RoomObjectVariable.PET_HEAD_ONLY, 1); - if (figureData.hasCustomParts) + if(figureData.hasCustomParts) { model.setValue(RoomObjectVariable.PET_CUSTOM_LAYER_IDS, figureData.customLayerIds); model.setValue(RoomObjectVariable.PET_CUSTOM_PARTS_IDS, figureData.customPartIds); model.setValue(RoomObjectVariable.PET_CUSTOM_PALETTE_IDS, figureData.customPaletteIds); } - if (posture) model.setValue(RoomObjectVariable.FIGURE_POSTURE, posture); + if(posture) model.setValue(RoomObjectVariable.FIGURE_POSTURE, posture); } break; case RoomObjectCategory.ROOM: @@ -3006,16 +3006,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const visualization = roomObject.visualization; - if (!visualization) + if(!visualization) { roomInstance.removeRoomObject(objectId, objectCategory); return imageResult; } - if ((state > -1) || objectData) + if((state > -1) || objectData) { - if (objectData && (objectData.getLegacyString() !== '')) + if(objectData && (objectData.getLegacyString() !== '')) { roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(parseInt(objectData.getLegacyString()), objectData)); } @@ -3029,11 +3029,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato visualization.update(geometry, 0, true, false); - if (frameCount > 0) + if(frameCount > 0) { let i = 0; - while (i < frameCount) + while(i < frameCount) { visualization.update(geometry, 0, true, false); @@ -3046,11 +3046,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato imageResult.data = texture; imageResult.id = objectId; - if (!this.isRoomContentTypeLoaded(type) && listener) + if(!this.isRoomContentTypeLoaded(type) && listener) { let imageListeners = this._imageCallbacks.get(objectId.toString()); - if (!imageListeners) + if(!imageListeners) { imageListeners = []; @@ -3077,27 +3077,27 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getGenericRoomObjectThumbnail(type: string, param: string, listener: IGetImageListener, extraData: string = null, stuffData: IObjectData = null): IImageResult { - if (!this._roomManager) return null; + if(!this._roomManager) return null; const imageResult = new ImageResult(); imageResult.id = -1; - if (!this._ready || !type) return imageResult; + if(!this._ready || !type) return imageResult; let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (!roomInstance) + if(!roomInstance) { roomInstance = this._roomManager.createRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (!roomInstance) return imageResult; + if(!roomInstance) return imageResult; } let objectId = this._thumbnailObjectIdBank.reserveNumber(); const objectCategory = this.getRoomObjectCategoryForType(type); - if (objectId < 0) return imageResult; + if(objectId < 0) return imageResult; objectId++; @@ -3109,11 +3109,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const asset = this._roomContentLoader.getImage(assetName); - if (!asset && listener) + if(!asset && listener) { let contentListeners = this._thumbnailCallbacks.get(assetName); - if (!contentListeners) + if(!contentListeners) { contentListeners = []; @@ -3126,7 +3126,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } else { - if (asset) + if(asset) { imageResult.image = asset; } @@ -3143,7 +3143,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); - if (!roomInstance || !this._roomContentLoader) return; + if(!roomInstance || !this._roomContentLoader) return; const objectCategory = this._roomContentLoader.getCategoryForType(type); const objectManager = roomInstance.getManager(objectCategory); @@ -3151,29 +3151,29 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let geometry: RoomGeometry = null; let scale = 0; - if (objectManager && objectManager.objects.length) + if(objectManager && objectManager.objects.length) { - for (const roomObject of objectManager.objects.getValues()) + for(const roomObject of objectManager.objects.getValues()) { - if (roomObject && roomObject.model && (roomObject.type === type)) + if(roomObject && roomObject.model && (roomObject.type === type)) { const objectId = roomObject.id; const visualization = roomObject.visualization; let texture: RenderTexture = null; - if (visualization) + if(visualization) { const imageScale = roomObject.model.getValue(RoomObjectVariable.IMAGE_QUERY_SCALE); - if (geometry && (scale !== imageScale)) + if(geometry && (scale !== imageScale)) { geometry.dispose(); geometry = null; } - if (!geometry) + if(!geometry) { scale = imageScale; @@ -3191,15 +3191,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const imageListeners = this._imageCallbacks.get(objectId.toString()); - if (imageListeners) + if(imageListeners) { this._imageCallbacks.delete(objectId.toString()); - for (const imageListener of imageListeners) + for(const imageListener of imageListeners) { - if (!imageListener) continue; + if(!imageListener) continue; - if (texture) imageListener.imageReady(objectId, texture); + if(texture) imageListener.imageReady(objectId, texture); else imageListener.imageFailed(objectId); } } @@ -3207,19 +3207,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - if (geometry) geometry.dispose(); + if(geometry) geometry.dispose(); } public setObjectMoverIconSpriteVisible(k: boolean): void { const canvas = this.getActiveRoomInstanceRenderingCanvas(); - if (!canvas) return; + if(!canvas) return; const overlay = this.getRenderingCanvasOverlay(canvas); const sprite = this.getOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE); - if (sprite) + if(sprite) { sprite.visible = k; } @@ -3229,7 +3229,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const canvas = this.getActiveRoomInstanceRenderingCanvas(); - if (!canvas) return; + if(!canvas) return; const sprite = this.getRenderingCanvasOverlay(canvas); @@ -3238,32 +3238,32 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): NitroSprite { - if (!k) return null; + if(!k) return null; const displayObject = (k.master as Container); - if (!displayObject) return null; + if(!displayObject) return null; return ((displayObject.getChildByName(RoomEngine.OVERLAY) as NitroSprite) || null); } private removeOverlayIconSprite(k: NitroSprite, _arg_2: string): boolean { - if (!k) return false; + if(!k) return false; let index = (k.children.length - 1); - while (index >= 0) + while(index >= 0) { const child = (k.getChildAt(index) as NitroSprite); - if (child) + if(child) { - if (child.name === _arg_2) + if(child.name === _arg_2) { k.removeChildAt(index); - if (child.children.length) + if(child.children.length) { const firstChild = (child.getChildAt(0) as NitroSprite); @@ -3284,17 +3284,17 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private getOverlayIconSprite(k: NitroSprite, _arg_2: string): NitroSprite { - if (!k) return null; + if(!k) return null; let index = (k.children.length - 1); - while (index >= 0) + while(index >= 0) { const child = (k.getChildAt(index) as NitroSprite); - if (child) + if(child) { - if (child.name === _arg_2) return child; + if(child.name === _arg_2) return child; } index--; @@ -3305,13 +3305,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public getRoomObjects(roomId: number, category: number): IRoomObject[] { - if (this._ready) + if(this._ready) { 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 []; @@ -3321,21 +3321,21 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { const tileObjectMap = this.getRoomInstanceData(k).tileObjectMap; - if (tileObjectMap) tileObjectMap.addRoomObject(_arg_2); + if(tileObjectMap) tileObjectMap.addRoomObject(_arg_2); } public refreshTileObjectMap(k: number, _arg_2: string): void { const tileObjectMap = this.getRoomInstanceData(k).tileObjectMap; - if (tileObjectMap) tileObjectMap.populate(this.getRoomObjects(k, RoomObjectCategory.FLOOR)); + if(tileObjectMap) tileObjectMap.populate(this.getRoomObjects(k, RoomObjectCategory.FLOOR)); } public getRenderRoomMessage(k: Rectangle, _arg_2: number, _arg_3: boolean = false, _arg_4: boolean = true, _arg_5: boolean = false, canvasId: number = -1): IMessageComposer { let canvas: IRoomRenderingCanvas = null; - if (canvasId > -1) + if(canvasId > -1) { canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); } @@ -3344,16 +3344,16 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato canvas = this.getActiveRoomInstanceRenderingCanvas(); } - if (!canvas) return null; + if(!canvas) return null; - if (_arg_5) + if(_arg_5) { canvas.skipSpriteVisibilityChecking(); } let _local_8 = -1; - if (((!(_arg_4)) && (!(this._roomSessionManager.getSession(this._activeRoomId) == null)))) + if(((!(_arg_4)) && (!(this._roomSessionManager.getSession(this._activeRoomId) == null)))) { _local_8 = this._roomSessionManager.getSession(this._activeRoomId).ownRoomIndex; } @@ -3363,9 +3363,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato const _local_11 = _local_9.getRoomRenderingModifiers(this); const _local_12 = _local_9.getRoomPlanes(k, canvas, this, _arg_2); - if (_arg_5) canvas.resumeSpriteVisibilityChecking(); + if(_arg_5) canvas.resumeSpriteVisibilityChecking(); - if (_arg_3) + if(_arg_3) { //return new RenderRoomThumbnailMessageComposer(_local_12, _local_10, _local_11, this._activeRoomId, this._sessionDataManager._Str_8500); } @@ -3381,7 +3381,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { let canvas: IRoomRenderingCanvas = null; - if (canvasId > -1) + if(canvasId > -1) { canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); } @@ -3392,7 +3392,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato let texture: RenderTexture = null; - if (bounds) + if(bounds) { texture = TextureUtils.generateTexture(canvas.master, bounds); } @@ -3408,7 +3408,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { let composer: RenderRoomMessageComposer = null; - if (saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); + if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); else composer = new RenderRoomMessageComposer(); composer.assignBitmap(texture); @@ -3420,7 +3420,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { let composer: RenderRoomMessageComposer = null; - if (saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); + if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); else composer = new RenderRoomMessageComposer(); composer.assignBase64(base64); @@ -3442,18 +3442,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private getRoomIdFromString(roomId: string): number { - if (!roomId) return -1; + if(!roomId) return -1; const split = roomId.split('_'); - if (split.length <= 0) return -1; + if(split.length <= 0) return -1; return (parseInt(split[0]) || 0); } private getRoomObjectRoomId(object: IRoomObject): string { - if (!object || !object.model) return null; + if(!object || !object.model) return null; return (object.model.getValue(RoomObjectVariable.OBJECT_ROOM_ID)); } @@ -3467,11 +3467,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato { let type = -1; - if (figure) + if(figure) { const parts = figure.split(' '); - if (parts.length > 1) type = parseInt(parts[0]); + if(parts.length > 1) type = parseInt(parts[0]); } return type; @@ -3479,15 +3479,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato private getPetType(type: string): string { - if (!type) return null; + if(!type) return null; const parts = type.split(' '); - if (parts.length > 1) + if(parts.length > 1) { const typeId = parseInt(parts[0]); - if (this._roomContentLoader) return this._roomContentLoader.getPetNameForType(typeId); + if(this._roomContentLoader) return this._roomContentLoader.getPetNameForType(typeId); return 'pet'; } @@ -3497,28 +3497,28 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public isRoomContentTypeLoaded(name: string): boolean { - if (!this._roomContentLoader) return false; + if(!this._roomContentLoader) return false; return (this._roomContentLoader.getCollection(name) !== null); } public getPetColorResult(petIndex: number, paletteIndex: number): IPetColorResult { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getPetColorResult(petIndex, paletteIndex); } public getPetColorResultsForTag(petIndex: number, tagName: string): IPetColorResult[] { - if (!this._roomContentLoader) return null; + if(!this._roomContentLoader) return null; return this._roomContentLoader.getPetColorResultsForTag(petIndex, tagName); } public deleteRoomObject(objectId: number, objectCategory: number): boolean { - if (!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false; + if(!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false; return this._roomObjectEventHandler.deleteWallItem(this._activeRoomId, objectId); } @@ -3595,7 +3595,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public get isDecorating(): boolean { - if (!this._roomSessionManager) return false; + if(!this._roomSessionManager) return false; const session = this._roomSessionManager.getSession(this._activeRoomId); @@ -3609,14 +3609,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato public get selectedAvatarId(): number { - if (!this._roomObjectEventHandler) return -1; + if(!this._roomObjectEventHandler) return -1; return this._roomObjectEventHandler.selectedAvatarId; } public getRoomObjectCount(roomId: number, categoryId: number): number { - if (this._roomManager == null) return 0; + if(this._roomManager == null) return 0; return this._roomManager.getRoomInstance(roomId.toString()).getRoomObjectsForCategory(categoryId).length; } diff --git a/src/nitro/room/RoomMessageHandler.ts b/src/nitro/room/RoomMessageHandler.ts index 70916a77..4943979f 100644 --- a/src/nitro/room/RoomMessageHandler.ts +++ b/src/nitro/room/RoomMessageHandler.ts @@ -44,7 +44,7 @@ export class RoomMessageHandler extends Disposable this._roomCreator = null; this._latestEntryTileEvent = null; - if (this._planeParser) + if(this._planeParser) { this._planeParser.dispose(); @@ -54,7 +54,7 @@ export class RoomMessageHandler extends Disposable public setConnection(connection: IConnection) { - if (this._connection || !connection) return; + if(this._connection || !connection) return; this._connection = connection; @@ -106,9 +106,9 @@ export class RoomMessageHandler extends Disposable public setRoomId(id: number): void { - if (this._currentRoomId !== 0) + if(this._currentRoomId !== 0) { - if (this._roomCreator) this._roomCreator.destroyRoom(this._currentRoomId); + if(this._roomCreator) this._roomCreator.destroyRoom(this._currentRoomId); } this._currentRoomId = id; @@ -123,11 +123,11 @@ export class RoomMessageHandler extends Disposable private onUserInfoEvent(event: UserInfoEvent): void { - if (!(event instanceof UserInfoEvent) || !event.connection) return; + if(!(event instanceof UserInfoEvent) || !event.connection) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._ownUserId = parser.userInfo.userId; } @@ -136,17 +136,17 @@ export class RoomMessageHandler extends Disposable { const parser = event.getParser(); - if (this._currentRoomId !== parser.roomId) + if(this._currentRoomId !== parser.roomId) { this.setRoomId(parser.roomId); } - if (this._roomCreator) + if(this._roomCreator) { this._roomCreator.setRoomInstanceModelName(parser.roomId, parser.name); } - if (this._initialConnection) + if(this._initialConnection) { event.connection.send(new FurnitureAliasesComposer()); @@ -160,17 +160,17 @@ export class RoomMessageHandler extends Disposable private onRoomPaintEvent(event: RoomPaintEvent): void { - if (!(event instanceof RoomPaintEvent)) return; + if(!(event instanceof RoomPaintEvent)) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const floorType = parser.floorType; const wallType = parser.wallType; const landscapeType = parser.landscapeType; - if (this._roomCreator) + if(this._roomCreator) { this._roomCreator.updateRoomInstancePlaneType(this._currentRoomId, floorType, wallType, landscapeType); } @@ -178,15 +178,15 @@ export class RoomMessageHandler extends Disposable private onRoomModelEvent(event: FloorHeightMapEvent): void { - if (!(event instanceof FloorHeightMapEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FloorHeightMapEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); - if (!wallGeometry) return; + if(!wallGeometry) return; this._planeParser.reset(); @@ -197,7 +197,7 @@ export class RoomMessageHandler extends Disposable let entryTile: RoomEntryTileMessageParser = null; - if (this._latestEntryTileEvent) entryTile = this._latestEntryTileEvent.getParser(); + if(this._latestEntryTileEvent) entryTile = this._latestEntryTileEvent.getParser(); let doorX = -1; let doorY = -1; @@ -206,17 +206,17 @@ export class RoomMessageHandler extends Disposable let y = 0; - while (y < height) + while(y < height) { let x = 0; - while (x < width) + while(x < width) { const tileHeight = parser.getHeight(x, y); - if (((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) + if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) { - if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) { doorX = (x + 0.5); doorY = y; @@ -224,7 +224,7 @@ export class RoomMessageHandler extends Disposable doorDirection = 90; } - if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) { doorX = x; doorY = (y + 0.5); @@ -245,7 +245,7 @@ export class RoomMessageHandler extends Disposable this._planeParser.initializeFromTileData(parser.wallHeight); this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), (doorZ + this._planeParser.wallHeight)); - if (parser.scale === 64) + if(parser.scale === 64) { this._planeParser.restrictsDragging = true; this._planeParser.restrictsScaling = true; @@ -263,11 +263,11 @@ export class RoomMessageHandler extends Disposable let heightIterator = (parser.height - 1); - while (heightIterator >= 0) + while(heightIterator >= 0) { let widthIterator = (parser.width - 1); - while (widthIterator >= 0) + while(widthIterator >= 0) { wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator)); widthIterator--; @@ -290,11 +290,11 @@ export class RoomMessageHandler extends Disposable private onRoomHeightMapEvent(event: RoomHeightMapEvent): void { - if (!(event instanceof RoomHeightMapEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomHeightMapEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const width = parser.width; const height = parser.height; @@ -302,11 +302,11 @@ export class RoomMessageHandler extends Disposable let y = 0; - while (y < height) + while(y < height) { let x = 0; - while (x < width) + while(x < width) { heightMap.setTileHeight(x, y, parser.getTileHeight(x, y)); heightMap.setStackingBlocked(x, y, parser.getStackingBlocked(x, y)); @@ -323,17 +323,17 @@ export class RoomMessageHandler extends Disposable private onRoomHeightMapUpdateEvent(event: RoomHeightMapUpdateEvent): void { - if (!(event instanceof RoomHeightMapUpdateEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomHeightMapUpdateEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const heightMap = this._roomCreator.getFurnitureStackingHeightMap(this._currentRoomId); - if (!heightMap) return; + if(!heightMap) return; - while (parser.next()) + while(parser.next()) { heightMap.setTileHeight(parser.x, parser.y, parser.tileHeight()); heightMap.setStackingBlocked(parser.x, parser.y, parser.isStackingBlocked()); @@ -345,18 +345,18 @@ export class RoomMessageHandler extends Disposable private onRoomThicknessEvent(event: RoomVisualizationSettingsEvent): void { - if (!(event instanceof RoomVisualizationSettingsEvent)) return; + if(!(event instanceof RoomVisualizationSettingsEvent)) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const visibleWall = !parser.hideWalls; const visibleFloor = true; const thicknessWall = parser.thicknessWall; const thicknessFloor = parser.thicknessFloor; - if (this._roomCreator) + if(this._roomCreator) { this._roomCreator.updateRoomInstancePlaneVisibility(this._currentRoomId, visibleWall, visibleFloor); this._roomCreator.updateRoomInstancePlaneThickness(this._currentRoomId, thicknessWall, thicknessFloor); @@ -365,14 +365,14 @@ export class RoomMessageHandler extends Disposable private onRoomDoorEvent(event: RoomEntryTileMessageEvent): void { - if (!(event instanceof RoomEntryTileMessageEvent)) return; + if(!(event instanceof RoomEntryTileMessageEvent)) return; this._latestEntryTileEvent = event; } private onRoomRollingEvent(event: ObjectsRollingEvent): void { - if (!(event instanceof ObjectsRollingEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof ObjectsRollingEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); @@ -381,11 +381,11 @@ export class RoomMessageHandler extends Disposable const furnitureRolling = parser.itemsRolling; - if (furnitureRolling && furnitureRolling.length) + if(furnitureRolling && furnitureRolling.length) { - for (const rollData of furnitureRolling) + for(const rollData of furnitureRolling) { - if (!rollData) continue; + if(!rollData) continue; this._roomCreator.rollRoomObjectFloor(this._currentRoomId, rollData.id, rollData.location, rollData.targetLocation); } @@ -393,17 +393,17 @@ export class RoomMessageHandler extends Disposable const unitRollData = parser.unitRolling; - if (unitRollData) + if(unitRollData) { this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, unitRollData.id, unitRollData.location, unitRollData.targetLocation); const object = this._roomCreator.getRoomObjectUser(this._currentRoomId, unitRollData.id); - if (object && object.type !== RoomObjectUserType.MONSTER_PLANT) + if(object && object.type !== RoomObjectUserType.MONSTER_PLANT) { let posture = 'std'; - switch (unitRollData.movementType) + switch(unitRollData.movementType) { case ObjectRolling.MOVE: posture = 'mv'; @@ -420,13 +420,13 @@ export class RoomMessageHandler extends Disposable private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void { - if (!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; - for (const object of parser.objects) + for(const object of parser.objects) { this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data); } @@ -434,7 +434,7 @@ export class RoomMessageHandler extends Disposable private onFurnitureAliasesEvent(event: FurnitureAliasesEvent): void { - if (!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return; const alises = event.getParser().aliases; @@ -443,32 +443,32 @@ export class RoomMessageHandler extends Disposable private onFurnitureFloorAddEvent(event: FurnitureFloorAddEvent): void { - if (!(event instanceof FurnitureFloorAddEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureFloorAddEvent) || !event.connection || !this._roomCreator) return; const item = event.getParser().item; - if (!item) return; + if(!item) return; this.addRoomObjectFurnitureFloor(this._currentRoomId, item); } private onFurnitureFloorEvent(event: FurnitureFloorEvent): void { - if (!(event instanceof FurnitureFloorEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureFloorEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const totalObjects = parser.items.length; let iterator = 0; - while (iterator < totalObjects) + while(iterator < totalObjects) { const object = parser.items[iterator]; - if (object) this.addRoomObjectFurnitureFloor(this._currentRoomId, object); + if(object) this.addRoomObjectFurnitureFloor(this._currentRoomId, object); iterator++; } @@ -476,13 +476,13 @@ export class RoomMessageHandler extends Disposable private onFurnitureFloorRemoveEvent(event: FurnitureFloorRemoveEvent): void { - if (!(event instanceof FurnitureFloorRemoveEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureFloorRemoveEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; - if (parser.delay > 0) + if(parser.delay > 0) { setTimeout(() => { @@ -497,11 +497,11 @@ export class RoomMessageHandler extends Disposable private onFurnitureFloorUpdateEvent(event: FurnitureFloorUpdateEvent): void { - if (!(event instanceof FurnitureFloorUpdateEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureFloorUpdateEvent) || !event.connection || !this._roomCreator) return; const item = event.getParser().item; - if (!item) return; + if(!item) return; const location: IVector3D = new Vector3d(item.x, item.y, item.z); const direction: IVector3D = new Vector3d(item.direction); @@ -513,32 +513,32 @@ export class RoomMessageHandler extends Disposable private onFurnitureWallAddEvent(event: FurnitureWallAddEvent): void { - if (!(event instanceof FurnitureWallAddEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureWallAddEvent) || !event.connection || !this._roomCreator) return; const data = event.getParser().item; - if (!data) return; + if(!data) return; this.addRoomObjectFurnitureWall(this._currentRoomId, data); } private onFurnitureWallEvent(event: FurnitureWallEvent): void { - if (!(event instanceof FurnitureWallEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureWallEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const totalObjects = parser.items.length; let iterator = 0; - while (iterator < totalObjects) + while(iterator < totalObjects) { const data = parser.items[iterator]; - if (data) this.addRoomObjectFurnitureWall(this._currentRoomId, data); + if(data) this.addRoomObjectFurnitureWall(this._currentRoomId, data); iterator++; } @@ -546,26 +546,26 @@ export class RoomMessageHandler extends Disposable private onFurnitureWallRemoveEvent(event: FurnitureWallRemoveEvent): void { - if (!(event instanceof FurnitureWallRemoveEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureWallRemoveEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.removeRoomObjectWall(this._currentRoomId, parser.itemId, parser.userId); } private onFurnitureWallUpdateEvent(event: FurnitureWallUpdateEvent): void { - if (!(event instanceof FurnitureWallUpdateEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureWallUpdateEvent) || !event.connection || !this._roomCreator) return; const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); - if (!wallGeometry) return; + if(!wallGeometry) return; const item = event.getParser().item; - if (!item) return; + if(!item) return; const location = wallGeometry.getLocation(item.width, item.height, item.localX, item.localY, item.direction); const direction = new Vector3d(wallGeometry.getDirection(item.direction)); @@ -576,7 +576,7 @@ export class RoomMessageHandler extends Disposable private onFurnitureDataEvent(event: FurnitureDataEvent): void { - if (!(event instanceof FurnitureDataEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof FurnitureDataEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); @@ -585,7 +585,7 @@ export class RoomMessageHandler extends Disposable private onItemDataUpdateMessageEvent(event: ItemDataUpdateMessageEvent): void { - if (!(event instanceof ItemDataUpdateMessageEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof ItemDataUpdateMessageEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); @@ -594,7 +594,7 @@ export class RoomMessageHandler extends Disposable private onOneWayDoorStatusMessageEvent(event: OneWayDoorStatusMessageEvent): void { - if (!(event instanceof OneWayDoorStatusMessageEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof OneWayDoorStatusMessageEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); @@ -603,7 +603,7 @@ export class RoomMessageHandler extends Disposable private onDiceValueMessageEvent(event: DiceValueMessageEvent): void { - if (!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); @@ -612,36 +612,36 @@ export class RoomMessageHandler extends Disposable private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void { - if (!(event instanceof RoomUnitDanceEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitDanceEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_DANCE, event.getParser().danceId); } private onRoomUnitEffectEvent(event: RoomUnitEffectEvent): void { - if (!(event instanceof RoomUnitEffectEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitEffectEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserEffect(this._currentRoomId, event.getParser().unitId, event.getParser().effectId, event.getParser().delay); } private onRoomUnitEvent(event: RoomUnitEvent): void { - if (!(event instanceof RoomUnitEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitEvent) || !event.connection || !this._roomCreator) return; const users = event.getParser().users; - if (!users || !users.length) return; + if(!users || !users.length) return; - for (const user of users) + for(const user of users) { - if (!user) continue; + if(!user) continue; const location = new Vector3d(user.x, user.y, user.z); const direction = new Vector3d(user.dir); this._roomCreator.addRoomObjectUser(this._currentRoomId, user.roomIndex, location, direction, user.dir, user.userType, user.figure); - if (user.webID === this._ownUserId) + if(user.webID === this._ownUserId) { this._roomCreator.setRoomSessionOwnUser(this._currentRoomId, user.roomIndex); this._roomCreator.updateRoomObjectUserOwn(this._currentRoomId, user.roomIndex); @@ -649,9 +649,9 @@ export class RoomMessageHandler extends Disposable this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, user.roomIndex, user.figure, user.sex, user.subType, user.isRiding); - if (RoomObjectUserType.getTypeString(user.userType) === RoomObjectUserType.PET) + if(RoomObjectUserType.getTypeString(user.userType) === RoomObjectUserType.PET) { - if (this._roomCreator.getPetTypeId(user.figure) === PetType.MONSTERPLANT) + if(this._roomCreator.getPetTypeId(user.figure) === PetType.MONSTERPLANT) { this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, user.roomIndex, user.petPosture); } @@ -665,46 +665,46 @@ export class RoomMessageHandler extends Disposable private onRoomUnitExpressionEvent(event: RoomUnitExpressionEvent): void { - if (!(event instanceof RoomUnitExpressionEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitExpressionEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_EXPRESSION, event.getParser().expression); } private onRoomUnitHandItemEvent(event: RoomUnitHandItemEvent): void { - if (!(event instanceof RoomUnitHandItemEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitHandItemEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_CARRY_OBJECT, event.getParser().handId); } private onRoomUnitIdleEvent(event: RoomUnitIdleEvent): void { - if (!(event instanceof RoomUnitIdleEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitIdleEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_SLEEP, (event.getParser().isIdle ? 1 : 0)); } private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void { - if (!(event instanceof RoomUnitInfoEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitInfoEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, event.getParser().unitId, event.getParser().figure, event.getParser().gender); } private onRoomUnitNumberEvent(event: RoomUnitNumberEvent): void { - if (!(event instanceof RoomUnitNumberEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitNumberEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.unitId, RoomObjectVariable.FIGURE_NUMBER_VALUE, parser.value); } private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void { - if (!(event instanceof RoomUnitRemoveEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitRemoveEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.removeRoomObjectUser(this._currentRoomId, event.getParser().unitId); @@ -713,32 +713,32 @@ export class RoomMessageHandler extends Disposable private onRoomUnitStatusEvent(event: RoomUnitStatusEvent): void { - if (!(event instanceof RoomUnitStatusEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitStatusEvent) || !event.connection || !this._roomCreator) return; const statuses = event.getParser().statuses; - if (!statuses || !statuses.length) return; + if(!statuses || !statuses.length) return; const roomInstance = this._roomCreator.getRoomInstance(this._currentRoomId); - if (!roomInstance) return; + if(!roomInstance) return; const zScale = (roomInstance.model.getValue(RoomVariableEnum.ROOM_Z_SCALE) || 1); - for (const status of statuses) + for(const status of statuses) { - if (!status) continue; + if(!status) continue; let height = status.height; - if (height) height = (height / zScale); + if(height) height = (height / zScale); const location = new Vector3d(status.x, status.y, (status.z + height)); const direction = new Vector3d(status.direction); let goal: IVector3D = null; - if (status.didMove) goal = new Vector3d(status.targetX, status.targetY, status.targetZ); + if(status.didMove) goal = new Vector3d(status.targetX, status.targetY, status.targetZ); this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, status.id, location, goal, status.canStandUp, height, direction, status.headDirection); this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, null); @@ -748,24 +748,24 @@ export class RoomMessageHandler extends Disposable let postureType = RoomObjectVariable.STD; let parameter = ''; - if (status.actions && status.actions.length) + if(status.actions && status.actions.length) { - for (const action of status.actions) + for(const action of status.actions) { - if (!action) continue; + if(!action) continue; - switch (action.action) + switch(action.action) { case 'flatctrl': this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, action.value); break; case 'sign': - if (status.actions.length === 1) isPosture = false; + if(status.actions.length === 1) isPosture = false; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, status.id, RoomObjectVariable.FIGURE_SIGN, parseInt(action.value)); break; case 'gst': - if (status.actions.length === 1) isPosture = false; + if(status.actions.length === 1) isPosture = false; this._roomCreator.updateRoomObjectUserPetGesture(this._currentRoomId, status.id, action.value); break; @@ -785,8 +785,8 @@ export class RoomMessageHandler extends Disposable } } - if (postureUpdate) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, postureType, parameter); - else if (isPosture) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, RoomObjectVariable.STD, ''); + if(postureUpdate) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, postureType, parameter); + else if(isPosture) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, RoomObjectVariable.STD, ''); } this.updateGuideMarker(); @@ -794,11 +794,11 @@ export class RoomMessageHandler extends Disposable private onRoomUnitChatEvent(event: RoomUnitChatEvent): void { - if (!event.connection || !this._roomCreator) return; + if(!event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.updateRoomObjectUserGesture(this._currentRoomId, parser.roomIndex, parser.gesture); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_TALK, (parser.message.length / 10)); @@ -806,18 +806,18 @@ export class RoomMessageHandler extends Disposable private onRoomUnitTypingEvent(event: RoomUnitTypingEvent): void { - if (!(event instanceof RoomUnitTypingEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof RoomUnitTypingEvent) || !event.connection || !this._roomCreator) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_IS_TYPING, event.getParser().isTyping ? 1 : 0); } private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void { - if (!(event instanceof PetFigureUpdateEvent) || !event.connection || !this._roomCreator) return; + if(!(event instanceof PetFigureUpdateEvent) || !event.connection || !this._roomCreator) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, parser.roomIndex, parser.figureData.figuredata, '', '', parser.isRiding); } @@ -826,30 +826,30 @@ export class RoomMessageHandler extends Disposable { const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, parser.gainedExperience); } private onYouArePlayingGameEvent(event: YouArePlayingGameEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._roomCreator.setRoomEngineGameMode(this._currentRoomId, parser.isPlaying); } private addRoomObjectFurnitureFloor(roomId: number, data: FurnitureFloorDataParser): void { - if (!data || !this._roomCreator) return; + if(!data || !this._roomCreator) return; const location = new Vector3d(data.x, data.y, data.z); const direction = new Vector3d(data.direction); - if (data.spriteName) + if(data.spriteName) { this._roomCreator.addFurnitureFloorByTypeName(roomId, data.itemId, data.spriteName, location, direction, data.state, data.data, data.extra, data.expires, data.usagePolicy, data.userId, data.username, true, true, data.stackHeight); } @@ -861,15 +861,15 @@ export class RoomMessageHandler extends Disposable private addRoomObjectFurnitureWall(roomId: number, data: FurnitureWallDataParser): void { - if (!data || !this._roomCreator) return; + if(!data || !this._roomCreator) return; const wallGeometry = this._roomCreator.getLegacyWallGeometry(roomId); - if (!wallGeometry) return; + if(!wallGeometry) return; let location: IVector3D = null; - if (!data.isOldFormat) + if(!data.isOldFormat) { location = wallGeometry.getLocation(data.width, data.height, data.localX, data.localY, data.direction); } @@ -885,21 +885,21 @@ export class RoomMessageHandler extends Disposable private onIgnoreResultEvent(event: IgnoreResultEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); - if (!roomSession) return; + if(!roomSession) return; const userData = roomSession.userDataManager.getUserDataByName(parser.name); - if (!userData) return; + if(!userData) return; - switch (parser.result) + switch(parser.result) { case 1: case 2: @@ -950,15 +950,15 @@ export class RoomMessageHandler extends Disposable private setUserGuideStatus(userId: number, status: number): void { - if (!this._roomCreator || !this._roomCreator.roomSessionManager) return; + if(!this._roomCreator || !this._roomCreator.roomSessionManager) return; const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); - if (!roomSession) return; + if(!roomSession) return; const userData = roomSession.userDataManager.getDataByType(userId, RoomObjectType.USER); - if (!userData) return; + if(!userData) return; this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_GUIDE_STATUS, status); } diff --git a/src/nitro/room/RoomObjectEventHandler.ts b/src/nitro/room/RoomObjectEventHandler.ts index 80d0ea54..bcf67740 100644 --- a/src/nitro/room/RoomObjectEventHandler.ts +++ b/src/nitro/room/RoomObjectEventHandler.ts @@ -41,7 +41,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public dispose(): void { - if (this._eventIds) + if(this._eventIds) { this._eventIds = null; } @@ -55,19 +55,19 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { let selectedData = this.getSelectedRoomObjectData(event.roomId); - if (!selectedData) return; + if(!selectedData) return; - if ((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) && (selectedData.id === event.objectId)) + if((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) && (selectedData.id === event.objectId)) { const roomObject = this._roomEngine.getRoomObject(event.roomId, selectedData.id, selectedData.category); - if (roomObject && roomObject.model) + if(roomObject && roomObject.model) { - if (selectedData.category === RoomObjectCategory.FLOOR) + if(selectedData.category === RoomObjectCategory.FLOOR) { const allowedDirections = roomObject.model.getValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS); - if (allowedDirections && allowedDirections.length) + if(allowedDirections && allowedDirections.length) { const direction = new Vector3d(allowedDirections[0]); @@ -77,7 +77,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou selectedData = this.getSelectedRoomObjectData(event.roomId); - if (!selectedData) return; + if(!selectedData) return; } } } @@ -88,31 +88,31 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public processRoomCanvasMouseEvent(event: RoomSpriteMouseEvent, object: IRoomObject, geometry: IRoomGeometry): void { - if (!event || !object) return; + if(!event || !object) return; - if (RoomEnterEffect.isRunning()) return; + if(RoomEnterEffect.isRunning()) return; const type = object.type; let category = this._roomEngine.getRoomObjectCategoryForType(type); - if ((category !== RoomObjectCategory.ROOM) && (!this._roomEngine.isPlayingGame() || category !== RoomObjectCategory.UNIT)) category = RoomObjectCategory.MINIMUM; + if((category !== RoomObjectCategory.ROOM) && (!this._roomEngine.isPlayingGame() || category !== RoomObjectCategory.UNIT)) category = RoomObjectCategory.MINIMUM; const _local_7 = this.getMouseEventId(category, event.type); - if (_local_7 === event.eventId) + if(_local_7 === event.eventId) { - if ((event.type === MouseEventType.MOUSE_CLICK) || (event.type === MouseEventType.DOUBLE_CLICK) || (event.type === MouseEventType.MOUSE_DOWN) || (event.type === MouseEventType.MOUSE_UP) || (event.type === MouseEventType.MOUSE_MOVE)) return; + if((event.type === MouseEventType.MOUSE_CLICK) || (event.type === MouseEventType.DOUBLE_CLICK) || (event.type === MouseEventType.MOUSE_DOWN) || (event.type === MouseEventType.MOUSE_UP) || (event.type === MouseEventType.MOUSE_MOVE)) return; } else { - if (event.eventId) + if(event.eventId) { this.setMouseEventId(category, event.type, event.eventId); } } - if (object.mouseHandler) object.mouseHandler.mouseEvent(event, geometry); + if(object.mouseHandler) object.mouseHandler.mouseEvent(event, geometry); } public processRoomObjectPlacement(placementSource: string, roomId: number, id: number, category: number, typeId: number, extra: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): boolean @@ -124,7 +124,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.setSelectedRoomObjectData(roomId, id, category, location, direction, RoomObjectOperationType.OBJECT_PLACE, typeId, extra, stuffData, state, frameNumber, posture); - if (this._roomEngine) + if(this._roomEngine) { this._roomEngine.setObjectMoverIconSprite(typeId, category, false, extra, stuffData, state, frameNumber, posture); this._roomEngine.setObjectMoverIconSpriteVisible(false); @@ -144,7 +144,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { const existing = this._eventIds.get(k); - if (!existing) return null; + if(!existing) return null; return (existing.get(_arg_2) || null); } @@ -153,7 +153,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { let existing = this._eventIds.get(k); - if (!existing) + if(!existing) { existing = new Map(); @@ -167,16 +167,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public handleRoomObjectEvent(event: RoomObjectEvent, roomId: number): void { - if (!event) return; + if(!event) return; - if (event instanceof RoomObjectMouseEvent) + if(event instanceof RoomObjectMouseEvent) { this.handleRoomObjectMouseEvent(event, roomId); return; } - switch (event.type) + switch(event.type) { case RoomObjectStateChangedEvent.STATE_CHANGE: case RoomObjectStateChangedEvent.STATE_RANDOM: @@ -290,9 +290,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectMouseEvent(event: RoomObjectMouseEvent, roomId: number): void { - if (!event || !event.type) return; + if(!event || !event.type) return; - switch (event.type) + switch(event.type) { case RoomObjectMouseEvent.CLICK: this.handleRoomObjectMouseClickEvent(event, roomId); @@ -317,20 +317,20 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectMouseClickEvent(event: RoomObjectMouseEvent, roomId: number): void { - if (!event) return; + if(!event) return; let operation = RoomObjectOperationType.OBJECT_UNDEFINED; const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) operation = selectedData.operation; + if(selectedData) operation = selectedData.operation; let didWalk = false; let didMove = false; - if (this._whereYouClickIsWhereYouGo) + if(this._whereYouClickIsWhereYouGo) { - if (!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED)) + if(!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED)) { didWalk = this.handleMoveTargetFurni(roomId, event); } @@ -338,50 +338,50 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_MOVE: - if (category === RoomObjectCategory.ROOM) + if(category === RoomObjectCategory.ROOM) { - if (selectedData) + if(selectedData) { this.modifyRoomObject(roomId, selectedData.id, selectedData.category, RoomObjectOperationType.OBJECT_MOVE_TO); } } - else if (category === RoomObjectCategory.UNIT) + else if(category === RoomObjectCategory.UNIT) { - if (selectedData && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + if(selectedData && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) { this.modifyRoomObject(roomId, selectedData.id, selectedData.category, RoomObjectOperationType.OBJECT_MOVE_TO); } - if (event.eventId) this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); + if(event.eventId) this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); this.placeObjectOnUser(roomId, event.objectId, category); } didMove = true; - if (event.objectId !== -1) this.setSelectedObject(roomId, event.objectId, category); + if(event.objectId !== -1) this.setSelectedObject(roomId, event.objectId, category); break; case RoomObjectOperationType.OBJECT_PLACE: - if (category === RoomObjectCategory.ROOM) + if(category === RoomObjectCategory.ROOM) { this.placeObject(roomId, (event instanceof RoomObjectTileMouseEvent), (event instanceof RoomObjectWallMouseEvent)); } - else if (category === RoomObjectCategory.UNIT) + else if(category === RoomObjectCategory.UNIT) { - switch (event.objectType) + switch(event.objectType) { case RoomObjectUserType.MONSTER_PLANT: case RoomObjectUserType.RENTABLE_BOT: this.placeObject(roomId, (event instanceof RoomObjectTileMouseEvent), (event instanceof RoomObjectWallMouseEvent)); break; default: - if (event.eventId) + if(event.eventId) { this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); } @@ -392,9 +392,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } break; case RoomObjectOperationType.OBJECT_UNDEFINED: - if (category === RoomObjectCategory.ROOM) + if(category === RoomObjectCategory.ROOM) { - if (!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.onRoomObjectTileMouseEvent(roomId, event); + if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.onRoomObjectTileMouseEvent(roomId, event); } else { @@ -402,24 +402,24 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou didMove = false; - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { - if (event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.RENTABLE_BOT)) + if(event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.RENTABLE_BOT)) { this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP_BOT); } - else if (event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + else if(event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) { this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP_PET); } - else if (!event.ctrlKey && !event.altKey && event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + else if(!event.ctrlKey && !event.altKey && event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) { this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE); } - if (!this._roomEngine.isPlayingGame()) + if(!this._roomEngine.isPlayingGame()) { didWalk = true; } @@ -429,27 +429,27 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - else if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) + else if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) { - if (event.altKey || event.ctrlKey || event.shiftKey) + if(event.altKey || event.ctrlKey || event.shiftKey) { - if (!event.ctrlKey && !event.altKey && event.shiftKey) + if(!event.ctrlKey && !event.altKey && event.shiftKey) { - if (category === RoomObjectCategory.FLOOR) + if(category === RoomObjectCategory.FLOOR) { - if (this._roomEngine.events) + if(this._roomEngine.events) { this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_ROTATE, roomId, event.objectId, category)); } } } - else if (event.ctrlKey && !event.altKey && !event.shiftKey) + else if(event.ctrlKey && !event.altKey && !event.shiftKey) { this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP); } - if (!this._roomEngine.isPlayingGame()) + if(!this._roomEngine.isPlayingGame()) { didWalk = true; } @@ -460,14 +460,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - if (event.eventId) + if(event.eventId) { - if (didWalk) + if(didWalk) { this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); } - if (didMove) + if(didMove) { this.setMouseEventId(RoomObjectCategory.MINIMUM, MouseEventType.MOUSE_CLICK, event.eventId); } @@ -476,16 +476,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou break; } - if (category === RoomObjectCategory.ROOM) + if(category === RoomObjectCategory.ROOM) { const _local_15 = this.getMouseEventId(RoomObjectCategory.MINIMUM, MouseEventType.MOUSE_CLICK); const _local_16 = this.getMouseEventId(RoomObjectCategory.UNIT, MouseEventType.MOUSE_CLICK); - if ((_local_15 !== event.eventId) && (_local_16 !== event.eventId) && !didMove) + if((_local_15 !== event.eventId) && (_local_16 !== event.eventId) && !didMove) { this.deselectObject(roomId); - if (this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); + if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); this.setSelectedAvatar(roomId, 0, false); } @@ -494,32 +494,32 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectMouseMoveEvent(event: RoomObjectMouseEvent, roomId: number): void { - if (!event) return; + if(!event) return; let operation = RoomObjectOperationType.OBJECT_UNDEFINED; const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) operation = selectedData.operation; + if(selectedData) operation = selectedData.operation; const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - if (this._roomEngine) + if(this._roomEngine) { const roomCursor = this._roomEngine.getRoomObjectCursor(roomId); - if (roomCursor && roomCursor.logic) + if(roomCursor && roomCursor.logic) { let newEvent: ObjectTileCursorUpdateMessage = null; - if (event instanceof RoomObjectTileMouseEvent) + if(event instanceof RoomObjectTileMouseEvent) { newEvent = this.handleMouseOverTile(event, roomId); } - else if (event.object && (event.object.id !== -1)) + else if(event.object && (event.object.id !== -1)) { - if (this._whereYouClickIsWhereYouGo) + if(this._whereYouClickIsWhereYouGo) { newEvent = this.handleMouseOverObject(category, roomId, event); } @@ -534,14 +534,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_MOVE: - if (category === RoomObjectCategory.ROOM) this.handleObjectMove(event, roomId); + if(category === RoomObjectCategory.ROOM) this.handleObjectMove(event, roomId); return; case RoomObjectOperationType.OBJECT_PLACE: - if (category === RoomObjectCategory.ROOM) this.handleObjectPlace(event, roomId); + if(category === RoomObjectCategory.ROOM) this.handleObjectPlace(event, roomId); return; } @@ -549,24 +549,24 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectMouseDownEvent(event: RoomObjectMouseEvent, roomId: number): void { - if (!event) return; + if(!event) return; let operation = RoomObjectOperationType.OBJECT_UNDEFINED; const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) operation = selectedData.operation; + if(selectedData) operation = selectedData.operation; const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_UNDEFINED: - if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) { - if ((event.altKey && !event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) + 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(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MOVE, roomId, event.objectId, category)); } } return; @@ -575,24 +575,24 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectMouseDownLongEvent(event: RoomObjectMouseEvent, roomId: number): void { - if (!event) return; + if(!event) return; let operation = RoomObjectOperationType.OBJECT_UNDEFINED; const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) operation = selectedData.operation; + if(selectedData) operation = selectedData.operation; const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_UNDEFINED: - if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) { - if ((!event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) + 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(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category)); } } return; @@ -605,7 +605,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const type = event.objectType; const category = this._roomEngine.getRoomObjectCategoryForType(type); - if (this._roomEngine.events) + if(this._roomEngine.events) { this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_ENTER, roomId, id, category)); } @@ -617,17 +617,17 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const type = event.objectType; const category = this._roomEngine.getRoomObjectCategoryForType(type); - if (category !== RoomObjectCategory.ROOM) + if(category !== RoomObjectCategory.ROOM) { - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { const cursor = this._roomEngine.getRoomObjectCursor(roomId); - if (cursor) cursor.processUpdateMessage(new ObjectDataUpdateMessage(0, null)); + if(cursor) cursor.processUpdateMessage(new ObjectDataUpdateMessage(0, null)); } } - if (this._roomEngine.events) + if(this._roomEngine.events) { this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_LEAVE, roomId, id, category)); } @@ -637,9 +637,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectStateChangedEvent(event: RoomObjectStateChangedEvent, roomId: number): void { - if (!event) return; + if(!event) return; - switch (event.type) + switch(event.type) { case RoomObjectStateChangedEvent.STATE_CHANGE: this.changeObjectState(roomId, event.object.id, event.object.type, event.state, false); @@ -652,9 +652,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectDimmerStateUpdateEvent(event: RoomObjectDimmerStateUpdateEvent, roomId: number): void { - if (!event) return; + if(!event) return; - switch (event.type) + switch(event.type) { case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE: this._roomEngine.events.dispatchEvent(new RoomEngineDimmerStateEvent(roomId, event.state, event.presetId, event.effectId, event.color, event.brightness)); @@ -664,9 +664,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleSelectedObjectRemove(event: RoomObjectMoveEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; - switch (event.type) + switch(event.type) { case RoomObjectMoveEvent.POSITION_CHANGED: { const objectId = event.objectId; @@ -675,7 +675,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const object = this._roomEngine.getRoomObject(roomId, objectId, objectCategory); const selectionArrow = this._roomEngine.getRoomObjectSelectionArrow(roomId); - if (object && selectionArrow && selectionArrow.logic) + if(object && selectionArrow && selectionArrow.logic) { const location = object.getLocation(); @@ -691,18 +691,18 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectWidgetRequestEvent(event: RoomObjectWidgetRequestEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; const objectId = event.objectId; const objectType = event.objectType; const objectCategory = this._roomEngine.getRoomObjectCategoryForType(objectType); const eventDispatcher = this._roomEngine.events; - if (!eventDispatcher) return; + if(!eventDispatcher) return; - if (RoomId.isRoomPreviewerId(roomId)) return; + if(RoomId.isRoomPreviewerId(roomId)) return; - switch (event.type) + switch(event.type) { case RoomObjectWidgetRequestEvent.OPEN_WIDGET: eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); @@ -820,27 +820,27 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectFurnitureActionEvent(event: RoomObjectFurnitureActionEvent, roomId: number): void { - if (!event) return; + if(!event) return; this.useObject(roomId, event.object.id, event.object.type, event.type); } private handleObjectSoundMachineEvent(event: RoomObjectEvent, roomId: number): void { - if (!event) return; + if(!event) return; const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) + if(selectedData) { - if ((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) + if((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) { - if (selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; + if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; } } - switch (event.type) + switch(event.type) { case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT: this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, roomId, event.objectId, objectCategory)); @@ -859,20 +859,20 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleObjectJukeboxEvent(event: RoomObjectEvent, roomId: number): void { - if (!event) return; + if(!event) return; const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) + if(selectedData) { - if ((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) + if((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) { - if (selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; + if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; } } - switch (event.type) + switch(event.type) { case RoomObjectFurnitureActionEvent.JUKEBOX_INIT: this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_INIT, roomId, event.objectId, objectCategory)); @@ -891,9 +891,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectFloorHoleEvent(event: RoomObjectFloorHoleEvent, roomId: number): void { - if (!event) return; + if(!event) return; - switch (event.type) + switch(event.type) { case RoomObjectFloorHoleEvent.ADD_HOLE: this._roomEngine.addRoomInstanceFloorHole(roomId, event.objectId); @@ -906,16 +906,16 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectRoomAdEvent(event: RoomObjectRoomAdEvent, roomId: number): void { - if (!event) return; + if(!event) return; let eventType: string = null; - switch (event.type) + switch(event.type) { case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK: this._roomEngine.events.dispatchEvent(event); - if (event.clickUrl && (event.clickUrl.length > 0)) + if(event.clickUrl && (event.clickUrl.length > 0)) { Nitro.instance.createLinkEvent(event.clickUrl); } @@ -923,11 +923,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou eventType = RoomEngineRoomAdEvent.FURNI_CLICK; break; case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK: - if (event.clickUrl && (event.clickUrl.length > 0)) + if(event.clickUrl && (event.clickUrl.length > 0)) { const catalogPage = 'CATALOG_PAGE'; - if (event.clickUrl.indexOf(catalogPage) === 0) + if(event.clickUrl.indexOf(catalogPage) === 0) { Nitro.instance.createLinkEvent(event.clickUrl.substr(catalogPage.length)); } @@ -943,14 +943,14 @@ 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) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(eventType, roomId, event.objectId, this._roomEngine.getRoomObjectCategoryForType(event.objectType))); } private onRoomObjectBadgeAssetEvent(event: RoomObjectBadgeAssetEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; - switch (event.type) + switch(event.type) { case RoomObjectBadgeAssetEvent.LOAD_BADGE: { const objectId = event.objectId; @@ -965,7 +965,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleMousePointer(event: RoomObjectFurnitureActionEvent, roomId: number): void { - if (!event) return; + if(!event) return; this._roomEngine.updateMousePointer(event.type, event.objectId, event.objectType); } @@ -974,7 +974,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - switch (event.type) + switch(event.type) { case RoomObjectPlaySoundIdEvent.PLAY_SOUND: this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); @@ -987,11 +987,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleRoomObjectSamplePlaybackEvent(event: RoomObjectSamplePlaybackEvent, roomId: number): void { - if (!event) return; + if(!event) return; const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); - switch (event.type) + 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)); @@ -1010,9 +1010,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onHSLColorEnableEvent(event: RoomObjectHSLColorEnableEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; - switch (event.type) + 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)); @@ -1022,9 +1022,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectDataRequestEvent(event: RoomObjectDataRequestEvent, roomId: number): void { - if (!event || !this._roomEngine || !event.object) return; + if(!event || !this._roomEngine || !event.object) return; - switch (event.type) + switch(event.type) { case RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID: event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, this._roomEngine.sessionDataManager.userId); @@ -1037,38 +1037,38 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private onRoomObjectTileMouseEvent(roomId: number, event: RoomObjectTileMouseEvent): void { - if (!this._roomEngine || this._roomEngine.isDecorating || !this._roomEngine.roomSessionManager) return; + if(!this._roomEngine || this._roomEngine.isDecorating || !this._roomEngine.roomSessionManager) return; const session = this._roomEngine.roomSessionManager.getSession(roomId); - if (!session || session.isSpectator) return; + if(!session || session.isSpectator) return; this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt); } private handleObjectMove(event: RoomObjectMouseEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; const eventDispatcher = this._roomEngine.events; - if (!eventDispatcher) return; + if(!eventDispatcher) return; const selectedData = this.getSelectedRoomObjectData(roomId); - if (!selectedData) return; + if(!selectedData) return; const roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); - if (!roomObject) return; + if(!roomObject) return; let _local_6 = true; - if ((selectedData.category === RoomObjectCategory.FLOOR) || (selectedData.category === RoomObjectCategory.UNIT)) + if((selectedData.category === RoomObjectCategory.FLOOR) || (selectedData.category === RoomObjectCategory.UNIT)) { const stackingHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); - if (!(((event instanceof RoomObjectTileMouseEvent)) && (this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap)))) + if(!(((event instanceof RoomObjectTileMouseEvent)) && (this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap)))) { this.handleFurnitureMove(roomObject, selectedData, selectedData.loc.x, selectedData.loc.y, stackingHeightMap); @@ -1076,11 +1076,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - else if ((selectedData.category === RoomObjectCategory.WALL)) + else if((selectedData.category === RoomObjectCategory.WALL)) { _local_6 = false; - if (event instanceof RoomObjectWallMouseEvent) + if(event instanceof RoomObjectWallMouseEvent) { const _local_10 = event.wallLocation; const _local_11 = event.wallWidth; @@ -1089,13 +1089,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const _local_14 = event.y; const _local_15 = event.direction; - if (this.handleWallItemMove(roomObject, selectedData, _local_10, _local_11, _local_12, _local_13, _local_14, _local_15)) + if(this.handleWallItemMove(roomObject, selectedData, _local_10, _local_11, _local_12, _local_13, _local_14, _local_15)) { _local_6 = true; } } - if (!_local_6) + if(!_local_6) { roomObject.setLocation(selectedData.loc); roomObject.setDirection(selectedData.dir); @@ -1104,7 +1104,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, _local_6); } - if (_local_6) + if(_local_6) { this.setFurnitureAlphaMultiplier(roomObject, 0.5); @@ -1120,28 +1120,28 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleObjectPlace(event: RoomObjectMouseEvent, roomId: number): void { - if (!event || !this._roomEngine) return; + if(!event || !this._roomEngine) return; const eventDispatcher = this._roomEngine.events; - if (!eventDispatcher) return; + if(!eventDispatcher) return; let selectedData = this.getSelectedRoomObjectData(roomId); - if (!selectedData) return; + if(!selectedData) return; let roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); - if (!roomObject) + if(!roomObject) { - if (event instanceof RoomObjectTileMouseEvent) + if(event instanceof RoomObjectTileMouseEvent) { - if (selectedData.category === RoomObjectCategory.FLOOR) + if(selectedData.category === RoomObjectCategory.FLOOR) { this._roomEngine.addFurnitureFloor(roomId, selectedData.id, selectedData.typeId, selectedData.loc, selectedData.dir, 0, selectedData.stuffData, parseFloat(selectedData.instanceData), -1, 0, 0, '', false); } - else if (selectedData.category === RoomObjectCategory.UNIT) + else if(selectedData.category === RoomObjectCategory.UNIT) { this._roomEngine.addRoomObjectUser(roomId, selectedData.id, new Vector3d(), new Vector3d(180), 180, selectedData.typeId, selectedData.instanceData); @@ -1151,9 +1151,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - else if (event instanceof RoomObjectWallMouseEvent) + else if(event instanceof RoomObjectWallMouseEvent) { - if (selectedData.category === RoomObjectCategory.WALL) + if(selectedData.category === RoomObjectCategory.WALL) { this._roomEngine.addFurnitureWall(roomId, selectedData.id, selectedData.typeId, selectedData.loc, selectedData.dir, 0, selectedData.instanceData, 0); } @@ -1161,13 +1161,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); - if (roomObject) + if(roomObject) { - if (selectedData.category === RoomObjectCategory.FLOOR) + if(selectedData.category === RoomObjectCategory.FLOOR) { const allowedDirections = roomObject.model.getValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS); - if (allowedDirections && allowedDirections.length) + if(allowedDirections && allowedDirections.length) { const direction = new Vector3d(allowedDirections[0]); @@ -1177,7 +1177,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou selectedData = this.getSelectedRoomObjectData(roomId); - if (!selectedData) return; + if(!selectedData) return; } } } @@ -1186,15 +1186,15 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this._roomEngine.setObjectMoverIconSpriteVisible(true); } - if (roomObject) + if(roomObject) { let _local_12 = true; const stackingHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); - if (selectedData.category === RoomObjectCategory.FLOOR) + if(selectedData.category === RoomObjectCategory.FLOOR) { - if (!((event instanceof RoomObjectTileMouseEvent) && this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap))) + if(!((event instanceof RoomObjectTileMouseEvent) && this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap))) { this._roomEngine.removeRoomObjectFloor(roomId, selectedData.id); @@ -1202,11 +1202,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - else if (selectedData.category === RoomObjectCategory.WALL) + else if(selectedData.category === RoomObjectCategory.WALL) { _local_12 = false; - if (event instanceof RoomObjectWallMouseEvent) + if(event instanceof RoomObjectWallMouseEvent) { const _local_14 = event.wallLocation; const _local_15 = event.wallWidth; @@ -1215,13 +1215,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const _local_18 = event.y; const _local_19 = event.direction; - if (this.handleWallItemMove(roomObject, selectedData, _local_14, _local_15, _local_16, _local_17, _local_18, _local_19)) + if(this.handleWallItemMove(roomObject, selectedData, _local_14, _local_15, _local_16, _local_17, _local_18, _local_19)) { _local_12 = true; } } - if (!_local_12) + if(!_local_12) { this._roomEngine.removeRoomObjectWall(roomId, selectedData.id); } @@ -1229,9 +1229,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, _local_12); } - else if (selectedData.category === RoomObjectCategory.UNIT) + else if(selectedData.category === RoomObjectCategory.UNIT) { - if (!((event instanceof RoomObjectTileMouseEvent) && this.handleUserPlace(roomObject, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), this._roomEngine.getLegacyWallGeometry(roomId)))) + if(!((event instanceof RoomObjectTileMouseEvent) && this.handleUserPlace(roomObject, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), this._roomEngine.getLegacyWallGeometry(roomId)))) { this._roomEngine.removeRoomObjectUser(roomId, selectedData.id); @@ -1245,7 +1245,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleFurnitureMove(roomObject: IRoomObjectController, selectedObjectData: ISelectedRoomObjectData, x: number, y: number, stackingHeightMap: IFurnitureStackingHeightMap): boolean { - if (!roomObject || !selectedObjectData) return false; + if(!roomObject || !selectedObjectData) return false; const _local_6 = new Vector3d(); _local_6.assign(roomObject.getDirection()); @@ -1259,7 +1259,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let _local_9 = this.validateFurnitureLocation(roomObject, _local_7, selectedObjectData.loc, selectedObjectData.dir, stackingHeightMap); - if (!_local_9) + if(!_local_9) { _local_8.x = this.getValidRoomObjectDirection(roomObject, true); @@ -1268,7 +1268,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou _local_9 = this.validateFurnitureLocation(roomObject, _local_7, selectedObjectData.loc, selectedObjectData.dir, stackingHeightMap); } - if (!_local_9) + if(!_local_9) { roomObject.setDirection(_local_6); @@ -1277,19 +1277,19 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou roomObject.setLocation(_local_9); - if (_local_8) roomObject.setDirection(_local_8); + if(_local_8) roomObject.setDirection(_local_8); return true; } private handleWallItemMove(k: IRoomObjectController, _arg_2: ISelectedRoomObjectData, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D, _arg_6: number, _arg_7: number, _arg_8: number): boolean { - if (!k || !_arg_2) return false; + if(!k || !_arg_2) return false; const _local_9 = new Vector3d(_arg_8); const _local_10 = this.validateWallItemLocation(k, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7, _arg_2); - if (!_local_10) return false; + if(!_local_10) return false; k.setLocation(_local_10); k.setDirection(_local_9); @@ -1299,19 +1299,19 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private validateFurnitureLocation(k: IRoomObject, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IFurnitureStackingHeightMap): Vector3d { - if (!k || !k.model || !_arg_2) return null; + if(!k || !k.model || !_arg_2) return null; let _local_15: Vector3d = null; const _local_6 = k.getDirection(); - if (!_local_6) return null; + if(!_local_6) return null; - if (!_arg_3 || !_arg_4) return null; + if(!_arg_3 || !_arg_4) return null; - if ((_arg_2.x === _arg_3.x) && (_arg_2.y === _arg_3.y)) + if((_arg_2.x === _arg_3.x) && (_arg_2.y === _arg_3.y)) { - if (_local_6.x === _arg_4.x) + if(_local_6.x === _arg_4.x) { _local_15 = new Vector3d(); @@ -1324,9 +1324,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let sizeX = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); let sizeY = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); - if (sizeX < 1) sizeX = 1; + if(sizeX < 1) sizeX = 1; - if (sizeY < 1) sizeY = 1; + if(sizeY < 1) sizeY = 1; const _local_9 = _arg_3.x; const _local_10 = _arg_3.y; @@ -1335,7 +1335,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let _local_13 = 0; let _local_14 = (Math.trunc((Math.trunc(_local_6.x + 45) % 360) / 90)); - if ((_local_14 === 1) || (_local_14 === 3)) + if((_local_14 === 1) || (_local_14 === 3)) { _local_13 = sizeX; @@ -1345,18 +1345,18 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou _local_14 = Math.trunc((Math.trunc(_arg_4.x + 45) % 360) / 90); - if ((_local_14 === 1) || (_local_14 === 3)) + if((_local_14 === 1) || (_local_14 === 3)) { _local_13 = _local_11; _local_11 = _local_12; _local_12 = _local_13; } - if (_arg_5 && _arg_2) + if(_arg_5 && _arg_2) { const stackable = (k.model.getValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE) === 1); - if (_arg_5.validateLocation(_arg_2.x, _arg_2.y, sizeX, sizeY, _local_9, _local_10, _local_11, _local_12, stackable)) + if(_arg_5.validateLocation(_arg_2.x, _arg_2.y, sizeX, sizeY, _local_9, _local_10, _local_11, _local_12, stackable)) { return new Vector3d(_arg_2.x, _arg_2.y, _arg_5.getTileHeight(_arg_2.x, _arg_2.y)); } @@ -1369,40 +1369,40 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private validateWallItemLocation(k: IRoomObject, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: number, _arg_6: number, _arg_7: ISelectedRoomObjectData): Vector3d { - if ((((((k == null) || (k.model == null)) || (_arg_2 == null)) || (_arg_3 == null)) || (_arg_4 == null)) || (_arg_7 == null)) return null; + if((((((k == null) || (k.model == null)) || (_arg_2 == null)) || (_arg_3 == null)) || (_arg_4 == null)) || (_arg_7 == null)) return null; const _local_8 = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); const _local_9 = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); const _local_10 = k.model.getValue(RoomObjectVariable.FURNITURE_CENTER_Z); - if ((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + if((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) { - if ((_arg_5 < (_local_8 / 2)) && (_arg_5 <= (_arg_3.length - (_local_8 / 2)))) + if((_arg_5 < (_local_8 / 2)) && (_arg_5 <= (_arg_3.length - (_local_8 / 2)))) { _arg_5 = (_local_8 / 2); } else { - if ((_arg_5 >= (_local_8 / 2)) && (_arg_5 > (_arg_3.length - (_local_8 / 2)))) + if((_arg_5 >= (_local_8 / 2)) && (_arg_5 > (_arg_3.length - (_local_8 / 2)))) { _arg_5 = (_arg_3.length - (_local_8 / 2)); } } - if ((_arg_6 < _local_10) && (_arg_6 <= (_arg_4.length - (_local_9 - _local_10)))) + if((_arg_6 < _local_10) && (_arg_6 <= (_arg_4.length - (_local_9 - _local_10)))) { _arg_6 = _local_10; } else { - if ((_arg_6 >= _local_10) && (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + if((_arg_6 >= _local_10) && (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) { _arg_6 = (_arg_4.length - (_local_9 - _local_10)); } } } - if ((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + if((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) { return null; } @@ -1423,8 +1423,8 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private useObject(roomId: number, objectId: number, type: string, action: string): void { - if (!this._roomEngine || !this._roomEngine.connection) return; - switch (action) + if(!this._roomEngine || !this._roomEngine.connection) return; + switch(action) { case RoomObjectFurnitureActionEvent.DICE_ACTIVATE: this._roomEngine.connection.send(new FurnitureDiceActivateComposer(objectId)); @@ -1446,11 +1446,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private changeRoomObjectState(roomId: number, objectId: number, category: number, state: number, isRandom: boolean): boolean { - if (!this._roomEngine || !this._roomEngine.connection) return true; + if(!this._roomEngine || !this._roomEngine.connection) return true; - if (category === RoomObjectCategory.FLOOR) + if(category === RoomObjectCategory.FLOOR) { - if (!isRandom) + if(!isRandom) { this._roomEngine.connection.send(new FurnitureMultiStateComposer(objectId, state)); } @@ -1460,7 +1460,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - else if (category === RoomObjectCategory.WALL) + else if(category === RoomObjectCategory.WALL) { this._roomEngine.connection.send(new FurnitureWallMultiStateComposer(objectId, state)); } @@ -1470,26 +1470,26 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private sendWalkUpdate(x: number, y: number): void { - if (!this._roomEngine || !this._roomEngine.connection) return; + if(!this._roomEngine || !this._roomEngine.connection) return; this._roomEngine.connection.send(new RoomUnitWalkComposer(x, y)); } private handleMouseOverObject(category: number, roomId: number, event: RoomObjectMouseEvent): ObjectTileCursorUpdateMessage { - if (category !== RoomObjectCategory.FLOOR) return null; + if(category !== RoomObjectCategory.FLOOR) return null; const roomObject = this._roomEngine.getRoomObject(roomId, event.objectId, RoomObjectCategory.FLOOR); - if (!roomObject) return null; + if(!roomObject) return null; const location = this.getActiveSurfaceLocation(roomObject, event); - if (!location) return null; + if(!location) return null; const furnitureHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); - if (!furnitureHeightMap) return null; + if(!furnitureHeightMap) return null; const x = location.x; const y = location.y; @@ -1500,12 +1500,12 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean { - if ((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return; + if((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return; const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR); const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2); - if (_local_4) + if(_local_4) { this.sendWalkUpdate(_local_4.x, _local_4.y); @@ -1517,17 +1517,17 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private getActiveSurfaceLocation(k: IRoomObject, _arg_2: RoomObjectMouseEvent): Vector3d { - if (!k || !_arg_2) return null; + if(!k || !_arg_2) return null; const furniData = this._roomEngine.sessionDataManager.getFloorItemDataByName(k.type); - if (!furniData) return null; + if(!furniData) return null; - if (!furniData.canStandOn && !furniData.canSitOn && !furniData.canLayOn) return null; + if(!furniData.canStandOn && !furniData.canSitOn && !furniData.canLayOn) return null; const model = k.model; - if (!model) return null; + if(!model) return null; const location = k.getLocation(); const direction = k.getDirection(); @@ -1536,14 +1536,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let sizeY = model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); const sizeZ = model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); - if ((direction.x === 90) || (direction.x === 270)) [sizeX, sizeY] = [sizeY, sizeX]; + if((direction.x === 90) || (direction.x === 270)) [sizeX, sizeY] = [sizeY, sizeX]; - if (sizeX < 1) sizeX = 1; - if (sizeY < 1) sizeY = 1; + if(sizeX < 1) sizeX = 1; + if(sizeY < 1) sizeY = 1; const renderingCanvas = this._roomEngine.getActiveRoomInstanceRenderingCanvas(); - if (!renderingCanvas) return null; + if(!renderingCanvas) return null; const scale = renderingCanvas.geometry.scale; const _local_13 = furniData.canSitOn ? 0.5 : 0; @@ -1556,44 +1556,44 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let _local_20 = false; - if ((_local_18 < location.x) || (_local_18 >= (location.x + sizeX))) _local_20 = true; - else if ((_local_19 < location.y) || (_local_19 >= (location.y + sizeY))) _local_20 = true; + if((_local_18 < location.x) || (_local_18 >= (location.x + sizeX))) _local_20 = true; + else if((_local_19 < location.y) || (_local_19 >= (location.y + sizeY))) _local_20 = true; const _local_21 = furniData.canSitOn ? (sizeZ - 0.5) : sizeZ; - if (!_local_20) return new Vector3d(_local_18, _local_19, _local_21); + if(!_local_20) return new Vector3d(_local_18, _local_19, _local_21); return null; } private handleMouseOverTile(k: RoomObjectTileMouseEvent, roomId: number): ObjectTileCursorUpdateMessage { - if (this._whereYouClickIsWhereYouGo) + if(this._whereYouClickIsWhereYouGo) { return new ObjectTileCursorUpdateMessage(new Vector3d(k.tileXAsInt, k.tileYAsInt, k.tileZAsInt), 0, true, k.eventId); } const roomObject = this._roomEngine.getRoomObjectCursor(roomId); - if (roomObject && roomObject.visualization) + if(roomObject && roomObject.visualization) { const _local_4 = k.tileXAsInt; const _local_5 = k.tileYAsInt; const _local_6 = k.tileZAsInt; const _local_7 = this._roomEngine.getRoomInstance(roomId); - if (_local_7) + if(_local_7) { const _local_8 = this._roomEngine.getRoomTileObjectMap(roomId); - if (_local_8) + if(_local_8) { const _local_9 = _local_8.getObjectIntTile(_local_4, _local_5); const _local_10 = this._roomEngine.getFurnitureStackingHeightMap(roomId); - if (_local_10) + if(_local_10) { - if (_local_9 && _local_9.model && (_local_9.model.getValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT) > 0)) + if(_local_9 && _local_9.model && (_local_9.model.getValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT) > 0)) { const _local_11 = _local_10.getTileHeight(_local_4, _local_5); const _local_12 = this._roomEngine.getLegacyWallGeometry(roomId).getHeight(_local_4, _local_5); @@ -1614,7 +1614,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { const selectedData = this.getSelectedRoomObjectData(roomId); - if (!selectedData) return; + if(!selectedData) return; let roomObject: IRoomObjectController = null; let objectId = selectedData.id; @@ -1626,24 +1626,24 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let direction = 0; let wallLocation = ''; - if (this._roomEngine && this._roomEngine.connection) + if(this._roomEngine && this._roomEngine.connection) { roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); - if (roomObject) + if(roomObject) { const location = roomObject.getLocation(); direction = roomObject.getDirection().x; - if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.UNIT)) + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.UNIT)) { x = location.x; y = location.y; z = location.z; } - else if (category === RoomObjectCategory.WALL) + else if(category === RoomObjectCategory.WALL) { x = location.x; y = location.y; @@ -1651,29 +1651,29 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const wallGeometry = this._roomEngine.getLegacyWallGeometry(roomId); - if (wallGeometry) wallLocation = wallGeometry.getOldLocationString(location, direction); + if(wallGeometry) wallLocation = wallGeometry.getOldLocationString(location, direction); } direction = ((((direction / 45) % 8) + 8) % 8); - if ((objectId < 0) && (category === RoomObjectCategory.UNIT)) objectId = (objectId * -1); + if((objectId < 0) && (category === RoomObjectCategory.UNIT)) objectId = (objectId * -1); - if (this._objectPlacementSource !== RoomObjectPlacementSource.CATALOG) + if(this._objectPlacementSource !== RoomObjectPlacementSource.CATALOG) { - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { - if (selectedData.typeId === RoomObjectType.PET) + if(selectedData.typeId === RoomObjectType.PET) { this._roomEngine.connection.send(new PetPlaceComposer(objectId, Math.trunc(x), Math.trunc(y))); } - else if (selectedData.typeId === RoomObjectType.RENTABLE_BOT) + else if(selectedData.typeId === RoomObjectType.RENTABLE_BOT) { this._roomEngine.connection.send(new BotPlaceComposer(objectId, Math.trunc(x), Math.trunc(y))); } } - else if (roomObject.model.getValue(RoomObjectVariable.FURNITURE_IS_STICKIE) !== undefined) + else if(roomObject.model.getValue(RoomObjectVariable.FURNITURE_IS_STICKIE) !== undefined) { this._roomEngine.connection.send(new FurniturePostItPlaceComposer(objectId, wallLocation)); } @@ -1690,7 +1690,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.resetSelectedObjectData(roomId); - if (this._roomEngine && this._roomEngine.events) + if(this._roomEngine && this._roomEngine.events) { const placedInRoom = (roomObject && (roomObject.id === selectedData.id)); @@ -1700,23 +1700,23 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public modifyRoomObject(roomId: number, objectId: number, category: number, operation: string): boolean { - if (!this._roomEngine) return false; + if(!this._roomEngine) return false; const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); - if (!roomObject) return false; + if(!roomObject) return false; let _local_9 = true; - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_ROTATE_POSITIVE: case RoomObjectOperationType.OBJECT_ROTATE_NEGATIVE: - if (this._roomEngine.connection) + if(this._roomEngine.connection) { let direction = 0; - if (operation == RoomObjectOperationType.OBJECT_ROTATE_NEGATIVE) + if(operation == RoomObjectOperationType.OBJECT_ROTATE_NEGATIVE) { direction = this.getValidRoomObjectDirection(roomObject, false); } @@ -1728,19 +1728,19 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const x = roomObject.getLocation().x; const y = roomObject.getLocation().y; - if (this.isValidLocation(roomObject, new Vector3d(direction), this._roomEngine.getFurnitureStackingHeightMap(roomId))) + if(this.isValidLocation(roomObject, new Vector3d(direction), this._roomEngine.getFurnitureStackingHeightMap(roomId))) { direction = Math.trunc((direction / 45)); - if (roomObject.type === RoomObjectUserType.MONSTER_PLANT) + if(roomObject.type === RoomObjectUserType.MONSTER_PLANT) { const roomSession = this._roomEngine.roomSessionManager.getSession(roomId); - if (roomSession) + if(roomSession) { const userData = roomSession.userDataManager.getUserDataByIndex(objectId); - if (userData) + if(userData) { this._roomEngine.connection.send(new PetMoveComposer(userData.webID, Math.trunc(x), Math.trunc(y), direction)); } @@ -1755,14 +1755,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou break; case RoomObjectOperationType.OBJECT_EJECT: case RoomObjectOperationType.OBJECT_PICKUP: - if (this._roomEngine.connection) this._roomEngine.connection.send(new FurniturePickupComposer(category, objectId)); + if(this._roomEngine.connection) this._roomEngine.connection.send(new FurniturePickupComposer(category, objectId)); break; case RoomObjectOperationType.OBJECT_PICKUP_PET: - if (this._roomEngine.connection) + if(this._roomEngine.connection) { const session = this._roomEngine.roomSessionManager.getSession(roomId); - if (session) + if(session) { const userData = session.userDataManager.getUserDataByIndex(objectId); @@ -1771,11 +1771,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } break; case RoomObjectOperationType.OBJECT_PICKUP_BOT: - if (this._roomEngine.connection) + if(this._roomEngine.connection) { const session = this._roomEngine.roomSessionManager.getSession(roomId); - if (session) + if(session) { const userData = session.userDataManager.getUserDataByIndex(objectId); @@ -1797,9 +1797,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.setFurnitureAlphaMultiplier(roomObject, 1); this._roomEngine.removeObjectMoverIconSprite(); - if (this._roomEngine.connection) + if(this._roomEngine.connection) { - if (category === RoomObjectCategory.FLOOR) + if(category === RoomObjectCategory.FLOOR) { const angle = ((roomObject.getDirection().x) % 360); const location = roomObject.getLocation(); @@ -1808,20 +1808,20 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this._roomEngine.connection.send(new FurnitureFloorUpdateComposer(objectId, location.x, location.y, direction)); } - else if (category === RoomObjectCategory.WALL) + else if(category === RoomObjectCategory.WALL) { const angle = ((roomObject.getDirection().x) % 360); const wallGeometry = this._roomEngine.getLegacyWallGeometry(roomId); - if (wallGeometry) + if(wallGeometry) { const location = wallGeometry.getOldLocationString(roomObject.getLocation(), angle); - if (location) this._roomEngine.connection.send(new FurnitureWallUpdateComposer(objectId, location)); + if(location) this._roomEngine.connection.send(new FurnitureWallUpdateComposer(objectId, location)); } } - else if (category === RoomObjectCategory.UNIT) + else if(category === RoomObjectCategory.UNIT) { const angle = ((roomObject.getDirection().x) % 360); const location = roomObject.getLocation(); @@ -1829,11 +1829,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const race = parseInt(roomObject.model.getValue(RoomObjectVariable.RACE)); const roomSession = this._roomEngine.roomSessionManager.getSession(roomId); - if (roomSession) + if(roomSession) { const userData = roomSession.userDataManager.getUserDataByIndex(objectId); - if (userData) this._roomEngine.connection.send(new PetMoveComposer(userData.webID, location.x, location.y, direction)); + if(userData) this._roomEngine.connection.send(new PetMoveComposer(userData.webID, location.x, location.y, direction)); } } } @@ -1842,23 +1842,23 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou } } - if (_local_9) this.resetSelectedObjectData(roomId); + if(_local_9) this.resetSelectedObjectData(roomId); return true; } public modifyRoomObjectDataWithMap(roomId: number, objectId: number, category: number, operation: string, data: Map): boolean { - if (!this._roomEngine) return false; + if(!this._roomEngine) return false; const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); - if (!roomObject) return false; + if(!roomObject) return false; - switch (operation) + switch(operation) { case RoomObjectOperationType.OBJECT_SAVE_STUFF_DATA: - if (this._roomEngine.connection) + if(this._roomEngine.connection) { this._roomEngine.connection.send(new SetObjectDataMessageComposer(objectId, data)); } @@ -1870,7 +1870,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public modifyWallItemData(roomId: number, objectId: number, colorHex: string, text: string): boolean { - if (!this._roomEngine || !this._roomEngine.connection) return false; + if(!this._roomEngine || !this._roomEngine.connection) return false; this._roomEngine.connection.send(new SetItemDataMessageComposer(objectId, colorHex, text)); @@ -1879,7 +1879,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public deleteWallItem(roomId: number, itemId: number): boolean { - if (!this._roomEngine || !this._roomEngine.connection) return false; + if(!this._roomEngine || !this._roomEngine.connection) return false; this._roomEngine.connection.send(new RemoveWallItemComposer(itemId)); @@ -1888,13 +1888,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public getValidRoomObjectDirection(k: IRoomObjectController, _arg_2: boolean): number { - if (!k || !k.model) return 0; + if(!k || !k.model) return 0; let _local_6 = 0; let _local_7 = 0; let allowedDirections: number[] = []; - if (k.type === RoomObjectUserType.MONSTER_PLANT) + if(k.type === RoomObjectUserType.MONSTER_PLANT) { allowedDirections = k.model.getValue(RoomObjectVariable.PET_ALLOWED_DIRECTIONS); } @@ -1905,18 +1905,18 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let direction = k.getDirection().x; - if (allowedDirections && allowedDirections.length) + if(allowedDirections && allowedDirections.length) { _local_6 = allowedDirections.indexOf(direction); - if (_local_6 < 0) + if(_local_6 < 0) { _local_6 = 0; _local_7 = 0; - while (_local_7 < allowedDirections.length) + while(_local_7 < allowedDirections.length) { - if (direction <= allowedDirections[_local_7]) break; + if(direction <= allowedDirections[_local_7]) break; _local_6++; _local_7++; @@ -1925,7 +1925,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou _local_6 = (_local_6 % allowedDirections.length); } - if (_arg_2) _local_6 = ((_local_6 + 1) % allowedDirections.length); + if(_arg_2) _local_6 = ((_local_6 + 1) % allowedDirections.length); else _local_6 = (((_local_6 - 1) + allowedDirections.length) % allowedDirections.length); direction = allowedDirections[_local_6]; @@ -1936,38 +1936,38 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private isValidLocation(object: IRoomObject, goalDirection: IVector3D, stackingHeightMap: IFurnitureStackingHeightMap): boolean { - if (!object || !object.model || !goalDirection) return false; + if(!object || !object.model || !goalDirection) return false; const direction = object.getDirection(); const location = object.getLocation(); - if (!direction || !location) return false; + if(!direction || !location) return false; - if ((direction.x % 180) === (goalDirection.x % 180)) return true; + if((direction.x % 180) === (goalDirection.x % 180)) return true; let sizeX = object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); let sizeY = object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); - if (sizeX < 1) sizeX = 1; + if(sizeX < 1) sizeX = 1; - if (sizeY < 1) sizeY = 1; + if(sizeY < 1) sizeY = 1; let _local_8 = sizeX; let _local_9 = sizeY; let _local_11 = (Math.trunc((Math.trunc((goalDirection.x + 45)) % 360) / 90)); - if ((_local_11 === 1) || (_local_11 === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + if((_local_11 === 1) || (_local_11 === 3)) [sizeX, sizeY] = [sizeY, sizeX]; _local_11 = (Math.trunc((Math.trunc((direction.x + 45)) % 360) / 90)); - if (((_local_11 === 1) || (_local_11 === 3))) [_local_8, _local_9] = [_local_9, _local_8]; + if(((_local_11 === 1) || (_local_11 === 3))) [_local_8, _local_9] = [_local_9, _local_8]; - if (stackingHeightMap && location) + if(stackingHeightMap && location) { const alwaysStackable = (object.model.getValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE) === 1); - if (stackingHeightMap.validateLocation(location.x, location.y, sizeX, sizeY, location.x, location.y, _local_8, _local_9, alwaysStackable, location.z)) return true; + if(stackingHeightMap.validateLocation(location.x, location.y, sizeX, sizeY, location.x, location.y, _local_8, _local_9, alwaysStackable, location.z)) return true; } return false; @@ -1977,31 +1977,31 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { const _local_4 = this.getSelectedRoomObjectData(roomId); - if (!_local_4) return; + if(!_local_4) return; const _local_5 = (this._roomEngine.getRoomObject(roomId, objectId, category) as IRoomObjectController); - if (!_local_5) return; + if(!_local_5) return; - if (!this._roomEngine || !this._roomEngine.events) return; + if(!this._roomEngine || !this._roomEngine.events) return; this._roomEngine.events.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; + if(!this._roomEngine) return; const eventDispatcher = this._roomEngine.events; - if (!eventDispatcher) return; + if(!eventDispatcher) return; - switch (category) + switch(category) { case RoomObjectCategory.UNIT: case RoomObjectCategory.FLOOR: case RoomObjectCategory.WALL: - if (category === RoomObjectCategory.UNIT) + if(category === RoomObjectCategory.UNIT) { this.deselectObject(roomId); this.setSelectedAvatar(roomId, objectId, true); @@ -2010,13 +2010,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { this.setSelectedAvatar(roomId, 0, false); - if (objectId !== this._selectedObjectId) + if(objectId !== this._selectedObjectId) { this.deselectObject(roomId); const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); - if (roomObject && roomObject.logic) + if(roomObject && roomObject.logic) { roomObject.logic.processUpdateMessage(new ObjectSelectedMessage(true)); @@ -2034,11 +2034,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private deselectObject(roomId: number): void { - if (this._selectedObjectId === -1) return; + if(this._selectedObjectId === -1) return; const object = this._roomEngine.getRoomObject(roomId, this._selectedObjectId, this._selectedObjectCategory); - if (object && object.logic) + if(object && object.logic) { object.logic.processUpdateMessage(new ObjectSelectedMessage(false)); @@ -2049,12 +2049,12 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou public setSelectedAvatar(k: number, _arg_2: number, _arg_3: boolean): void { - if (!this._roomEngine) return; + if(!this._roomEngine) return; const _local_4 = RoomObjectCategory.UNIT; const _local_5 = this._roomEngine.getRoomObject(k, this._selectedAvatarId, _local_4); - if (_local_5 && _local_5.logic) + if(_local_5 && _local_5.logic) { _local_5.logic.processUpdateMessage(new ObjectAvatarSelectedMessage(false)); @@ -2063,11 +2063,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou let _local_6 = false; - if (_arg_3) + if(_arg_3) { const _local_5 = this._roomEngine.getRoomObject(k, _arg_2, _local_4); - if (_local_5 && _local_5.logic) + if(_local_5 && _local_5.logic) { _local_5.logic.processUpdateMessage(new ObjectAvatarSelectedMessage(true)); @@ -2077,34 +2077,34 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const location = _local_5.getLocation(); - if (location) this._roomEngine.connection.send(new RoomUnitLookComposer(~~(location.x), ~~(location.y))); + if(location) this._roomEngine.connection.send(new RoomUnitLookComposer(~~(location.x), ~~(location.y))); } } const selectionArrow = this._roomEngine.getRoomObjectSelectionArrow(k); - if (selectionArrow && selectionArrow.logic) + if(selectionArrow && selectionArrow.logic) { - if (_local_6 && !this._roomEngine.isPlayingGame()) selectionArrow.logic.processUpdateMessage(new ObjectVisibilityUpdateMessage(ObjectVisibilityUpdateMessage.ENABLED)); + if(_local_6 && !this._roomEngine.isPlayingGame()) selectionArrow.logic.processUpdateMessage(new ObjectVisibilityUpdateMessage(ObjectVisibilityUpdateMessage.ENABLED)); else selectionArrow.logic.processUpdateMessage(new ObjectVisibilityUpdateMessage(ObjectVisibilityUpdateMessage.DISABLED)); } } private resetSelectedObjectData(roomId: number): void { - if (!this._roomEngine) return; + if(!this._roomEngine) return; this._roomEngine.removeObjectMoverIconSprite(); const selectedData = this.getSelectedRoomObjectData(roomId); - if (selectedData) + if(selectedData) { - if ((selectedData.operation === RoomObjectOperationType.OBJECT_MOVE) || (selectedData.operation === RoomObjectOperationType.OBJECT_MOVE_TO)) + if((selectedData.operation === RoomObjectOperationType.OBJECT_MOVE) || (selectedData.operation === RoomObjectOperationType.OBJECT_MOVE_TO)) { const roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); - if (roomObject && (selectedData.operation !== RoomObjectOperationType.OBJECT_MOVE_TO)) + if(roomObject && (selectedData.operation !== RoomObjectOperationType.OBJECT_MOVE_TO)) { roomObject.setLocation(selectedData.loc); roomObject.setDirection(selectedData.dir); @@ -2112,7 +2112,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.setFurnitureAlphaMultiplier(roomObject, 1); - if (selectedData.category === RoomObjectCategory.WALL) + if(selectedData.category === RoomObjectCategory.WALL) { this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, true); } @@ -2120,12 +2120,12 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou this.updateSelectedObjectData(roomId, selectedData.id, selectedData.category, selectedData.loc, selectedData.dir, RoomObjectOperationType.OBJECT_MOVE, selectedData.typeId, selectedData.instanceData, selectedData.stuffData, selectedData.state, selectedData.animFrame, selectedData.posture); } - else if ((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE)) + else if((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE)) { const objectId = selectedData.id; const category = selectedData.category; - switch (category) + switch(category) { case RoomObjectCategory.FLOOR: this._roomEngine.removeRoomObjectFloor(roomId, objectId); @@ -2145,14 +2145,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private getSelectedRoomObjectData(roomId: number): ISelectedRoomObjectData { - if (!this._roomEngine) return null; + if(!this._roomEngine) return null; return this._roomEngine.getSelectedRoomObjectData(roomId); } private setFurnitureAlphaMultiplier(object: IRoomObjectController, multiplier: number): void { - if (!object || !object.model) return; + if(!object || !object.model) return; object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, multiplier); } @@ -2173,7 +2173,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou { this.resetSelectedObjectData(roomId); - if (!this._roomEngine) return; + if(!this._roomEngine) return; const selectedData = new SelectedRoomObjectData(id, category, operation, location, direction, typeId, instanceData, stuffData, state, frameNumber, posture); @@ -2182,7 +2182,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private updateSelectedObjectData(roomId: number, id: number, category: number, location: IVector3D, direction: IVector3D, operation: string, typeId: number = 0, instanceData: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): void { - if (!this._roomEngine) return null; + if(!this._roomEngine) return null; const selectedData = new SelectedRoomObjectData(id, category, operation, location, direction, typeId, instanceData, stuffData, state, frameNumber, posture); @@ -2191,7 +2191,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou private handleUserPlace(roomObject: IRoomObjectController, x: number, y: number, wallGeometry: ILegacyWallGeometry): boolean { - if (!wallGeometry.isRoomTile(x, y)) return false; + if(!wallGeometry.isRoomTile(x, y)) return false; roomObject.setLocation(new Vector3d(x, y, wallGeometry.getHeight(x, y))); diff --git a/src/nitro/room/RoomObjectLogicFactory.ts b/src/nitro/room/RoomObjectLogicFactory.ts index 600e3985..471a0b9f 100644 --- a/src/nitro/room/RoomObjectLogicFactory.ts +++ b/src/nitro/room/RoomObjectLogicFactory.ts @@ -24,23 +24,23 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory { const logic = this.getLogicType(type); - if (!logic) return null; + if(!logic) return null; const instance = (new logic() as IRoomObjectEventHandler); - if (!instance) return null; + if(!instance) return null; instance.eventDispatcher = this._events; - if (!this._cachedEvents.get(type)) + if(!this._cachedEvents.get(type)) { this._cachedEvents.set(type, true); const eventTypes = instance.getEventTypes(); - for (const eventType of eventTypes) + for(const eventType of eventTypes) { - if (!eventType) continue; + if(!eventType) continue; this.registerEventType(eventType); } @@ -51,13 +51,13 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory private registerEventType(type: string): void { - if (this._registeredEvents.get(type)) return; + if(this._registeredEvents.get(type)) return; this._registeredEvents.set(type, true); - for (const func of this._functions) + for(const func of this._functions) { - if (!func) continue; + if(!func) continue; this._events.addEventListener(type, func); } @@ -65,15 +65,15 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory public registerEventFunction(func: Function): void { - if (!func) return; + if(!func) return; - if (this._functions.indexOf(func) >= 0) return; + if(this._functions.indexOf(func) >= 0) return; this._functions.push(func); - for (const eventType of this._registeredEvents.keys()) + for(const eventType of this._registeredEvents.keys()) { - if (!eventType) continue; + if(!eventType) continue; this._events.addEventListener(eventType, func); } @@ -81,17 +81,17 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory public removeEventFunction(func: Function): void { - if (!func) return; + if(!func) return; const index = this._functions.indexOf(func); - if (index === -1) return; + if(index === -1) return; this._functions.splice(index, 1); - for (const event of this._registeredEvents.keys()) + for(const event of this._registeredEvents.keys()) { - if (!event) continue; + if(!event) continue; this._events.removeEventListener(event, func); } @@ -99,11 +99,11 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory public getLogicType(type: string): typeof RoomObjectLogicBase { - if (!type) return null; + if(!type) return null; let logic: typeof RoomObjectLogicBase = null; - switch (type) + switch(type) { case RoomObjectLogicType.ROOM: logic = RoomLogic; @@ -307,7 +307,7 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory break; } - if (!logic) + if(!logic) { NitroLogger.warn('Unknown Logic', type); diff --git a/src/nitro/room/messages/ObjectMoveUpdateMessage.ts b/src/nitro/room/messages/ObjectMoveUpdateMessage.ts index 0a614c31..f352ccaf 100644 --- a/src/nitro/room/messages/ObjectMoveUpdateMessage.ts +++ b/src/nitro/room/messages/ObjectMoveUpdateMessage.ts @@ -16,7 +16,7 @@ export class ObjectMoveUpdateMessage extends RoomObjectUpdateMessage public get targetLocation(): IVector3D { - if (!this._targetLocation) return this.location; + if(!this._targetLocation) return this.location; return this._targetLocation; } diff --git a/src/nitro/room/object/RoomObjectVisualizationFactory.ts b/src/nitro/room/object/RoomObjectVisualizationFactory.ts index e591c429..b48f15a9 100644 --- a/src/nitro/room/object/RoomObjectVisualizationFactory.ts +++ b/src/nitro/room/object/RoomObjectVisualizationFactory.ts @@ -19,18 +19,18 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF { const visualization = this.getVisualizationType(type); - if (!visualization) return null; + if(!visualization) return null; return new visualization(); } public getVisualizationType(type: string): typeof RoomObjectSpriteVisualization { - if (!type) return null; + if(!type) return null; let visualization: typeof RoomObjectSpriteVisualization = null; - switch (type) + switch(type) { case RoomObjectVisualizationType.ROOM: visualization = RoomVisualization; @@ -141,7 +141,7 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF break; } - if (!visualization) + if(!visualization) { NitroLogger.log('Unknown Visualization', type); @@ -155,11 +155,11 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF { const existing = this._visualizationDatas.get(type); - if (existing) return existing; + if(existing) return existing; let visualizationData: IObjectVisualizationData = null; - switch (visualization) + switch(visualization) { case RoomObjectVisualizationType.FURNITURE_STATIC: case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED: @@ -211,21 +211,21 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF break; } - if (!visualizationData) return null; + if(!visualizationData) return null; - if (!visualizationData.initialize(asset)) + if(!visualizationData.initialize(asset)) { visualizationData.dispose(); return null; } - if ((visualizationData instanceof AvatarVisualizationData) || (visualizationData instanceof FurnitureMannequinVisualizationData)) + if((visualizationData instanceof AvatarVisualizationData) || (visualizationData instanceof FurnitureMannequinVisualizationData)) { visualizationData.avatarManager = Nitro.instance.avatar; } - if (RoomObjectVisualizationFactory.CACHING_ENABLED) this._visualizationDatas.set(type, visualizationData); + if(RoomObjectVisualizationFactory.CACHING_ENABLED) this._visualizationDatas.set(type, visualizationData); return visualizationData; } diff --git a/src/nitro/room/object/RoomPlaneBitmapMaskData.ts b/src/nitro/room/object/RoomPlaneBitmapMaskData.ts index c6fbaf3a..dfa299ad 100644 --- a/src/nitro/room/object/RoomPlaneBitmapMaskData.ts +++ b/src/nitro/room/object/RoomPlaneBitmapMaskData.ts @@ -23,7 +23,7 @@ export class RoomPlaneBitmapMaskData public set loc(k: IVector3D) { - if (!this._loc) this._loc = new Vector3d(); + if(!this._loc) this._loc = new Vector3d(); this._loc.assign(k); } diff --git a/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts b/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts index 76b0ceff..d4f84fb7 100644 --- a/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts +++ b/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts @@ -18,7 +18,7 @@ export class RoomPlaneBitmapMaskParser public dispose(): void { - if (this._masks) + if(this._masks) { this.reset(); @@ -28,19 +28,19 @@ export class RoomPlaneBitmapMaskParser public initialize(k: RoomMapMaskData): boolean { - if (!k) return false; + if(!k) return false; this._masks.clear(); - if (k.masks.length) + if(k.masks.length) { - for (const mask of k.masks) + for(const mask of k.masks) { - if (!mask) continue; + if(!mask) continue; const location = mask.locations.length ? mask.locations[0] : null; - if (!location) continue; + if(!location) continue; this._masks.set(mask.id, new RoomPlaneBitmapMaskData(mask.type, location, mask.category)); } @@ -51,9 +51,9 @@ export class RoomPlaneBitmapMaskParser public reset(): void { - for (const mask of this._masks.values()) + for(const mask of this._masks.values()) { - if (!mask) continue; + if(!mask) continue; mask.dispose(); } @@ -73,7 +73,7 @@ export class RoomPlaneBitmapMaskParser { const existing = this._masks.get(k); - if (existing) + if(existing) { this._masks.delete(k); @@ -89,15 +89,15 @@ export class RoomPlaneBitmapMaskParser { const data = new RoomMapMaskData(); - for (const [key, mask] of this._masks.entries()) + for(const [key, mask] of this._masks.entries()) { - if (!mask) continue; + if(!mask) continue; const type = this.getMaskType(mask); const category = this.getMaskCategory(mask); const location = this.getMaskLocation(mask); - if (type && category && location) + if(type && category && location) { const newMask: any = { id: key, @@ -121,21 +121,21 @@ export class RoomPlaneBitmapMaskParser public getMaskLocation(mask: RoomPlaneBitmapMaskData): IVector3D { - if (!mask) return null; + if(!mask) return null; return mask.loc; } public getMaskType(mask: RoomPlaneBitmapMaskData): string { - if (!mask) return null; + if(!mask) return null; return mask.type; } public getMaskCategory(mask: RoomPlaneBitmapMaskData): string { - if (!mask) return null; + if(!mask) return null; return mask.category; } diff --git a/src/nitro/room/object/RoomPlaneData.ts b/src/nitro/room/object/RoomPlaneData.ts index ac396a17..db26460a 100644 --- a/src/nitro/room/object/RoomPlaneData.ts +++ b/src/nitro/room/object/RoomPlaneData.ts @@ -37,7 +37,7 @@ export class RoomPlaneData this._rightSide = new Vector3d(); this._rightSide.assign(_arg_4); this._type = k; - if (((!(_arg_3 == null)) && (!(_arg_4 == null)))) + if(((!(_arg_3 == null)) && (!(_arg_4 == null)))) { this._normal = Vector3d.crossProduct(_arg_3, _arg_4); _local_6 = 0; @@ -45,26 +45,26 @@ export class RoomPlaneData _local_8 = 0; _local_9 = 0; _local_10 = 0; - if (((!(this.normal.x == 0)) || (!(this.normal.y == 0)))) + if(((!(this.normal.x == 0)) || (!(this.normal.y == 0)))) { _local_9 = this.normal.x; _local_10 = this.normal.y; _local_6 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); - if (_local_6 >= 360) + if(_local_6 >= 360) { _local_6 = (_local_6 - 360); } _local_9 = Math.sqrt(((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y))); _local_10 = this.normal.z; _local_7 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); - if (_local_7 >= 360) + if(_local_7 >= 360) { _local_7 = (_local_7 - 360); } } else { - if (this.normal.z < 0) + if(this.normal.z < 0) { _local_7 = 90; } @@ -75,13 +75,13 @@ export class RoomPlaneData } this._normalDirection = new Vector3d(_local_6, _local_7, _local_8); } - if (((!(_arg_5 == null)) && (_arg_5.length > 0))) + if(((!(_arg_5 == null)) && (_arg_5.length > 0))) { _local_11 = 0; - while (_local_11 < _arg_5.length) + while(_local_11 < _arg_5.length) { _local_12 = _arg_5[_local_11]; - if (((!(_local_12 == null)) && (_local_12.length > 0))) + if(((!(_local_12 == null)) && (_local_12.length > 0))) { _local_13 = new Vector3d(); _local_13.assign(_local_12); @@ -135,7 +135,7 @@ export class RoomPlaneData public getSecondaryNormal(k: number): IVector3D { - if (((k < 0) || (k >= this.secondaryNormalCount))) + if(((k < 0) || (k >= this.secondaryNormalCount))) { return null; } @@ -152,7 +152,7 @@ export class RoomPlaneData private getMask(k: number): RoomPlaneMaskData { - if (((k < 0) || (k >= this.maskCount))) + if(((k < 0) || (k >= this.maskCount))) { return null; } @@ -162,7 +162,7 @@ export class RoomPlaneData public getMaskLeftSideLoc(k: number): number { const _local_2: RoomPlaneMaskData = this.getMask(k); - if (_local_2 != null) + if(_local_2 != null) { return _local_2.leftSideLoc; } @@ -172,7 +172,7 @@ export class RoomPlaneData public getMaskRightSideLoc(k: number): number { const _local_2: RoomPlaneMaskData = this.getMask(k); - if (_local_2 != null) + if(_local_2 != null) { return _local_2.rightSideLoc; } @@ -182,7 +182,7 @@ export class RoomPlaneData public getMaskLeftSideLength(k: number): number { const _local_2: RoomPlaneMaskData = this.getMask(k); - if (_local_2 != null) + if(_local_2 != null) { return _local_2.leftSideLength; } @@ -192,7 +192,7 @@ export class RoomPlaneData public getMaskRightSideLength(k: number): number { const _local_2: RoomPlaneMaskData = this.getMask(k); - if (_local_2 != null) + if(_local_2 != null) { return _local_2.rightSideLength; } diff --git a/src/nitro/room/object/RoomPlaneParser.ts b/src/nitro/room/object/RoomPlaneParser.ts index e0532e67..4a791f27 100644 --- a/src/nitro/room/object/RoomPlaneParser.ts +++ b/src/nitro/room/object/RoomPlaneParser.ts @@ -50,23 +50,23 @@ export class RoomPlaneParser { const length = matricies.length; - if (!length) return 0; + if(!length) return 0; let tileHeight = 0; let i = 0; - while (i < length) + while(i < length) { const matrix = matricies[i]; let j = 0; - while (j < matrix.length) + while(j < matrix.length) { const height = matrix[j]; - if (height > tileHeight) tileHeight = height; + if(height > tileHeight) tileHeight = height; j++; } @@ -79,27 +79,27 @@ export class RoomPlaneParser private static findEntranceTile(matricies: number[][]): Point { - if (!matricies) return null; + if(!matricies) return null; const length = matricies.length; - if (!length) return null; + if(!length) return null; const _local_6: number[] = []; let i = 0; - while (i < length) + while(i < length) { const matrix = matricies[i]; - if (!matrix || !matrix.length) return null; + if(!matrix || !matrix.length) return null; let j = 0; - while (j < matrix.length) + while(j < matrix.length) { - if (matrix[j] >= 0) + if(matrix[j] >= 0) { _local_6.push(j); @@ -109,16 +109,16 @@ export class RoomPlaneParser j++; } - if (_local_6.length < (i + 1)) _local_6.push((matrix.length + 1)); + if(_local_6.length < (i + 1)) _local_6.push((matrix.length + 1)); i++; } i = 1; - while (i < (_local_6.length - 1)) + while(i < (_local_6.length - 1)) { - if (((Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i - 1)]) - 1)) && (Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i + 1)]) - 1)))) return new Point(Math.trunc((_local_6[i]) | 0), i); + if(((Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i - 1)]) - 1)) && (Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i + 1)]) - 1)))) return new Point(Math.trunc((_local_6[i]) | 0), i); i++; } @@ -144,29 +144,29 @@ export class RoomPlaneParser const _local_3: number = k[0].length; const _local_4: number[][] = []; _local_6 = 0; - while (_local_6 < (_local_2 * 4)) + while(_local_6 < (_local_2 * 4)) { _local_4[_local_6] = []; _local_6++; } let _local_9 = 0; _local_6 = 0; - while (_local_6 < _local_2) + while(_local_6 < _local_2) { _local_10 = 0; _local_5 = 0; - while (_local_5 < _local_3) + while(_local_5 < _local_3) { _local_11 = k[_local_6][_local_5]; - if (((_local_11 < 0) || (_local_11 <= 0xFF))) + if(((_local_11 < 0) || (_local_11 <= 0xFF))) { _local_8 = 0; - while (_local_8 < 4) + while(_local_8 < 4) { _local_7 = 0; - while (_local_7 < 4) + while(_local_7 < 4) { - if (_local_4[(_local_9 + _local_8)] === undefined) _local_4[(_local_9 + _local_8)] = []; + if(_local_4[(_local_9 + _local_8)] === undefined) _local_4[(_local_9 + _local_8)] = []; _local_4[(_local_9 + _local_8)][(_local_10 + _local_7)] = ((_local_11 < 0) ? _local_11 : (_local_11 * 4)); _local_7++; @@ -182,7 +182,7 @@ export class RoomPlaneParser _local_15 = (_local_12 + (((_local_11 >> 9) & 0x01) * 3)); _local_16 = (_local_12 + (((_local_11 >> 8) & 0x01) * 3)); _local_7 = 0; - while (_local_7 < 3) + while(_local_7 < 3) { _local_17 = (_local_7 + 1); _local_4[_local_9][(_local_10 + _local_7)] = (((_local_13 * (3 - _local_7)) + (_local_14 * _local_7)) / 3); @@ -224,13 +224,13 @@ export class RoomPlaneParser const _local_2: number = (k.length - 1); const _local_3: number = (k[0].length - 1); _local_5 = 1; - while (_local_5 < _local_2) + while(_local_5 < _local_2) { _local_4 = 1; - while (_local_4 < _local_3) + while(_local_4 < _local_3) { _local_6 = k[_local_5][_local_4]; - if (_local_6 < 0) + if(_local_6 < 0) { // } @@ -247,7 +247,7 @@ export class RoomPlaneParser _local_15 = (_local_6 + 1); _local_16 = (_local_6 - 1); _local_17 = (((((((_local_7 == _local_15) || (_local_8 == _local_15)) || (_local_10 == _local_15)) ? 8 : 0) | ((((_local_9 == _local_15) || (_local_8 == _local_15)) || (_local_11 == _local_15)) ? 4 : 0)) | ((((_local_12 == _local_15) || (_local_13 == _local_15)) || (_local_10 == _local_15)) ? 2 : 0)) | ((((_local_14 == _local_15) || (_local_13 == _local_15)) || (_local_11 == _local_15)) ? 1 : 0)); - if (_local_17 == 15) + if(_local_17 == 15) { _local_17 = 0; } @@ -264,7 +264,7 @@ export class RoomPlaneParser k.shift(); k.pop(); - for (const _local_2 of k) + for(const _local_2 of k) { _local_2.shift(); _local_2.pop(); @@ -275,12 +275,12 @@ export class RoomPlaneParser { const _local_2: number[] = []; const _local_3: number[] = []; - for (const _local_4 of k) + for(const _local_4 of k) { _local_4.push(RoomPlaneParser.TILE_BLOCKED); _local_4.unshift(RoomPlaneParser.TILE_BLOCKED); } - for (const _local_5 of k[0]) + for(const _local_5 of k[0]) { _local_2.push(RoomPlaneParser.TILE_BLOCKED); _local_3.push(RoomPlaneParser.TILE_BLOCKED); @@ -327,7 +327,7 @@ export class RoomPlaneParser public get floorHeight(): number { - if (this._fixedWallHeight != -1) + if(this._fixedWallHeight != -1) { return this._fixedWallHeight; } @@ -336,7 +336,7 @@ export class RoomPlaneParser public get wallHeight(): number { - if (this._fixedWallHeight != -1) + if(this._fixedWallHeight != -1) { return this._fixedWallHeight + 3.6; } @@ -345,7 +345,7 @@ export class RoomPlaneParser public set wallHeight(k: number) { - if (k < 0) + if(k < 0) { k = 0; } @@ -359,7 +359,7 @@ export class RoomPlaneParser public set wallThicknessMultiplier(k: number) { - if (k < 0) + if(k < 0) { k = 0; } @@ -373,7 +373,7 @@ export class RoomPlaneParser public set floorThicknessMultiplier(k: number) { - if (k < 0) + if(k < 0) { k = 0; } @@ -386,7 +386,7 @@ export class RoomPlaneParser this._tileMatrix = null; this._tileMatrixOriginal = null; this._floorHoleMatrix = null; - if (this._floorHoles != null) + if(this._floorHoles != null) { this._floorHoles.clear(); this._floorHoles = null; @@ -410,9 +410,9 @@ export class RoomPlaneParser public initializeTileMap(width: number, height: number): boolean { - if (width < 0) width = 0; + if(width < 0) width = 0; - if (height < 0) height = 0; + if(height < 0) height = 0; this._tileMatrix = []; this._tileMatrixOriginal = []; @@ -420,7 +420,7 @@ export class RoomPlaneParser let y = 0; - while (y < height) + while(y < height) { const tileMatrix = []; const tileMatrixOriginal = []; @@ -428,7 +428,7 @@ export class RoomPlaneParser let x = 0; - while (x < width) + while(x < width) { tileMatrix[x] = RoomPlaneParser.TILE_BLOCKED; tileMatrixOriginal[x] = RoomPlaneParser.TILE_BLOCKED; @@ -461,77 +461,77 @@ export class RoomPlaneParser let _local_6: number; let _local_7: boolean; let _local_8: number; - if (((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))) + if(((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))) { _local_4 = this._tileMatrix[_arg_2]; _local_4[k] = _arg_3; - if (_arg_3 >= 0) + if(_arg_3 >= 0) { - if (k < this._minX) + if(k < this._minX) { this._minX = k; } - if (k > this._maxX) + if(k > this._maxX) { this._maxX = k; } - if (_arg_2 < this._minY) + if(_arg_2 < this._minY) { this._minY = _arg_2; } - if (_arg_2 > this._maxY) + if(_arg_2 > this._maxY) { this._maxY = _arg_2; } } else { - if (((k == this._minX) || (k == this._maxX))) + if(((k == this._minX) || (k == this._maxX))) { _local_5 = false; _local_6 = this._minY; - while (_local_6 < this._maxY) + while(_local_6 < this._maxY) { - if (this.getTileHeightInternal(k, _local_6) >= 0) + if(this.getTileHeightInternal(k, _local_6) >= 0) { _local_5 = true; break; } _local_6++; } - if (!_local_5) + if(!_local_5) { - if (k == this._minX) + if(k == this._minX) { this._minX++; } - if (k == this._maxX) + if(k == this._maxX) { this._maxX--; } } } - if (((_arg_2 == this._minY) || (_arg_2 == this._maxY))) + if(((_arg_2 == this._minY) || (_arg_2 == this._maxY))) { _local_7 = false; _local_8 = this._minX; - while (_local_8 < this._maxX) + while(_local_8 < this._maxX) { - if (this.getTileHeight(_local_8, _arg_2) >= 0) + if(this.getTileHeight(_local_8, _arg_2) >= 0) { _local_7 = true; break; } _local_8++; } - if (!_local_7) + if(!_local_7) { - if (_arg_2 == this._minY) + if(_arg_2 == this._minY) { this._minY++; } - if (_arg_2 == this._maxY) + if(_arg_2 == this._maxY) { this._maxY--; } @@ -545,25 +545,25 @@ export class RoomPlaneParser public getTileHeight(k: number, _arg_2: number): number { - if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } const _local_3 = this._tileMatrix[_arg_2]; - if (_local_3[k] === undefined) return 0; + if(_local_3[k] === undefined) return 0; return Math.abs(_local_3[k]); } private getTileHeightOriginal(k: number, _arg_2: number): number { - if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } - if (this._floorHoleMatrix[_arg_2][k]) + if(this._floorHoleMatrix[_arg_2][k]) { return RoomPlaneParser.TILE_HOLE; } @@ -573,7 +573,7 @@ export class RoomPlaneParser private getTileHeightInternal(k: number, _arg_2: number): number { - if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } @@ -587,12 +587,12 @@ export class RoomPlaneParser let _local_3: number; this._fixedWallHeight = k; _local_3 = 0; - while (_local_3 < this._height) + while(_local_3 < this._height) { _local_2 = 0; - while (_local_2 < this._width) + while(_local_2 < this._width) { - if (this._tileMatrixOriginal[_local_3] === undefined) this._tileMatrixOriginal[_local_3] = []; + if(this._tileMatrixOriginal[_local_3] === undefined) this._tileMatrixOriginal[_local_3] = []; this._tileMatrixOriginal[_local_3][_local_2] = this._tileMatrix[_local_3][_local_2]; _local_2++; } @@ -601,13 +601,13 @@ export class RoomPlaneParser const _local_4: Point = RoomPlaneParser.findEntranceTile(this._tileMatrix); _local_3 = 0; - while (_local_3 < this._height) + while(_local_3 < this._height) { _local_2 = 0; - while (_local_2 < this._width) + while(_local_2 < this._width) { - if (this._floorHoleMatrix[_local_3] === undefined) this._floorHoleMatrix[_local_3] = []; - if (this._floorHoleMatrix[_local_3][_local_2]) + if(this._floorHoleMatrix[_local_3] === undefined) this._floorHoleMatrix[_local_3] = []; + if(this._floorHoleMatrix[_local_3][_local_2]) { this.setTileHeight(_local_2, _local_3, RoomPlaneParser.TILE_HOLE); } @@ -622,7 +622,7 @@ export class RoomPlaneParser private initialize(k: Point): boolean { let _local_2 = 0; - if (k != null) + if(k != null) { _local_2 = this.getTileHeight(k.x, k.y); this.setTileHeight(k.x, k.y, RoomPlaneParser.TILE_BLOCKED); @@ -631,14 +631,14 @@ export class RoomPlaneParser this.createWallPlanes(); const _local_3: number[][] = []; - for (const _local_4 of this._tileMatrix) _local_3.push(_local_4.concat()); + for(const _local_4 of this._tileMatrix) _local_3.push(_local_4.concat()); RoomPlaneParser.padHeightMap(_local_3); RoomPlaneParser.addTileTypes(_local_3); RoomPlaneParser.unpadHeightMap(_local_3); const _local_5 = RoomPlaneParser.expandFloorTiles(_local_3); this.extractPlanes(_local_5); - if (k != null) + if(k != null) { this.setTileHeight(k.x, k.y, _local_2); this.addFloor(new Vector3d((k.x + 0.5), (k.y + 0.5), _local_2), new Vector3d(-1, 0, 0), new Vector3d(0, -1, 0), false, false, false, false); @@ -659,22 +659,22 @@ export class RoomPlaneParser let _local_5 = 0; let _local_6: Point = new Point(k.x, k.y); let _local_7 = 0; - while (_local_7++ < 1000) + while(_local_7++ < 1000) { _local_8 = false; _local_9 = false; _local_10 = _local_5; - if (((((_local_6.x < this.minX) || (_local_6.x > this.maxX)) || (_local_6.y < this.minY)) || (_local_6.y > this.maxY))) + if(((((_local_6.x < this.minX) || (_local_6.x > this.maxX)) || (_local_6.y < this.minY)) || (_local_6.y > this.maxY))) { _local_8 = true; } _local_11 = _local_4[_local_5](_local_6, _arg_2); - if (_local_11 == null) + if(_local_11 == null) { return null; } _local_12 = (Math.abs((_local_11.x - _local_6.x)) + Math.abs((_local_11.y - _local_6.y))); - if (((_local_6.x == _local_11.x) || (_local_6.y == _local_11.y))) + if(((_local_6.x == _local_11.x) || (_local_6.y == _local_11.y))) { _local_5 = (((_local_5 - 1) + _local_4.length) % _local_4.length); _local_12 = (_local_12 + 1); @@ -686,13 +686,13 @@ export class RoomPlaneParser _local_12--; } _local_3.addWall(_local_6, _local_10, _local_12, _local_8, _local_9); - if ((((_local_11.x == k.x) && (_local_11.y == k.y)) && ((!(_local_11.x == _local_6.x)) || (!(_local_11.y == _local_6.y))))) + if((((_local_11.x == k.x) && (_local_11.y == k.y)) && ((!(_local_11.x == _local_6.x)) || (!(_local_11.y == _local_6.y))))) { break; } _local_6 = _local_11; } - if (_local_3.count == 0) + if(_local_3.count == 0) { return null; } @@ -707,37 +707,37 @@ export class RoomPlaneParser let _local_8: number; let _local_2 = 0; const _local_3: number = k.count; - while (_local_2 < _local_3) + while(_local_2 < _local_3) { const _local_4 = _local_2; _local_5 = _local_2; _local_6 = 0; _local_7 = false; - while (((!(k.getBorder(_local_2))) && (_local_2 < _local_3))) + while(((!(k.getBorder(_local_2))) && (_local_2 < _local_3))) { - if (k.getLeftTurn(_local_2)) + if(k.getLeftTurn(_local_2)) { _local_6++; } else { - if (_local_6 > 0) + if(_local_6 > 0) { _local_6--; } } - if (_local_6 > 1) + if(_local_6 > 1) { _local_7 = true; } _local_5 = _local_2; _local_2++; } - if (_local_7) + if(_local_7) { _local_8 = _local_4; - while (_local_8 <= _local_5) + while(_local_8 <= _local_5) { k.setHideWall(_local_8, true); _local_8++; @@ -758,9 +758,9 @@ export class RoomPlaneParser let _local_10: number; const _local_2: number = k.count; let _local_3 = 0; - while (_local_3 < _local_2) + while(_local_3 < _local_2) { - if (!k.getHideWall(_local_3)) + if(!k.getHideWall(_local_3)) { _local_4 = k.getCorner(_local_3); _local_5 = k.getDirection(_local_3); @@ -769,11 +769,11 @@ export class RoomPlaneParser _local_8 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; _local_9 = 0; _local_10 = 0; - while (_local_10 < _local_6) + while(_local_10 < _local_6) { - if (this.getTileHeightInternal(((_local_4.x + (_local_10 * _local_7.x)) - _local_8.x), ((_local_4.y + (_local_10 * _local_7.y)) - _local_8.y)) == RoomPlaneParser.TILE_HOLE) + if(this.getTileHeightInternal(((_local_4.x + (_local_10 * _local_7.x)) - _local_8.x), ((_local_4.y + (_local_10 * _local_7.y)) - _local_8.y)) == RoomPlaneParser.TILE_HOLE) { - if (((_local_10 > 0) && (_local_9 == 0))) + if(((_local_10 > 0) && (_local_9 == 0))) { k.setLength(_local_3, _local_10); break; @@ -782,7 +782,7 @@ export class RoomPlaneParser } else { - if (_local_9 > 0) + if(_local_9 > 0) { k.moveCorner(_local_3, _local_9); break; @@ -790,7 +790,7 @@ export class RoomPlaneParser } _local_10++; } - if (_local_9 == _local_6) + if(_local_9 == _local_6) { k.setHideWall(_local_3, true); } @@ -813,17 +813,17 @@ export class RoomPlaneParser const _local_7: number = Math.max(k.x, _arg_2.x); const _local_8: number = _arg_3.count; let _local_9 = 0; - while (_local_9 < _local_8) + while(_local_9 < _local_8) { _local_10 = _arg_3.getCorner(_local_9); _local_11 = _arg_3.getEndPoint(_local_9); - if (k.x == _arg_2.x) + if(k.x == _arg_2.x) { - if (((_local_10.x == k.x) && (_local_11.x == k.x))) + if(((_local_10.x == k.x) && (_local_11.x == k.x))) { _local_12 = Math.min(_local_10.y, _local_11.y); _local_13 = Math.max(_local_10.y, _local_11.y); - if (((_local_12 <= _local_4) && (_local_5 <= _local_13))) + if(((_local_12 <= _local_4) && (_local_5 <= _local_13))) { return _local_9; } @@ -831,13 +831,13 @@ export class RoomPlaneParser } else { - if (k.y == _arg_2.y) + if(k.y == _arg_2.y) { - if (((_local_10.y == k.y) && (_local_11.y == k.y))) + if(((_local_10.y == k.y) && (_local_11.y == k.y))) { _local_14 = Math.min(_local_10.x, _local_11.x); _local_15 = Math.max(_local_10.x, _local_11.x); - if (((_local_14 <= _local_6) && (_local_7 <= _local_15))) + if(((_local_14 <= _local_6) && (_local_7 <= _local_15))) { return _local_9; } @@ -858,9 +858,9 @@ export class RoomPlaneParser let _local_9: number; const _local_3: number = k.count; let _local_4 = 0; - while (_local_4 < _local_3) + while(_local_4 < _local_3) { - if (!k.getHideWall(_local_4)) + if(!k.getHideWall(_local_4)) { _local_5 = k.getCorner(_local_4); _local_6 = new Point(_local_5.x, _local_5.y); @@ -869,9 +869,9 @@ export class RoomPlaneParser _local_6.x = (_local_6.x + (_local_7.x * _local_8)); _local_6.y = (_local_6.y + (_local_7.y * _local_8)); _local_9 = this.resolveOriginalWallIndex(_local_5, _local_6, _arg_2); - if (_local_9 >= 0) + if(_local_9 >= 0) { - if (_arg_2.getHideWall(_local_9)) + if(_arg_2.getHideWall(_local_9)) { k.setHideWall(_local_4, true); } @@ -898,9 +898,9 @@ export class RoomPlaneParser const _local_4 = _arg_2.count; let _local_7 = 0; - while (_local_7 < _local_3) + while(_local_7 < _local_3) { - if (!k.getHideWall(_local_7)) + if(!k.getHideWall(_local_7)) { const _local_8 = k.getCorner(_local_7); const _local_9 = k.getDirection(_local_7); @@ -910,11 +910,11 @@ export class RoomPlaneParser let _local_13 = -1; let _local_14 = 0; - while (_local_14 < _local_10) + while(_local_14 < _local_10) { const _local_27 = this.getTileHeightInternal(((_local_8.x + (_local_14 * _local_11.x)) + _local_12.x), ((_local_8.y + (_local_14 * _local_11.y)) + _local_12.y)); - if (((_local_27 >= 0) && ((_local_27 < _local_13) || (_local_13 < 0)))) + if(((_local_27 >= 0) && ((_local_27 < _local_13) || (_local_13 < 0)))) { _local_13 = _local_27; } @@ -939,7 +939,7 @@ export class RoomPlaneParser let _local_5 = 0; let _local_6 = 0; - if (_local_20 >= 0) + if(_local_20 >= 0) { _local_5 = _arg_2.getDirection(((_local_20 + 1) % _local_4)); _local_6 = _arg_2.getDirection((((_local_20 - 1) + _local_4) % _local_4)); @@ -952,13 +952,13 @@ export class RoomPlaneParser let _local_21 = null; - if ((((_local_5 - _local_9) + 4) % 4) == 3) + if((((_local_5 - _local_9) + 4) % 4) == 3) { _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; } else { - if ((((_local_9 - _local_6) + 4) % 4) == 3) + if((((_local_9 - _local_6) + 4) % 4) == 3) { _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_6]; } @@ -982,7 +982,7 @@ export class RoomPlaneParser let _local_13: number; let _local_14: number; const k = this._tileMatrix; - if (k == null) + if(k == null) { return false; } @@ -991,19 +991,19 @@ export class RoomPlaneParser let _local_4: number[]; const _local_5: number = k.length; let _local_6 = 0; - if (_local_5 == 0) + if(_local_5 == 0) { return false; } _local_2 = 0; - while (_local_2 < _local_5) + while(_local_2 < _local_5) { _local_4 = k[_local_2]; - if (((_local_4 == null) || (_local_4.length == 0))) + if(((_local_4 == null) || (_local_4.length == 0))) { return false; } - if (_local_6 > 0) + if(_local_6 > 0) { _local_6 = Math.min(_local_6, _local_4.length); } @@ -1017,23 +1017,23 @@ export class RoomPlaneParser const _local_8: number = this.minX; let _local_9: number = this.minY; _local_9 = this.minY; - while (_local_9 <= this.maxY) + while(_local_9 <= this.maxY) { - if (this.getTileHeightInternal(_local_8, _local_9) > RoomPlaneParser.TILE_HOLE) + if(this.getTileHeightInternal(_local_8, _local_9) > RoomPlaneParser.TILE_HOLE) { _local_9--; break; } _local_9++; } - if (_local_9 > this.maxY) + if(_local_9 > this.maxY) { return false; } const _local_10: Point = new Point(_local_8, _local_9); const _local_11: RoomWallData = this.generateWallData(_local_10, true); const _local_12: RoomWallData = this.generateWallData(_local_10, false); - if (_local_11 != null) + if(_local_11 != null) { _local_13 = _local_11.count; _local_14 = _local_12.count; @@ -1041,12 +1041,12 @@ export class RoomPlaneParser this.addWalls(_local_11, _local_12); } _local_3 = 0; - while (_local_3 < this.tileMapHeight) + while(_local_3 < this.tileMapHeight) { _local_2 = 0; - while (_local_2 < this.tileMapWidth) + while(_local_2 < this.tileMapWidth) { - if (this.getTileHeightInternal(_local_2, _local_3) < 0) + if(this.getTileHeightInternal(_local_2, _local_3) < 0) { this.setTileHeight(_local_2, _local_3, -(_local_7 + this.wallHeight)); } @@ -1059,23 +1059,23 @@ export class RoomPlaneParser private extractTopWall(k: Point, _arg_2: boolean): Point { - if (k == null) + if(k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if (!_arg_2) + if(!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while (_local_3 < 1000) + while(_local_3 < 1000) { - if (this.getTileHeightInternal((k.x + _local_3), k.y) > _local_4) + if(this.getTileHeightInternal((k.x + _local_3), k.y) > _local_4) { return new Point(((k.x + _local_3) - 1), k.y); } - if (this.getTileHeightInternal((k.x + _local_3), (k.y + 1)) <= _local_4) + if(this.getTileHeightInternal((k.x + _local_3), (k.y + 1)) <= _local_4) { return new Point((k.x + _local_3), (k.y + 1)); } @@ -1086,23 +1086,23 @@ export class RoomPlaneParser private extractRightWall(k: Point, _arg_2: boolean): Point { - if (k == null) + if(k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if (!_arg_2) + if(!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while (_local_3 < 1000) + while(_local_3 < 1000) { - if (this.getTileHeightInternal(k.x, (k.y + _local_3)) > _local_4) + if(this.getTileHeightInternal(k.x, (k.y + _local_3)) > _local_4) { return new Point(k.x, (k.y + (_local_3 - 1))); } - if (this.getTileHeightInternal((k.x - 1), (k.y + _local_3)) <= _local_4) + if(this.getTileHeightInternal((k.x - 1), (k.y + _local_3)) <= _local_4) { return new Point((k.x - 1), (k.y + _local_3)); } @@ -1113,23 +1113,23 @@ export class RoomPlaneParser private extractBottomWall(k: Point, _arg_2: boolean): Point { - if (k == null) + if(k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if (!_arg_2) + if(!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while (_local_3 < 1000) + while(_local_3 < 1000) { - if (this.getTileHeightInternal((k.x - _local_3), k.y) > _local_4) + if(this.getTileHeightInternal((k.x - _local_3), k.y) > _local_4) { return new Point((k.x - (_local_3 - 1)), k.y); } - if (this.getTileHeightInternal((k.x - _local_3), (k.y - 1)) <= _local_4) + if(this.getTileHeightInternal((k.x - _local_3), (k.y - 1)) <= _local_4) { return new Point((k.x - _local_3), (k.y - 1)); } @@ -1140,23 +1140,23 @@ export class RoomPlaneParser private extractLeftWall(k: Point, _arg_2: boolean): Point { - if (k == null) + if(k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if (!_arg_2) + if(!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while (_local_3 < 1000) + while(_local_3 < 1000) { - if (this.getTileHeightInternal(k.x, (k.y - _local_3)) > _local_4) + if(this.getTileHeightInternal(k.x, (k.y - _local_3)) > _local_4) { return new Point(k.x, (k.y - (_local_3 - 1))); } - if (this.getTileHeightInternal((k.x + 1), (k.y - _local_3)) <= _local_4) + if(this.getTileHeightInternal((k.x + 1), (k.y - _local_3)) <= _local_4) { return new Point((k.x + 1), (k.y - _local_3)); } @@ -1174,14 +1174,14 @@ export class RoomPlaneParser const _local_10: Vector3d = Vector3d.crossProduct(_arg_2, _arg_3); const _local_11: Vector3d = Vector3d.product(_local_10, ((1 / _local_10.length) * -(_local_8))); this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, _arg_3), _arg_2, _local_11, [_local_10, _arg_4]); - if (_arg_5) + if(_arg_5) { this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_2), _arg_3), Vector3d.product(_arg_3, (-(_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); } - if (_arg_6) + if(_arg_6) { this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, Vector3d.product(_arg_3, (-(_local_9) / _arg_3.length))), Vector3d.product(_arg_3, ((_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); - if (_arg_7) + if(_arg_7) { const _local_12 = Vector3d.product(_arg_2, (_local_8 / _arg_2.length)); this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_3), Vector3d.product(_local_12, -1)), _local_12, _local_11, [_local_10, _arg_2, _arg_4]); @@ -1195,24 +1195,24 @@ export class RoomPlaneParser let _local_10: Vector3d; let _local_11: Vector3d; const _local_8: RoomPlaneData = this.addPlane(RoomPlaneData.PLANE_FLOOR, k, _arg_2, _arg_3); - if (_local_8 != null) + if(_local_8 != null) { _local_9 = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); _local_10 = new Vector3d(0, 0, _local_9); _local_11 = Vector3d.dif(k, _local_10); - if (_arg_6) + if(_arg_6) { this.addPlane(RoomPlaneData.PLANE_FLOOR, _local_11, _arg_2, _local_10); } - if (_arg_7) + if(_arg_7) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, Vector3d.sum(_arg_2, _arg_3)), Vector3d.product(_arg_2, -1), _local_10); } - if (_arg_4) + if(_arg_4) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_3), Vector3d.product(_arg_3, -1), _local_10); } - if (_arg_5) + if(_arg_5) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_2), _arg_3, _local_10); } @@ -1221,7 +1221,7 @@ export class RoomPlaneParser public initializeFromMapData(data: RoomMapData): boolean { - if (!data) return false; + if(!data) return false; this.reset(); @@ -1234,23 +1234,23 @@ export class RoomPlaneParser this.initializeTileMap(width, height); - if (data.tileMap) + if(data.tileMap) { let y = 0; - while (y < data.tileMap.length) + while(y < data.tileMap.length) { const row = data.tileMap[y]; - if (row) + if(row) { let x = 0; - while (x < row.length) + while(x < row.length) { const column = row[x]; - if (column) this.setTileHeight(x, y, column.height); + if(column) this.setTileHeight(x, y, column.height); x++; } @@ -1260,15 +1260,15 @@ export class RoomPlaneParser } } - if (data.holeMap && data.holeMap.length) + if(data.holeMap && data.holeMap.length) { let index = 0; - while (index < data.holeMap.length) + while(index < data.holeMap.length) { const hole = data.holeMap[index]; - if (!hole) continue; + if(!hole) continue; this.addFloorHole(hole.id, hole.x, hole.y, hole.width, hole.height); @@ -1290,7 +1290,7 @@ export class RoomPlaneParser private addPlane(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[] = null): RoomPlaneData { - if (((_arg_3.length == 0) || (_arg_4.length == 0))) + if(((_arg_3.length == 0) || (_arg_4.length == 0))) { return null; } @@ -1317,14 +1317,14 @@ export class RoomPlaneParser let y = 0; - while (y < this._height) + while(y < this._height) { const tileRow: { height: number }[] = []; const tileMatrix = this._tileMatrixOriginal[y]; let x = 0; - while (x < this._width) + while(x < this._width) { const tileHeight = tileMatrix[x]; @@ -1338,9 +1338,9 @@ export class RoomPlaneParser y++; } - for (const [holeId, holeData] of this._floorHoles.entries()) + for(const [holeId, holeData] of this._floorHoles.entries()) { - if (!holeData) continue; + if(!holeData) continue; data.holeMap.push({ id: holeId, @@ -1356,55 +1356,55 @@ export class RoomPlaneParser public getPlaneLocation(k: number): IVector3D { - if (((k < 0) || (k >= this.planeCount))) return null; + if(((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if (!planeData) return null; + if(!planeData) return null; return planeData.loc; } public getPlaneNormal(k: number): IVector3D { - if (((k < 0) || (k >= this.planeCount))) return null; + if(((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if (!planeData) return null; + if(!planeData) return null; return planeData.normal; } public getPlaneLeftSide(k: number): IVector3D { - if (((k < 0) || (k >= this.planeCount))) return null; + if(((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if (!planeData) return null; + if(!planeData) return null; return planeData.leftSide; } public getPlaneRightSide(k: number): IVector3D { - if (((k < 0) || (k >= this.planeCount))) return null; + if(((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if (!planeData) return null; + if(!planeData) return null; return planeData.rightSide; } public getPlaneNormalDirection(k: number): IVector3D { - if (((k < 0) || (k >= this.planeCount))) return null; + if(((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if (!planeData) return null; + if(!planeData) return null; return planeData.normalDirection; } @@ -1413,16 +1413,16 @@ export class RoomPlaneParser { let _local_3: IVector3D[]; let _local_4: number; - if (((k < 0) || (k >= this.planeCount))) + if(((k < 0) || (k >= this.planeCount))) { return null; } const _local_2: RoomPlaneData = (this._planes[k] as RoomPlaneData); - if (_local_2 != null) + if(_local_2 != null) { _local_3 = []; _local_4 = 0; - while (_local_4 < _local_2.secondaryNormalCount) + while(_local_4 < _local_2.secondaryNormalCount) { _local_3.push(_local_2.getSecondaryNormal(_local_4)); _local_4++; @@ -1434,66 +1434,66 @@ export class RoomPlaneParser public getPlaneType(k: number): number { - if (((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; + if(((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; const planeData = this._planes[k]; - if (!planeData) return RoomPlaneData.PLANE_UNDEFINED; + if(!planeData) return RoomPlaneData.PLANE_UNDEFINED; return planeData.type; } public getPlaneMaskCount(k: number): number { - if (((k < 0) || (k >= this.planeCount))) return 0; + if(((k < 0) || (k >= this.planeCount))) return 0; const planeData = this._planes[k]; - if (!planeData) return 0; + if(!planeData) return 0; return planeData.maskCount; } public getPlaneMaskLeftSideLoc(k: number, _arg_2: number): number { - if (((k < 0) || (k >= this.planeCount))) return -1; + if(((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if (!planeData) return -1; + if(!planeData) return -1; return planeData.getMaskLeftSideLoc(_arg_2); } public getPlaneMaskRightSideLoc(k: number, _arg_2: number): number { - if (((k < 0) || (k >= this.planeCount))) return -1; + if(((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if (!planeData) return -1; + if(!planeData) return -1; return planeData.getMaskRightSideLoc(_arg_2); } public getPlaneMaskLeftSideLength(k: number, _arg_2: number): number { - if (((k < 0) || (k >= this.planeCount))) return -1; + if(((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if (!planeData) return -1; + if(!planeData) return -1; return planeData.getMaskLeftSideLength(_arg_2); } public getPlaneMaskRightSideLength(k: number, _arg_2: number): number { - if (((k < 0) || (k >= this.planeCount))) return -1; + if(((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if (!planeData) return -1; + if(!planeData) return -1; return planeData.getMaskRightSideLength(_arg_2); } @@ -1526,21 +1526,21 @@ export class RoomPlaneParser let _local_8: number; let _local_9: number; _local_2 = 0; - while (_local_2 < this._height) + while(_local_2 < this._height) { _local_3 = this._floorHoleMatrix[_local_2]; k = 0; - while (k < this._width) + while(k < this._width) { _local_3[k] = false; k++; } _local_2++; } - for (const _local_4 of this._floorHoles.values()) + for(const _local_4 of this._floorHoles.values()) { _local_5 = _local_4; - if (_local_5 != null) + if(_local_5 != null) { _local_6 = _local_5.x; _local_7 = ((_local_5.x + _local_5.width) - 1); @@ -1551,11 +1551,11 @@ export class RoomPlaneParser _local_8 = ((_local_8 < 0) ? 0 : _local_8); _local_9 = ((_local_9 >= this._height) ? (this._height - 1) : _local_9); _local_2 = _local_8; - while (_local_2 <= _local_9) + while(_local_2 <= _local_9) { _local_3 = this._floorHoleMatrix[_local_2]; k = _local_6; - while (k <= _local_7) + while(k <= _local_7) { _local_3[k] = true; k++; @@ -1589,19 +1589,19 @@ export class RoomPlaneParser const _local_3: number = k[0].length; const _local_4: boolean[][] = []; let _local_5 = 0; - while (_local_5 < _local_2) + while(_local_5 < _local_2) { _local_4[_local_5] = []; _local_5++; } let _local_6 = 0; - while (_local_6 < _local_2) + while(_local_6 < _local_2) { _local_7 = 0; - while (_local_7 < _local_3) + while(_local_7 < _local_3) { _local_8 = k[_local_6][_local_7]; - if (((_local_8 < 0) || (_local_4[_local_6][_local_7]))) + if(((_local_8 < 0) || (_local_4[_local_6][_local_7]))) { // } @@ -1610,9 +1610,9 @@ export class RoomPlaneParser _local_11 = ((_local_7 == 0) || (!(k[_local_6][(_local_7 - 1)] == _local_8))); _local_12 = ((_local_6 == 0) || (!(k[(_local_6 - 1)][_local_7] == _local_8))); _local_9 = (_local_7 + 1); - while (_local_9 < _local_3) + while(_local_9 < _local_3) { - if ((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) + if((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) { break; } @@ -1621,14 +1621,14 @@ export class RoomPlaneParser _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); _local_17 = false; _local_10 = (_local_6 + 1); - while (((_local_10 < _local_2) && (!(_local_17)))) + while(((_local_10 < _local_2) && (!(_local_17)))) { _local_14 = (!(k[_local_10][_local_7] == _local_8)); _local_17 = (((_local_14) || ((_local_7 > 0) && ((k[_local_10][(_local_7 - 1)] == _local_8) == _local_11))) || ((_local_9 < _local_3) && ((k[_local_10][_local_9] == _local_8) == _local_13))); _local_15 = _local_7; - while (_local_15 < _local_9) + while(_local_15 < _local_9) { - if ((k[_local_10][_local_15] == _local_8) == _local_14) + if((k[_local_10][_local_15] == _local_8) == _local_14) { _local_17 = true; _local_9 = _local_15; @@ -1636,7 +1636,7 @@ export class RoomPlaneParser } _local_15++; } - if (_local_17) + if(_local_17) { break; } @@ -1645,10 +1645,10 @@ export class RoomPlaneParser _local_14 = ((_local_14) || (_local_10 == _local_2)); _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); _local_16 = _local_6; - while (_local_16 < _local_10) + while(_local_16 < _local_10) { _local_15 = _local_7; - while (_local_15 < _local_9) + while(_local_15 < _local_9) { _local_4[_local_16][_local_15] = true; _local_15++; diff --git a/src/nitro/room/object/RoomWallData.ts b/src/nitro/room/object/RoomWallData.ts index b715f8e3..e15dacc5 100644 --- a/src/nitro/room/object/RoomWallData.ts +++ b/src/nitro/room/object/RoomWallData.ts @@ -46,7 +46,7 @@ export class RoomWallData public addWall(k: Point, _arg_2: number, _arg_3: number, _arg_4: boolean, _arg_5: boolean): void { - if (((this._addDuplicates) || (this.checkIsNotDuplicate(k, _arg_2, _arg_3, _arg_4, _arg_5)))) + if(((this._addDuplicates) || (this.checkIsNotDuplicate(k, _arg_2, _arg_3, _arg_4, _arg_5)))) { this._corners.push(k); this._directions.push(_arg_2); @@ -64,9 +64,9 @@ export class RoomWallData { let _local_6 = 0; - while (_local_6 < this._count) + while(_local_6 < this._count) { - if (((((((this._corners[_local_6].x == k.x) && (this._corners[_local_6].y == k.y)) && (this._directions[_local_6] == _arg_2)) && (this._lengths[_local_6] == _arg_3)) && (this._borders[_local_6] == _arg_4)) && (this._leftTurns[_local_6] == _arg_5))) + if(((((((this._corners[_local_6].x == k.x) && (this._corners[_local_6].y == k.y)) && (this._directions[_local_6] == _arg_2)) && (this._lengths[_local_6] == _arg_3)) && (this._borders[_local_6] == _arg_4)) && (this._leftTurns[_local_6] == _arg_5))) { return false; } @@ -133,7 +133,7 @@ export class RoomWallData public setLength(k: number, _arg_2: number): void { - if (_arg_2 < this._lengths[k]) + if(_arg_2 < this._lengths[k]) { this._lengths[k] = _arg_2; this._manuallyRightCut[k] = true; @@ -143,7 +143,7 @@ export class RoomWallData public moveCorner(k: number, _arg_2: number): void { let _local_3: IVector3D; - if (((_arg_2 > 0) && (_arg_2 < this._lengths[k]))) + if(((_arg_2 > 0) && (_arg_2 < this._lengths[k]))) { const corner = this._corners[k]; @@ -161,11 +161,11 @@ export class RoomWallData let _local_3: Point; let _local_4: IVector3D; let _local_5: number; - if (this._endPoints.length != this.count) + if(this._endPoints.length != this.count) { this._endPoints = []; k = 0; - while (k < this.count) + while(k < this.count) { _local_2 = this.getCorner(k); _local_3 = new Point(_local_2.x, _local_2.y); diff --git a/src/nitro/room/object/logic/MovingObjectLogic.ts b/src/nitro/room/object/logic/MovingObjectLogic.ts index 2551250c..ac3907bc 100644 --- a/src/nitro/room/object/logic/MovingObjectLogic.ts +++ b/src/nitro/room/object/logic/MovingObjectLogic.ts @@ -42,11 +42,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase const locationOffset = this.getLocationOffset(); const model = this.object && this.object.model; - if (model) + if(model) { - if (locationOffset) + if(locationOffset) { - if (this._liftAmount !== locationOffset.z) + if(this._liftAmount !== locationOffset.z) { this._liftAmount = locationOffset.z; @@ -55,7 +55,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase } else { - if (this._liftAmount !== 0) + if(this._liftAmount !== 0) { this._liftAmount = 0; @@ -64,17 +64,17 @@ export class MovingObjectLogic extends RoomObjectLogicBase } } - if ((this._locationDelta.length > 0) || locationOffset) + if((this._locationDelta.length > 0) || locationOffset) { const vector = MovingObjectLogic.TEMP_VECTOR; let difference = (this.time - this._changeTime); - if (difference === (this._updateInterval >> 1)) difference++; + if(difference === (this._updateInterval >> 1)) difference++; - if (difference > this._updateInterval) difference = this._updateInterval; + if(difference > this._updateInterval) difference = this._updateInterval; - if (this._locationDelta.length > 0) + if(this._locationDelta.length > 0) { vector.assign(this._locationDelta); vector.multiply((difference / this._updateInterval)); @@ -85,11 +85,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase vector.assign(this._location); } - if (locationOffset) vector.add(locationOffset); + if(locationOffset) vector.add(locationOffset); this.object.setLocation(vector); - if (difference === this._updateInterval) + if(difference === this._updateInterval) { this._locationDelta.x = 0; this._locationDelta.y = 0; @@ -104,23 +104,23 @@ export class MovingObjectLogic extends RoomObjectLogicBase { super.setObject(object); - if (object) this._location.assign(object.getLocation()); + if(object) this._location.assign(object.getLocation()); } public processUpdateMessage(message: IRoomObjectUpdateMessage): void { - if (!message) return; + if(!message) return; super.processUpdateMessage(message); - if (message.location) this._location.assign(message.location); + if(message.location) this._location.assign(message.location); - if (message instanceof ObjectMoveUpdateMessage) return this.processMoveMessage(message); + if(message instanceof ObjectMoveUpdateMessage) return this.processMoveMessage(message); } private processMoveMessage(message: ObjectMoveUpdateMessage): void { - if (!message || !this.object || !message.location) return; + if(!message || !this.object || !message.location) return; this._changeTime = this._lastUpdateTime; @@ -140,7 +140,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase protected set updateInterval(interval: number) { - if (interval <= 0) interval = 1; + if(interval <= 0) interval = 1; this._updateInterval = interval; } diff --git a/src/nitro/room/object/logic/avatar/AvatarLogic.ts b/src/nitro/room/object/logic/avatar/AvatarLogic.ts index 10dda102..490dbb86 100644 --- a/src/nitro/room/object/logic/avatar/AvatarLogic.ts +++ b/src/nitro/room/object/logic/avatar/AvatarLogic.ts @@ -66,9 +66,9 @@ export class AvatarLogic extends MovingObjectLogic public dispose(): void { - if (this._selected && this.object) + if(this._selected && this.object) { - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); } super.dispose(); @@ -80,15 +80,15 @@ export class AvatarLogic extends MovingObjectLogic { super.update(time); - if (this._selected && this.object) + if(this._selected && this.object) { - if (this.eventDispatcher) + if(this.eventDispatcher) { const location = this.object.getLocation(); - if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) + if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) { - if (!this._reportedLocation) this._reportedLocation = new Vector3d(); + if(!this._reportedLocation) this._reportedLocation = new Vector3d(); this._reportedLocation.assign(location); @@ -99,14 +99,14 @@ export class AvatarLogic extends MovingObjectLogic const model = this.object && this.object.model; - if (model) this.updateModel(this.time, model); + if(model) this.updateModel(this.time, model); } private updateModel(time: number, model: IRoomObjectModel): void { - if (this._talkingEndTimestamp > 0) + if(this._talkingEndTimestamp > 0) { - if (time > this._talkingEndTimestamp) + if(time > this._talkingEndTimestamp) { model.setValue(RoomObjectVariable.FIGURE_TALK, 0); @@ -116,14 +116,14 @@ export class AvatarLogic extends MovingObjectLogic } else { - if (!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) + if(!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) { this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp(); this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp(); } else { - if ((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) + if((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_TALK, 0); @@ -131,7 +131,7 @@ export class AvatarLogic extends MovingObjectLogic } else { - if ((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) + if((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_TALK, 1); @@ -142,30 +142,30 @@ export class AvatarLogic extends MovingObjectLogic } } - if ((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) + if((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); this._animationEndTimestamp = 0; } - if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) + if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0); this._gestureEndTimestamp = 0; } - if ((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) + if((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_SIGN, -1); this._signEndTimestamp = 0; } - if (this._carryObjectEndTimestamp > 0) + if(this._carryObjectEndTimestamp > 0) { - if (time > this._carryObjectEndTimestamp) + if(time > this._carryObjectEndTimestamp) { model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); @@ -176,11 +176,11 @@ export class AvatarLogic extends MovingObjectLogic } } - if (this._allowUseCarryObject) + if(this._allowUseCarryObject) { - if ((time - this._carryObjectStartTimestamp) > 5000) + if((time - this._carryObjectStartTimestamp) > 5000) { - if (((time - this._carryObjectStartTimestamp) % 10000) < 1000) + if(((time - this._carryObjectStartTimestamp) % 10000) < 1000) { model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1); } @@ -191,7 +191,7 @@ export class AvatarLogic extends MovingObjectLogic } } - if ((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) + if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_BLINK, 1); @@ -199,21 +199,21 @@ export class AvatarLogic extends MovingObjectLogic this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp(); } - if ((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) + if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_BLINK, 0); this._blinkingEndTimestamp = 0; } - if ((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) + if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) { model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect); this._effectChangeTimeStamp = 0; } - if ((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) + if((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0); @@ -223,15 +223,15 @@ export class AvatarLogic extends MovingObjectLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (!message || !this.object) return; + if(!message || !this.object) return; super.processUpdateMessage(message); const model = this.object && this.object.model; - if (!model) return; + if(!model) return; - if (message instanceof ObjectAvatarPostureUpdateMessage) + if(message instanceof ObjectAvatarPostureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter); @@ -239,7 +239,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarChatUpdateMessage) + if(message instanceof ObjectAvatarChatUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_TALK, 1); @@ -248,28 +248,28 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarTypingUpdateMessage) + if(message instanceof ObjectAvatarTypingUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0); return; } - if (message instanceof ObjectAvatarMutedUpdateMessage) + if(message instanceof ObjectAvatarMutedUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0)); return; } - if (message instanceof ObjectAvatarPlayingGameUpdateMessage) + if(message instanceof ObjectAvatarPlayingGameUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0)); return; } - if (message instanceof ObjectAvatarUpdateMessage) + if(message instanceof ObjectAvatarUpdateMessage) { model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp); @@ -278,7 +278,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarGestureUpdateMessage) + if(message instanceof ObjectAvatarGestureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); @@ -287,35 +287,35 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarExpressionUpdateMessage) + if(message instanceof ObjectAvatarExpressionUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType); this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue(RoomObjectVariable.FIGURE_EXPRESSION)); - if (this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; + if(this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; return; } - if (message instanceof ObjectAvatarDanceUpdateMessage) + if(message instanceof ObjectAvatarDanceUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle); return; } - if (message instanceof ObjectAvatarSleepUpdateMessage) + if(message instanceof ObjectAvatarSleepUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); - if (message.isSleeping) this._blinkingStartTimestamp = -1; + if(message.isSleeping) this._blinkingStartTimestamp = -1; else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp()); return; } - if (message instanceof ObjectAvatarPlayerValueUpdateMessage) + if(message instanceof ObjectAvatarPlayerValueUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value); @@ -324,19 +324,19 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarEffectUpdateMessage) + if(message instanceof ObjectAvatarEffectUpdateMessage) { this.updateAvatarEffect(message.effect, message.delayMilliseconds, model); return; } - if (message instanceof ObjectAvatarCarryObjectUpdateMessage) + if(message instanceof ObjectAvatarCarryObjectUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); - if (message.itemType === 0) + if(message.itemType === 0) { this._carryObjectStartTimestamp = 0; this._carryObjectEndTimestamp = 0; @@ -346,7 +346,7 @@ export class AvatarLogic extends MovingObjectLogic { this._carryObjectStartTimestamp = this.time; - if (message.itemType < AvatarLogic.MAX_HAND_ID) + if(message.itemType < AvatarLogic.MAX_HAND_ID) { this._carryObjectEndTimestamp = 0; this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID; @@ -361,14 +361,14 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarUseObjectUpdateMessage) + if(message instanceof ObjectAvatarUseObjectUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType); return; } - if (message instanceof ObjectAvatarSignUpdateMessage) + if(message instanceof ObjectAvatarSignUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType); @@ -377,14 +377,14 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarFlatControlUpdateMessage) + if(message instanceof ObjectAvatarFlatControlUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level); return; } - if (message instanceof ObjectAvatarFigureUpdateMessage) + if(message instanceof ObjectAvatarFigureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE, message.figure); model.setValue(RoomObjectVariable.GENDER, message.gender); @@ -392,7 +392,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarSelectedMessage) + if(message instanceof ObjectAvatarSelectedMessage) { this._selected = message.selected; this._reportedLocation = null; @@ -400,7 +400,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarOwnMessage) + if(message instanceof ObjectAvatarOwnMessage) { model.setValue(RoomObjectVariable.OWN_USER, 1); @@ -410,19 +410,19 @@ export class AvatarLogic extends MovingObjectLogic private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void { - if (effect === AvatarLogic.EFFECT_TYPE_SPLASH) + if(effect === AvatarLogic.EFFECT_TYPE_SPLASH) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM; } - else if (effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) + else if(effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK; } - else if (model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) + else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = effect; @@ -430,7 +430,7 @@ export class AvatarLogic extends MovingObjectLogic effect = AvatarLogic.EFFECT_TYPE_SPLASH; } - else if (model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) + else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = effect; @@ -438,7 +438,7 @@ export class AvatarLogic extends MovingObjectLogic effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK; } - else if (delay === 0) + else if(delay === 0) { this._effectChangeTimeStamp = 0; } @@ -458,7 +458,7 @@ export class AvatarLogic extends MovingObjectLogic { let eventType: string = null; - switch (event.type) + switch(event.type) { case MouseEventType.MOUSE_CLICK: eventType = RoomObjectMouseEvent.CLICK; @@ -466,20 +466,20 @@ export class AvatarLogic extends MovingObjectLogic case MouseEventType.ROLL_OVER: eventType = RoomObjectMouseEvent.MOUSE_ENTER; - if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); break; case MouseEventType.ROLL_OUT: eventType = RoomObjectMouseEvent.MOUSE_LEAVE; - if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); break; } - if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); } private randomTalkingPauseStartTimestamp(): number diff --git a/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts index 8ba49599..0c35f2e0 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts @@ -24,17 +24,17 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo { super.processUpdateMessage(message); - if (message instanceof ObjectGroupBadgeUpdateMessage) + if(message instanceof ObjectGroupBadgeUpdateMessage) { - if (message.assetName !== 'loading_icon') + if(message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE, FurnitureAchievementResolutionLogic.BADGE_VISIBLE_IN_STATE); } } - if (message instanceof ObjectSelectedMessage) + if(message instanceof ObjectSelectedMessage) { - if (!this.eventDispatcher || !this.object) return; + if(!this.eventDispatcher || !this.object) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); } @@ -42,11 +42,11 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; let event: RoomObjectEvent = null; - switch (this.object.getState(0)) + switch(this.object.getState(0)) { case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_NOT_STARTED: case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_IN_PROGRESS: @@ -60,12 +60,12 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo break; } - if (event) this.eventDispatcher.dispatchEvent(event); + if(event) this.eventDispatcher.dispatchEvent(event); } protected updateBadge(badgeId: string): void { - if (badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return; + if(badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return; super.updateBadge(badgeId); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts index d79759b8..bc3a5499 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts @@ -18,20 +18,20 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (!this.object) return; + if(!this.object) return; - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const data = message.data; - if (data instanceof StringDataType) this.updateBadge(data.getValue(1)); + if(data instanceof StringDataType) this.updateBadge(data.getValue(1)); return; } - if (message instanceof ObjectGroupBadgeUpdateMessage) + if(message instanceof ObjectGroupBadgeUpdateMessage) { - if (message.assetName !== 'loading_icon') + if(message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME, message.assetName); this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, 1); @@ -45,16 +45,16 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object)); } protected updateBadge(badgeId: string): void { - if (badgeId === '') return; + if(badgeId === '') return; - if (this.eventDispatcher) + if(this.eventDispatcher) { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1); diff --git a/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts index 49333b89..d3621175 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts @@ -15,33 +15,33 @@ export class FurnitureChangeStateWhenStepOnLogic extends FurnitureLogic { super.initialize(asset); - if (this.eventDispatcher) this.eventDispatcher.addEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); + if(this.eventDispatcher) this.eventDispatcher.addEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); } public tearDown(): void { - if (this.eventDispatcher) this.eventDispatcher.removeEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); + if(this.eventDispatcher) this.eventDispatcher.removeEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); super.tearDown(); } private onRoomToObjectOwnAvatarMoveEvent(event: RoomToObjectOwnAvatarMoveEvent): void { - if (!event || !this.object) return; + if(!event || !this.object) return; const location = this.object.getLocation(); const targetLocation = event.targetLocation; - if (!targetLocation) return; + if(!targetLocation) return; let sizeX = this.object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); let sizeY = this.object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); const direction = (((Math.floor(this.object.getDirection().x) + 45) % 360) / 90); - if ((direction === 1) || (direction === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + if((direction === 1) || (direction === 3)) [sizeX, sizeY] = [sizeY, sizeX]; - if (((targetLocation.x >= location.x) && (targetLocation.x < (location.x + sizeX))) && ((targetLocation.y >= location.y) && (targetLocation.y < (location.y + sizeY)))) + if(((targetLocation.x >= location.x) && (targetLocation.x < (location.x + sizeX))) && ((targetLocation.y >= location.y) && (targetLocation.y < (location.y + sizeY)))) { this.object.setState(1, 0); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts index 1befdeac..e71a1ae3 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts @@ -26,22 +26,22 @@ export class FurnitureClothingChangeLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) message.data && this.updateClothingData(message.data.getLegacyString()); + if(message instanceof ObjectDataUpdateMessage) message.data && this.updateClothingData(message.data.getLegacyString()); } private updateClothingData(furnitureData: string): void { - if (!furnitureData || !furnitureData.length) return; + if(!furnitureData || !furnitureData.length) return; const [boyClothing, girlClothing] = furnitureData.split(','); - if (boyClothing && boyClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_BOY, boyClothing); - if (girlClothing && girlClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_GIRL, girlClothing); + if(boyClothing && boyClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_BOY, boyClothing); + if(girlClothing && girlClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_GIRL, girlClothing); } public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOTHING_CHANGE, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts index 21968f25..cebd64b7 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts @@ -15,14 +15,14 @@ export class FurnitureCounterClockLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch (event.type) + switch(event.type) { case MouseEventType.DOUBLE_CLICK: - switch (event.spriteTag) + switch(event.spriteTag) { case 'start_stop': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); @@ -32,7 +32,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic break; } - if (this.eventDispatcher && objectEvent) + if(this.eventDispatcher && objectEvent) { this.eventDispatcher.dispatchEvent(objectEvent); @@ -46,7 +46,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts index 28ed661f..d06bcf3e 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts @@ -9,9 +9,9 @@ export class FurnitureCrackableLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (!this.object) return; + if(!this.object) return; - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.CRACKABLE_FURNI); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts index 4d19800c..33432f0b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts @@ -19,9 +19,9 @@ export class FurnitureCreditLogic extends FurnitureLogic let creditValue = 0; - if (asset.logic) + if(asset.logic) { - if (asset.logic.credits && (asset.logic.credits !== '') && (asset.logic.credits.length > 0)) creditValue = parseInt(asset.logic.credits); + if(asset.logic.credits && (asset.logic.credits !== '') && (asset.logic.credits.length > 0)) creditValue = parseInt(asset.logic.credits); } this.object.model.setValue(RoomObjectVariable.FURNITURE_CREDIT_VALUE, creditValue); @@ -29,7 +29,7 @@ export class FurnitureCreditLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CREDITFURNI, this.object)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts index bcc5ab17..00015d9f 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts @@ -17,12 +17,12 @@ export class FurnitureCustomStackHeightLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if (this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE, 1); + if(this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE, 1); } public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.STACK_HEIGHT, this.object)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts index e06b2487..c61697ef 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts @@ -26,16 +26,16 @@ export class FurnitureDiceLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch (event.type) + switch(event.type) { case MouseEventType.DOUBLE_CLICK: - if (this._noTags) + if(this._noTags) { - if (((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + if(((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); @@ -50,18 +50,18 @@ export class FurnitureDiceLogic extends FurnitureLogic } else { - if (((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + if(((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); } - else if (event.spriteTag === 'deactivate') + else if(event.spriteTag === 'deactivate') { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_OFF, this.object); } } - if (objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent); + if(objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent); return; } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts index 260023b7..afdf0a86 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts @@ -14,7 +14,7 @@ export class FurnitureEcotronBoxLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ECOTRONBOX, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts index 4f89826e..4432f1d4 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts @@ -28,11 +28,11 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.action) + if(asset.logic.action) { - if (asset.logic.action.startState === 1) this._showStateOnceRendered = true; + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; } } } @@ -41,11 +41,11 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic { super.update(time); - if (!this._showStateOnceRendered) return; + if(!this._showStateOnceRendered) return; this._updateCount++; - if (this._showStateOnceRendered && (this._updateCount > 20)) + if(this._showStateOnceRendered && (this._updateCount > 20)) { this.setAutomaticStateIndex(1); @@ -55,9 +55,9 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic private setAutomaticStateIndex(state: number): void { - if (!this.object) return; + if(!this.object) return; - if (this.object.model) + if(this.object.model) { this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); } @@ -65,9 +65,9 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry) return; + if(!event || !geometry) return; - if (event.type === MouseEventType.DOUBLE_CLICK) + if(event.type === MouseEventType.DOUBLE_CLICK) { this.setAutomaticStateIndex(0); } @@ -77,7 +77,7 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts index e6dba70d..7b6f7950 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts @@ -17,11 +17,11 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.action) + if(asset.logic.action) { - if (asset.logic.action.link && (asset.logic.action.link !== '') && (asset.logic.action.link.length > 0)) + if(asset.logic.action.link && (asset.logic.action.link !== '') && (asset.logic.action.link.length > 0)) { (this.object && this.object.model && this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link)); } @@ -31,7 +31,7 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic protected onDispose(): void { - if (this._timer) + if(this._timer) { clearTimeout(this._timer); @@ -43,9 +43,9 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic private setAutomaticStateIndex(state: number): void { - if (!this.object) return; + if(!this.object) return; - if (this.object.model) + if(this.object.model) { this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); } @@ -55,7 +55,7 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic { this.setAutomaticStateIndex(1); - if (this._timer) + if(this._timer) { clearTimeout(this._timer); @@ -69,7 +69,7 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic this._timer = null; }, 2500); - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ROOM_LINK, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts index 6ef8fd14..699d0a49 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts @@ -15,7 +15,7 @@ export class FurnitureEffectBoxLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts index 6ae4e5d5..429c5023 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts @@ -17,15 +17,15 @@ export class FurnitureExternalImageLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if (!asset) return; + if(!asset) return; - if (this.object && this.object.model) + if(this.object && this.object.model) { let maskType = ''; - if (asset.logic) + if(asset.logic) { - if (asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; } this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 0); @@ -35,7 +35,7 @@ export class FurnitureExternalImageLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE, this.object)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts index b3e7ce4c..9a78ad22 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts @@ -17,9 +17,9 @@ export class FurnitureFireworksLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.particleSystems && asset.logic.particleSystems.length) + if(asset.logic.particleSystems && asset.logic.particleSystems.length) { this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); } @@ -28,14 +28,14 @@ export class FurnitureFireworksLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch (event.type) + switch(event.type) { case MouseEventType.DOUBLE_CLICK: - switch (event.spriteTag) + switch(event.spriteTag) { case 'start_stop': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); @@ -45,7 +45,7 @@ export class FurnitureFireworksLogic extends FurnitureLogic break; } - if (this.eventDispatcher && objectEvent) + if(this.eventDispatcher && objectEvent) { this.eventDispatcher.dispatchEvent(objectEvent); @@ -59,7 +59,7 @@ export class FurnitureFireworksLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 0)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts index 4a356753..1caa3305 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts @@ -28,7 +28,7 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic protected onDispose(): void { - if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); } @@ -47,26 +47,26 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (!this.object) return; + if(!this.object) return; - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { this.handleStateUpdate(this.object.getState(0)); } const location = this.object.getLocation(); - if (!this._currentLocation) + if(!this._currentLocation) { this._currentLocation = new Vector3d(); } else { - if ((location.x !== this._currentLocation.x) || (location.y !== this._currentLocation.y)) + if((location.x !== this._currentLocation.x) || (location.y !== this._currentLocation.y)) { - if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); } } } @@ -76,16 +76,16 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic private handleStateUpdate(state: number): void { - if (state === this._currentState) return; + if(state === this._currentState) return; - if (this.eventDispatcher) + if(this.eventDispatcher) { - if (state === FurnitureFloorHoleLogic.STATE_HOLE) + if(state === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); } - else if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + else if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); } @@ -96,14 +96,14 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic private handleAutomaticStateUpdate(): void { - if (!this.object) return; + if(!this.object) return; const model = this.object.model; - if (!model) return; + if(!model) return; const stateIndex = model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); - if (!isNaN(stateIndex)) this.handleStateUpdate((stateIndex % 2)); + if(!isNaN(stateIndex)) this.handleStateUpdate((stateIndex % 2)); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts index 2ad1bcaf..d1f5d578 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts @@ -17,16 +17,16 @@ export class FurnitureFriendFurniLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if (this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_FRIENDFURNI_ENGRAVING, this.engravingDialogType); + if(this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_FRIENDFURNI_ENGRAVING, this.engravingDialogType); } public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const data = (message.data as StringDataType); - if (data) + if(data) { this._state = data.state; } @@ -48,9 +48,9 @@ export class FurnitureFriendFurniLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; - if (this._state === FurnitureFriendFurniLogic.STATE_LOCKED) + if(this._state === FurnitureFriendFurniLogic.STATE_LOCKED) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts index d98af8ab..b5366630 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts @@ -22,7 +22,7 @@ export class FurnitureGroupForumTerminalLogic extends FurnitureGuildCustomizedLo public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts index 7c37463c..6b6d145b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts @@ -28,11 +28,11 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const data = message.data; - if (data instanceof StringDataType) + if(data instanceof StringDataType) { this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY)); this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY)); @@ -40,9 +40,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic } } - else if (message instanceof ObjectGroupBadgeUpdateMessage) + else if(message instanceof ObjectGroupBadgeUpdateMessage) { - if (message.assetName !== 'loading_icon') + if(message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName); @@ -50,9 +50,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic } } - else if (message instanceof ObjectSelectedMessage) + else if(message instanceof ObjectSelectedMessage) { - if (!message.selected) + if(!message.selected) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); } @@ -77,9 +77,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; - switch (event.type) + switch(event.type) { case MouseEventType.MOUSE_CLICK: this.openContextMenu(); diff --git a/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts index 6cfd9d9b..de8d69a7 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts @@ -12,7 +12,7 @@ export class FurnitureHabboWheelLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.USE_HABBOWHEEL, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts index c3176ce1..6f03eae7 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts @@ -17,7 +17,7 @@ export class FurnitureHighScoreLogic extends FurnitureLogic public tearDown(): void { - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY, this.object)); } @@ -29,11 +29,11 @@ export class FurnitureHighScoreLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { - if (message.state === FurnitureHighScoreLogic.SHOW_WIDGET_IN_STATE) + if(message.state === FurnitureHighScoreLogic.SHOW_WIDGET_IN_STATE) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts index e48d8b59..e656c710 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts @@ -15,14 +15,14 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch (event.type) + switch(event.type) { case MouseEventType.DOUBLE_CLICK: - switch (event.spriteTag) + switch(event.spriteTag) { case 'off': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3); @@ -30,7 +30,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic } break; case MouseEventType.MOUSE_CLICK: - switch (event.spriteTag) + switch(event.spriteTag) { case 'inc': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2); @@ -42,7 +42,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic break; } - if (this.eventDispatcher && objectEvent) + if(this.eventDispatcher && objectEvent) { this.eventDispatcher.dispatchEvent(objectEvent); @@ -54,7 +54,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts index 9be06fb6..fb876df7 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts @@ -19,7 +19,7 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic public update(totalTimeRunning: number): void { - if ((this._nextStateTimestamp > 0) && (totalTimeRunning >= this._nextStateTimestamp)) + if((this._nextStateTimestamp > 0) && (totalTimeRunning >= this._nextStateTimestamp)) { this._nextStateTimestamp = 0; @@ -35,7 +35,7 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { this.processUpdate(message); @@ -47,12 +47,12 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic private processUpdate(message: ObjectDataUpdateMessage): void { - if (!message) return; + if(!message) return; const state = ~~(message.state / 1000); const time = ~~(message.state % 1000); - if (!time) + if(!time) { this._nextStateTimestamp = 0; diff --git a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts index e8f03b02..144164f7 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts @@ -22,13 +22,13 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.action) + if(asset.logic.action) { this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link); - if (asset.logic.action.startState === 1) this._showStateOnceRendered = true; + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; } } } @@ -37,11 +37,11 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic { super.update(time); - if (!this._showStateOnceRendered) return; + if(!this._showStateOnceRendered) return; this._updateCount++; - if (this._showStateOnceRendered && (this._updateCount === 20)) + if(this._showStateOnceRendered && (this._updateCount === 20)) { this.setAutomaticStateIndex(1); @@ -51,9 +51,9 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic private setAutomaticStateIndex(state: number): void { - if (!this.object) return; + if(!this.object) return; - if (this.object.model) + if(this.object.model) { this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); } @@ -61,9 +61,9 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry) return; + if(!event || !geometry) return; - if ((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered) + if((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered) { this.setAutomaticStateIndex(0); } @@ -73,7 +73,7 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts index c1239596..8b8e68d4 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts @@ -35,29 +35,29 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if (!this._isInitialized) this.requestInit(); + if(!this._isInitialized) this.requestInit(); this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const state = this.object.getState(0); - if (state !== this._currentState) + if(state !== this._currentState) { this._currentState = state; - if (state === 1) this.requestPlayList(); - else if (state === 0) this.requestStopPlaying(); + if(state === 1) this.requestPlayList(); + else if(state === 0) this.requestStopPlaying(); } } } private requestInit(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -68,7 +68,7 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic private requestPlayList(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -77,21 +77,21 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic private requestStopPlaying(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP, this.object)); } private requestDispose(): void { - if (!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE, this.object)); } public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, -1)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts index 647bcd21..11f20def 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts @@ -47,12 +47,12 @@ export class FurnitureLogic extends MovingObjectLogic this._storedRotateMessage = null; this._directionInitialized = false; - if (FurnitureLogic.BOUNCING_STEPS === -1) + if(FurnitureLogic.BOUNCING_STEPS === -1) { FurnitureLogic.BOUNCING_STEPS = Nitro.instance.getConfiguration('furni.rotation.bounce.steps', 8); } - if (FurnitureLogic.BOUNCING_Z === -1) + if(FurnitureLogic.BOUNCING_Z === -1) { FurnitureLogic.BOUNCING_Z = Nitro.instance.getConfiguration('furni.rotation.bounce.height', 0.0625); } @@ -70,28 +70,28 @@ export class FurnitureLogic extends MovingObjectLogic RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK]; - if (this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET); + if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET); - if (this.contextMenu) types.push(RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU, RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU); + if(this.contextMenu) types.push(RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU, RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU); return this.mergeTypes(super.getEventTypes(), types); } public initialize(asset: IAssetData): void { - if (!asset) return; + if(!asset) return; const model = this.object && this.object.model; - if (!model) return; + if(!model) return; - if (asset.logic) + if(asset.logic) { - if (asset.logic.model) + if(asset.logic.model) { const dimensions = asset.logic.model.dimensions; - if (dimensions) + if(dimensions) { this._sizeX = dimensions.x; this._sizeY = dimensions.y; @@ -104,19 +104,19 @@ export class FurnitureLogic extends MovingObjectLogic const directions = asset.logic.model.directions; - if (directions && directions.length) + if(directions && directions.length) { - for (const direction of directions) this._directions.push(direction); + for(const direction of directions) this._directions.push(direction); this._directions.sort((a, b) => (a - b)); } } - if (asset.logic.customVars) + if(asset.logic.customVars) { const variables = asset.logic.customVars.variables; - if (variables && variables.length) + if(variables && variables.length) { model.setValue(RoomObjectVariable.FURNITURE_CUSTOM_VARIABLES, variables); } @@ -145,7 +145,7 @@ export class FurnitureLogic extends MovingObjectLogic { super.setObject(object); - if (object && object.getLocation().length) this._directionInitialized = true; + if(object && object.getLocation().length) this._directionInitialized = true; } protected getAdClickUrl(model: IRoomObjectModel): string @@ -155,7 +155,7 @@ export class FurnitureLogic extends MovingObjectLogic protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void { - if (!this.eventDispatcher) return; + if(!this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object)); } @@ -164,31 +164,31 @@ export class FurnitureLogic extends MovingObjectLogic { super.update(time); - if (this._bouncingStep > 0) + if(this._bouncingStep > 0) { this._bouncingStep++; - if (this._bouncingStep > FurnitureLogic.BOUNCING_STEPS) this._bouncingStep = 0; + if(this._bouncingStep > FurnitureLogic.BOUNCING_STEPS) this._bouncingStep = 0; } } public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { this.processDataUpdateMessage(message); return; } - if (message instanceof ObjectHeightUpdateMessage) + if(message instanceof ObjectHeightUpdateMessage) { this.processObjectHeightUpdateMessage(message); return; } - if (message instanceof ObjectItemDataUpdateMessage) + if(message instanceof ObjectItemDataUpdateMessage) { this.processItemDataUpdateMessage(message); @@ -197,16 +197,16 @@ export class FurnitureLogic extends MovingObjectLogic this._mouseOver = false; - if (message.location && message.direction) + if(message.location && message.direction) { - if (!(message instanceof ObjectMoveUpdateMessage)) + if(!(message instanceof ObjectMoveUpdateMessage)) { const direction = this.object.getDirection(); const location = this.object.getLocation(); - if ((direction.x !== message.direction.x) && this._directionInitialized) + if((direction.x !== message.direction.x) && this._directionInitialized) { - if ((location.x === message.location.x) && (location.y === message.location.y) && (location.z === message.location.z)) + if((location.x === message.location.x) && (location.y === message.location.y) && (location.z === message.location.z)) { this._bouncingStep = 1; this._storedRotateMessage = new RoomObjectUpdateMessage(message.location, message.direction); @@ -219,9 +219,9 @@ export class FurnitureLogic extends MovingObjectLogic this._directionInitialized = true; } - if (message instanceof ObjectSelectedMessage) + if(message instanceof ObjectSelectedMessage) { - if (this.contextMenu && this.eventDispatcher && this.object) + if(this.contextMenu && this.eventDispatcher && this.object) { const eventType = (message.selected) ? RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU : RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU; @@ -234,27 +234,27 @@ export class FurnitureLogic extends MovingObjectLogic private processDataUpdateMessage(message: ObjectDataUpdateMessage): void { - if (!message) return; + if(!message) return; this.object.setState(message.state, 0); - if (message.data) message.data.writeRoomObjectModel(this.object.model); + if(message.data) message.data.writeRoomObjectModel(this.object.model); - if (message.extra !== null) this.object.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, message.extra.toString()); + if(message.extra !== null) this.object.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, message.extra.toString()); this.object.model.setValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME, this.lastUpdateTime); } private processObjectHeightUpdateMessage(message: ObjectHeightUpdateMessage): void { - if (!message) return; + if(!message) return; this.object.model.setValue(RoomObjectVariable.FURNITURE_SIZE_Z, message.height); } private processItemDataUpdateMessage(message: ObjectItemDataUpdateMessage): void { - if (!message) return; + if(!message) return; this.object.model.setValue(RoomObjectVariable.FURNITURE_ITEMDATA, message.data); } @@ -263,10 +263,10 @@ export class FurnitureLogic extends MovingObjectLogic { const adUrl = this.getAdClickUrl(this.object.model); - switch (event.type) + switch(event.type) { case MouseEventType.MOUSE_MOVE: - if (this.eventDispatcher) + if(this.eventDispatcher) { const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_MOVE, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); @@ -279,11 +279,11 @@ export class FurnitureLogic extends MovingObjectLogic } return; case MouseEventType.ROLL_OVER: - if (!this._mouseOver) + if(!this._mouseOver) { - if (this.eventDispatcher) + if(this.eventDispatcher) { - if (adUrl && (adUrl.indexOf('http') === 0)) + if(adUrl && (adUrl.indexOf('http') === 0)) { this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW, this.object)); } @@ -302,11 +302,11 @@ export class FurnitureLogic extends MovingObjectLogic } return; case MouseEventType.ROLL_OUT: - if (this._mouseOver) + if(this._mouseOver) { - if (this.eventDispatcher) + if(this.eventDispatcher) { - if (adUrl && (adUrl.indexOf('http') === 0)) + if(adUrl && (adUrl.indexOf('http') === 0)) { this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object)); } @@ -328,7 +328,7 @@ export class FurnitureLogic extends MovingObjectLogic this.useObject(); return; case MouseEventType.MOUSE_CLICK: - if (this.eventDispatcher) + if(this.eventDispatcher) { const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.CLICK, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); @@ -339,16 +339,16 @@ export class FurnitureLogic extends MovingObjectLogic this.eventDispatcher.dispatchEvent(mouseEvent); - if (adUrl && (adUrl.indexOf('http') === 0)) + if(adUrl && (adUrl.indexOf('http') === 0)) { this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object)); } - if (adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl); + if(adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl); } return; case MouseEventType.MOUSE_DOWN: - if (this.eventDispatcher) + if(this.eventDispatcher) { const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); @@ -356,7 +356,7 @@ export class FurnitureLogic extends MovingObjectLogic } return; case MouseEventType.MOUSE_DOWN_LONG: - if (this.eventDispatcher) + if(this.eventDispatcher) { const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN_LONG, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); @@ -368,20 +368,20 @@ export class FurnitureLogic extends MovingObjectLogic protected getLocationOffset(): IVector3D { - if (this._bouncingStep <= 0) return null; + if(this._bouncingStep <= 0) return null; this._locationOffset.x = 0; this._locationOffset.y = 0; - if (this._bouncingStep <= (FurnitureLogic.BOUNCING_STEPS / 2)) + if(this._bouncingStep <= (FurnitureLogic.BOUNCING_STEPS / 2)) { this._locationOffset.z = FurnitureLogic.BOUNCING_Z * this._bouncingStep; } else { - if (this._bouncingStep <= FurnitureLogic.BOUNCING_STEPS) + if(this._bouncingStep <= FurnitureLogic.BOUNCING_STEPS) { - if (this._storedRotateMessage) + if(this._storedRotateMessage) { super.processUpdateMessage(this._storedRotateMessage); @@ -397,27 +397,27 @@ export class FurnitureLogic extends MovingObjectLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; const clickUrl = this.getAdClickUrl(this.object.model); - if (clickUrl && clickUrl.length) + if(clickUrl && clickUrl.length) { this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, this.object, null, clickUrl)); } - if (this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object)); + if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); } public tearDown(): void { - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { - if (this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object)); + if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object)); - if (this.contextMenu) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); + if(this.contextMenu) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); } super.tearDown(); diff --git a/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts index a82c8b9f..14b9996d 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts @@ -21,7 +21,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { message.data.writeRoomObjectModel(this.object.model); @@ -31,7 +31,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic private processObjectData(): void { - if (!this.object || !this.object.model) return; + if(!this.object || !this.object.model) return; const data = new MapDataType(); @@ -44,7 +44,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MANNEQUIN, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts index fc1ae20b..faadd8bb 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts @@ -13,7 +13,7 @@ export class FurnitureMonsterplantSeedLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts index f1629c6a..078fc6d3 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts @@ -7,6 +7,6 @@ export class FurnitureMultiHeightLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if (this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT, 1); + if(this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT, 1); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts index 8af26064..4cf4a341 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts @@ -15,9 +15,9 @@ export class FurnitureMultiStateLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; - switch (event.type) + switch(event.type) { case MouseEventType.ROLL_OVER: this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts index 9b9a8f39..9a6ee439 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts @@ -13,7 +13,7 @@ export class FurnitureMysteryBoxLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts index 7e81c06d..f23ecd0c 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts @@ -13,7 +13,7 @@ export class FurnitureMysteryTrophyLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts index 37aa8bbe..55fe52ff 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts @@ -12,7 +12,7 @@ export class FurnitureOneWayDoorLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts index 3663142d..751e9d55 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts @@ -17,9 +17,9 @@ export class FurniturePetCustomizationLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (!this.object) return; + if(!this.object) return; - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.USABLE_PRODUCT); } @@ -27,7 +27,7 @@ export class FurniturePetCustomizationLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts index 2370b189..e8054254 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts @@ -14,7 +14,7 @@ export class FurniturePlaceholderLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PLACEHOLDER, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts index 9b804bd0..54802a7d 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts @@ -7,9 +7,9 @@ export class FurniturePlanetSystemLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.planetSystems) + if(asset.logic.planetSystems) { this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA, asset.logic.planetSystems); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts index b15b834f..7e527249 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts @@ -26,9 +26,9 @@ export class FurniturePresentLogic extends FurnitureLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.particleSystems && asset.logic.particleSystems.length) + if(asset.logic.particleSystems && asset.logic.particleSystems.length) { this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); } @@ -39,16 +39,16 @@ export class FurniturePresentLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { message.data.writeRoomObjectModel(this.object.model); this.updateStuffData(); } - if (message instanceof ObjectModelDataUpdateMessage) + if(message instanceof ObjectModelDataUpdateMessage) { - if (message.numberKey === RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION) + if(message.numberKey === RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION) { this.object.model.setValue(RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION, message.numberValue); } @@ -57,7 +57,7 @@ export class FurniturePresentLogic extends FurnitureLogic private updateStuffData(): void { - if (!this.object || !this.object.model) return; + if(!this.object || !this.object.model) return; const stuffData = new MapDataType(); @@ -66,7 +66,7 @@ export class FurniturePresentLogic extends FurnitureLogic const message = stuffData.getValue(FurniturePresentLogic.MESSAGE); const data = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); - if (!message && (typeof data === 'string')) + if(!message && (typeof data === 'string')) { this.object.model.setValue(RoomObjectVariable.FURNITURE_DATA, data.substr(1)); } @@ -82,16 +82,16 @@ export class FurniturePresentLogic extends FurnitureLogic private writeToModel(key: string, value: string): void { - if (!value) return; + if(!value) return; this.object.model.setValue(key, value); } public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; - switch (event.type) + switch(event.type) { case MouseEventType.ROLL_OVER: this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); @@ -106,7 +106,7 @@ export class FurniturePresentLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PRESENT, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts index 0715bb1d..dde59861 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts @@ -16,7 +16,7 @@ export class FurniturePurchaseableClothingLogic extends FurnitureMultiStateLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts index 5ecf3cee..be6c7334 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts @@ -22,22 +22,22 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (!message) return; + if(!message) return; const isMoveMessage = (message instanceof ObjectMoveUpdateMessage); - if (this.object && !isMoveMessage && message.location) + if(this.object && !isMoveMessage && message.location) { const location = this.object.getLocation(); const difference = Vector3d.dif(message.location, location); - if (difference) + if(difference) { - if ((Math.abs(difference.x) < 2) && (Math.abs(difference.y) < 2)) + if((Math.abs(difference.x) < 2) && (Math.abs(difference.y) < 2)) { let prevLocation = location; - if ((Math.abs(difference.x) > 1) || (Math.abs(difference.y) > 1)) + if((Math.abs(difference.x) > 1) || (Math.abs(difference.y) > 1)) { prevLocation = Vector3d.sum(location, Vector3d.product(difference, 0.5)); } @@ -49,11 +49,11 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic } } - if (message.location && !isMoveMessage) super.processUpdateMessage(new ObjectMoveUpdateMessage(message.location, message.location, message.direction)); + if(message.location && !isMoveMessage) super.processUpdateMessage(new ObjectMoveUpdateMessage(message.location, message.location, message.direction)); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { - if (message.state > 0) + if(message.state > 0) { this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL / this.getUpdateIntervalValue(message.state); } @@ -67,7 +67,7 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic return; } - if (isMoveMessage && message.isSlide) this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; + if(isMoveMessage && message.isSlide) this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; super.processUpdateMessage(message); } @@ -86,7 +86,7 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic { const animation = this.getAnimationValue(message.state); - if (animation !== message.state) + if(animation !== message.state) { const legacyStuff = new LegacyDataType(); @@ -100,14 +100,14 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic public update(time: number): void { - if (!this.object) return; + if(!this.object) return; this._oldLocation.assign(this.object.getLocation()); super.update(time); - if (Vector3d.dif(this.object.getLocation(), this._oldLocation).length !== 0) return; + if(Vector3d.dif(this.object.getLocation(), this._oldLocation).length !== 0) return; - if (this.object.getState(0) !== FurniturePushableLogic.ANIMATION_NOT_MOVING) this.object.setState(FurniturePushableLogic.ANIMATION_NOT_MOVING, 0); + if(this.object.getState(0) !== FurniturePushableLogic.ANIMATION_NOT_MOVING) this.object.setState(FurniturePushableLogic.ANIMATION_NOT_MOVING, 0); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts index 6d710e0e..2d0f868e 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts @@ -19,9 +19,9 @@ export class FurnitureRentableSpaceLogic extends FurnitureLogic { super.update(time); - if (this.object && this.object.model) + if(this.object && this.object.model) { - if (!this.object.model.getValue(RoomObjectVariable.SESSION_CURRENT_USER_ID)) + if(!this.object.model.getValue(RoomObjectVariable.SESSION_CURRENT_USER_ID)) { this.eventDispatcher.dispatchEvent(new RoomObjectDataRequestEvent(RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID, this.object)); } @@ -29,9 +29,9 @@ export class FurnitureRentableSpaceLogic extends FurnitureLogic const renterId = this.object.model.getValue>(RoomObjectVariable.FURNITURE_DATA).getValue('renterId'); const userId = this.object.model.getValue(RoomObjectVariable.SESSION_CURRENT_USER_ID); - if (renterId) + if(renterId) { - if (parseInt(renterId) === userId) this.object.setState(2, 0); + if(parseInt(renterId) === userId) this.object.setState(2, 0); else this.object.setState(1, 0); } else diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts index 10f144a4..d96614ab 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts @@ -29,13 +29,13 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic protected onDispose(): void { - if (this._roomColorUpdated) + if(this._roomColorUpdated) { - if (this.eventDispatcher && this.object) + if(this.eventDispatcher && this.object) { const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if (realRoomObject === 1) + if(realRoomObject === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, false, 0, 0, 0)); } @@ -51,19 +51,19 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { message.data.writeRoomObjectModel(this.object.model); const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if (realRoomObject === 1) this.processColorUpdate(); + if(realRoomObject === 1) this.processColorUpdate(); } } private processColorUpdate(): void { - if (!this.object || !this.object.model) return; + if(!this.object || !this.object.model) return; const numberData = new NumberDataType(); @@ -74,7 +74,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic const saturation = numberData.getValue(2); const lightness = numberData.getValue(3); - if ((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1)) + if((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1)) { this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE, hue); this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION, saturation); @@ -82,7 +82,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic this.object.setState(state, 0); - if (this.eventDispatcher) + if(this.eventDispatcher) { this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, (state === 1), hue, saturation, lightness)); } @@ -93,9 +93,9 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object) return; + if(!event || !geometry || !this.object) return; - switch (event.type) + switch(event.type) { case MouseEventType.DOUBLE_CLICK: (this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object))); diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts index 24cc0f6f..5753a769 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts @@ -19,13 +19,13 @@ export class FurnitureRoomBillboardLogic extends FurnitureRoomBrandingLogic protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void { - if (clickUrl.indexOf('http') === 0) + if(clickUrl.indexOf('http') === 0) { HabboWebTools.openWebPage(clickUrl); return; } - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl)); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts index c8438b0e..d8059b08 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts @@ -39,7 +39,7 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic { super.initialize(asset); - if (this._disableFurnitureSelection) + if(this._disableFurnitureSelection) { this.object.model.setValue(RoomObjectVariable.FURNITURE_SELECTION_DISABLED, 1); } @@ -49,14 +49,14 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) this.processAdDataUpdateMessage(message); + if(message instanceof ObjectDataUpdateMessage) this.processAdDataUpdateMessage(message); - if (message instanceof ObjectAdUpdateMessage) this.processAdUpdate(message); + if(message instanceof ObjectAdUpdateMessage) this.processAdUpdate(message); } private processAdDataUpdateMessage(message: ObjectDataUpdateMessage): void { - if (!message) return; + if(!message) return; const objectData = new MapDataType(); @@ -64,12 +64,12 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic const state = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.STATE)); - if (!isNaN(state) && (this.object.getState(0) !== state)) this.object.setState(state, 0); + if(!isNaN(state) && (this.object.getState(0) !== state)) this.object.setState(state, 0); const imageUrl = objectData.getValue(FurnitureRoomBrandingLogic.IMAGEURL_KEY); const existingUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); - if (!existingUrl || (existingUrl !== imageUrl)) + if(!existingUrl || (existingUrl !== imageUrl)) { this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL, imageUrl); this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 0); @@ -79,13 +79,13 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic const clickUrl = objectData.getValue(FurnitureRoomBrandingLogic.CLICKURL_KEY); - if (clickUrl) + if(clickUrl) { const existingUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_URL); - if (!existingUrl || existingUrl !== clickUrl) + if(!existingUrl || existingUrl !== clickUrl) { - if (this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_URL, clickUrl); + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_URL, clickUrl); } } @@ -93,13 +93,13 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic const offsetY = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETY_KEY)); const offsetZ = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETZ_KEY)); - if (!isNaN(offsetX)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X, offsetX); - if (!isNaN(offsetY)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y, offsetY); - if (!isNaN(offsetZ)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z, offsetZ); + if(!isNaN(offsetX)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X, offsetX); + if(!isNaN(offsetY)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y, offsetY); + if(!isNaN(offsetZ)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z, offsetZ); let options = (((FurnitureRoomBrandingLogic.IMAGEURL_KEY + '=') + ((imageUrl !== null) ? imageUrl : '')) + '\t'); - if (this._hasClickUrl) + if(this._hasClickUrl) { options = (options + (((FurnitureRoomBrandingLogic.CLICKURL_KEY + '=') + ((clickUrl !== null) ? clickUrl : '')) + '\t')); } @@ -113,9 +113,9 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic private processAdUpdate(message: ObjectAdUpdateMessage): void { - if (!message || !this.object) return; + if(!message || !this.object) return; - switch (message.type) + switch(message.type) { case ObjectAdUpdateMessage.IMAGE_LOADED: this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 1); @@ -128,9 +128,9 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry) return; + if(!event || !geometry) return; - if ((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return; + if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return; super.mouseEvent(event, geometry); } @@ -139,14 +139,14 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic { const model = this.object && this.object.model; - if (!model) return; + if(!model) return; const imageUrl = model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); const imageStatus = model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS); - if (!imageUrl || (imageUrl === '') || (imageStatus === 1)) return; + if(!imageUrl || (imageUrl === '') || (imageStatus === 1)) return; - if (imageUrl.endsWith('.gif')) + if(imageUrl.endsWith('.gif')) { this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IS_ANIMATED, true); @@ -164,23 +164,23 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic let frame = new Uint8Array(wh * 4); - for (let ind = 0; ind < frames.length; ind++) + for(let ind = 0; ind < frames.length; ind++) { - if (ind > 0) frame = frame.slice(0); + if(ind > 0) frame = frame.slice(0); const pixels = frames[ind].pixels; const colorTable = frames[ind].colorTable; const trans = frames[ind].transparentIndex; const dims = frames[ind].dims; - for (let j = 0; j < dims.height; j++) + for(let j = 0; j < dims.height; j++) { - for (let i = 0; i < dims.width; i++) + for(let i = 0; i < dims.width; i++) { const pixel = pixels[j * dims.width + i]; const coord = (j + dims.top) * width + (i + dims.left); - if (trans !== pixel) + if(trans !== pixel) { const c = colorTable[pixel]; @@ -211,15 +211,15 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic { const asset = Nitro.instance.core && Nitro.instance.core.asset; - if (!asset) return; + if(!asset) return; const texture = asset.getTexture(imageUrl); - if (!texture) + if(!texture) { asset.downloadAsset(imageUrl, (flag: boolean) => { - if (flag) + if(flag) { this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADED)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts index 80ad0517..9c915985 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts @@ -28,13 +28,13 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic protected onDispose(): void { - if (this._roomColorUpdated) + if(this._roomColorUpdated) { - if (this.eventDispatcher && this.object) + if(this.eventDispatcher && this.object) { const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if (realRoomObject === 1) + if(realRoomObject === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, 0, 1, 1, 0xFFFFFF, 0xFF)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER, this.object)); @@ -49,15 +49,15 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { - if (message.data) + if(message.data) { const extra = message.data.getLegacyString(); const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if (realRoomObject === 1) this.processDimmerData(extra); + if(realRoomObject === 1) this.processDimmerData(extra); super.processUpdateMessage(new ObjectDataUpdateMessage(this.getStateFromDimmerData(extra), message.data)); } @@ -70,22 +70,22 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic private getStateFromDimmerData(data: string): number { - if (!data) return 0; + if(!data) return 0; const parts = data.split(','); - if (parts.length >= 5) return (parseInt(parts[0]) - 1); + if(parts.length >= 5) return (parseInt(parts[0]) - 1); return 0; } private processDimmerData(data: string): void { - if (!data) return; + if(!data) return; const parts = data.split(','); - if (parts.length >= 5) + if(parts.length >= 5) { const state = this.getStateFromDimmerData(data); const presetId = parseInt(parts[1]); @@ -95,13 +95,13 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic let colorCode = parseInt(color.substr(1), 16); let brightness = parseInt(parts[4]); - if (!state) + if(!state) { colorCode = 0xFFFFFF; brightness = 0xFF; } - if (this.eventDispatcher && this.object) + if(this.eventDispatcher && this.object) { this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, state, presetId, effectId, colorCode, brightness)); @@ -112,7 +112,7 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.DIMMER, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts index 6f6a9c44..74928f4b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts @@ -23,7 +23,7 @@ export class FurnitureScoreLogic extends FurnitureLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); + if(message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); super.processUpdateMessage(message); } @@ -34,13 +34,13 @@ export class FurnitureScoreLogic extends FurnitureLogic const currentScore = this.object.getState(0); - if (this._score !== currentScore) + if(this._score !== currentScore) { let difference = (this._score - currentScore); - if (difference < 0) difference = -(difference); + if(difference < 0) difference = -(difference); - if ((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); + if((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); else this._scoreIncreaser = FurnitureScoreLogic.UPDATE_INTERVAL; this._scoreTimer = Nitro.instance.time; @@ -53,15 +53,15 @@ export class FurnitureScoreLogic extends FurnitureLogic const currentScore = this.object.getState(0); - if ((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) + if((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) { const _local_3 = (time - this._scoreTimer); let _local_4 = (_local_3 / this._scoreIncreaser); let _local_5 = 1; - if (this._score < currentScore) _local_5 = -1; + if(this._score < currentScore) _local_5 = -1; - if (_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); + if(_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); this.object.setState((currentScore + (_local_5 * _local_4)), 0); diff --git a/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts index 8e99fcd9..345be2f0 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts @@ -9,7 +9,7 @@ export class FurnitureSongDiskLogic extends FurnitureLogic { super.processUpdateMessage(message); - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); const diskId = parseInt(extras); diff --git a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts index 25cb1a35..4bf7f54b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts @@ -31,9 +31,9 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if (asset.logic) + if(asset.logic) { - if (asset.logic.soundSample) + if(asset.logic.soundSample) { this._sampleId = asset.logic.soundSample.id; this._noPitch = asset.logic.soundSample.noPitch; @@ -45,7 +45,7 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic protected onDispose(): void { - if (this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED) + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED) { this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, this.object, this._sampleId)); } @@ -57,27 +57,27 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) this.updateSoundBlockMessage(message); + if(message instanceof ObjectDataUpdateMessage) this.updateSoundBlockMessage(message); } private updateSoundBlockMessage(message: ObjectDataUpdateMessage): void { - if (!message) return; + if(!message) return; const model = this.object && this.object.model; const location = this.object && this.object.location; - if (!model || !location) return; + if(!model || !location) return; - if (this._state === FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this._state === FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this._lastLocZ = location.z; this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, this.object, this._sampleId, this.getPitchForHeight(location.z))); } - if (this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { - if (this._lastLocZ !== location.z) + if(this._lastLocZ !== location.z) { this._lastLocZ = location.z; this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.CHANGE_PITCH, this.object, this._sampleId, this.getPitchForHeight(location.z))); @@ -85,7 +85,7 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic } - if (this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && message.state !== this._state) + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && message.state !== this._state) { this.playSoundAt(location.z); } @@ -95,7 +95,7 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic private playSoundAt(height: number): void { - if (!this.object) return; + if(!this.object) return; const pitch: number = this.getPitchForHeight(height); @@ -106,11 +106,11 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic private getPitchForHeight(height: number): number { - if (this._noPitch) return 1; + if(this._noPitch) return 1; let heightScaled: number = (height * 2); - if (heightScaled > FurnitureSoundBlockLogic.HIGHEST_SEMITONE) + if(heightScaled > FurnitureSoundBlockLogic.HIGHEST_SEMITONE) { heightScaled = Math.min(0, (FurnitureSoundBlockLogic.LOWEST_SEMITONE + ((heightScaled - FurnitureSoundBlockLogic.HIGHEST_SEMITONE) - 1))); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts index e35601e4..5fa62ebc 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts @@ -34,29 +34,29 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if (!this._isInitialized) this.requestInit(); + if(!this._isInitialized) this.requestInit(); this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const state = this.object.getState(0); - if (state !== this._currentState) + if(state !== this._currentState) { this._currentState = state; - if (state === 1) this.requestPlayList(); - else if (state === 0) this.requestStopPlaying(); + if(state === 1) this.requestPlayList(); + else if(state === 0) this.requestStopPlaying(); } } } private requestInit(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -67,7 +67,7 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic private requestPlayList(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -76,14 +76,14 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic private requestStopPlaying(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP, this.object)); } private requestDispose(): void { - if (!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts index 40591605..b1efb9dd 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts @@ -24,14 +24,14 @@ export class FurnitureStickieLogic extends FurnitureLogic this.updateColor(); - if (this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_STICKIE, ''); + if(this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_STICKIE, ''); } public processUpdateMessage(message: RoomObjectUpdateMessage): void { super.processUpdateMessage(message); - if (message instanceof ObjectItemDataUpdateMessage) + if(message instanceof ObjectItemDataUpdateMessage) { this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.STICKIE, this.object)); } @@ -41,20 +41,20 @@ export class FurnitureStickieLogic extends FurnitureLogic protected updateColor(): void { - if (!this.object) return; + if(!this.object) return; const furnitureData = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); let colorIndex = FurnitureStickieLogic.STICKIE_COLORS.indexOf(furnitureData); - if (colorIndex < 0) colorIndex = 3; + if(colorIndex < 0) colorIndex = 3; this.object.model.setValue(RoomObjectVariable.FURNITURE_COLOR, (colorIndex + 1)); } public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.STICKIE, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts index 0e2125b9..b373979d 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts @@ -12,7 +12,7 @@ export class FurnitureTrophyLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.TROPHY, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts index 92101c1f..92484c05 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts @@ -27,11 +27,11 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const stuffData = (message.data as VoteDataType); - if (!stuffData) return; + if(!stuffData) return; this.updateTotal(stuffData.result); } @@ -41,7 +41,7 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { this._total = k; - if (!this._lastUpdate) + if(!this._lastUpdate) { this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, k); @@ -50,11 +50,11 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic return; } - if (this._total !== this.currentTotal) + if(this._total !== this.currentTotal) { const difference = Math.abs((this._total - this.currentTotal)); - if ((difference * FurnitureVoteCounterLogic.UPDATE_INTERVAL) > FurnitureVoteCounterLogic.MAX_UPDATE_TIME) + if((difference * FurnitureVoteCounterLogic.UPDATE_INTERVAL) > FurnitureVoteCounterLogic.MAX_UPDATE_TIME) { this._interval = (FurnitureVoteCounterLogic.MAX_UPDATE_TIME / difference); } @@ -71,17 +71,17 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { super.update(time); - if (this.object) + if(this.object) { - if ((this.currentTotal !== this._total) && (time >= (this._lastUpdate + this._interval))) + if((this.currentTotal !== this._total) && (time >= (this._lastUpdate + this._interval))) { const _local_2 = (time - this._lastUpdate); let _local_3 = (_local_2 / this._interval); let _local_4 = 1; - if (this._total < this.currentTotal) _local_4 = -1; + if(this._total < this.currentTotal) _local_4 = -1; - if (_local_3 > (_local_4 * (this._total - this.currentTotal))) _local_3 = (_local_4 * (this._total - this.currentTotal)); + if(_local_3 > (_local_4 * (this._total - this.currentTotal))) _local_3 = (_local_4 * (this._total - this.currentTotal)); this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, (this.currentTotal + (_local_4 * _local_3))); diff --git a/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts index da4a5ce3..cd7bae5f 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts @@ -9,13 +9,13 @@ export class FurnitureVoteMajorityLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if (!this.object) return; + if(!this.object) return; - if (message instanceof ObjectDataUpdateMessage) + if(message instanceof ObjectDataUpdateMessage) { const data = message.data; - if (data instanceof VoteDataType) this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT, data.result); + if(data instanceof VoteDataType) this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT, data.result); } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts index 931d02a9..f014b6ad 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts @@ -8,11 +8,11 @@ export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic { public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry) return; + if(!event || !geometry) return; - if (event.type === MouseEventType.DOUBLE_CLICK) + if(event.type === MouseEventType.DOUBLE_CLICK) { - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); } super.mouseEvent(event, geometry); diff --git a/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts index a4e04f8f..c8e1be4c 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts @@ -9,9 +9,9 @@ export class FurnitureWindowLogic extends FurnitureMultiStateLogic let maskType = ''; - if (asset.logic) + if(asset.logic) { - if (asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; } this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 0); diff --git a/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts index 5d8efaa5..a2ab5701 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts @@ -18,7 +18,7 @@ export class FurnitureYoutubeLogic extends FurnitureLogic { super.update(time); - if (!this.object.model.getValue(RoomObjectVariable.SESSION_URL_PREFIX)) + if(!this.object.model.getValue(RoomObjectVariable.SESSION_URL_PREFIX)) { this.eventDispatcher.dispatchEvent(new RoomObjectDataRequestEvent(RoomObjectDataRequestEvent.RODRE_URL_PREFIX, this.object)); } @@ -26,7 +26,7 @@ export class FurnitureYoutubeLogic extends FurnitureLogic public useObject(): void { - if (!this.object || !this.eventDispatcher) return; + if(!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.YOUTUBE, this.object)); } diff --git a/src/nitro/room/object/logic/pet/PetLogic.ts b/src/nitro/room/object/logic/pet/PetLogic.ts index 7fb3623a..1204ceba 100644 --- a/src/nitro/room/object/logic/pet/PetLogic.ts +++ b/src/nitro/room/object/logic/pet/PetLogic.ts @@ -44,21 +44,21 @@ export class PetLogic extends MovingObjectLogic public initialize(asset: IAssetData): void { - if (!asset) return; + if(!asset) return; const model = this.object && this.object.model; - if (!model) return; + if(!model) return; - if (asset.logic) + if(asset.logic) { - if (asset.logic.model) + if(asset.logic.model) { const directions = asset.logic.model.directions; - if (directions && directions.length) + if(directions && directions.length) { - for (const direction of directions) this._directions.push(direction); + for(const direction of directions) this._directions.push(direction); this._directions.sort(); } @@ -70,9 +70,9 @@ export class PetLogic extends MovingObjectLogic public dispose(): void { - if (this._selected && this.object) + if(this._selected && this.object) { - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); } this._directions = null; @@ -83,15 +83,15 @@ export class PetLogic extends MovingObjectLogic { super.update(totalTimeRunning); - if (this._selected && this.object) + if(this._selected && this.object) { - if (this.eventDispatcher) + if(this.eventDispatcher) { const location = this.object.getLocation(); - if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) + if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) { - if (!this._reportedLocation) this._reportedLocation = new Vector3d(); + if(!this._reportedLocation) this._reportedLocation = new Vector3d(); this._reportedLocation.assign(location); @@ -100,21 +100,21 @@ export class PetLogic extends MovingObjectLogic } } - if (this.object && this.object.model) this.updateModel(totalTimeRunning, this.object.model); + if(this.object && this.object.model) this.updateModel(totalTimeRunning, this.object.model); } private updateModel(time: number, model: IRoomObjectModel): void { - if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) + if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, null); this._gestureEndTimestamp = 0; } - if (this._talkingEndTimestamp > 0) + if(this._talkingEndTimestamp > 0) { - if (time > this._talkingEndTimestamp) + if(time > this._talkingEndTimestamp) { model.setValue(RoomObjectVariable.FIGURE_TALK, 0); @@ -122,7 +122,7 @@ export class PetLogic extends MovingObjectLogic } } - if ((this._expressionEndTimestamp > 0) && (time > this._expressionEndTimestamp)) + if((this._expressionEndTimestamp > 0) && (time > this._expressionEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); @@ -132,22 +132,22 @@ export class PetLogic extends MovingObjectLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (!message || !this.object) return; + if(!message || !this.object) return; super.processUpdateMessage(message); const model = this.object && this.object.model; - if (!model) return; + if(!model) return; - if (message instanceof ObjectAvatarUpdateMessage) + if(message instanceof ObjectAvatarUpdateMessage) { model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); return; } - if (message instanceof ObjectAvatarFigureUpdateMessage) + if(message instanceof ObjectAvatarFigureUpdateMessage) { const petFigureData = new PetFigureData(message.figure); @@ -164,14 +164,14 @@ export class PetLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarPostureUpdateMessage) + if(message instanceof ObjectAvatarPostureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); return; } - if (message instanceof ObjectAvatarChatUpdateMessage) + if(message instanceof ObjectAvatarChatUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_TALK, 1); @@ -180,14 +180,14 @@ export class PetLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarSleepUpdateMessage) + if(message instanceof ObjectAvatarSleepUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); return; } - if (message instanceof ObjectAvatarPetGestureUpdateMessage) + if(message instanceof ObjectAvatarPetGestureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); @@ -196,7 +196,7 @@ export class PetLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarSelectedMessage) + if(message instanceof ObjectAvatarSelectedMessage) { this._selected = message.selected; this._reportedLocation = null; @@ -204,7 +204,7 @@ export class PetLogic extends MovingObjectLogic return; } - if (message instanceof ObjectAvatarExperienceUpdateMessage) + if(message instanceof ObjectAvatarExperienceUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_EXPERIENCE_TIMESTAMP, this.time); model.setValue(RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, message.gainedExperience); @@ -217,7 +217,7 @@ export class PetLogic extends MovingObjectLogic { let eventType: string = null; - switch (event.type) + switch(event.type) { case MouseEventType.MOUSE_CLICK: eventType = RoomObjectMouseEvent.CLICK; @@ -227,14 +227,14 @@ export class PetLogic extends MovingObjectLogic case MouseEventType.MOUSE_DOWN: { const petType = this.object.model.getValue(RoomObjectVariable.PET_TYPE); - if (petType === PetType.MONSTERPLANT) + if(petType === PetType.MONSTERPLANT) { - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); } break; } } - if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); } } diff --git a/src/nitro/room/object/logic/room/RoomLogic.ts b/src/nitro/room/object/logic/room/RoomLogic.ts index c823f231..071a7b5a 100644 --- a/src/nitro/room/object/logic/room/RoomLogic.ts +++ b/src/nitro/room/object/logic/room/RoomLogic.ts @@ -57,14 +57,14 @@ export class RoomLogic extends RoomObjectLogicBase { super.dispose(); - if (this._planeParser) + if(this._planeParser) { this._planeParser.dispose(); this._planeParser = null; } - if (this._planeBitmapMaskParser) + if(this._planeBitmapMaskParser) { this._planeBitmapMaskParser.dispose(); @@ -74,11 +74,11 @@ export class RoomLogic extends RoomObjectLogicBase public initialize(roomMap: RoomMapData): void { - if (!roomMap || !this.object) return; + if(!roomMap || !this.object) return; - if (!(roomMap instanceof RoomMapData)) return; + if(!(roomMap instanceof RoomMapData)) return; - if (!this._planeParser.initializeFromMapData(roomMap)) return; + if(!this._planeParser.initializeFromMapData(roomMap)) return; this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, roomMap); this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, 0xFFFFFF); @@ -95,13 +95,13 @@ export class RoomLogic extends RoomObjectLogicBase this.updateBackgroundColor(time); - if (this._needsMapUpdate) + if(this._needsMapUpdate) { - if (this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return; + if(this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return; const model = this.object && this.object.model; - if (model) + if(model) { const mapData = this._planeParser.getMapData(); @@ -119,12 +119,12 @@ export class RoomLogic extends RoomObjectLogicBase private updateBackgroundColor(k: number): void { - if (!this.object || !this._colorChangedTime) return; + if(!this.object || !this._colorChangedTime) return; let color = this._color; let newColor = this._light; - if ((k - this._colorChangedTime) >= this._colorTransitionLength) + if((k - this._colorChangedTime) >= this._colorTransitionLength) { color = this._targetColor; newColor = this._targetLight; @@ -158,60 +158,60 @@ export class RoomLogic extends RoomObjectLogicBase _local_5 = ((_local_5 & 0xFFFF00) + newColor); color = ColorConverter.hslToRGB(_local_5); - if (this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color); + if(this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color); } public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (!message || !this.object) return; + if(!message || !this.object) return; const model = this.object.model; - if (!model) return; + if(!model) return; - if (message instanceof ObjectRoomUpdateMessage) + if(message instanceof ObjectRoomUpdateMessage) { this.onObjectRoomUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomMaskUpdateMessage) + if(message instanceof ObjectRoomMaskUpdateMessage) { this.onObjectRoomMaskUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomPlaneVisibilityUpdateMessage) + if(message instanceof ObjectRoomPlaneVisibilityUpdateMessage) { this.onObjectRoomPlaneVisibilityUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomPlanePropertyUpdateMessage) + if(message instanceof ObjectRoomPlanePropertyUpdateMessage) { this.onObjectRoomPlanePropertyUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomFloorHoleUpdateMessage) + if(message instanceof ObjectRoomFloorHoleUpdateMessage) { this.onObjectRoomFloorHoleUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomColorUpdateMessage) + if(message instanceof ObjectRoomColorUpdateMessage) { this.onObjectRoomColorUpdateMessage(message, model); return; } - if (message instanceof ObjectRoomMapUpdateMessage) + if(message instanceof ObjectRoomMapUpdateMessage) { this.onObjectRoomMapUpdateMessage(message); } @@ -219,7 +219,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomUpdateMessage(message: ObjectRoomUpdateMessage, model: IRoomObjectModel): void { - switch (message.type) + switch(message.type) { case ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE: model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, message.value); @@ -238,12 +238,12 @@ export class RoomLogic extends RoomObjectLogicBase let maskType: string = null; let update = false; - switch (message.type) + switch(message.type) { case ObjectRoomMaskUpdateMessage.ADD_MASK: maskType = RoomPlaneBitmapMaskData.WINDOW; - if (message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE; + if(message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE; this._planeBitmapMaskParser.addMask(message.maskId, message.maskType, message.maskLocation, maskType); @@ -255,16 +255,16 @@ export class RoomLogic extends RoomObjectLogicBase } - if (update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML()); + if(update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML()); } private onObjectRoomPlaneVisibilityUpdateMessage(message: ObjectRoomPlaneVisibilityUpdateMessage, model: IRoomObjectModel): void { let visible = 0; - if (message.visible) visible = 1; + if(message.visible) visible = 1; - switch (message.type) + switch(message.type) { case ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY: model.setValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY, visible); @@ -278,7 +278,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomPlanePropertyUpdateMessage(message: ObjectRoomPlanePropertyUpdateMessage, model: IRoomObjectModel): void { - switch (message.type) + switch(message.type) { case ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS: model.setValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS, message.value); @@ -291,7 +291,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomFloorHoleUpdateMessage(message: ObjectRoomFloorHoleUpdateMessage, model: IRoomObjectModel): void { - switch (message.type) + switch(message.type) { case ObjectRoomFloorHoleUpdateMessage.ADD: this._planeParser.addFloorHole(message.id, message.x, message.y, message.width, message.height); @@ -308,7 +308,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomColorUpdateMessage(message: ObjectRoomColorUpdateMessage, model: IRoomObjectModel): void { - if (!message || !model) return; + if(!message || !model) return; this._originalColor = this._color; this._originalLight = this._light; @@ -316,7 +316,7 @@ export class RoomLogic extends RoomObjectLogicBase this._targetLight = message.light; this._colorChangedTime = this.time; - if (this._skipColorTransition) + if(this._skipColorTransition) this._colorTransitionLength = 0; else this._colorTransitionLength = 1500; @@ -326,7 +326,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomMapUpdateMessage(message: ObjectRoomMapUpdateMessage): void { - if (!message || !message.mapData) return; + if(!message || !message.mapData) return; this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, message.mapData); this.object.model.setValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME, this.time); @@ -336,20 +336,20 @@ export class RoomLogic extends RoomObjectLogicBase public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if (!event || !geometry || !this.object || !this.object.model) return; + if(!event || !geometry || !this.object || !this.object.model) return; const tag = event.spriteTag; let planeId = 0; - if (tag && (tag.indexOf('@') >= 0)) + if(tag && (tag.indexOf('@') >= 0)) { planeId = parseInt(tag.substr(tag.indexOf('@') + 1)); } - if ((planeId < 1) || (planeId > this._planeParser.planeCount)) + if((planeId < 1) || (planeId > this._planeParser.planeCount)) { - if (event.type === MouseEventType.ROLL_OUT) + if(event.type === MouseEventType.ROLL_OUT) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); } @@ -367,12 +367,12 @@ export class RoomLogic extends RoomObjectLogicBase const planeNormalDirection = this._planeParser.getPlaneNormalDirection(planeId); const planeType = this._planeParser.getPlaneType(planeId); - if (((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return; + if(((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return; const leftSideLength = planeLeftSide.length; const rightSideLength = planeRightSide.length; - if (((leftSideLength == 0) || (rightSideLength == 0))) return; + if(((leftSideLength == 0) || (rightSideLength == 0))) return; const screenX = event.screenX; const screenY = event.screenY; @@ -380,7 +380,7 @@ export class RoomLogic extends RoomObjectLogicBase planePosition = geometry.getPlanePosition(screenPoint, planeLocation, planeLeftSide, planeRightSide); - if (!planePosition) + if(!planePosition) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); @@ -396,7 +396,7 @@ export class RoomLogic extends RoomObjectLogicBase const tileY = _local_18.y; const tileZ = _local_18.z; - if (((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength))) + if(((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength))) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY); @@ -412,30 +412,30 @@ export class RoomLogic extends RoomObjectLogicBase let eventType: string = null; - if ((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; - else if ((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; + if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; - switch (event.type) + switch(event.type) { case MouseEventType.MOUSE_MOVE: case MouseEventType.ROLL_OVER: case MouseEventType.MOUSE_CLICK: { let newEvent: RoomObjectEvent = null; - if (planeType === RoomPlaneData.PLANE_FLOOR) + if(planeType === RoomPlaneData.PLANE_FLOOR) { newEvent = new RoomObjectTileMouseEvent(eventType, this.object, event.eventId, tileX, tileY, tileZ, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); } - else if ((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE)) + else if((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE)) { let direction = 90; - if (planeNormalDirection) + if(planeNormalDirection) { direction = (planeNormalDirection.x + 90); - if (direction > 360) direction -= 360; + if(direction > 360) direction -= 360; } const _local_27 = ((planeLeftSide.length * planePosition.x) / leftSideLength); @@ -444,7 +444,7 @@ export class RoomLogic extends RoomObjectLogicBase newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, planeLocation, planeLeftSide, planeRightSide, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); } - if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); return; } diff --git a/src/nitro/room/object/logic/room/SelectionArrowLogic.ts b/src/nitro/room/object/logic/room/SelectionArrowLogic.ts index e732ff36..515f4baa 100644 --- a/src/nitro/room/object/logic/room/SelectionArrowLogic.ts +++ b/src/nitro/room/object/logic/room/SelectionArrowLogic.ts @@ -6,7 +6,7 @@ export class SelectionArrowLogic extends RoomObjectLogicBase { public initialize(data: IAssetData): void { - if (!this.object) return; + if(!this.object) return; this.object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1); @@ -17,11 +17,11 @@ export class SelectionArrowLogic extends RoomObjectLogicBase { super.processUpdateMessage(message); - if (!(message instanceof ObjectVisibilityUpdateMessage)) return; + if(!(message instanceof ObjectVisibilityUpdateMessage)) return; - if (this.object) + if(this.object) { - switch (message.type) + switch(message.type) { case ObjectVisibilityUpdateMessage.ENABLED: this.object.setState(0, 0); diff --git a/src/nitro/room/object/logic/room/TileCursorLogic.ts b/src/nitro/room/object/logic/room/TileCursorLogic.ts index 8398bda4..c850c8c4 100644 --- a/src/nitro/room/object/logic/room/TileCursorLogic.ts +++ b/src/nitro/room/object/logic/room/TileCursorLogic.ts @@ -21,7 +21,7 @@ export class TileCursorLogic extends RoomObjectLogicBase public initialize(data: IAssetData): void { - if (!this.object) return; + if(!this.object) return; this.object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1); @@ -30,23 +30,23 @@ export class TileCursorLogic extends RoomObjectLogicBase public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if (!(message instanceof ObjectTileCursorUpdateMessage)) return; + if(!(message instanceof ObjectTileCursorUpdateMessage)) return; - if (this._lastEventId && (this._lastEventId === message.sourceEventId)) return; + if(this._lastEventId && (this._lastEventId === message.sourceEventId)) return; - if (message.toggleVisibility) this._isHidden = !this._isHidden; + if(message.toggleVisibility) this._isHidden = !this._isHidden; super.processUpdateMessage(message); - if (this.object) + if(this.object) { - if (this._isHidden) + if(this._isHidden) { this.object.setState(TileCursorLogic.CURSOR_HIDDEN_STATE, 0); } else { - if (!message.visible) + if(!message.visible) { this.object.setState(TileCursorLogic.CURSOR_HIDDEN_STATE, 0); } diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts index dfe6c2d6..92345057 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts @@ -133,7 +133,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement public initialize(data: IObjectVisualizationData): boolean { - if (!(data instanceof AvatarVisualizationData)) return false; + if(!(data instanceof AvatarVisualizationData)) return false; this._data = data; @@ -146,11 +146,11 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; super.dispose(); - if (this._avatarImage) this._avatarImage.dispose(); + if(this._avatarImage) this._avatarImage.dispose(); this._shadow = null; this._disposed = true; @@ -158,13 +158,13 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void { - if (!this.object || !geometry || !this._data) return; + if(!this.object || !geometry || !this._data) return; - if (time < (this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER)) return; + if(time < (this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER)) return; this._lastUpdate += AvatarVisualization.UPDATE_TIME_INCREASER; - if ((this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER) < time) this._lastUpdate = (time - AvatarVisualization.UPDATE_TIME_INCREASER); + if((this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER) < time) this._lastUpdate = (time - AvatarVisualization.UPDATE_TIME_INCREASER); const model = this.object.model; const scale = geometry.scale; @@ -177,41 +177,41 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const updateModel = this.updateModel(model, scale); - if ((updateModel || (scale !== this._scale)) || !this._avatarImage) + if((updateModel || (scale !== this._scale)) || !this._avatarImage) { - if (scale !== this._scale) + if(scale !== this._scale) { didScaleUpdate = true; this.updateScale(scale); } - if (effect !== this._effect) didEffectUpdate = true; + if(effect !== this._effect) didEffectUpdate = true; - if (didScaleUpdate || !this._avatarImage || didEffectUpdate) + if(didScaleUpdate || !this._avatarImage || didEffectUpdate) { this._avatarImage = this.createAvatarImage(scale, this._effect); - if (!this._avatarImage) return; + if(!this._avatarImage) return; otherUpdate = true; const sprite = this.getSprite(AvatarVisualization.AVATAR_LAYER_ID); - if ((sprite && this._avatarImage) && this._avatarImage.isPlaceholder()) + if((sprite && this._avatarImage) && this._avatarImage.isPlaceholder()) { sprite.alpha = 150; } - else if (sprite) + else if(sprite) { sprite.alpha = 255; } } - if (!this._avatarImage) return; + if(!this._avatarImage) return; - if (didEffectUpdate && this._avatarImage.animationHasResetOnToggle) this._avatarImage.resetAnimationFrameCounter(); + if(didEffectUpdate && this._avatarImage.animationHasResetOnToggle) this._avatarImage.resetAnimationFrameCounter(); this.updateShadow(scale); @@ -219,11 +219,11 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement this.processActionsForAvatar(this._avatarImage); - if (this._additions) + if(this._additions) { let index = this._extraSpritesStartIndex; - for (const addition of this._additions.values()) + for(const addition of this._additions.values()) { addition.update(this.getSprite(index++), scale); } @@ -236,29 +236,29 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement objectUpdate = this.updateObject(this.object, geometry, update); } - if (this._additions) + if(this._additions) { let index = this._extraSpritesStartIndex; - for (const addition of this._additions.values()) + for(const addition of this._additions.values()) { - if (addition.animate(this.getSprite(index++))) this.updateSpriteCounter++; + if(addition.animate(this.getSprite(index++))) this.updateSpriteCounter++; } } const update1 = (objectUpdate || updateModel || didScaleUpdate); const update2 = ((this._isAnimating || (this._forcedAnimFrames > 0)) && update); - if (update1) this._forcedAnimFrames = AvatarVisualization.ANIMATION_FRAME_UPDATE_INTERVAL; + if(update1) this._forcedAnimFrames = AvatarVisualization.ANIMATION_FRAME_UPDATE_INTERVAL; - if (update1 || update2) + if(update1 || update2) { this.updateSpriteCounter++; this._forcedAnimFrames--; this._updatesUntilFrameUpdate--; - if ((((this._updatesUntilFrameUpdate <= 0) || didScaleUpdate) || updateModel) || otherUpdate) + if((((this._updatesUntilFrameUpdate <= 0) || didScaleUpdate) || updateModel) || otherUpdate) { this._avatarImage.updateAnimationByFrames(1); @@ -271,21 +271,21 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let _local_20 = this._avatarImage.getCanvasOffsets(); - if (!_local_20 || (_local_20.length < 3)) _local_20 = AvatarVisualization.DEFAULT_CANVAS_OFFSETS; + if(!_local_20 || (_local_20.length < 3)) _local_20 = AvatarVisualization.DEFAULT_CANVAS_OFFSETS; const sprite = this.getSprite(AvatarVisualization.SPRITE_INDEX_AVATAR); - if (sprite) + if(sprite) { const highlightEnabled = ((this.object.model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) === 1) && (this.object.model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT) === 1)); const avatarImage = this._avatarImage.getImage(AvatarSetType.FULL, highlightEnabled); - if (avatarImage) + if(avatarImage) { sprite.texture = avatarImage; - if (highlightEnabled) + if(highlightEnabled) { // sprite.filters = [ // new GlowFilter({ @@ -300,15 +300,15 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement } } - if (sprite.texture) + if(sprite.texture) { sprite.offsetX = ((((-1 * scale) / 2) + _local_20[0]) - ((sprite.texture.width - scale) / 2)); sprite.offsetY = (((-(sprite.texture.height) + (scale / 4)) + _local_20[1]) + this._postureOffset); } - if (this._isLaying) + if(this._isLaying) { - if (this._layInside) sprite.relativeDepth = -0.5; + if(this._layInside) sprite.relativeDepth = -0.5; else sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH + _local_20[2]); } else @@ -316,7 +316,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH + _local_20[2]); } - if (this._ownUser) + if(this._ownUser) { sprite.relativeDepth -= AvatarVisualization.AVATAR_OWN_DEPTH_ADJUST; sprite.spriteType = RoomObjectSpriteType.AVATAR_OWN; @@ -329,9 +329,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const typingBubble = this.getAddition(AvatarVisualization.TYPING_BUBBLE_ID) as TypingBubbleAddition; - if (typingBubble) + if(typingBubble) { - if (!this._isLaying) typingBubble.relativeDepth = ((AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH - 0.01) + _local_20[2]); + if(!this._isLaying) typingBubble.relativeDepth = ((AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH - 0.01) + _local_20[2]); else typingBubble.relativeDepth = ((AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH - 0.01) + _local_20[2]); } @@ -340,32 +340,32 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let _local_21 = AvatarVisualization.INITIAL_RESERVED_SPRITES; const direction = this._avatarImage.getDirection(); - for (const spriteData of this._avatarImage.getSprites()) + for(const spriteData of this._avatarImage.getSprites()) { - if (spriteData.id === AvatarVisualization.AVATAR) + if(spriteData.id === AvatarVisualization.AVATAR) { const sprite = this.getSprite(AvatarVisualization.SPRITE_INDEX_AVATAR); - if (sprite) + if(sprite) { const layerData = this._avatarImage.getLayerData(spriteData); let offsetX = spriteData.getDirectionOffsetX(direction); let offsetY = spriteData.getDirectionOffsetY(direction); - if (layerData) + if(layerData) { offsetX += layerData.dx; offsetY += layerData.dy; } - if (scale < 48) + if(scale < 48) { offsetX /= 2; offsetY /= 2; } - if (!this._canStandUp) + if(!this._canStandUp) { sprite.offsetX += offsetX; sprite.offsetY += offsetY; @@ -376,7 +376,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement { const sprite = this.getSprite(_local_21); - if (sprite) + if(sprite) { sprite.alphaTolerance = AlphaTolerance.MATCH_NOTHING; sprite.visible = true; @@ -389,9 +389,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const offsetZ = spriteData.getDirectionOffsetZ(direction); let dd = 0; - if (spriteData.hasDirections) dd = direction; + if(spriteData.hasDirections) dd = direction; - if (layerData) + if(layerData) { frameNumber = layerData.animationFrame; offsetX += layerData.dx; @@ -399,30 +399,30 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement dd += layerData.dd; } - if (scale < 48) + if(scale < 48) { offsetX /= 2; offsetY /= 2; } - if (dd < 0) dd += 8; + if(dd < 0) dd += 8; else { - if (dd > 7) dd -= 8; + if(dd > 7) dd -= 8; } const assetName = ((((((this._avatarImage.getScale() + '_') + spriteData.member) + '_') + dd) + '_') + frameNumber); const asset = this._avatarImage.getAsset(assetName); - if (!asset) continue; + if(!asset) continue; sprite.texture = asset.texture; sprite.offsetX = ((asset.offsetX - (scale / 2)) + offsetX); sprite.offsetY = (asset.offsetY + offsetY); sprite.flipH = asset.flipH; - if (spriteData.hasStaticY) + if(spriteData.hasStaticY) { sprite.offsetY += ((this._verticalOffset * scale) / (2 * AvatarVisualization.BASE_Y_SCALE)); } @@ -431,7 +431,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement sprite.offsetY += this._postureOffset; } - if (this._isLaying) + if(this._isLaying) { sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH - ((0.001 * this.totalSprites) * offsetZ)); } @@ -440,7 +440,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH - ((0.001 * this.totalSprites) * offsetZ)); } - if (spriteData.ink === 33) sprite.blendMode = BLEND_MODES.ADD; + if(spriteData.ink === 33) sprite.blendMode = BLEND_MODES.ADD; else sprite.blendMode = BLEND_MODES.NORMAL; } @@ -455,7 +455,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let cachedImage: IAvatarImage = null; let imageName = 'avatarImage' + scale.toString(); - if (!effectId) + if(!effectId) { cachedImage = this._cachedAvatars.getValue(imageName); } @@ -466,24 +466,24 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement cachedImage = this._cachedAvatarEffects.getValue(imageName); } - if (!cachedImage) + if(!cachedImage) { cachedImage = this._data.createAvatarImage(this._figure, scale, this._gender, this, this); - if (cachedImage) + if(cachedImage) { - if (!effectId) + if(!effectId) { this._cachedAvatars.add(imageName, cachedImage); } else { - if (this._cachedAvatarEffects.length >= AvatarVisualization.MAX_EFFECT_CACHE) + if(this._cachedAvatarEffects.length >= AvatarVisualization.MAX_EFFECT_CACHE) { const cached = this._cachedAvatarEffects.remove(this._cachedAvatarEffects.getKey(0)); - if (cached) cached.dispose(); + if(cached) cached.dispose(); } this._cachedAvatarEffects.add(imageName, cachedImage); @@ -496,23 +496,23 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement protected updateObject(object: IRoomObject, geometry: IRoomGeometry, update: boolean, _arg_4: boolean = false): boolean { - if ((!_arg_4 && (this.updateObjectCounter === object.updateCounter)) && (this._geometryUpdateCounter === geometry.updateId)) return false; + if((!_arg_4 && (this.updateObjectCounter === object.updateCounter)) && (this._geometryUpdateCounter === geometry.updateId)) return false; let direction = (object.getDirection().x - geometry.direction.x); let headDirection = (this._headDirection - geometry.direction.x); - if (this._posture === 'float') headDirection = direction; + if(this._posture === 'float') headDirection = direction; direction = (((direction % 360) + 360) % 360); headDirection = (((headDirection % 360) + 360) % 360); - if ((this._posture === 'sit') && this._canStandUp) + if((this._posture === 'sit') && this._canStandUp) { direction -= ((direction % 90) - 45); headDirection -= ((headDirection % 90) - 45); } - if ((direction !== this._angle) || _arg_4) + if((direction !== this._angle) || _arg_4) { update = true; @@ -524,13 +524,13 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement this._avatarImage.setDirectionAngle(AvatarSetType.FULL, direction); } - if ((headDirection !== this._headAngle) || _arg_4) + if((headDirection !== this._headAngle) || _arg_4) { update = true; this._headAngle = headDirection; - if (this._headAngle !== this._angle) + if(this._headAngle !== this._angle) { headDirection = (headDirection - (135 - 22.5)); headDirection = ((headDirection + 360) % 360); @@ -548,15 +548,15 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement protected updateModel(model: IRoomObjectModel, scale: number): boolean { - if (!model) return false; + if(!model) return false; - if (this.updateModelCounter === model.updateCounter) return false; + if(this.updateModelCounter === model.updateCounter) return false; let needsUpdate = false; const talk = (model.getValue(RoomObjectVariable.FIGURE_TALK) > 0); - if (talk !== this._talk) + if(talk !== this._talk) { this._talk = talk; @@ -565,7 +565,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const expression = model.getValue(RoomObjectVariable.FIGURE_EXPRESSION); - if (expression !== this._expression) + if(expression !== this._expression) { this._expression = expression; @@ -574,7 +574,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const sleep = (model.getValue(RoomObjectVariable.FIGURE_SLEEP) > 0); - if (sleep !== this._sleep) + if(sleep !== this._sleep) { this._sleep = sleep; @@ -583,7 +583,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const blink = (model.getValue(RoomObjectVariable.FIGURE_BLINK) > 0); - if (blink !== this._blink) + if(blink !== this._blink) { this._blink = blink; @@ -592,7 +592,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const gesture = (model.getValue(RoomObjectVariable.FIGURE_GESTURE) || 0); - if (gesture !== this._gesture) + if(gesture !== this._gesture) { this._gesture = gesture; @@ -601,7 +601,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const posture = model.getValue(RoomObjectVariable.FIGURE_POSTURE); - if (posture !== this._posture) + if(posture !== this._posture) { this._posture = posture; @@ -610,7 +610,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const postureParameter = model.getValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER); - if (postureParameter !== this._postureParameter) + if(postureParameter !== this._postureParameter) { this._postureParameter = postureParameter; @@ -619,7 +619,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const canStandUp = model.getValue(RoomObjectVariable.FIGURE_CAN_STAND_UP); - if (canStandUp !== this._canStandUp) + if(canStandUp !== this._canStandUp) { this._canStandUp = canStandUp; @@ -628,7 +628,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const verticalOffset = (model.getValue(RoomObjectVariable.FIGURE_VERTICAL_OFFSET) * AvatarVisualization.BASE_Y_SCALE); - if (verticalOffset !== this._verticalOffset) + if(verticalOffset !== this._verticalOffset) { this._verticalOffset = verticalOffset; @@ -637,7 +637,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const dance = (model.getValue(RoomObjectVariable.FIGURE_DANCE) || 0); - if (dance !== this._dance) + if(dance !== this._dance) { this._dance = dance; @@ -646,7 +646,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const effect = (model.getValue(RoomObjectVariable.FIGURE_EFFECT) || 0); - if (effect !== this._effect) + if(effect !== this._effect) { this._effect = effect; @@ -655,7 +655,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const carryObject = (model.getValue(RoomObjectVariable.FIGURE_CARRY_OBJECT) || 0); - if (carryObject !== this._carryObject) + if(carryObject !== this._carryObject) { this._carryObject = carryObject; @@ -664,7 +664,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const useObject = (model.getValue(RoomObjectVariable.FIGURE_USE_OBJECT) || 0); - if (useObject !== this._useObject) + if(useObject !== this._useObject) { this._useObject = useObject; @@ -673,16 +673,16 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const headDirection = model.getValue(RoomObjectVariable.HEAD_DIRECTION); - if (headDirection !== this._headDirection) + if(headDirection !== this._headDirection) { this._headDirection = headDirection; needsUpdate = true; } - if ((this._carryObject > 0) && (useObject > 0)) + if((this._carryObject > 0) && (useObject > 0)) { - if (this._useObject !== this._carryObject) + if(this._useObject !== this._carryObject) { this._useObject = this._carryObject; @@ -691,7 +691,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement } else { - if (this._useObject !== 0) + if(this._useObject !== 0) { this._useObject = 0; @@ -701,30 +701,30 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let idleAddition = this.getAddition(AvatarVisualization.FLOATING_IDLE_Z_ID); - if (this._sleep) + if(this._sleep) { - if (!idleAddition) idleAddition = this.addAddition(new FloatingIdleZAddition(AvatarVisualization.FLOATING_IDLE_Z_ID, this)); + if(!idleAddition) idleAddition = this.addAddition(new FloatingIdleZAddition(AvatarVisualization.FLOATING_IDLE_Z_ID, this)); needsUpdate = true; } else { - if (idleAddition) this.removeAddition(AvatarVisualization.FLOATING_IDLE_Z_ID); + if(idleAddition) this.removeAddition(AvatarVisualization.FLOATING_IDLE_Z_ID); } const isMuted = (model.getValue(RoomObjectVariable.FIGURE_IS_MUTED) > 0); let mutedAddition = this.getAddition(AvatarVisualization.MUTED_BUBBLE_ID); - if (isMuted) + if(isMuted) { - if (!mutedAddition) mutedAddition = this.addAddition(new MutedBubbleAddition(AvatarVisualization.MUTED_BUBBLE_ID, this)); + if(!mutedAddition) mutedAddition = this.addAddition(new MutedBubbleAddition(AvatarVisualization.MUTED_BUBBLE_ID, this)); needsUpdate = true; } else { - if (mutedAddition) + if(mutedAddition) { this.removeAddition(AvatarVisualization.MUTED_BUBBLE_ID); @@ -735,15 +735,15 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let typingAddition = this.getAddition(AvatarVisualization.TYPING_BUBBLE_ID); - if (isTyping) + if(isTyping) { - if (!typingAddition) typingAddition = this.addAddition(new TypingBubbleAddition(AvatarVisualization.TYPING_BUBBLE_ID, this)); + if(!typingAddition) typingAddition = this.addAddition(new TypingBubbleAddition(AvatarVisualization.TYPING_BUBBLE_ID, this)); needsUpdate = true; } else { - if (typingAddition) + if(typingAddition) { this.removeAddition(AvatarVisualization.TYPING_BUBBLE_ID); @@ -754,7 +754,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const guideStatusValue = (model.getValue(RoomObjectVariable.FIGURE_GUIDE_STATUS) || 0); - if (guideStatusValue !== AvatarGuideStatus.NONE) + if(guideStatusValue !== AvatarGuideStatus.NONE) { this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID); this.addAddition(new GuideStatusBubbleAddition(AvatarVisualization.GUIDE_BUBBLE_ID, this, guideStatusValue)); @@ -763,7 +763,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement } else { - if (this.getAddition(AvatarVisualization.GUIDE_BUBBLE_ID)) + if(this.getAddition(AvatarVisualization.GUIDE_BUBBLE_ID)) { this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID); @@ -775,66 +775,66 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let gameClickAddition = this.getAddition(AvatarVisualization.GAME_CLICK_TARGET_ID); - if (isPlayingGame) + if(isPlayingGame) { - if (!gameClickAddition) gameClickAddition = this.addAddition(new GameClickTargetAddition(AvatarVisualization.GAME_CLICK_TARGET_ID)); + if(!gameClickAddition) gameClickAddition = this.addAddition(new GameClickTargetAddition(AvatarVisualization.GAME_CLICK_TARGET_ID)); needsUpdate = true; } else { - if (gameClickAddition) this.removeAddition(AvatarVisualization.GAME_CLICK_TARGET_ID); + if(gameClickAddition) this.removeAddition(AvatarVisualization.GAME_CLICK_TARGET_ID); } const numberValue = model.getValue(RoomObjectVariable.FIGURE_NUMBER_VALUE); let numberAddition = this.getAddition(AvatarVisualization.NUMBER_BUBBLE_ID); - if (numberValue > 0) + if(numberValue > 0) { - if (!numberAddition) numberAddition = this.addAddition(new NumberBubbleAddition(AvatarVisualization.NUMBER_BUBBLE_ID, numberValue, this)); + if(!numberAddition) numberAddition = this.addAddition(new NumberBubbleAddition(AvatarVisualization.NUMBER_BUBBLE_ID, numberValue, this)); needsUpdate = true; } else { - if (numberAddition) this.removeAddition(AvatarVisualization.NUMBER_BUBBLE_ID); + if(numberAddition) this.removeAddition(AvatarVisualization.NUMBER_BUBBLE_ID); } let expressionAddition = this.getAddition(AvatarVisualization.EXPRESSION_ID); - if (this._expression > 0) + if(this._expression > 0) { - if (!expressionAddition) + if(!expressionAddition) { expressionAddition = ExpressionAdditionFactory.getExpressionAddition(AvatarVisualization.EXPRESSION_ID, this._expression, this); - if (expressionAddition) this.addAddition(expressionAddition); + if(expressionAddition) this.addAddition(expressionAddition); } } else { - if (expressionAddition) this.removeAddition(AvatarVisualization.EXPRESSION_ID); + if(expressionAddition) this.removeAddition(AvatarVisualization.EXPRESSION_ID); } this.updateScale(scale); const gender = model.getValue(RoomObjectVariable.GENDER); - if (gender !== this._gender) + if(gender !== this._gender) { this._gender = gender; needsUpdate = true; } - if (this.updateFigure(model.getValue(RoomObjectVariable.FIGURE))) needsUpdate = true; + if(this.updateFigure(model.getValue(RoomObjectVariable.FIGURE))) needsUpdate = true; let sign = model.getValue(RoomObjectVariable.FIGURE_SIGN); - if (sign === null) sign = -1; + if(sign === null) sign = -1; - if (this._sign !== sign) + if(this._sign !== sign) { this._sign = sign; @@ -843,18 +843,18 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const highlightEnabled = (model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) > 0); - if (highlightEnabled !== this._highlightEnabled) + if(highlightEnabled !== this._highlightEnabled) { this._highlightEnabled = highlightEnabled; needsUpdate = true; } - if (this._highlightEnabled) + if(this._highlightEnabled) { const highlight = (model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT) > 0); - if (highlight !== this._highlight) + if(highlight !== this._highlight) { this._highlight = highlight; @@ -864,7 +864,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const ownUser = (model.getValue(RoomObjectVariable.OWN_USER) > 0); - if (ownUser !== this._ownUser) + if(ownUser !== this._ownUser) { this._ownUser = ownUser; @@ -878,7 +878,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement protected setDirection(direction: number): void { - if (this._direction === direction) return; + if(this._direction === direction) return; this._direction = direction; @@ -887,9 +887,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement private updateScale(scale: number): void { - if (scale < 48) this._blink = false; + if(scale < 48) this._blink = false; - if ((this._posture === 'sit') || (this._posture === 'lay')) + if((this._posture === 'sit') || (this._posture === 'lay')) { this._postureOffset = (scale / 2); } @@ -901,45 +901,45 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement this._layInside = false; this._isLaying = false; - if (this._posture === 'lay') + if(this._posture === 'lay') { this._isLaying = true; const _local_2 = parseInt(this._postureParameter); - if (_local_2 < 0) this._layInside = true; + if(_local_2 < 0) this._layInside = true; } } private processActionsForAvatar(avatar: IAvatarImage): void { - if (!avatar) return; + if(!avatar) return; avatar.initActionAppends(); avatar.appendAction(AvatarAction.POSTURE, this._posture, this._postureParameter); - if (this._gesture > 0) this._avatarImage.appendAction(AvatarAction.GESTURE, AvatarAction.getGesture(this._gesture)); + if(this._gesture > 0) this._avatarImage.appendAction(AvatarAction.GESTURE, AvatarAction.getGesture(this._gesture)); - if (this._dance > 0) this._avatarImage.appendAction(AvatarAction.DANCE, this._dance); + if(this._dance > 0) this._avatarImage.appendAction(AvatarAction.DANCE, this._dance); - if (this._sign > -1) this._avatarImage.appendAction(AvatarAction.SIGN, this._sign); + if(this._sign > -1) this._avatarImage.appendAction(AvatarAction.SIGN, this._sign); - if (this._carryObject > 0) this._avatarImage.appendAction(AvatarAction.CARRY_OBJECT, this._carryObject); + if(this._carryObject > 0) this._avatarImage.appendAction(AvatarAction.CARRY_OBJECT, this._carryObject); - if (this._useObject > 0) this._avatarImage.appendAction(AvatarAction.USE_OBJECT, this._useObject); + if(this._useObject > 0) this._avatarImage.appendAction(AvatarAction.USE_OBJECT, this._useObject); - if (this._talk) this._avatarImage.appendAction(AvatarAction.TALK); + if(this._talk) this._avatarImage.appendAction(AvatarAction.TALK); - if (this._sleep || this._blink) this._avatarImage.appendAction(AvatarAction.SLEEP); + if(this._sleep || this._blink) this._avatarImage.appendAction(AvatarAction.SLEEP); - if (this._expression > 0) + if(this._expression > 0) { const expression = AvatarAction.getExpression(this._expression); - if (expression !== '') + if(expression !== '') { - switch (expression) + switch(expression) { case AvatarAction.DANCE: this._avatarImage.appendAction(AvatarAction.DANCE, 2); @@ -951,7 +951,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement } } - if (this._effect > 0) this._avatarImage.appendAction(AvatarAction.EFFECT, this._effect); + if(this._effect > 0) this._avatarImage.appendAction(AvatarAction.EFFECT, this._effect); avatar.endActionAppends(); @@ -959,24 +959,24 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement let spriteCount = AvatarVisualization.INITIAL_RESERVED_SPRITES; - for (const sprite of this._avatarImage.getSprites()) + for(const sprite of this._avatarImage.getSprites()) { - if (sprite.id !== AvatarVisualization.AVATAR) spriteCount++; + if(sprite.id !== AvatarVisualization.AVATAR) spriteCount++; } - if (spriteCount !== this.totalSprites) this.createSprites(spriteCount); + if(spriteCount !== this.totalSprites) this.createSprites(spriteCount); this._extraSpritesStartIndex = spriteCount; - if (this._additions) + if(this._additions) { - for (const addition of this._additions.values()) this.createSprite(); + for(const addition of this._additions.values()) this.createSprite(); } } private updateFigure(figure: string): boolean { - if (this._figure === figure) return false; + if(this._figure === figure) return false; this._figure = figure; @@ -997,9 +997,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement private clearAvatar(): void { - for (const avatar of this._cachedAvatars.getValues()) avatar && avatar.dispose(); + for(const avatar of this._cachedAvatars.getValues()) avatar && avatar.dispose(); - for (const avatar of this._cachedAvatarEffects.getValues()) avatar && avatar.dispose(); + for(const avatar of this._cachedAvatarEffects.getValues()) avatar && avatar.dispose(); this._cachedAvatars.reset(); this._cachedAvatarEffects.reset(); @@ -1008,7 +1008,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const sprite = this.getSprite(AvatarVisualization.AVATAR_LAYER_ID); - if (sprite) + if(sprite) { sprite.texture = Texture.EMPTY; sprite.alpha = 255; @@ -1017,11 +1017,11 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement private getAddition(id: number): IAvatarAddition { - if (!this._additions) return null; + if(!this._additions) return null; const existing = this._additions.get(id); - if (!existing) return null; + if(!existing) return null; return existing; } @@ -1030,7 +1030,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement { const existing = this.getAddition(addition.id); - if (existing) return; + if(existing) return; this._additions.set(addition.id, addition); @@ -1041,7 +1041,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement { const addition = this.getAddition(id); - if (!addition) return; + if(!addition) return; this._additions.delete(addition.id); @@ -1054,22 +1054,22 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement const sprite = this.getSprite(AvatarVisualization.SHADOW_LAYER_ID); - if (!sprite) return; + if(!sprite) return; let hasShadow = (((this._posture === 'mv') || (this._posture === 'std')) || ((this._posture === 'sit') && this._canStandUp)); - if (this._effect === AvatarVisualization.SNOWBOARDING_EFFECT) hasShadow = false; + if(this._effect === AvatarVisualization.SNOWBOARDING_EFFECT) hasShadow = false; - if (hasShadow) + if(hasShadow) { sprite.visible = true; - if (!this._shadow || (scale !== this._scale)) + if(!this._shadow || (scale !== this._scale)) { let offsetX = 0; let offsetY = 0; - if (scale < 48) + if(scale < 48) { sprite.libraryAssetName = 'sh_std_sd_1_0_0'; @@ -1088,7 +1088,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement offsetY = ((this._canStandUp) ? 10 : -7); } - if (this._shadow) + if(this._shadow) { sprite.texture = this._shadow.texture; sprite.offsetX = offsetX; diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts index a3f7c5f9..6ab961ab 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts @@ -26,7 +26,7 @@ export class AvatarVisualizationData extends Disposable implements IObjectVisual { let avatarImage: IAvatarImage = null; - if (size > 48) avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.LARGE, gender, avatarListener, effectListener); + if(size > 48) avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.LARGE, gender, avatarListener, effectListener); else avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.SMALL, gender, avatarListener, effectListener); return avatarImage; @@ -34,7 +34,7 @@ export class AvatarVisualizationData extends Disposable implements IObjectVisual public getAvatarRendererAsset(name: string): Texture { - if (!this._avatarRenderer) return null; + if(!this._avatarRenderer) return null; return this._avatarRenderer.assets.getTexture(name); } diff --git a/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts b/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts index b6daef10..e127a8f9 100644 --- a/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts @@ -34,23 +34,23 @@ export class FloatingHeartAddition extends ExpressionAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; this._scale = scale; let additionScale = 64; let offsetX = 0; - if (scale < 48) + if(scale < 48) { this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss_small'); - if ((this.visualization.angle === 90) || (this.visualization.angle === 270)) + if((this.visualization.angle === 90) || (this.visualization.angle === 270)) { offsetX = 0; } - else if ((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) { offsetX = 6; } @@ -65,12 +65,12 @@ export class FloatingHeartAddition extends ExpressionAddition { this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss'); - if ((this.visualization.angle === 90) || (this.visualization.angle === 270)) + if((this.visualization.angle === 90) || (this.visualization.angle === 270)) { offsetX = -3; } - else if ((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) { offsetX = 22; } @@ -80,17 +80,17 @@ export class FloatingHeartAddition extends ExpressionAddition this._offsetY = -70; } - if (this.visualization.posture === AvatarAction.POSTURE_SIT) + if(this.visualization.posture === AvatarAction.POSTURE_SIT) { this._offsetY += (additionScale / 2); } - else if (this.visualization.posture === AvatarAction.POSTURE_LAY) + else if(this.visualization.posture === AvatarAction.POSTURE_LAY) { this._offsetY += additionScale; } - if (this._asset) + if(this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -108,13 +108,13 @@ export class FloatingHeartAddition extends ExpressionAddition public animate(sprite: IRoomObjectSprite): boolean { - if (!sprite) return false; + if(!sprite) return false; - if (this._asset) sprite.texture = this._asset; + if(this._asset) sprite.texture = this._asset; - if (this._state === FloatingHeartAddition.STATE_DELAY) + if(this._state === FloatingHeartAddition.STATE_DELAY) { - if ((Nitro.instance.time - this._startTime) < FloatingHeartAddition.DELAY_BEFORE_ANIMATION) return false; + if((Nitro.instance.time - this._startTime) < FloatingHeartAddition.DELAY_BEFORE_ANIMATION) return false; this._state = FloatingHeartAddition.STATE_FADE_IN; @@ -126,14 +126,14 @@ export class FloatingHeartAddition extends ExpressionAddition return true; } - if (this._state === FloatingHeartAddition.STATE_FADE_IN) + if(this._state === FloatingHeartAddition.STATE_FADE_IN) { this._delta += 0.1; sprite.offsetY = this._offsetY; sprite.alpha = (Math.pow(this._delta, 0.9) * 255); - if (this._delta >= 1) + if(this._delta >= 1) { sprite.alpha = 255; @@ -144,7 +144,7 @@ export class FloatingHeartAddition extends ExpressionAddition return true; } - if (this._state === FloatingHeartAddition.STATE_FLOAT) + if(this._state === FloatingHeartAddition.STATE_FLOAT) { const alpha = Math.pow(this._delta, 0.9); @@ -155,7 +155,7 @@ export class FloatingHeartAddition extends ExpressionAddition sprite.offsetY = (this._offsetY + (((this._delta < 1) ? alpha : 1) * offset)); sprite.alpha = ((1 - alpha) * 255); - if (sprite.alpha <= 0) + if(sprite.alpha <= 0) { sprite.visible = false; diff --git a/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts b/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts index a19feb1e..542548f0 100644 --- a/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts @@ -42,14 +42,14 @@ export class FloatingIdleZAddition implements IAvatarAddition { let side = 'left'; - if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; return ('avatar_addition_user_idle_' + side + '_' + state + ((this._scale < 48) ? '_small' : '')); } public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; this._scale = scale; this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName((this._state === FloatingIdleZAddition.STATE_FRAME_A) ? 1 : 2)); @@ -57,9 +57,9 @@ export class FloatingIdleZAddition implements IAvatarAddition let additionScale = 64; let offsetX = 0; - if (scale < 48) + if(scale < 48) { - if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) { offsetX = 10; } @@ -74,7 +74,7 @@ export class FloatingIdleZAddition implements IAvatarAddition } else { - if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) { offsetX = 22; } @@ -86,17 +86,17 @@ export class FloatingIdleZAddition implements IAvatarAddition this._offsetY = -70; } - if (this._visualization.posture === AvatarAction.POSTURE_SIT) + if(this._visualization.posture === AvatarAction.POSTURE_SIT) { this._offsetY += (additionScale / 2); } - else if (this._visualization.posture === AvatarAction.POSTURE_LAY) + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) { this._offsetY += (additionScale - (0.3 * additionScale)); } - if (this._asset) + if(this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -108,13 +108,13 @@ export class FloatingIdleZAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if (!sprite) return false; + if(!sprite) return false; const totalTimeRunning = Nitro.instance.time; - if (this._state === FloatingIdleZAddition.STATE_DELAY) + if(this._state === FloatingIdleZAddition.STATE_DELAY) { - if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_BEFORE_ANIMATION) + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_BEFORE_ANIMATION) { this._state = FloatingIdleZAddition.STATE_FRAME_A; this._startTime = totalTimeRunning; @@ -122,9 +122,9 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if (this._state === FloatingIdleZAddition.STATE_FRAME_A) + if(this._state === FloatingIdleZAddition.STATE_FRAME_A) { - if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) { this._state = FloatingIdleZAddition.STATE_FRAME_B; this._startTime = totalTimeRunning; @@ -132,9 +132,9 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if (this._state === FloatingIdleZAddition.STATE_FRAME_B) + if(this._state === FloatingIdleZAddition.STATE_FRAME_B) { - if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) { this._state = FloatingIdleZAddition.STATE_FRAME_A; this._startTime = totalTimeRunning; @@ -142,7 +142,7 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if (this._asset) + if(this._asset) { sprite.texture = this._asset; sprite.alpha = 255; diff --git a/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts b/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts index ab84e24e..ae85ca3c 100644 --- a/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts @@ -29,9 +29,9 @@ export class GameClickTargetAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; - if (!this._asset) + if(!this._asset) { const newSprite = new Sprite(Texture.WHITE); diff --git a/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts index 763e8e60..ff218838 100644 --- a/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts @@ -29,7 +29,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; sprite.visible = true; sprite.relativeDepth = this._relativeDepth; @@ -41,7 +41,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition this._asset = this._visualization.getAvatarRenderAsset((this._status === AvatarGuideStatus.GUIDE) ? 'avatar_addition_user_guide_bubble' : 'avatar_addition_user_guide_requester_bubble'); - if (scale < 48) + if(scale < 48) { offsetX = -19; offsetY = -80; @@ -53,17 +53,17 @@ export class GuideStatusBubbleAddition implements IAvatarAddition offsetY = -120; } - if (this._visualization.posture === AvatarAction.POSTURE_SIT) + if(this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if (this._visualization.posture === AvatarAction.POSTURE_LAY) + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if (this._asset) + if(this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -74,7 +74,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if (this._asset && sprite) + if(this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts index 159966b9..327ca01f 100644 --- a/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts @@ -25,13 +25,13 @@ export class MutedBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; let additionScale = 64; let offsetX = 0; let offsetY = 0; - if (scale < 48) + if(scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted_small'); @@ -47,10 +47,10 @@ export class MutedBubbleAddition implements IAvatarAddition offsetY = -110; } - if (this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2); - else if (this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale; + if(this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2); + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale; - if (this._asset) + if(this._asset) { sprite.visible = true; sprite.texture = this._asset; @@ -66,7 +66,7 @@ export class MutedBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if (this._asset && sprite) + if(this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts index ca72fb2c..7517ebfc 100644 --- a/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts @@ -35,7 +35,7 @@ export class NumberBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; this._scale = scale; @@ -43,9 +43,9 @@ export class NumberBubbleAddition implements IAvatarAddition let offsetX = 0; let offsetY = 0; - if (this._number > 0) + if(this._number > 0) { - if (scale < 48) + if(scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number + '_small'); @@ -61,17 +61,17 @@ export class NumberBubbleAddition implements IAvatarAddition offsetY = -105; } - if (this._visualization.posture === AvatarAction.POSTURE_SIT) + if(this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if (this._visualization.posture === AvatarAction.POSTURE_LAY) + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if (this._asset) + if(this._asset) { sprite.visible = true; sprite.texture = this._asset; @@ -91,15 +91,15 @@ export class NumberBubbleAddition implements IAvatarAddition } else { - if (sprite.visible) this._numberValueFadeDirection = -1; + if(sprite.visible) this._numberValueFadeDirection = -1; } } public animate(sprite: IRoomObjectSprite): boolean { - if (!sprite) return false; + if(!sprite) return false; - if (this._asset) + if(this._asset) { sprite.texture = this._asset; } @@ -107,15 +107,15 @@ export class NumberBubbleAddition implements IAvatarAddition let alpha = sprite.alpha; let didAnimate = false; - if (this._numberValueMoving) + if(this._numberValueMoving) { this._numberValueMoveCounter++; - if (this._numberValueMoveCounter < 10) return false; + if(this._numberValueMoveCounter < 10) return false; - if (this._numberValueFadeDirection < 0) + if(this._numberValueFadeDirection < 0) { - if (this._scale < 48) + if(this._scale < 48) { sprite.offsetY -= 2; } @@ -128,9 +128,9 @@ export class NumberBubbleAddition implements IAvatarAddition { let count = 4; - if (this._scale < 48) count = 8; + if(this._scale < 48) count = 8; - if (!(this._numberValueMoveCounter % count)) + if(!(this._numberValueMoveCounter % count)) { sprite.offsetY--; @@ -139,11 +139,11 @@ export class NumberBubbleAddition implements IAvatarAddition } } - if (this._numberValueFadeDirection > 0) + if(this._numberValueFadeDirection > 0) { - if (alpha < 255) alpha += 32; + if(alpha < 255) alpha += 32; - if (alpha >= 255) + if(alpha >= 255) { alpha = 255; @@ -155,11 +155,11 @@ export class NumberBubbleAddition implements IAvatarAddition return true; } - if (this._numberValueFadeDirection < 0) + if(this._numberValueFadeDirection < 0) { - if (alpha >= 0) alpha -= 32; + if(alpha >= 0) alpha -= 32; - if (alpha <= 0) + if(alpha <= 0) { this._numberValueFadeDirection = 0; this._numberValueMoving = false; diff --git a/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts index 3f5909ae..87ae943b 100644 --- a/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts @@ -27,7 +27,7 @@ export class TypingBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if (!sprite) return; + if(!sprite) return; sprite.visible = true; sprite.relativeDepth = this._relativeDepth; @@ -37,7 +37,7 @@ export class TypingBubbleAddition implements IAvatarAddition let offsetX = 0; let offsetY = 0; - if (scale < 48) + if(scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing_small'); @@ -54,17 +54,17 @@ export class TypingBubbleAddition implements IAvatarAddition offsetY = -83; } - if (this._visualization.posture === AvatarAction.POSTURE_SIT) + if(this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if (this._visualization.posture === AvatarAction.POSTURE_LAY) + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if (this._asset) + if(this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -75,7 +75,7 @@ export class TypingBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if (this._asset && sprite) + if(this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/data/AnimationData.ts b/src/nitro/room/object/visualization/data/AnimationData.ts index 8dadac8c..32593aa7 100644 --- a/src/nitro/room/object/visualization/data/AnimationData.ts +++ b/src/nitro/room/object/visualization/data/AnimationData.ts @@ -45,9 +45,9 @@ export class AnimationData public dispose(): void { - for (const layer of this._layers.values()) + for(const layer of this._layers.values()) { - if (!layer) continue; + if(!layer) continue; layer.dispose(); } @@ -64,29 +64,29 @@ export class AnimationData public isImmediateChange(k: number): boolean { - if (!this._immediateChanges || (this._immediateChanges.indexOf(k) === -1)) return false; + if(!this._immediateChanges || (this._immediateChanges.indexOf(k) === -1)) return false; return true; } public getStartFrame(direction: number): number { - if (!this._randomStart) return 0; + if(!this._randomStart) return 0; return Math.random() * this._frameCount; } public initialize(k: IAssetVisualAnimation): boolean { - if (k.randomStart) this._randomStart = true; + if(k.randomStart) this._randomStart = true; - if (k.layers) + if(k.layers) { - for (const key in k.layers) + for(const key in k.layers) { const layer = k.layers[key]; - if (!layer) return false; + if(!layer) return false; const animationId = parseInt(key); @@ -94,7 +94,7 @@ export class AnimationData const frameRepeat = (layer.frameRepeat !== undefined) ? layer.frameRepeat : 1; const isRandom = ((layer.random !== undefined) && (layer.random !== 0)) ? true : false; - if (!this.addLayer(animationId, loopCount, frameRepeat, isRandom, layer)) return false; + if(!this.addLayer(animationId, loopCount, frameRepeat, isRandom, layer)) return false; } } @@ -105,26 +105,26 @@ export class AnimationData { const layerData = new AnimationLayerData(loopCount, frameRepeat, isRandom); - if (layer.frameSequences) + if(layer.frameSequences) { - for (const key in layer.frameSequences) + for(const key in layer.frameSequences) { const animationSequence = layer.frameSequences[key]; - if (!animationSequence) continue; + if(!animationSequence) continue; const loopCount = (animationSequence.loopCount !== undefined) ? animationSequence.loopCount : 1; const isSequenceRandom = ((animationSequence.random !== undefined) && (animationSequence.random !== 0)) ? true : false; const frame = layerData.addFrameSequence(loopCount, isSequenceRandom); - if (animationSequence.frames) + if(animationSequence.frames) { - for (const key in animationSequence.frames) + for(const key in animationSequence.frames) { const animationFrame = animationSequence.frames[key]; - if (!animationFrame) + if(!animationFrame) { layerData.dispose(); @@ -145,7 +145,7 @@ export class AnimationData const frameCount: number = layerData.frameCount; - if (frameCount > this._frameCount) this._frameCount = frameCount; + if(frameCount > this._frameCount) this._frameCount = frameCount; return true; } @@ -154,15 +154,15 @@ export class AnimationData { let directionalOffset: DirectionalOffsetData = null; - if (frame && frame.offsets) + if(frame && frame.offsets) { - for (const directionId in frame.offsets) + for(const directionId in frame.offsets) { const offset = frame.offsets[directionId]; - if (!offset) continue; + if(!offset) continue; - if (!directionalOffset) directionalOffset = new DirectionalOffsetData(); + if(!directionalOffset) directionalOffset = new DirectionalOffsetData(); directionalOffset.setDirection(offset.direction, offset.x, offset.y); } @@ -175,7 +175,7 @@ export class AnimationData { const layer = this._layers.get(layerId); - if (!layer) return null; + if(!layer) return null; return layer.getFrame(direction, frameCount); } @@ -184,7 +184,7 @@ export class AnimationData { const layer = this._layers.get(layerId); - if (!layer) return null; + if(!layer) return null; return layer.getFrameFromSequence(direction, sequenceId, offset, frameCount); } diff --git a/src/nitro/room/object/visualization/data/AnimationSizeData.ts b/src/nitro/room/object/visualization/data/AnimationSizeData.ts index 4b698e3f..c2d9d00d 100644 --- a/src/nitro/room/object/visualization/data/AnimationSizeData.ts +++ b/src/nitro/room/object/visualization/data/AnimationSizeData.ts @@ -20,9 +20,9 @@ export class AnimationSizeData extends SizeData { super.dispose(); - for (const animation of this._animations.values()) + for(const animation of this._animations.values()) { - if (!animation) continue; + if(!animation) continue; animation.dispose(); } @@ -34,13 +34,13 @@ export class AnimationSizeData extends SizeData public defineAnimations(animations: { [index: string]: IAssetVisualAnimation }): boolean { - if (!animations) return true; + if(!animations) return true; - for (const key in animations) + for(const key in animations) { const animation = animations[key]; - if (!animation) return false; + if(!animation) return false; let animationId = parseInt(key.split('_')[0]); let isTransition = false; @@ -48,13 +48,13 @@ export class AnimationSizeData extends SizeData const transitionTo = animation.transitionTo; const transitionFrom = animation.transitionFrom; - if (transitionTo !== undefined) + if(transitionTo !== undefined) { animationId = AnimationData.getTransitionToAnimationId(transitionTo); isTransition = true; } - if (transitionFrom !== undefined) + if(transitionFrom !== undefined) { animationId = AnimationData.getTransitionFromAnimationId(transitionFrom); isTransition = true; @@ -62,7 +62,7 @@ export class AnimationSizeData extends SizeData const animationData = this.createAnimationData(); - if (!animationData.initialize(animation)) + if(!animationData.initialize(animation)) { animationData.dispose(); @@ -71,16 +71,16 @@ export class AnimationSizeData extends SizeData const immediateChangeFrom = animation.immediateChangeFrom; - if (immediateChangeFrom !== undefined) + if(immediateChangeFrom !== undefined) { const changes = immediateChangeFrom.split(','); const changeIds = []; - for (const change of changes) + for(const change of changes) { const changeId = parseInt(change); - if (changeIds.indexOf(changeId) === -1) changeIds.push(changeId); + if(changeIds.indexOf(changeId) === -1) changeIds.push(changeId); } animationData.setImmediateChanges(changeIds); @@ -88,7 +88,7 @@ export class AnimationSizeData extends SizeData this._animations.set(animationId, animationData); - if (!isTransition) this._animationIds.push(animationId); + if(!isTransition) this._animationIds.push(animationId); } return true; @@ -101,7 +101,7 @@ export class AnimationSizeData extends SizeData public hasAnimation(animationId: number): boolean { - if (!this._animations.get(animationId)) return false; + if(!this._animations.get(animationId)) return false; return true; } @@ -115,7 +115,7 @@ export class AnimationSizeData extends SizeData { const totalAnimations = this.getAnimationCount(); - if ((animationId < 0) || (totalAnimations <= 0)) return 0; + if((animationId < 0) || (totalAnimations <= 0)) return 0; return this._animationIds[(animationId % totalAnimations)]; } @@ -124,7 +124,7 @@ export class AnimationSizeData extends SizeData { const animation = this._animations.get(animationId); - if (!animation) return false; + if(!animation) return false; return animation.isImmediateChange(_arg_2); } @@ -133,7 +133,7 @@ export class AnimationSizeData extends SizeData { const animation = this._animations.get(animationId); - if (!animation) return 0; + if(!animation) return 0; return animation.getStartFrame(direction); } @@ -142,7 +142,7 @@ export class AnimationSizeData extends SizeData { const animation = this._animations.get(animationId); - if (!animation) return null; + if(!animation) return null; return animation.getFrame(direction, layerId, frameCount); } @@ -151,7 +151,7 @@ export class AnimationSizeData extends SizeData { const animation = this._animations.get(animationId); - if (!animation) return null; + if(!animation) return null; return animation.getFrameFromSequence(direction, layerId, sequenceId, offset, frameCount); } diff --git a/src/nitro/room/object/visualization/data/PetSizeData.ts b/src/nitro/room/object/visualization/data/PetSizeData.ts index a254362a..f7263b6c 100644 --- a/src/nitro/room/object/visualization/data/PetSizeData.ts +++ b/src/nitro/room/object/visualization/data/PetSizeData.ts @@ -20,33 +20,33 @@ export class PetSizeData extends AnimationSizeData public processPostures(postures: { defaultPosture?: string, postures: IAssetPosture[] }): boolean { - if (!postures) return false; + if(!postures) return false; - if (postures.defaultPosture && postures.defaultPosture.length) this._defaultPosture = postures.defaultPosture; + if(postures.defaultPosture && postures.defaultPosture.length) this._defaultPosture = postures.defaultPosture; - if (!postures.postures) return false; + if(!postures.postures) return false; - for (const posture of postures.postures) + for(const posture of postures.postures) { - if (this._posturesToAnimations.get(posture.id)) continue; + if(this._posturesToAnimations.get(posture.id)) continue; - if (this._defaultPosture === null) this._defaultPosture = posture.id; + if(this._defaultPosture === null) this._defaultPosture = posture.id; this._posturesToAnimations.set(posture.id, posture.animationId); } - if (this._posturesToAnimations.get(this._defaultPosture) === undefined) return false; + if(this._posturesToAnimations.get(this._defaultPosture) === undefined) return false; return true; } public processGestures(gestures: IAssetGesture[]): boolean { - if (!gestures) return false; + if(!gestures) return false; - for (const gesture of gestures) + for(const gesture of gestures) { - if (this._gesturesToAnimations.get(gesture.id)) continue; + if(this._gesturesToAnimations.get(gesture.id)) continue; this._gesturesToAnimations.set(gesture.id, gesture.animationId); } @@ -56,38 +56,38 @@ export class PetSizeData extends AnimationSizeData public postureToAnimation(posture: string): number { - if (!this._posturesToAnimations.get(posture)) posture = this._defaultPosture; + if(!this._posturesToAnimations.get(posture)) posture = this._defaultPosture; return this._posturesToAnimations.get(posture); } public getGestureDisabled(k: string): boolean { - if (k === 'ded') return true; + if(k === 'ded') return true; return false; } public gestureToAnimation(gesture: string): number { - if (!this._gesturesToAnimations.get(gesture)) return PetSizeData.DEFAULT; + if(!this._gesturesToAnimations.get(gesture)) return PetSizeData.DEFAULT; return this._gesturesToAnimations.get(gesture); } public animationToPosture(k: number, _arg_2: boolean): string { - if ((k >= 0) && (k < this._posturesToAnimations.size)) + if((k >= 0) && (k < this._posturesToAnimations.size)) { const keys = this._posturesToAnimations.keys(); - for (; ;) + for(; ;) { const key = keys.next(); - if (key.done) return null; + if(key.done) return null; - if (k <= 0) return key.value; + if(k <= 0) return key.value; --k; } @@ -98,17 +98,17 @@ export class PetSizeData extends AnimationSizeData public animationToGesture(index: number): string { - if ((index >= 0) && (index < this._gesturesToAnimations.size)) + if((index >= 0) && (index < this._gesturesToAnimations.size)) { const keys = this._gesturesToAnimations.keys(); - for (; ;) + for(; ;) { const key = keys.next(); - if (key.done) return null; + if(key.done) return null; - if (index <= 0) return key.value; + if(index <= 0) return key.value; --index; } @@ -119,9 +119,9 @@ export class PetSizeData extends AnimationSizeData public getGestureForAnimationId(k: number): string { - for (const _local_2 of this._gesturesToAnimations.keys()) + for(const _local_2 of this._gesturesToAnimations.keys()) { - if (this._gesturesToAnimations.get(_local_2) === k) return _local_2; + if(this._gesturesToAnimations.get(_local_2) === k) return _local_2; } return null; diff --git a/src/nitro/room/object/visualization/data/SizeData.ts b/src/nitro/room/object/visualization/data/SizeData.ts index 7420b390..e37ec689 100644 --- a/src/nitro/room/object/visualization/data/SizeData.ts +++ b/src/nitro/room/object/visualization/data/SizeData.ts @@ -31,18 +31,18 @@ export class SizeData public dispose(): void { - if (this._defaultDirection) this._defaultDirection.dispose(); + if(this._defaultDirection) this._defaultDirection.dispose(); - for (const direction of this._directions.values()) + for(const direction of this._directions.values()) { - if (!direction) continue; + if(!direction) continue; direction.dispose(); } - for (const color of this._colors) + for(const color of this._colors) { - if (!color) continue; + if(!color) continue; color.dispose(); } @@ -62,24 +62,24 @@ export class SizeData public processLayers(layers: { [index: string]: IAssetVisualizationLayer }): boolean { - if (!layers) return false; + if(!layers) return false; return this.setDirectionLayers(this._defaultDirection, layers); } public processDirections(directions: { [index: string]: IAssetVisualizationDirection }): boolean { - if (!directions) return false; + if(!directions) return false; - for (const key in directions) + for(const key in directions) { const direction = directions[key]; - if (!direction) continue; + if(!direction) continue; const directionNumber = parseInt(key); - if (this._directions.get(directionNumber)) return false; + if(this._directions.get(directionNumber)) return false; const directionData = new DirectionData(this._layerCount); @@ -98,25 +98,25 @@ export class SizeData public processColors(colors: { [index: string]: IAssetColor }): boolean { - if (!colors) return false; + if(!colors) return false; - for (const key in colors) + for(const key in colors) { const color = colors[key]; - if (!color) continue; + if(!color) continue; const colorNumber = parseInt(key); - if (this._colors[colorNumber]) return false; + if(this._colors[colorNumber]) return false; const colorData = new ColorData(this._layerCount); - for (const layer in color.layers) + for(const layer in color.layers) { const colorLayer = color.layers[layer]; - if (!colorLayer) continue; + if(!colorLayer) continue; const layerId = parseInt(layer); const colorId = colorLayer.color; @@ -132,31 +132,31 @@ export class SizeData private setDirectionLayers(directionData: DirectionData, layers: { [index: string]: IAssetVisualizationLayer }): boolean { - if (!directionData || !layers) return false; + if(!directionData || !layers) return false; - for (const key in layers) + for(const key in layers) { const layer = layers[key]; - if (!layer) continue; + if(!layer) continue; const layerId = parseInt(key); - if (layerId < 0 || (layerId >= this._layerCount)) return false; + if(layerId < 0 || (layerId >= this._layerCount)) return false; - if (layer.ink !== undefined) directionData.setLayerInk(layerId, SpriteUtilities.inkToBlendMode(layer.ink)); + if(layer.ink !== undefined) directionData.setLayerInk(layerId, SpriteUtilities.inkToBlendMode(layer.ink)); - if (layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag); + if(layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag); - if (layer.alpha !== undefined) directionData.setLayerAlpha(layerId, layer.alpha); + if(layer.alpha !== undefined) directionData.setLayerAlpha(layerId, layer.alpha); - if (layer.ignoreMouse !== undefined) directionData.setLayerIgnoreMouse(layerId, layer.ignoreMouse); + if(layer.ignoreMouse !== undefined) directionData.setLayerIgnoreMouse(layerId, layer.ignoreMouse); - if (layer.x !== undefined) directionData.setLayerXOffset(layerId, layer.x); + if(layer.x !== undefined) directionData.setLayerXOffset(layerId, layer.x); - if (layer.y !== undefined) directionData.setLayerYOffset(layerId, layer.y); + if(layer.y !== undefined) directionData.setLayerYOffset(layerId, layer.y); - if (layer.z !== undefined) directionData.setLayerZOffset(layerId, (layer.z / -1000)); + if(layer.z !== undefined) directionData.setLayerZOffset(layerId, (layer.z / -1000)); } return true; @@ -166,38 +166,38 @@ export class SizeData { const existing = this._directions.get(direction); - if (existing) return direction; + if(existing) return direction; direction = (((direction % 360) + 360) % 360); let currentAngle = -1; let validDirection = -1; - for (const key of this._directions.keys()) + for(const key of this._directions.keys()) { let angle = ((((key * this._angle) - direction) + 360) % 360); - if (angle > 180) angle = (360 - angle); + if(angle > 180) angle = (360 - angle); - if ((angle < currentAngle) || (currentAngle < 0)) + if((angle < currentAngle) || (currentAngle < 0)) { currentAngle = angle; validDirection = key; } } - if (validDirection >= 0) return Math.trunc(validDirection); + if(validDirection >= 0) return Math.trunc(validDirection); return 0; } public getDirectionData(direction: number): DirectionData { - if (direction === this._lastDirection && this._lastDirectionData) return this._lastDirectionData; + if(direction === this._lastDirection && this._lastDirectionData) return this._lastDirectionData; let directionData = this._directions.get(direction); - if (!directionData) directionData = this._defaultDirection; + if(!directionData) directionData = this._defaultDirection; this._lastDirection = direction; this._lastDirectionData = directionData; @@ -209,7 +209,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_TAG; + if(!directionData) return LayerData.DEFAULT_TAG; return directionData.getLayerTag(layerId); } @@ -218,7 +218,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_INK; + if(!directionData) return LayerData.DEFAULT_INK; return directionData.getLayerInk(layerId); } @@ -227,7 +227,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_ALPHA; + if(!directionData) return LayerData.DEFAULT_ALPHA; return directionData.getLayerAlpha(layerId); } @@ -236,7 +236,7 @@ export class SizeData { const existing = this._colors[colorId] as ColorData; - if (!existing) return ColorData.DEFAULT_COLOR; + if(!existing) return ColorData.DEFAULT_COLOR; return existing.getLayerColor(layerId); } @@ -245,7 +245,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_IGNORE_MOUSE; + if(!directionData) return LayerData.DEFAULT_IGNORE_MOUSE; return directionData.getLayerIgnoreMouse(layerId); } @@ -254,7 +254,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_XOFFSET; + if(!directionData) return LayerData.DEFAULT_XOFFSET; return directionData.getLayerXOffset(layerId); } @@ -263,7 +263,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_YOFFSET; + if(!directionData) return LayerData.DEFAULT_YOFFSET; return directionData.getLayerYOffset(layerId); } @@ -272,7 +272,7 @@ export class SizeData { const directionData = this.getDirectionData(direction); - if (!directionData) return LayerData.DEFAULT_ZOFFSET; + if(!directionData) return LayerData.DEFAULT_ZOFFSET; return directionData.getLayerZOffset(layerId); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts index 7691e29d..1d7b310b 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts @@ -33,7 +33,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization public initialize(data: IObjectVisualizationData): boolean { - if (!(data instanceof FurnitureAnimatedVisualizationData)) return false; + if(!(data instanceof FurnitureAnimatedVisualizationData)) return false; return super.initialize(data); } @@ -42,7 +42,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { super.dispose(); - if (this._animationData) + if(this._animationData) { this._animationData.dispose(); @@ -62,18 +62,18 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected getAnimationId(animationData: AnimationStateData): number { - if ((this.animationId !== FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID) && this._data.hasAnimation(this._animationScale, this.animationId)) return this.animationId; + if((this.animationId !== FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID) && this._data.hasAnimation(this._animationScale, this.animationId)) return this.animationId; return FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID; } protected updateObject(scale: number, direction: number): boolean { - if (super.updateObject(scale, direction)) + if(super.updateObject(scale, direction)) { const state = this.object.getState(0); - if (state !== this._state) + if(state !== this._state) { this.setAnimation(state); @@ -90,13 +90,13 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateModel(scale: number): boolean { - if (super.updateModel(scale)) + if(super.updateModel(scale)) { - if (this.usesAnimationResetting()) + if(this.usesAnimationResetting()) { const updateTime = this.object.model.getValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME); - if (updateTime > this._animationChangeTime) + if(updateTime > this._animationChangeTime) { this._animationChangeTime = updateTime; @@ -106,7 +106,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const state = this.object.model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); - if (!isNaN(state)) + if(!isNaN(state)) { const animationId = this._data.getAnimationId(this._animationScale, state); @@ -121,11 +121,11 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization private isPlayingTransition(animationData: AnimationStateData, animationId: number): boolean { - if (!AnimationData.isTransitionFromAnimation(animationData.animationId) && !AnimationData.isTransitionToAnimation(animationData.animationId)) return false; + if(!AnimationData.isTransitionFromAnimation(animationData.animationId) && !AnimationData.isTransitionToAnimation(animationData.animationId)) return false; - if (animationId !== animationData.animationAfterTransitionId) return false; + if(animationId !== animationData.animationAfterTransitionId) return false; - if (animationData.animationOver) return false; + if(animationData.animationOver) return false; return true; } @@ -134,14 +134,14 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const animationId = animationData.animationId; - if (!AnimationData.isTransitionFromAnimation(animationId) && !AnimationData.isTransitionToAnimation(animationId)) return animationId; + if(!AnimationData.isTransitionFromAnimation(animationId) && !AnimationData.isTransitionToAnimation(animationId)) return animationId; return animationData.animationAfterTransitionId; } protected setAnimation(animationId: number): void { - if (!this._data) return; + if(!this._data) return; this.setSubAnimation(this._animationData, animationId, (this._state >= 0)); } @@ -150,19 +150,19 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const currentAnimation = animationData.animationId; - if (_arg_3) + if(_arg_3) { - if (this.isPlayingTransition(animationData, animationId)) return false; + if(this.isPlayingTransition(animationData, animationId)) return false; const state = this.getCurrentState(animationData); - if (animationId !== state) + if(animationId !== state) { - if (!this._data.isImmediateChange(this._animationScale, animationId, state)) + if(!this._data.isImmediateChange(this._animationScale, animationId, state)) { let transition = AnimationData.getTransitionFromAnimationId(state); - if (this._data.hasAnimation(this._animationScale, transition)) + if(this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -171,7 +171,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { transition = AnimationData.getTransitionToAnimationId(animationId); - if (this._data.hasAnimation(this._animationScale, transition)) + if(this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -181,24 +181,24 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization } else { - if (AnimationData.isTransitionFromAnimation(animationData.animationId)) + if(AnimationData.isTransitionFromAnimation(animationData.animationId)) { const transition = AnimationData.getTransitionToAnimationId(animationId); - if (this._data.hasAnimation(this._animationScale, transition)) + if(this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; } } - else if (!AnimationData.isTransitionToAnimation(animationData.animationId)) + else if(!AnimationData.isTransitionToAnimation(animationData.animationId)) { - if (this.usesAnimationResetting()) + if(this.usesAnimationResetting()) { const transition = AnimationData.getTransitionFromAnimationId(state); - if (this._data.hasAnimation(this._animationScale, transition)) + if(this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -207,7 +207,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const transition = AnimationData.getTransitionToAnimationId(animationId); - if (this._data.hasAnimation(this._animationScale, transition)) + if(this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -218,7 +218,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization } } - if (currentAnimation !== animationId) + if(currentAnimation !== animationId) { animationData.animationId = animationId; @@ -235,16 +235,16 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected resetAllAnimationFrames(): void { - if (!this._animationData) return; + if(!this._animationData) return; this._animationData.setLayerCount(this._animatedLayerCount); } protected updateAnimation(scale: number): number { - if (!this._data) return 0; + if(!this._data) return 0; - if (scale !== this._animationScale) + if(scale !== this._animationScale) { this._animationScale = scale; this._animatedLayerCount = this._data.getLayerCount(scale); @@ -261,13 +261,13 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateAnimations(scale: number): number { - if (this._animationData.animationOver && !this._directionChanged) return 0; + if(this._animationData.animationOver && !this._directionChanged) return 0; const update = this.updateFramesForAnimation(this._animationData, scale); - if (this._animationData.animationOver) + if(this._animationData.animationOver) { - if ((AnimationData.isTransitionFromAnimation(this._animationData.animationId)) || (AnimationData.isTransitionToAnimation(this._animationData.animationId))) + if((AnimationData.isTransitionFromAnimation(this._animationData.animationId)) || (AnimationData.isTransitionToAnimation(this._animationData.animationId))) { this.setAnimation(this._animationData.animationAfterTransitionId); this._animationData.animationOver = false; @@ -279,12 +279,12 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateFramesForAnimation(animationData: AnimationStateData, scale: number): number { - if (animationData.animationOver && !this._directionChanged) return 0; + if(animationData.animationOver && !this._directionChanged) return 0; const animationId = this.getAnimationId(animationData); let frameCount = animationData.frameCounter; - if (!frameCount) frameCount = this._data.getStartFrame(scale, animationId, this._direction); + if(!frameCount) frameCount = this._data.getStartFrame(scale, animationId, this._direction); frameCount += this.frameIncrease; animationData.frameCounter = frameCount; @@ -295,32 +295,32 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization let update = 0; let layerUpdate = (1 << (this._animatedLayerCount - 1)); - while (layerId >= 0) + while(layerId >= 0) { let sequenceId = 0; animationPlayed = animationData.getAnimationPlayed(layerId); - if (!animationPlayed || this._directionChanged) + if(!animationPlayed || this._directionChanged) { let lastFramePlayed = animationData.getLastFramePlayed(layerId); let frame = animationData.getFrame(layerId); - if (frame) + if(frame) { - if (frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) + if(frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) { lastFramePlayed = true; } } - if ((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) + if((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) { sequenceId = AnimationFrame.SEQUENCE_NOT_DEFINED; - if (frame) sequenceId = frame.activeSequence; + if(frame) sequenceId = frame.activeSequence; - if (sequenceId === AnimationFrame.SEQUENCE_NOT_DEFINED) + if(sequenceId === AnimationFrame.SEQUENCE_NOT_DEFINED) { frame = this._data.getFrame(scale, animationId, this._direction, layerId, frameCount); } @@ -334,7 +334,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization update = (update | layerUpdate); } - if (!frame || (frame.remainingFrameRepeats == AnimationFrame.FRAME_REPEAT_FOREVER)) + if(!frame || (frame.remainingFrameRepeats == AnimationFrame.FRAME_REPEAT_FOREVER)) { lastFramePlayed = true; animationPlayed = true; @@ -360,7 +360,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const currentFrame = this._animationData.getFrame(layerId); - if (!currentFrame) return super.getFrameNumber(scale, layerId); + if(!currentFrame) return super.getFrameNumber(scale, layerId); return currentFrame.id; } @@ -371,7 +371,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const currentFrame = this._animationData.getFrame(layerId); - if (!currentFrame) return offset; + if(!currentFrame) return offset; return (offset + currentFrame.x); } @@ -382,7 +382,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const currentFrame = this._animationData.getFrame(layerId); - if (!currentFrame) return offset; + if(!currentFrame) return offset; return (offset + currentFrame.y); } @@ -394,7 +394,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected setDirection(direction: number): void { - if (this._direction === direction) return; + if(this._direction === direction) return; super.setDirection(direction); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts index f3e33c3d..675d19bc 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts @@ -10,15 +10,15 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean { - if (!sizeData || !key || !data) return false; + if(!sizeData || !key || !data) return false; - switch (key) + switch(key) { case 'animations': - if (!(sizeData instanceof AnimationSizeData) || !sizeData.defineAnimations(data)) return false; + if(!(sizeData instanceof AnimationSizeData) || !sizeData.defineAnimations(data)) return false; break; default: - if (!super.processVisualElement(sizeData, key, data)) return false; + if(!super.processVisualElement(sizeData, key, data)) return false; break; } @@ -29,7 +29,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.hasAnimation(animationId); } @@ -38,7 +38,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.getAnimationCount(); } @@ -47,7 +47,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.getAnimationId(animationId); } @@ -56,7 +56,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.isImmediateChange(animationId, _arg_3); } @@ -65,7 +65,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.getStartFrame(animationId, direction); } @@ -74,7 +74,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.getFrame(animationId, direction, layerId, frameCount); } @@ -83,7 +83,7 @@ export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationDa { const size = this.getSizeData(scale) as AnimationSizeData; - if (!size) return null; + if(!size) return null; return size.getFrameFromSequence(animationId, direction, layerId, sequenceId, offset, frameCount); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts index d8c28eff..ba2169b6 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts @@ -27,22 +27,22 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali const badgeStatus = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS); const badgeId = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME); - if (badgeStatus === -1) + if(badgeStatus === -1) { this._badgeAssetNameNormalScale = ''; this._badgeAssetNameSmallScale = ''; } - else if ((badgeStatus === 1) && (badgeId !== this._badgeId)) + else if((badgeStatus === 1) && (badgeId !== this._badgeId)) { this._badgeId = badgeId; this._badgeAssetNameNormalScale = this._badgeId; - if (this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32'; + if(this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32'; const visibleInState = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE); - if (!isNaN(visibleInState)) this._badgeVisibleInState = visibleInState; + if(!isNaN(visibleInState)) this._badgeVisibleInState = visibleInState; updateModel = true; } @@ -54,9 +54,9 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali { const tag = this.getLayerTag(scale, this.direction, layerId); - if ((tag !== FurnitureBadgeDisplayVisualization.BADGE) || ((this._badgeVisibleInState !== -1) && (this.object.getState(0) !== this._badgeVisibleInState))) return super.getSpriteAssetName(scale, layerId); + if((tag !== FurnitureBadgeDisplayVisualization.BADGE) || ((this._badgeVisibleInState !== -1) && (this.object.getState(0) !== this._badgeVisibleInState))) return super.getSpriteAssetName(scale, layerId); - if (scale === 32) return this._badgeAssetNameSmallScale; + if(scale === 32) return this._badgeAssetNameSmallScale; return this._badgeAssetNameNormalScale; } @@ -65,13 +65,13 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali { let offset = super.getLayerXOffset(scale, direction, layerId); - if (this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) + if(this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) { const asset = this.getAsset(((scale === 32) ? this._badgeAssetNameSmallScale : this._badgeAssetNameNormalScale), layerId); - if (asset) + if(asset) { - if (scale === 64) offset += ((40 - asset.width) / 2); + if(scale === 64) offset += ((40 - asset.width) / 2); else offset += ((20 - asset.width) / 2); } } @@ -83,13 +83,13 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali { let offset = super.getLayerYOffset(scale, direction, layerId); - if (this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) + if(this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) { const asset = this.getAsset(((scale === 32) ? this._badgeAssetNameSmallScale : this._badgeAssetNameNormalScale), layerId); - if (asset) + if(asset) { - if (scale === 64) offset += ((40 - asset.height) / 2); + if(scale === 64) offset += ((40 - asset.height) / 2); else offset += ((20 - asset.height) / 2); } } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts index bf6a6b67..129a02b8 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts @@ -45,7 +45,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization { super.dispose(); - if (this._imageUrl) + if(this._imageUrl) { (this.asset && this.asset.disposeAsset(this._imageUrl)); // dispose all @@ -54,9 +54,9 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization protected updateObject(scale: number, direction: number): boolean { - if (!super.updateObject(scale, direction)) return false; + if(!super.updateObject(scale, direction)) return false; - if (this._imageReady) this.checkAndCreateImageForCurrentState(); + if(this._imageReady) this.checkAndCreateImageForCurrentState(); return true; } @@ -65,7 +65,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization { const flag = super.updateModel(scale); - if (flag) + if(flag) { this._offsetX = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X) || 0); this._offsetY = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y) || 0); @@ -73,11 +73,11 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization this._isAnimated = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IS_ANIMATED) || false); } - if (!this._imageReady) + if(!this._imageReady) { this._imageReady = this.checkIfImageReady(); - if (this._imageReady) + if(this._imageReady) { this.checkAndCreateImageForCurrentState(); @@ -86,7 +86,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization } else { - if (this.checkIfImageChanged()) + if(this.checkIfImageChanged()) { this._imageReady = false; this._imageUrl = null; @@ -102,9 +102,9 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization { const imageUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); - if (imageUrl && (imageUrl === this._imageUrl)) return false; + if(imageUrl && (imageUrl === this._imageUrl)) return false; - if (this._gifCollection) + if(this._gifCollection) { // } @@ -120,25 +120,25 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization { const model = this.object && this.object.model; - if (!model) return false; + if(!model) return false; const imageUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); - if (!imageUrl) return false; + if(!imageUrl) return false; - if (this._imageUrl && (this._imageUrl === imageUrl)) return false; + if(this._imageUrl && (this._imageUrl === imageUrl)) return false; const imageStatus = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS); - if (imageStatus === 1) + if(imageStatus === 1) { let texture: Texture = null; - if (this._isAnimated) + if(this._isAnimated) { const gifCollection = Nitro.instance.roomEngine.roomContentLoader.getGifCollection(imageUrl); - if (gifCollection) + if(gifCollection) { this._gifCollection = gifCollection; @@ -150,7 +150,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization texture = Nitro.instance.core.asset.getTexture(imageUrl); } - if (!texture) return false; + if(!texture) return false; this.imageReady(texture, imageUrl); @@ -162,7 +162,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization protected imageReady(texture: Texture, imageUrl: string): void { - if (!texture) + if(!texture) { this._imageUrl = null; @@ -174,18 +174,18 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization protected checkAndCreateImageForCurrentState(): void { - if (this._isAnimated) + if(this._isAnimated) { this.buildAssetsForGif(); return; } - if (!this._imageUrl) return; + if(!this._imageUrl) return; const texture = Nitro.instance.core.asset.getTexture(this._imageUrl); - if (!texture) return; + if(!texture) return; const state = this.object.getState(0); @@ -194,21 +194,21 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization protected buildAssetsForGif(): void { - if (!this._gifCollection) return; + if(!this._gifCollection) return; const textures = this._gifCollection.textures; const durations = this._gifCollection.durations; - if (!textures.length || !durations.length || (textures.length !== durations.length)) return; + if(!textures.length || !durations.length || (textures.length !== durations.length)) return; const state = this.object.getState(0); - for (let i = 0; i < textures.length; i++) + for(let i = 0; i < textures.length; i++) { const texture = textures[i]; const duration = durations[i]; - if (!texture) continue; + if(!texture) continue; this.addBackgroundAsset(texture, state, i); } @@ -224,7 +224,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization let flipH = false; let flipV = false; - switch (state) + switch(state) { case FurnitureBrandedImageVisualization.STATE_0: x = 0; @@ -259,7 +259,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization { const tag = this.getLayerTag(scale, this._direction, layerId); - if ((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) { return `${this._imageUrl}_${this.getFrameNumber(scale, layerId)}`; } @@ -269,22 +269,22 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization protected updateAnimation(scale: number): number { - if (!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; + if(!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; return 1; } protected getFrameNumber(scale: number, layerId: number): number { - if (!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; + if(!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; const tag = this.getLayerTag(scale, this._direction, layerId); - if ((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) { let newFrame = this._currentFrame; - if (newFrame < 0) + if(newFrame < 0) { newFrame = 0; } @@ -293,7 +293,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization newFrame += 1; } - if (newFrame === this._totalFrames) newFrame = 0; + if(newFrame === this._totalFrames) newFrame = 0; this._currentFrame = newFrame; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts index 952acff9..99efd9fc 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts @@ -16,15 +16,15 @@ export class FurnitureExternalImageVisualization extends FurnitureDynamicThumbna protected getThumbnailURL(): string { - if (!this.object) return null; + if(!this.object) return null; - if (this._url) return this._url; + if(this._url) return this._url; const jsonString = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); - if (!jsonString || jsonString === '') return null; + if(!jsonString || jsonString === '') return null; - if (this.object.type.indexOf('') >= 0) + if(this.object.type.indexOf('') >= 0) { this._typePrefix = (this.object.type.indexOf('') >= 0) ? '' : 'postcards/selfie/'; } @@ -44,7 +44,7 @@ export class FurnitureExternalImageVisualization extends FurnitureDynamicThumbna { url = url.replace('.png', '_small.png'); - if (url.indexOf('.png') === -1) url = (url + '_small.png'); + if(url.indexOf('.png') === -1) url = (url + '_small.png'); return url; } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts index db337c12..e980c75a 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts @@ -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/FurnitureGiftWrappedFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts index 89a61b83..66cce6aa 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts @@ -20,7 +20,7 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor private updatePresentWrap(): void { - if (!this.object) return; + if(!this.object) return; const local3 = 1000; const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); @@ -35,11 +35,11 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor public getFrameNumber(scale: number, layerId: number): number { - if (this._lastAnimationId === FurnitureGiftWrappedFireworksVisualization.PRESENT_DEFAULT_STATE) + if(this._lastAnimationId === FurnitureGiftWrappedFireworksVisualization.PRESENT_DEFAULT_STATE) { - if (layerId <= 1) return this._packetType; + if(layerId <= 1) return this._packetType; - if (layerId === 2) return this._ribbonType; + if(layerId === 2) return this._ribbonType; } return super.getFrameNumber(scale, layerId); @@ -52,7 +52,7 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor let assetName = this._type; let layerCode = ''; - if (layerId < (this.spriteCount - 1)) + if(layerId < (this.spriteCount - 1)) { layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts index 7bc84ea7..4826501b 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts @@ -15,7 +15,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization private updatePresentWrap(): void { - if (!this.object) return; + if(!this.object) return; const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); @@ -28,7 +28,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization public getFrameNumber(scale: number, layerId: number): number { - if (layerId <= 1) return this._packetType; + if(layerId <= 1) return this._packetType; return this._ribbonType; } @@ -40,7 +40,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization let assetName = this._type; let layerCode = ''; - if (layerId < (this.spriteCount - 1)) + if(layerId < (this.spriteCount - 1)) { layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts index 1b273f2f..0d3bb42d 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts @@ -28,11 +28,11 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu { const flag = super.updateModel(scale); - if (this._badgeAssetNameNormalScale === '') + if(this._badgeAssetNameNormalScale === '') { const assetName = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); - if (assetName) + if(assetName) { this._badgeAssetNameNormalScale = assetName; this._badgeAssetNameSmallScale = (this._badgeAssetNameNormalScale + '_32'); @@ -54,7 +54,7 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu { const tag = this.getLayerTag(scale, this._direction, layerId); - switch (tag) + switch(tag) { case FurnitureGuildCustomizedVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1; case FurnitureGuildCustomizedVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2; @@ -67,9 +67,9 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu { const tag = this.getLayerTag(scale, this._direction, layerId); - if (tag === FurnitureGuildCustomizedVisualization.BADGE) + if(tag === FurnitureGuildCustomizedVisualization.BADGE) { - if (scale === 32) return this._badgeAssetNameSmallScale; + if(scale === 32) return this._badgeAssetNameSmallScale; return this._badgeAssetNameNormalScale; } @@ -79,7 +79,7 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string { - if (sprite.tag === FurnitureGuildCustomizedVisualization.BADGE) + if(sprite.tag === FurnitureGuildCustomizedVisualization.BADGE) { return '%group.badge.url%' + sprite.libraryAssetName.replace('badge_', ''); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts index 1d957036..b6434c66 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts @@ -15,11 +15,11 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur { const flag = super.updateModel(scale); - if (!this.hasThumbnailImage) + if(!this.hasThumbnailImage) { const assetName = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); - if (assetName && assetName.length) this.setThumbnailImages(this.getBitmapAsset(assetName)); + if(assetName && assetName.length) this.setThumbnailImages(this.getBitmapAsset(assetName)); } const color1 = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1); @@ -37,7 +37,7 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur { const tag = this.getLayerTag(scale, this._direction, layerId); - switch (tag) + switch(tag) { case FurnitureGuildIsometricBadgeVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1; case FurnitureGuildIsometricBadgeVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2; @@ -48,9 +48,9 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string { - if (sprite.tag === FurnitureGuildIsometricBadgeVisualization.THUMBNAIL) + if(sprite.tag === FurnitureGuildIsometricBadgeVisualization.THUMBNAIL) { - if (this.object && this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME)) + if(this.object && this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME)) { return '%group.badge.url%' + this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); } @@ -63,7 +63,7 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur { const asset = this.asset.getAsset(name); - if (!asset || !asset.texture) return null; + if(!asset || !asset.texture) return null; return asset.texture; } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts index 74cbe1e9..3396e1ee 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts @@ -12,27 +12,27 @@ export class FurnitureIsometricBBVisualization extends FurnitureBBVisualization protected transformGifTextures(asset: IGraphicAsset): void { - if (!this._gifCollection) return; + if(!this._gifCollection) return; const textures = this._gifCollection.textures; - if (!textures.length) return; + if(!textures.length) return; - for (let i = 0; i < textures.length; i++) + for(let i = 0; i < textures.length; i++) { const texture = textures[i]; - if (!texture) continue; + if(!texture) continue; const existingAsset = this.getAsset(`${this._imageUrl}_${i}`); - if (!existingAsset) continue; + if(!existingAsset) continue; const scale = 1.1; const matrix = new Matrix(); const difference = (asset.width / texture.width); - switch (this.direction) + switch(this.direction) { case 2: matrix.a = difference; @@ -86,7 +86,7 @@ export class FurnitureIsometricBBVisualization extends FurnitureBBVisualization const matrix = new Matrix(); const difference = (asset.width / texture.width); - switch (this.direction) + switch(this.direction) { case 2: matrix.a = difference; @@ -144,11 +144,11 @@ export class FurnitureIsometricBBVisualization extends FurnitureBBVisualization { const tag = this.getLayerTag(scale, this._direction, layerId); - if ((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) { - if (this._needsTransform) + if(this._needsTransform) { - if (this._isAnimated) + if(this._isAnimated) { this.transformGifTextures(this.getAsset(super.getSpriteAssetName(scale, layerId))); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts index a92c1494..c27c1fb1 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts @@ -36,18 +36,18 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl public initialize(data: IObjectVisualizationData): boolean { - if (!(data instanceof FurnitureMannequinVisualizationData)) return false; + if(!(data instanceof FurnitureMannequinVisualizationData)) return false; return super.initialize(data); } public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; this._disposed = true; - if (this._dynamicAssetName && this.asset) + if(this._dynamicAssetName && this.asset) { this.asset.disposeAsset(this._dynamicAssetName); @@ -61,9 +61,9 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const updateObject = super.updateObject(scale, direction); - if (updateObject) + if(updateObject) { - if (this._mannequinScale !== scale) + if(this._mannequinScale !== scale) { this._mannequinScale = scale; @@ -78,11 +78,11 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { let updateModel = super.updateModel(scale); - if (updateModel) + if(updateModel) { const figure = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_FIGURE) || null); - if (figure) + if(figure) { this._figure = (figure + '.' + this._placeHolderFigure); this._gender = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_GENDER) || null); @@ -100,15 +100,15 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl private updateAvatar(forceUpdate: boolean = false): void { - if (!this.avatarExists() || forceUpdate) + if(!this.avatarExists() || forceUpdate) { const avatarImage = this._data.createAvatarImage(this._figure, this._mannequinScale, this._gender, this); - if (avatarImage) + if(avatarImage) { avatarImage.setDirection(AvatarSetType.FULL, this.direction); - if (this._dynamicAssetName) this.asset.disposeAsset(this._dynamicAssetName); + if(this._dynamicAssetName) this.asset.disposeAsset(this._dynamicAssetName); this.asset.addAsset(this.getAvatarAssetName(), avatarImage.getImage(AvatarSetType.FULL, false, 1, false), true); @@ -132,14 +132,14 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl public resetFigure(figure: string): void { - if (figure === this._figure) this.updateAvatar(true); + if(figure === this._figure) this.updateAvatar(true); } protected getSpriteAssetName(scale: number, layerId: number): string { const tag = this.getLayerTag(scale, this.direction, layerId); - if (this._figure && (tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) + if(this._figure && (tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) { return this.getAvatarAssetName(); } @@ -151,7 +151,7 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const tag = this.getLayerTag(scale, direction, layerId); - if ((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return (-(this.getSprite(layerId).width) / 2); + if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return (-(this.getSprite(layerId).width) / 2); return super.getLayerXOffset(scale, direction, layerId); } @@ -160,7 +160,7 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const tag = this.getLayerTag(scale, direction, layerId); - if ((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return -(this.getSprite(layerId).height); + if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return -(this.getSprite(layerId).height); return super.getLayerYOffset(scale, direction, layerId); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts index b5f33199..2db37dbc 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts @@ -17,7 +17,7 @@ export class FurnitureMannequinVisualizationData extends FurnitureVisualizationD { super.dispose(); - if (this._avatarData) + if(this._avatarData) { this._avatarData.dispose(); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 1d0acc84..30a6e346 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -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/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts index ab721a7c..5fce0acb 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts @@ -39,7 +39,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti public dispose(): void { - for (const k of this._particles) k.dispose(); + for(const k of this._particles) k.dispose(); this._particles = null; this._particleConfigurations = null; @@ -65,7 +65,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti public reset(): void { - for (const particle of this._particles) particle.dispose(); + for(const particle of this._particles) particle.dispose(); this._particles = []; this._emittedParticles = 0; @@ -106,24 +106,24 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti { this._hasIgnited = true; - if (this._emittedParticles < this._maxNumberOfParticles) + if(this._emittedParticles < this._maxNumberOfParticles) { - if (this.age > 1) this.releaseParticles(this, this.direction); + if(this.age > 1) this.releaseParticles(this, this.direction); } } private releaseParticles(particle: FurnitureParticleSystemParticle, direction: Vector3D = null): void { - if (!direction) direction = new Vector3D(); + if(!direction) direction = new Vector3D(); const newDirection = new Vector3D(); const randomParticle = this.getRandomParticleConfiguration(); let i = 0; - while (i < this._particlesPerFrame) + while(i < this._particlesPerFrame) { - switch (this._explosionShape) + switch(this._explosionShape) { case FurnitureParticleSystemEmitter.CONE: newDirection.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); @@ -151,7 +151,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti let fade = false; let frames: IGraphicAsset[] = []; - if (randomParticle) + if(randomParticle) { lifeTime = Math.floor(((Math.random() * randomParticle.lifeTime) + 10)); isEmitter = randomParticle.isEmitter; @@ -189,15 +189,15 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti this.verlet(); this.satisfyConstraints(); - if (!this.isAlive && (this._emittedParticles < this._maxNumberOfParticles)) + if(!this.isAlive && (this._emittedParticles < this._maxNumberOfParticles)) { - if ((this.age % this._burstPulse) === 0) this.releaseParticles(this, this.direction); + if((this.age % this._burstPulse) === 0) this.releaseParticles(this, this.direction); } } public verlet(): void { - if (this.isAlive || (this._emittedParticles < this._maxNumberOfParticles)) + if(this.isAlive || (this._emittedParticles < this._maxNumberOfParticles)) { const x = this.x; const y = this.y; @@ -213,7 +213,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti const particles: FurnitureParticleSystemParticle[] = []; - for (const particle of this._particles) + for(const particle of this._particles) { particle.update(); @@ -227,12 +227,12 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti particle.lastY = y; particle.lastZ = z; - if ((particle.y > 10) || !particle.isAlive) particles.push(particle); + if((particle.y > 10) || !particle.isAlive) particles.push(particle); } - for (const particle of particles) + for(const particle of particles) { - if (particle.isEmitter) + if(particle.isEmitter) { // } @@ -249,7 +249,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti private accumulateForces(): void { - for (const k of this._particles) + for(const k of this._particles) { // } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts index f8006ba4..fc7b48be 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts @@ -49,11 +49,11 @@ export class FurnitureParticleSystemParticle { this._age++; - if (this._age === this._lifeTime) this.ignite(); + if(this._age === this._lifeTime) this.ignite(); - if (this._fade) + if(this._fade) { - if ((this._age / this._lifeTime) > this._fadeTime) + if((this._age / this._lifeTime) > this._fadeTime) { this._alphaMultiplier = ((this._lifeTime - this._age) / (this._lifeTime * (1 - this._fadeTime))); } @@ -62,7 +62,7 @@ export class FurnitureParticleSystemParticle public getAsset(): IGraphicAsset { - if (((this._frames) && (this._frames.length > 0))) + if(((this._frames) && (this._frames.length > 0))) { return this._frames[(this._age % this._frames.length)]; } diff --git a/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts b/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts index 8402eddb..78b32c70 100644 --- a/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts @@ -24,15 +24,15 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz protected updateAnimation(scale: number): number { - if (!this._animSpeedIndex) this.initItems(scale); + if(!this._animSpeedIndex) this.initItems(scale); let sprite = this.getSprite(2); - if (sprite) this._animOffsetIndex[0] = this.getNewPoint(scale, 0); + if(sprite) this._animOffsetIndex[0] = this.getNewPoint(scale, 0); sprite = this.getSprite(3); - if (sprite) this._animOffsetIndex[1] = this.getNewPoint(scale, 1); + if(sprite) this._animOffsetIndex[1] = this.getNewPoint(scale, 1); return super.updateAnimation(scale); } @@ -49,7 +49,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz let _local_7 = 1; - if (scale == 32) + if(scale == 32) { diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL; _local_7 = 0.5; @@ -61,9 +61,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz const _local_9: number = (animationPhase + (animationDirection * animationSpeed)); - if (Math.abs(_local_9) >= diameter) + if(Math.abs(_local_9) >= diameter) { - if (animationDirection > 0) + if(animationDirection > 0) { animationPhase = (animationPhase - (_local_9 - diameter)); } @@ -81,7 +81,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz let _local_11: number = ((animationDirection * Math.sin(Math.abs((animationPhase / 4)))) * _local_10); - if (animationDirection > 0) + if(animationDirection > 0) { _local_11 = (_local_11 - _local_10); } @@ -94,7 +94,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz this._animPhaseIndex[layerId] = animationPhase; - if (Math.trunc(_local_11) == 0) this._animFactorIndex[layerId] = this.getRandomAmplitudeFactor(); + if(Math.trunc(_local_11) == 0) this._animFactorIndex[layerId] = this.getRandomAmplitudeFactor(); return new NitroPoint(animationPhase, _local_11); } @@ -103,7 +103,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz { let diameter: number; - if (scale === 32) + if(scale === 32) { diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL; } @@ -131,9 +131,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz protected getLayerXOffset(scale: number, direction: number, layerId: number): number { - if ((layerId === 2) || (layerId === 3)) + if((layerId === 2) || (layerId === 3)) { - if (this._animOffsetIndex.length == 2) + if(this._animOffsetIndex.length == 2) { return this._animOffsetIndex[(layerId - 2)].x; } @@ -143,9 +143,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if ((layerId === 2) || (layerId === 3)) + if((layerId === 2) || (layerId === 3)) { - if (this._animOffsetIndex.length == 2) + if(this._animOffsetIndex.length == 2) { return this._animOffsetIndex[(layerId - 2)].y; } diff --git a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts index b7941613..cae21b4b 100644 --- a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts @@ -19,9 +19,9 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali public dispose(): void { - if (this._planetIndex) + if(this._planetIndex) { - while (this._planetIndex.length > 0) + while(this._planetIndex.length > 0) { const planet = this._planetIndex.shift(); @@ -35,14 +35,14 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali protected updateAnimation(scale: number): number { - if (!this._planetIndex && (this.spriteCount > 0)) + if(!this._planetIndex && (this.spriteCount > 0)) { - if (!this.processPlanets()) return 0; + if(!this.processPlanets()) return 0; } - if (this._planetIndex) + if(this._planetIndex) { - for (const planet of this._planetIndex) planet.update(this._offsetArray, this._rootPosition, scale); + for(const planet of this._planetIndex) planet.update(this._offsetArray, this._rootPosition, scale); return super.updateAnimation(scale); } @@ -52,7 +52,7 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali protected getLayerXOffset(scale: number, direction: number, layerId: number): number { - if (this._offsetArray[layerId]) + if(this._offsetArray[layerId]) { return this._offsetArray[layerId].x; } @@ -62,7 +62,7 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if (this._offsetArray[layerId]) + if(this._offsetArray[layerId]) { return this._offsetArray[layerId].y; } @@ -72,7 +72,7 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali protected getLayerZOffset(scale: number, direction: number, layerId: number): number { - if (this._offsetArray[layerId]) + if(this._offsetArray[layerId]) { return this._offsetArray[layerId].z; } @@ -82,20 +82,20 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali private processPlanets(): boolean { - if (!this.object || !this.object.model) return; + if(!this.object || !this.object.model) return; const planetSystems = this.object.model.getValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA); - if (!planetSystems) return false; + if(!planetSystems) return false; this._planetIndex = []; this._planetNameIndex = []; - for (const planet of planetSystems) + for(const planet of planetSystems) { const sprite = this.getSprite(planet.id); - if (sprite) + if(sprite) { this.addPlanet(planet.name, planet.id, planet.parent, (planet.radius || 0), (planet.arcSpeed || 0), (planet.arcOffset || 0), (planet.height || 0)); } @@ -106,12 +106,12 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali private addPlanet(name: string, index: number, parentName: string, radius: number, arcSpeed: number, arcOffset: number, height: number): void { - if (!this._planetIndex) return; + if(!this._planetIndex) return; const planet = new FurniturePlanetSystemVisualizationPlanetObject(name, index, radius, arcSpeed, arcOffset, height); const existingPlanet = this.getPlanet(parentName); - if (existingPlanet) existingPlanet.addChild(planet); + if(existingPlanet) existingPlanet.addChild(planet); else { this._planetIndex.push(planet); @@ -121,11 +121,11 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali private getPlanet(name: string): FurniturePlanetSystemVisualizationPlanetObject { - for (const planet of this._planetIndex) + for(const planet of this._planetIndex) { - if (planet.name === name) return planet; + if(planet.name === name) return planet; - if (planet.hasChild(name)) return planet.getChild(name); + if(planet.hasChild(name)) return planet.getChild(name); } return null; diff --git a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts index ee75d584..770daaeb 100644 --- a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts +++ b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts @@ -29,7 +29,7 @@ export class FurniturePlanetSystemVisualizationPlanetObject public dispose(): void { - while (this._children.length > 0) + while(this._children.length > 0) { const child = this._children.shift(); @@ -43,7 +43,7 @@ export class FurniturePlanetSystemVisualizationPlanetObject offsets[this._index] = this.getPositionVector(rootPosition, scale); - for (const child of this._children) child.update(offsets, this._positionVector, scale); + for(const child of this._children) child.update(offsets, this._positionVector, scale); } public getPositionVector(position: Vector3d, scale: number): Vector3d @@ -55,14 +55,14 @@ export class FurniturePlanetSystemVisualizationPlanetObject this._positionVector.y = ((((sine + cos) * (scale / 2)) * 0.5) - (this._height * (scale / 2))); this._positionVector.z = -(Math.trunc(((4 * (cos + sine)) - 0.7))); - if (position) this._positionVector.add(position); + if(position) this._positionVector.add(position); return this._positionVector; } public addChild(planetObject: FurniturePlanetSystemVisualizationPlanetObject): void { - if (this._children.indexOf(planetObject) >= 0) return; + if(this._children.indexOf(planetObject) >= 0) return; this._children.push(planetObject); } @@ -74,11 +74,11 @@ export class FurniturePlanetSystemVisualizationPlanetObject public getChild(name: string): FurniturePlanetSystemVisualizationPlanetObject { - for (const child of this._children) + for(const child of this._children) { - if (child.name === name) return child; + if(child.name === name) return child; - if (child.hasChild(name)) return child.getChild(name); + if(child.hasChild(name)) return child.getChild(name); } return null; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts index 59010ceb..fc353765 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts @@ -10,7 +10,7 @@ export class FurnitureRoomBackgroundVisualization extends FurnitureBrandedImageV { super.imageReady(texture, imageUrl); - if (!texture) return; + if(!texture) return; this.setImageOffset(texture.width, texture.height); } @@ -30,11 +30,11 @@ export class FurnitureRoomBackgroundVisualization extends FurnitureBrandedImageV protected getLayerXOffset(scale: number, direction: number, layerId: number): number { - if (this._imageOffset) + if(this._imageOffset) { const offset = this._imageOffset.getXOffset(direction, 0); - if (offset !== undefined) return offset + this._offsetX; + if(offset !== undefined) return offset + this._offsetX; } return super.getLayerXOffset(scale, direction, layerId) + this._offsetX; @@ -42,11 +42,11 @@ export class FurnitureRoomBackgroundVisualization extends FurnitureBrandedImageV protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if (this._imageOffset) + if(this._imageOffset) { const offset = this._imageOffset.getYOffset(direction, 0); - if (offset !== undefined) return offset + this._offsetY; + if(offset !== undefined) return offset + this._offsetY; } return super.getLayerYOffset(scale, direction, layerId) + this._offsetY; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts index 6d943cda..98d2f3e1 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts @@ -80,7 +80,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { this.reset(); - if (!(data instanceof FurnitureVisualizationData)) return false; + if(!(data instanceof FurnitureVisualizationData)) return false; this._type = data.type; this._data = data; @@ -128,7 +128,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected resetLayers(scale: number, direction: number): void { - if ((this._cacheDirection === direction) && (this._cacheScale === scale)) return; + if((this._cacheDirection === direction) && (this._cacheScale === scale)) return; this._updatedLayers = []; this._assetNames = []; @@ -150,18 +150,18 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void { - if (!geometry) return; + if(!geometry) return; const scale = geometry.scale; let updateSprites = false; - if (this.updateObject(scale, geometry.direction.x)) updateSprites = true; + if(this.updateObject(scale, geometry.direction.x)) updateSprites = true; - if (this.updateModel(scale)) updateSprites = true; + if(this.updateModel(scale)) updateSprites = true; let number = 0; - if (skipUpdate) + if(skipUpdate) { this._animationNumber = (this._animationNumber | this.updateAnimation(scale)); } @@ -172,7 +172,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization this._animationNumber = 0; } - if (updateSprites || (number !== 0)) + if(updateSprites || (number !== 0)) { this.updateSprites(scale, updateSprites, number); @@ -184,15 +184,15 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected updateObject(scale: number, direction: number): boolean { - if (!this.object) return false; + if(!this.object) return false; - if ((this.updateObjectCounter === this.object.updateCounter) && (scale === this._scale) && (this._lastCameraAngle === direction)) return false; + if((this.updateObjectCounter === this.object.updateCounter) && (scale === this._scale) && (this._lastCameraAngle === direction)) return false; let offsetDirection = (this.object.getDirection().x - (direction + 135)); offsetDirection = ((((offsetDirection) % 360) + 360) % 360); - if (this._data) + if(this._data) { const validDirection = this._data.getValidDirection(scale, offsetDirection); @@ -213,9 +213,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const model = this.object && this.object.model; - if (!model) return false; + if(!model) return false; - if (this.updateModelCounter === model.updateCounter) return false; + if(this.updateModelCounter === model.updateCounter) return false; this._selectedColor = model.getValue(RoomObjectVariable.FURNITURE_COLOR); this._clickUrl = model.getValue(RoomObjectVariable.FURNITURE_AD_URL); @@ -224,9 +224,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization let alphaMultiplier = model.getValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER); - if (isNaN(alphaMultiplier)) alphaMultiplier = 1; + if(isNaN(alphaMultiplier)) alphaMultiplier = 1; - if (this._alphaMultiplier !== alphaMultiplier) + if(this._alphaMultiplier !== alphaMultiplier) { this._alphaMultiplier = alphaMultiplier; @@ -240,13 +240,13 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected updateSprites(scale: number, update: boolean, animation: number): void { - if (this._layerCount !== this.totalSprites) this.createSprites(this._layerCount); + if(this._layerCount !== this.totalSprites) this.createSprites(this._layerCount); - if (update) + if(update) { let layerId = (this.totalSprites - 1); - while (layerId >= 0) + while(layerId >= 0) { this.updateSprite(scale, layerId); @@ -257,9 +257,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { let layerId = 0; - while (animation > 0) + while(animation > 0) { - if (animation) this.updateSprite(scale, layerId); + if(animation) this.updateSprite(scale, layerId); layerId++; animation = (animation >> 1); @@ -274,11 +274,11 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization const assetName = this.getSpriteAssetName(scale, layerId); const sprite = this.getSprite(layerId); - if (assetName && sprite) + if(assetName && sprite) { const assetData = this.getAsset(assetName, layerId); - if (assetData && assetData.texture) + if(assetData && assetData.texture) { sprite.visible = true; sprite.type = this._type; @@ -289,7 +289,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization let relativeDepth = 0; - if (layerId !== this._shadowLayerIndex) + if(layerId !== this._shadowLayerIndex) { sprite.tag = this.getLayerTag(scale, this._direction, layerId); sprite.alpha = this.getLayerAlpha(scale, this._direction, layerId); @@ -325,7 +325,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization } else { - if (sprite) this.resetSprite(sprite); + if(sprite) this.resetSprite(sprite); } } @@ -341,7 +341,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization private resetSprite(sprite: IRoomObjectSprite): void { - if (!sprite) return; + if(!sprite) return; sprite.texture = null; sprite.libraryAssetName = ''; @@ -357,18 +357,18 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected getSpriteAssetName(scale: number, layerId: number): string { - if (!this._data || (layerId >= FurnitureVisualizationData.LAYER_LETTERS.length)) return ''; + if(!this._data || (layerId >= FurnitureVisualizationData.LAYER_LETTERS.length)) return ''; let assetName = this._assetNames[layerId]; let updated = this._updatedLayers[layerId]; - if (!assetName || !assetName.length) + if(!assetName || !assetName.length) { assetName = this.cacheSpriteAssetName(scale, layerId, true); updated = (this._cacheSize !== 1); } - if (updated) assetName += this.getFrameNumber(scale, layerId); + if(updated) assetName += this.getFrameNumber(scale, layerId); return assetName; } @@ -380,7 +380,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization let layerCode = ''; const isntIcon = (size !== 1); - if (layerId !== this._shadowLayerIndex) + if(layerId !== this._shadowLayerIndex) { layerCode = FurnitureVisualizationData.LAYER_LETTERS[layerId] || ''; } @@ -389,11 +389,11 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization layerCode = 'sd'; } - if (layerCode === '') return null; + if(layerCode === '') return null; const assetName = (this._type + ((isntIcon) ? ('_' + size + '_' + layerCode + '_' + this._direction + '_') : ('_icon_' + layerCode))); - if (cache) + if(cache) { this._assetNames[layerId] = assetName; this._updatedLayers[layerId] = isntIcon; @@ -406,9 +406,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteTags[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_TAG; + if(!this._data) return LayerData.DEFAULT_TAG; const tag = this._data.getLayerTag(scale, direction, layerId); @@ -421,9 +421,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteInks[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_INK; + if(!this._data) return LayerData.DEFAULT_INK; const ink = this._data.getLayerInk(scale, direction, layerId); @@ -434,18 +434,18 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected getLayerAlpha(scale: number, direction: number, layerId: number): number { - if (!this._alphaChanged) + if(!this._alphaChanged) { const existing = this._spriteAlphas[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; } - if (!this._data) return LayerData.DEFAULT_ALPHA; + if(!this._data) return LayerData.DEFAULT_ALPHA; let alpha = this._data.getLayerAlpha(scale, direction, layerId); - if (this._alphaMultiplier !== null) alpha = (alpha * this._alphaMultiplier); + if(this._alphaMultiplier !== null) alpha = (alpha * this._alphaMultiplier); this._spriteAlphas[layerId] = alpha; @@ -456,9 +456,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteColors[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return ColorData.DEFAULT_COLOR; + if(!this._data) return ColorData.DEFAULT_COLOR; const color = this._data.getLayerColor(scale, layerId, colorId); @@ -471,9 +471,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteMouseCaptures[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_IGNORE_MOUSE; + if(!this._data) return LayerData.DEFAULT_IGNORE_MOUSE; const ignoreMouse = this._data.getLayerIgnoreMouse(scale, direction, layerId); @@ -486,9 +486,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteXOffsets[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_XOFFSET; + if(!this._data) return LayerData.DEFAULT_XOFFSET; const xOffset = this._data.getLayerXOffset(scale, direction, layerId); @@ -499,13 +499,13 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if (layerId === this._shadowLayerIndex) return Math.ceil((this._furnitureLift * (scale / 2))); + if(layerId === this._shadowLayerIndex) return Math.ceil((this._furnitureLift * (scale / 2))); const existing = this._spriteYOffsets[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_YOFFSET; + if(!this._data) return LayerData.DEFAULT_YOFFSET; const yOffset = this._data.getLayerYOffset(scale, direction, layerId); @@ -518,9 +518,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization { const existing = this._spriteZOffsets[layerId]; - if (existing !== undefined) return existing; + if(existing !== undefined) return existing; - if (!this._data) return LayerData.DEFAULT_ZOFFSET; + if(!this._data) return LayerData.DEFAULT_ZOFFSET; const zOffset = this._data.getLayerZOffset(scale, direction, layerId); @@ -531,7 +531,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected getValidSize(scale: number): number { - if (!this._data) return scale; + if(!this._data) return scale; return this._data.getValidSize(scale); } @@ -544,7 +544,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected setDirection(direction: number): void { - if (this._direction === direction) return; + if(this._direction === direction) return; this._direction = direction; } @@ -571,7 +571,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization public getAsset(name: string, layerId: number = -1): IGraphicAsset { - if (!this.asset) return null; + if(!this.asset) return null; return this.asset.getAsset(name); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts b/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts index 0c0c57e6..7c6b948f 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts @@ -28,11 +28,11 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { this.reset(); - if (!asset) return false; + if(!asset) return false; this._type = asset.name; - if (!this.defineVisualizations(asset.visualizations)) + if(!this.defineVisualizations(asset.visualizations)) { this.reset(); @@ -44,9 +44,9 @@ export class FurnitureVisualizationData implements IObjectVisualizationData public dispose(): void { - if (this._sizeDatas && this._sizeDatas.size) + if(this._sizeDatas && this._sizeDatas.size) { - for (const size of this._sizeDatas.values()) size && size.dispose(); + for(const size of this._sizeDatas.values()) size && size.dispose(); this._sizeDatas = null; } @@ -59,9 +59,9 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { this._type = ''; - if (this._sizeDatas && this._sizeDatas.size) + if(this._sizeDatas && this._sizeDatas.size) { - for (const size of this._sizeDatas.values()) size && size.dispose(); + for(const size of this._sizeDatas.values()) size && size.dispose(); } this._sizeDatas.clear(); @@ -78,9 +78,9 @@ export class FurnitureVisualizationData implements IObjectVisualizationData protected defineVisualizations(visualizations: IAssetVisualizationData[]): boolean { - if (!visualizations) return false; + if(!visualizations) return false; - for (const visualizationId in visualizations) + for(const visualizationId in visualizations) { const visualization = visualizations[visualizationId]; @@ -89,20 +89,20 @@ export class FurnitureVisualizationData implements IObjectVisualizationData let size = visualization.size; - if (size < 1) size = 1; + if(size < 1) size = 1; - if (this._sizeDatas.get(size)) return false; + if(this._sizeDatas.get(size)) return false; const sizeData = this.createSizeData(size, layerCount, angle); - if (!sizeData) return false; + if(!sizeData) return false; - for (const key in visualization) + for(const key in visualization) { //@ts-ignore const data = visualization[key]; - if (!this.processVisualElement(sizeData, key, data)) + if(!this.processVisualElement(sizeData, key, data)) { sizeData.dispose(); @@ -122,18 +122,18 @@ export class FurnitureVisualizationData implements IObjectVisualizationData protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean { - if (!sizeData || !key || !data) return false; + if(!sizeData || !key || !data) return false; - switch (key) + switch(key) { case 'layers': - if (!sizeData.processLayers(data)) return false; + if(!sizeData.processLayers(data)) return false; break; case 'directions': - if (!sizeData.processDirections(data)) return false; + if(!sizeData.processDirections(data)) return false; break; case 'colors': - if (!sizeData.processColors(data)) return false; + if(!sizeData.processColors(data)) return false; break; } @@ -142,13 +142,13 @@ export class FurnitureVisualizationData implements IObjectVisualizationData public getValidSize(scale: number): number { - if (scale === this._lastSizeScale) return this._lastSize; + if(scale === this._lastSizeScale) return this._lastSize; const sizeIndex = this.getSizeIndex(scale); let newScale = -1; - if (sizeIndex < this._sizes.length) newScale = this._sizes[sizeIndex]; + if(sizeIndex < this._sizes.length) newScale = this._sizes[sizeIndex]; this._lastSizeScale = scale; this._lastSize = newScale; @@ -158,16 +158,16 @@ export class FurnitureVisualizationData implements IObjectVisualizationData private getSizeIndex(size: number): number { - if (size <= 0) return 0; + if(size <= 0) return 0; let index = 0; let iterator = 1; - while (iterator < this._sizes.length) + while(iterator < this._sizes.length) { - if (this._sizes[iterator] > size) + if(this._sizes[iterator] > size) { - if ((this._sizes[iterator] / size) < (size / this._sizes[(iterator - 1)])) index = iterator; + if((this._sizes[iterator] / size) < (size / this._sizes[(iterator - 1)])) index = iterator; break; } @@ -182,11 +182,11 @@ export class FurnitureVisualizationData implements IObjectVisualizationData protected getSizeData(size: number): SizeData { - if (size === this._lastSizeDataScale) return this._lastSizeData; + if(size === this._lastSizeDataScale) return this._lastSizeData; const sizeIndex = this.getSizeIndex(size); - if (sizeIndex < this._sizes.length) this._lastSizeData = this._sizeDatas.get(this._sizes[sizeIndex]); + if(sizeIndex < this._sizes.length) this._lastSizeData = this._sizeDatas.get(this._sizes[sizeIndex]); else this._lastSizeData = null; this._lastSizeDataScale = size; @@ -198,7 +198,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_COUNT; + if(!size) return LayerData.DEFAULT_COUNT; return size.layerCount; } @@ -207,7 +207,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_DIRECTION; + if(!size) return LayerData.DEFAULT_DIRECTION; return size.getValidDirection(direction); } @@ -216,7 +216,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_TAG; + if(!size) return LayerData.DEFAULT_TAG; return size.getLayerTag(direction, layerId); } @@ -225,7 +225,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_INK; + if(!size) return LayerData.DEFAULT_INK; return size.getLayerInk(direction, layerId); } @@ -234,7 +234,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_ALPHA; + if(!size) return LayerData.DEFAULT_ALPHA; return size.getLayerAlpha(direction, layerId); } @@ -243,7 +243,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return ColorData.DEFAULT_COLOR; + if(!size) return ColorData.DEFAULT_COLOR; return size.getLayerColor(layerId, colorId); } @@ -252,7 +252,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_IGNORE_MOUSE; + if(!size) return LayerData.DEFAULT_IGNORE_MOUSE; return size.getLayerIgnoreMouse(direction, layerId); } @@ -261,7 +261,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_XOFFSET; + if(!size) return LayerData.DEFAULT_XOFFSET; return size.getLayerXOffset(direction, layerId); } @@ -270,7 +270,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_YOFFSET; + if(!size) return LayerData.DEFAULT_YOFFSET; return size.getLayerYOffset(direction, layerId); } @@ -279,7 +279,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData { const size = this.getSizeData(scale); - if (!size) return LayerData.DEFAULT_ZOFFSET; + if(!size) return LayerData.DEFAULT_ZOFFSET; return size.getLayerZOffset(direction, layerId); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts index bcf8b185..b313402f 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts @@ -20,7 +20,7 @@ export class FurnitureVoteCounterVisualization extends FurnitureAnimatedVisualiz const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT); const tag = this.getLayerTag(scale, this.direction, layerId); - switch (tag) + switch(tag) { case FurnitureVoteCounterVisualization.ONES_SPRITE: return (result % 10); case FurnitureVoteCounterVisualization.TENS_SPRITE: return ((result / 10) % 10); @@ -33,11 +33,11 @@ export class FurnitureVoteCounterVisualization extends FurnitureAnimatedVisualiz { const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT); - if (result === FurnitureVoteCounterVisualization.HIDE_COUNTER_SCORE) + if(result === FurnitureVoteCounterVisualization.HIDE_COUNTER_SCORE) { const tag = this.getLayerTag(scale, direction, layerId); - switch (tag) + switch(tag) { case FurnitureVoteCounterVisualization.ONES_SPRITE: case FurnitureVoteCounterVisualization.TENS_SPRITE: diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts index 3fd373a9..8e4b46dd 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts @@ -14,7 +14,7 @@ export class FurnitureVoteMajorityVisualization extends FurnitureAnimatedVisuali const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT); const tag = this.getLayerTag(scale, this.direction, layerId); - switch (tag) + switch(tag) { case FurnitureVoteMajorityVisualization.ONES_SPRITE: return (result % 10); case FurnitureVoteMajorityVisualization.TENS_SPRITE: return ((result / 10) % 10); @@ -27,11 +27,11 @@ export class FurnitureVoteMajorityVisualization extends FurnitureAnimatedVisuali { const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT); - if (((!(FurnitureVoteMajorityVisualization.HIDE_RESULTS_STATES.indexOf(this.object.getState(0)) === -1)) || (result === FurnitureVoteMajorityVisualization.HIDE_RESULTS_VALUE))) + if(((!(FurnitureVoteMajorityVisualization.HIDE_RESULTS_STATES.indexOf(this.object.getState(0)) === -1)) || (result === FurnitureVoteMajorityVisualization.HIDE_RESULTS_VALUE))) { const tag = this.getLayerTag(scale, direction, layerId); - switch (tag) + switch(tag) { case FurnitureVoteMajorityVisualization.ONES_SPRITE: case FurnitureVoteMajorityVisualization.TENS_SPRITE: diff --git a/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts index 8fb3261a..2283aec8 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts @@ -7,11 +7,11 @@ export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisu protected getThumbnailURL(): string { - if (!this.object) return null; + if(!this.object) return null; const furnitureData = this.object.model.getValue<{ [index: string]: string }>(RoomObjectVariable.FURNITURE_DATA); - if (furnitureData) return (furnitureData[FurnitureYoutubeVisualization.THUMBNAIL_URL] || null); + if(furnitureData) return (furnitureData[FurnitureYoutubeVisualization.THUMBNAIL_URL] || null); return null; } diff --git a/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts b/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts index 2fd735e4..016526e6 100644 --- a/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts @@ -40,7 +40,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza { const flag = super.updateModel(scale); - if (!this._thumbnailChanged && (this._thumbnailDirection === this.direction)) return flag; + if(!this._thumbnailChanged && (this._thumbnailDirection === this.direction)) return flag; this.refreshThumbnail(); @@ -49,9 +49,9 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza private refreshThumbnail(): void { - if (this.asset == null) return; + if(this.asset == null) return; - if (this._thumbnailImageNormal) + if(this._thumbnailImageNormal) { this.addThumbnailAsset(this._thumbnailImageNormal, 64); } @@ -68,14 +68,14 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza { let layerId = 0; - while (layerId < this.totalSprites) + while(layerId < this.totalSprites) { - if (this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL) + if(this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL) { const assetName = (this.cacheSpriteAssetName(scale, layerId, false) + this.getFrameNumber(scale, layerId)); const asset = this.getAsset(assetName, layerId); - if (asset) + if(asset) { const _local_6 = this.generateTransformedThumbnail(k, asset); const _local_7 = this.getThumbnailAssetName(scale); @@ -93,7 +93,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza private generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture { - if (this._hasOutline) + if(this._hasOutline) { const container = new NitroSprite(); const background = new NitroSprite(NitroTexture.WHITE); @@ -117,7 +117,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza const matrix = new Matrix(); const difference = (asset.width / texture.width); - switch (this.direction) + switch(this.direction) { case 2: matrix.a = difference; @@ -154,7 +154,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza protected getSpriteAssetName(scale: number, layerId: number): string { - if (this._thumbnailImageNormal && (this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL)) return this.getThumbnailAssetName(scale); + if(this._thumbnailImageNormal && (this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL)) return this.getThumbnailAssetName(scale); return super.getSpriteAssetName(scale, layerId); } diff --git a/src/nitro/room/object/visualization/pet/ExperienceData.ts b/src/nitro/room/object/visualization/pet/ExperienceData.ts index ffa47108..535c7ff4 100644 --- a/src/nitro/room/object/visualization/pet/ExperienceData.ts +++ b/src/nitro/room/object/visualization/pet/ExperienceData.ts @@ -20,7 +20,7 @@ export class ExperienceData public renderBubble(amount: number): RenderTexture { - if (!this._sprite || (this._amount === amount)) return null; + if(!this._sprite || (this._amount === amount)) return null; const container = new NitroContainer(); @@ -40,7 +40,7 @@ export class ExperienceData container.addChild(text); - if (!this._texture) + if(!this._texture) { this._texture = TextureUtils.generateTexture(container); } diff --git a/src/nitro/room/object/visualization/pet/PetVisualization.ts b/src/nitro/room/object/visualization/pet/PetVisualization.ts index 8dbfd100..70cd187e 100644 --- a/src/nitro/room/object/visualization/pet/PetVisualization.ts +++ b/src/nitro/room/object/visualization/pet/PetVisualization.ts @@ -74,16 +74,16 @@ export class PetVisualization extends FurnitureAnimatedVisualization this._previousAnimationDirection = -1; this._animationStates = []; - while (this._animationStates.length < PetVisualization.ANIMATION_INDEX_COUNT) this._animationStates.push(new AnimationStateData()); + while(this._animationStates.length < PetVisualization.ANIMATION_INDEX_COUNT) this._animationStates.push(new AnimationStateData()); } public initialize(data: IObjectVisualizationData): boolean { - if (!(data instanceof PetVisualizationData)) return false; + if(!(data instanceof PetVisualizationData)) return false; const texture = this.getPetAdditionAsset(PetVisualization.PET_EXPERIENCE_BUBBLE); - if (texture) + if(texture) { this._experienceData = new ExperienceData(texture); } @@ -95,13 +95,13 @@ export class PetVisualization extends FurnitureAnimatedVisualization { super.dispose(); - if (this._animationStates) + if(this._animationStates) { - while (this._animationStates.length) + while(this._animationStates.length) { const animationState = this._animationStates[0]; - if (animationState) animationState.dispose(); + if(animationState) animationState.dispose(); this._animationStates.pop(); } @@ -124,15 +124,15 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected updateExperienceBubble(time: number): void { - if (!this._experienceData) return; + if(!this._experienceData) return; this._experienceData.alpha = 0; - if (this._experienceTimestamp) + if(this._experienceTimestamp) { const difference = (time - this._experienceTimestamp); - if (difference < PetVisualization.EXPERIENCE_BUBBLE_VISIBLE_IN_MS) + if(difference < PetVisualization.EXPERIENCE_BUBBLE_VISIBLE_IN_MS) { this._experienceData.alpha = (Math.sin(((difference / PetVisualization.EXPERIENCE_BUBBLE_VISIBLE_IN_MS) * Math.PI)) * 0xFF); } @@ -143,13 +143,13 @@ export class PetVisualization extends FurnitureAnimatedVisualization const sprite = this.getSprite((this.totalSprites - 1)); - if (sprite) + if(sprite) { - if (this._experienceData.alpha > 0) + if(this._experienceData.alpha > 0) { const texture = this._experienceData.renderBubble(this._experience); - if (texture) + if(texture) { sprite.texture = texture; sprite.offsetX = -20; @@ -172,9 +172,9 @@ export class PetVisualization extends FurnitureAnimatedVisualization { const model = this.object && this.object.model; - if (!model) return false; + if(!model) return false; - if (this.updateModelCounter === model.updateCounter) return false; + if(this.updateModelCounter === model.updateCounter) return false; const posture = model.getValue(RoomObjectVariable.FIGURE_POSTURE); const gesture = model.getValue(RoomObjectVariable.FIGURE_GESTURE); @@ -183,9 +183,9 @@ export class PetVisualization extends FurnitureAnimatedVisualization let alphaMultiplier = (model.getValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER) || null); - if (alphaMultiplier === null || isNaN(alphaMultiplier)) alphaMultiplier = 1; + if(alphaMultiplier === null || isNaN(alphaMultiplier)) alphaMultiplier = 1; - if (this._alphaMultiplier !== alphaMultiplier) + if(this._alphaMultiplier !== alphaMultiplier) { this._alphaMultiplier = alphaMultiplier; @@ -196,7 +196,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization const headDirection = model.getValue(RoomObjectVariable.HEAD_DIRECTION); - if (!isNaN(headDirection) && this._data.isAllowedToTurnHead) + if(!isNaN(headDirection) && this._data.isAllowedToTurnHead) { this._headDirection = headDirection; } @@ -216,7 +216,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization const headOnly = model.getValue(RoomObjectVariable.PET_HEAD_ONLY); const color = model.getValue(RoomObjectVariable.PET_COLOR); - if (customPaletteIndex !== this._paletteIndex) + if(customPaletteIndex !== this._paletteIndex) { this._paletteIndex = customPaletteIndex; this._paletteName = this._paletteIndex.toString(); @@ -228,7 +228,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization this._isRiding = (!isNaN(isRiding) && (isRiding > 0)); this._headOnly = (!isNaN(headOnly) && (headOnly > 0)); - if (!isNaN(color) && this._color !== color) this._color = color; + if(!isNaN(color) && this._color !== color) this._color = color; this.updateModelCounter = model.updateCounter; @@ -237,11 +237,11 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected updateAnimation(scale: number): number { - if (this.object) + if(this.object) { const direction = this.object.getDirection().x; - if (direction !== this._previousAnimationDirection) + if(direction !== this._previousAnimationDirection) { this._previousAnimationDirection = direction; @@ -254,18 +254,18 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected setPostureAndGesture(posture: string, gesture: string): void { - if (!this._data) return; + if(!this._data) return; - if (posture !== this._posture) + if(posture !== this._posture) { this._posture = posture; this.setAnimationForIndex(PetVisualization.POSTURE_ANIMATION_INDEX, this._data.postureToAnimation(this._scale, posture)); } - if (this._data.getGestureDisabled(this._scale, posture)) gesture = null; + if(this._data.getGestureDisabled(this._scale, posture)) gesture = null; - if (gesture !== this._gesture) + if(gesture !== this._gesture) { this._gesture = gesture; @@ -275,7 +275,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization private getAnimationStateData(k: number): AnimationStateData { - if ((k >= 0) && (k < this._animationStates.length)) return this._animationStates[k]; + if((k >= 0) && (k < this._animationStates.length)) return this._animationStates[k]; return null; } @@ -284,9 +284,9 @@ export class PetVisualization extends FurnitureAnimatedVisualization { const animationStateData = this.getAnimationStateData(k); - if (animationStateData) + if(animationStateData) { - if (this.setSubAnimation(animationStateData, _arg_2)) this._animationOver = false; + if(this.setSubAnimation(animationStateData, _arg_2)) this._animationOver = false; } } @@ -296,11 +296,11 @@ export class PetVisualization extends FurnitureAnimatedVisualization let index = (this._animationStates.length - 1); - while (index >= 0) + while(index >= 0) { const stateData = this._animationStates[index]; - if (stateData) stateData.setLayerCount(this.animatedLayerCount); + if(stateData) stateData.setLayerCount(this.animatedLayerCount); index--; } @@ -308,31 +308,31 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected updateAnimations(scale: number): number { - if (this._animationOver) return 0; + if(this._animationOver) return 0; let animationOver = true; let _local_3 = 0; let index = 0; - while (index < this._animationStates.length) + while(index < this._animationStates.length) { const stateData = this._animationStates[index]; - if (stateData) + if(stateData) { - if (!stateData.animationOver) + if(!stateData.animationOver) { const _local_6 = this.updateFramesForAnimation(stateData, scale); _local_3 = (_local_3 | _local_6); - if (!stateData.animationOver) + if(!stateData.animationOver) { animationOver = false; } else { - if (AnimationData.isTransitionFromAnimation(stateData.animationId) || AnimationData.isTransitionToAnimation(stateData.animationId)) + if(AnimationData.isTransitionFromAnimation(stateData.animationId) || AnimationData.isTransitionToAnimation(stateData.animationId)) { this.setAnimationForIndex(index, stateData.animationAfterTransitionId); @@ -352,23 +352,23 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected getSpriteAssetName(scale: number, layerId: number): string { - if (this._headOnly && this.isNonHeadSprite(layerId)) return null; + if(this._headOnly && this.isNonHeadSprite(layerId)) return null; - if (this._isRiding && this._parser3(layerId)) return null; + if(this._isRiding && this._parser3(layerId)) return null; const totalSprites = this.totalSprites; - if (layerId < (totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) + if(layerId < (totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) { const validScale = this.getValidSize(scale); - if (layerId < (totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) + if(layerId < (totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) { - if (layerId >= FurnitureVisualizationData.LAYER_LETTERS.length) return null; + if(layerId >= FurnitureVisualizationData.LAYER_LETTERS.length) return null; const layerLetter = FurnitureVisualizationData.LAYER_LETTERS[layerId]; - if (validScale === 1) return (this._type + '_icon_' + layerLetter); + if(validScale === 1) return (this._type + '_icon_' + layerLetter); return (this._type + '_' + validScale + '_' + layerLetter + '_' + this.getDirection(scale, layerId) + '_' + this.getFrameNumber(validScale, layerId)); } @@ -381,7 +381,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected getLayerColor(scale: number, layerId: number, colorId: number): number { - if (layerId < (this.totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) return this._color; + if(layerId < (this.totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) return this._color; return 0xFFFFFF; } @@ -391,15 +391,15 @@ export class PetVisualization extends FurnitureAnimatedVisualization let offset = super.getLayerXOffset(scale, direction, layerId); let index = (this._animationStates.length - 1); - while (index >= 0) + while(index >= 0) { const stateData = this._animationStates[index]; - if (stateData) + if(stateData) { const frame = stateData.getFrame(layerId); - if (frame) offset += frame.x; + if(frame) offset += frame.x; } index--; @@ -413,15 +413,15 @@ export class PetVisualization extends FurnitureAnimatedVisualization let offset = super.getLayerYOffset(scale, direction, layerId); let index = (this._animationStates.length - 1); - while (index >= 0) + while(index >= 0) { const stateData = this._animationStates[index]; - if (stateData) + if(stateData) { const frame = stateData.getFrame(layerId); - if (frame) offset += frame.y; + if(frame) offset += frame.y; } index--; @@ -432,14 +432,14 @@ export class PetVisualization extends FurnitureAnimatedVisualization protected getLayerZOffset(scale: number, direction: number, layerId: number): number { - if (!this._data) return LayerData.DEFAULT_ZOFFSET; + if(!this._data) return LayerData.DEFAULT_ZOFFSET; return this._data.getLayerZOffset(scale, this.getDirection(scale, layerId), layerId); } private getDirection(scale: number, layerId: number): number { - if (!this.isHeadSprite(layerId)) return this._direction; + if(!this.isHeadSprite(layerId)) return this._direction; return this._data.getValidDirection(scale, this._headDirection); } @@ -448,15 +448,15 @@ export class PetVisualization extends FurnitureAnimatedVisualization { let index = (this._animationStates.length - 1); - while (index >= 0) + while(index >= 0) { const stateData = this._animationStates[index]; - if (stateData) + if(stateData) { const frame = stateData.getFrame(layerId); - if (frame) return frame.id; + if(frame) return frame.id; } index--; @@ -467,12 +467,12 @@ export class PetVisualization extends FurnitureAnimatedVisualization private isHeadSprite(layerId: number): boolean { - if (this._headSprites[layerId] === undefined) + if(this._headSprites[layerId] === undefined) { const isHead = (this._data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.HEAD); const isHair = (this._data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.HAIR); - if (isHead || isHair) this._headSprites[layerId] = true; + if(isHead || isHair) this._headSprites[layerId] = true; else this._headSprites[layerId] = false; } @@ -481,13 +481,13 @@ export class PetVisualization extends FurnitureAnimatedVisualization private isNonHeadSprite(layerId: number): boolean { - if (this._nonHeadSprites[layerId] === undefined) + if(this._nonHeadSprites[layerId] === undefined) { - if (layerId < (this.totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) + if(layerId < (this.totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) { const tag = this._data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId); - if (((tag && (tag.length > 0)) && (tag !== PetVisualization.HEAD)) && (tag !== PetVisualization.HAIR)) + if(((tag && (tag.length > 0)) && (tag !== PetVisualization.HEAD)) && (tag !== PetVisualization.HAIR)) { this._nonHeadSprites[layerId] = true; } @@ -507,9 +507,9 @@ export class PetVisualization extends FurnitureAnimatedVisualization private _parser3(layerId: number): boolean { - if (this._saddleSprites[layerId] === undefined) + if(this._saddleSprites[layerId] === undefined) { - if (this._data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.SADDLE) + if(this._data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.SADDLE) { this._saddleSprites[layerId] = true; } @@ -524,21 +524,21 @@ export class PetVisualization extends FurnitureAnimatedVisualization public getAsset(name: string, layerId: number = -1): IGraphicAsset { - if (!this.asset) return null; + if(!this.asset) return null; const layerIndex = this._customLayerIds.indexOf(layerId); let paletteName = this._paletteName; let partId = -1; let paletteId = -1; - if (layerIndex > -1) + if(layerIndex > -1) { partId = this._customPartIds[layerIndex]; paletteId = this._customPaletteIds[layerIndex]; paletteName = ((paletteId > -1) ? paletteId.toString() : this._paletteName); } - if (!(isNaN(partId)) && (partId > -1)) + if(!(isNaN(partId)) && (partId > -1)) { name = (name + '_' + partId); } @@ -564,9 +564,9 @@ export class PetVisualization extends FurnitureAnimatedVisualization let length = parts.length; let i = 0; - while (i < parts.length) + while(i < parts.length) { - if ((parts[i] === '64') || (parts[i] === '32')) + if((parts[i] === '64') || (parts[i] === '32')) { length = (i + 3); @@ -578,7 +578,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization let posture: string = null; - if (length < parts.length) + if(length < parts.length) { let part = parts[length]; @@ -586,7 +586,7 @@ export class PetVisualization extends FurnitureAnimatedVisualization posture = this._data.animationToPosture(scale, (parseInt(part) / 100), false); - if (!posture) posture = this._data.getGestureForAnimationId(scale, (parseInt(part) / 100)); + if(!posture) posture = this._data.getGestureForAnimationId(scale, (parseInt(part) / 100)); } return posture; diff --git a/src/nitro/room/object/visualization/pet/PetVisualizationData.ts b/src/nitro/room/object/visualization/pet/PetVisualizationData.ts index a5b5352e..a1f92ec3 100644 --- a/src/nitro/room/object/visualization/pet/PetVisualizationData.ts +++ b/src/nitro/room/object/visualization/pet/PetVisualizationData.ts @@ -15,7 +15,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData protected createSizeData(scale: number, layerCount: number, angle: number): SizeData { - if (scale > 1) return new PetSizeData(layerCount, angle); + if(scale > 1) return new PetSizeData(layerCount, angle); else return new AnimationSizeData(layerCount, angle); } @@ -28,18 +28,18 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean { - if (!sizeData || !key || !data) return false; + if(!sizeData || !key || !data) return false; - switch (key) + switch(key) { case 'postures': - if (!(sizeData instanceof PetSizeData) || !sizeData.processPostures(data)) return false; + if(!(sizeData instanceof PetSizeData) || !sizeData.processPostures(data)) return false; break; case 'gestures': - if (!(sizeData instanceof PetSizeData) || !sizeData.processGestures(data)) return false; + if(!(sizeData instanceof PetSizeData) || !sizeData.processGestures(data)) return false; break; default: - if (!super.processVisualElement(sizeData, key, data)) return false; + if(!super.processVisualElement(sizeData, key, data)) return false; break; } @@ -50,7 +50,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return PetSizeData.DEFAULT; + if(!size) return PetSizeData.DEFAULT; return size.postureToAnimation(posture); } @@ -59,7 +59,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return false; + if(!size) return false; return size.getGestureDisabled(posture); } @@ -68,7 +68,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return PetSizeData.DEFAULT; + if(!size) return PetSizeData.DEFAULT; return size.gestureToAnimation(gesture); } @@ -77,7 +77,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return null; + if(!size) return null; return size.animationToPosture(index, useDefault); } @@ -86,7 +86,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return null; + if(!size) return null; return size.animationToGesture(index); } @@ -95,7 +95,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return null; + if(!size) return null; return size.getGestureForAnimationId(_arg_2); } @@ -104,7 +104,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return 0; + if(!size) return 0; return size.totalPostures; } @@ -113,7 +113,7 @@ export class PetVisualizationData extends FurnitureAnimatedVisualizationData { const size = this.getSizeData(scale) as PetSizeData; - if (!size) return 0; + if(!size) return 0; return size.totalGestures; } diff --git a/src/nitro/room/object/visualization/room/PlaneDrawingData.ts b/src/nitro/room/object/visualization/room/PlaneDrawingData.ts index 96465df1..009d9183 100644 --- a/src/nitro/room/object/visualization/room/PlaneDrawingData.ts +++ b/src/nitro/room/object/visualization/room/PlaneDrawingData.ts @@ -21,7 +21,7 @@ export class PlaneDrawingData implements IPlaneDrawingData this._maskAssetFlipHs = []; this._maskAssetFlipVs = []; - if (k != null) + if(k != null) { this._maskAssetNames = k._maskAssetNames; this._maskAssetLocations = k._maskAssetLocations; diff --git a/src/nitro/room/object/visualization/room/RoomPlane.ts b/src/nitro/room/object/visualization/room/RoomPlane.ts index 1aad4bad..79deedb3 100644 --- a/src/nitro/room/object/visualization/room/RoomPlane.ts +++ b/src/nitro/room/object/visualization/room/RoomPlane.ts @@ -84,16 +84,16 @@ export class RoomPlane implements IRoomPlane this._rightSide.assign(rightSide); this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide); - if (this._normal.length > 0) + if(this._normal.length > 0) { this._normal.multiply((1 / this._normal.length)); } - if (secondaryNormals != null) + if(secondaryNormals != null) { - for (const entry of secondaryNormals) + for(const entry of secondaryNormals) { - if (!entry) continue; + if(!entry) continue; const vector = new Vector3d(); @@ -136,9 +136,9 @@ export class RoomPlane implements IRoomPlane public set canBeVisible(k: boolean) { - if (k !== this._canBeVisible) + if(k !== this._canBeVisible) { - if (!this._canBeVisible) this.resetTextureCache(); + if(!this._canBeVisible) this.resetTextureCache(); this._canBeVisible = k; } @@ -151,11 +151,11 @@ export class RoomPlane implements IRoomPlane public get bitmapData(): Texture { - if (!this.visible || !this._bitmapData) return null; + if(!this.visible || !this._bitmapData) return null; let texture: RenderTexture = RoomVisualization.getTextureCache(this._bitmapData); - if (!texture) + if(!texture) { texture = TextureUtils.generateTexture(this._bitmapData, new Rectangle(0, 0, this._width, this._height)); @@ -237,7 +237,7 @@ export class RoomPlane implements IRoomPlane public set id(k: string) { - if (k === this._id) return; + if(k === this._id) return; this.resetTextureCache(); this._id = k; @@ -250,20 +250,20 @@ export class RoomPlane implements IRoomPlane public dispose(): void { - if (this._bitmapData) + if(this._bitmapData) { this._bitmapData.destroy(); this._bitmapData = null; } - if (this._textures) + if(this._textures) { - for (const bitmap of this._textures.values()) + for(const bitmap of this._textures.values()) { - if (!bitmap) continue; + if(!bitmap) continue; - if (bitmap.bitmap) bitmap.bitmap.destroy(); + if(bitmap.bitmap) bitmap.bitmap.destroy(); bitmap.dispose(); } @@ -285,7 +285,7 @@ export class RoomPlane implements IRoomPlane this._bitmapMasks = null; this._rectangleMasks = null; - if (this._maskBitmapData) + if(this._maskBitmapData) { this._maskBitmapData.destroy(); @@ -297,9 +297,9 @@ export class RoomPlane implements IRoomPlane public copyBitmapData(k: Texture): Texture { - if (!this.visible || !this._bitmapData || !k) return null; + if(!this.visible || !this._bitmapData || !k) return null; - if ((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null; + if((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null; //k.copyPixels(this._bitmapData, this._bitmapData.rect, RoomPlane.ZERO_POINT); return k; @@ -309,7 +309,7 @@ export class RoomPlane implements IRoomPlane { const existing = this._textures.get(k); - if (existing) + if(existing) { this._textures.delete(k); @@ -324,11 +324,11 @@ export class RoomPlane implements IRoomPlane private resetTextureCache(k: Graphics = null): void { - if (this._textures && this._textures.size) + if(this._textures && this._textures.size) { - for (const bitmap of this._textures.values()) + for(const bitmap of this._textures.values()) { - if (!bitmap) continue; + if(!bitmap) continue; bitmap.dispose(); } @@ -341,43 +341,43 @@ export class RoomPlane implements IRoomPlane private getTextureIdentifier(k: number): string { - if (this._rasterizer) return this._rasterizer.getTextureIdentifier(k, this.normal); + if(this._rasterizer) return this._rasterizer.getTextureIdentifier(k, this.normal); return k.toString(); } private needsNewTexture(k: IRoomGeometry, _arg_2: number): boolean { - if (!k) return false; + if(!k) return false; let planeBitmap = this._activeTexture; - if (!planeBitmap) + if(!planeBitmap) { planeBitmap = this._textures.get(this.getTextureIdentifier(k.scale)); } this.updateMaskChangeStatus(); - if (this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true; + if(this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true; return false; } private getTexture(k: IRoomGeometry, _arg_2: number): Graphics { - if (!k) return null; + if(!k) return null; let _local_3: PlaneBitmapData = null; - if (this.needsNewTexture(k, _arg_2)) + if(this.needsNewTexture(k, _arg_2)) { const _local_4 = this.getTextureIdentifier(k.scale); const _local_5 = (this._leftSide.length * k.scale); const _local_6 = (this._rightSide.length * k.scale); const _local_7 = k.getCoordinatePosition(this._normal); - if (this._activeTexture) + if(this._activeTexture) { _local_3 = this._activeTexture; } @@ -388,15 +388,15 @@ export class RoomPlane implements IRoomPlane let _local_8: Graphics = null; - if (_local_3) _local_8 = _local_3.bitmap; + if(_local_3) _local_8 = _local_3.bitmap; - if (this._rasterizer) + if(this._rasterizer) { _local_3 = this._rasterizer.render(_local_8, this._id, _local_5, _local_6, k.scale, _local_7, this._hasTexture, this._textureOffsetX, this._textureOffsetY, this._textureMaxX, this._textureMaxY, _arg_2); - if (_local_3) + if(_local_3) { - if (_local_8 && (_local_3.bitmap !== _local_8)) _local_8.destroy(); + if(_local_8 && (_local_3.bitmap !== _local_8)) _local_8.destroy(); } } else @@ -410,7 +410,7 @@ export class RoomPlane implements IRoomPlane _local_3 = new PlaneBitmapData(_local_9, -1); } - if (_local_3) + if(_local_3) { this.updateMask(_local_3.bitmap, k); this.cacheTexture(_local_4, _local_3); @@ -418,7 +418,7 @@ export class RoomPlane implements IRoomPlane } else { - if (this._activeTexture) + if(this._activeTexture) { _local_3 = this._activeTexture; } @@ -428,7 +428,7 @@ export class RoomPlane implements IRoomPlane } } - if (_local_3) + if(_local_3) { this._activeTexture = _local_3; @@ -440,30 +440,30 @@ export class RoomPlane implements IRoomPlane private resolveMasks(k: IRoomGeometry): PlaneDrawingData { - if (!this._useMask) return null; + if(!this._useMask) return null; const _local_5 = new PlaneDrawingData(); const index = 0; - while (index < this._bitmapMasks.length) + while(index < this._bitmapMasks.length) { const mask = this._bitmapMasks[index]; - if (mask) + if(mask) { const planeMask = this._maskManager.getMask(mask.type); - if (planeMask) + if(planeMask) { const assetName = planeMask.getAssetName(k.scale); - if (assetName) + if(assetName) { const position = k.getCoordinatePosition(this._normal); const asset = planeMask.getGraphicAsset(k.scale, position); - if (asset) + if(asset) { const _local_3 = (this._maskBitmapData.width * (1 - (mask.leftSideLoc / this._leftSide.length))); const _local_4 = (this._maskBitmapData.height * (1 - (mask.rightSideLoc / this._rightSide.length))); @@ -491,20 +491,20 @@ export class RoomPlane implements IRoomPlane { const drawingDatas: PlaneDrawingData[] = []; - if (this._isVisible) + if(this._isVisible) { const maskData = this.resolveMasks(geometry); const layers = this._rasterizer.getLayers(this._id); let i = 0; - while (i < layers.length) + while(i < layers.length) { const layer = (layers[i] as PlaneVisualizationLayer); - if (layer) + if(layer) { - if (this._hasTexture && layer.getMaterial()) + if(this._hasTexture && layer.getMaterial()) { const normal = geometry.getCoordinatePosition(this._normal); const cm = layer.getMaterial().getMaterialCellMatrix(normal); @@ -513,26 +513,26 @@ export class RoomPlane implements IRoomPlane Randomizer.setSeed(this._randomSeed); - for (const column of cm.getColumns(this.screenWidth(geometry))) + for(const column of cm.getColumns(this.screenWidth(geometry))) { const assetNames: string[] = []; - for (const cell of column.getCells()) + for(const cell of column.getCells()) { const name = cell.getAssetName(normal); - if (name) assetNames.push(name); + if(name) assetNames.push(name); } - if (assetNames.length > 0) + if(assetNames.length > 0) { - if (!column.isRepeated()) assetNames.push(''); + if(!column.isRepeated()) assetNames.push(''); data.addAssetColumn(assetNames); } } - if (data.assetNameColumns.length > 0) drawingDatas.push(data); + if(data.assetNameColumns.length > 0) drawingDatas.push(data); } else { @@ -546,7 +546,7 @@ export class RoomPlane implements IRoomPlane i++; } - if (!drawingDatas.length) drawingDatas.push(new PlaneDrawingData(maskData, this._color)); + if(!drawingDatas.length) drawingDatas.push(new PlaneDrawingData(maskData, this._color)); } return drawingDatas; @@ -558,18 +558,18 @@ export class RoomPlane implements IRoomPlane public update(geometry: IRoomGeometry, timeSinceStartMs: number): boolean { - if (!geometry || this._disposed) return false; + if(!geometry || this._disposed) return false; let geometryChanged = false; - if (this._geometryUpdateId != geometry.updateId) geometryChanged = true; + if(this._geometryUpdateId != geometry.updateId) geometryChanged = true; - if (!geometryChanged || !this._canBeVisible) + if(!geometryChanged || !this._canBeVisible) { - if (!this.visible) return false; + if(!this.visible) return false; } - if (geometryChanged) + if(geometryChanged) { this._activeTexture = null; @@ -577,9 +577,9 @@ export class RoomPlane implements IRoomPlane cosAngle = Vector3d.cosAngle(geometry.directionAxis, this.normal); - if (cosAngle > -0.001) + if(cosAngle > -0.001) { - if (this._isVisible) + if(this._isVisible) { this._isVisible = false; return true; @@ -590,13 +590,13 @@ export class RoomPlane implements IRoomPlane let i = 0; - while (i < this._secondaryNormals.length) + while(i < this._secondaryNormals.length) { cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._secondaryNormals[i]); - if (cosAngle > -0.001) + if(cosAngle > -0.001) { - if (this._isVisible) + if(this._isVisible) { this._isVisible = false; return true; @@ -615,12 +615,12 @@ export class RoomPlane implements IRoomPlane let relativeDepth = (Math.max(this._cornerA.z, this._cornerB.z, this._cornerC.z, this._cornerD.z) - originZ); - if (this._type === RoomPlane.TYPE_FLOOR) + if(this._type === RoomPlane.TYPE_FLOOR) { relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._leftSide.z, this._rightSide.z)) * 8)); } - if (this._type === RoomPlane.TYPE_LANDSCAPE) + if(this._type === RoomPlane.TYPE_LANDSCAPE) { relativeDepth = (relativeDepth + 0.02); } @@ -630,21 +630,21 @@ export class RoomPlane implements IRoomPlane this._geometryUpdateId = geometry.updateId; } - if (geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs)) + if(geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs)) { - if (!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height)) + if(!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height)) { - if (this._bitmapData) + if(this._bitmapData) { this._bitmapData.destroy(); this._bitmapData = null; - if ((this._width < 1) || (this._height < 1)) return true; + if((this._width < 1) || (this._height < 1)) return true; } else { - if ((this._width < 1) || (this._height < 1)) return false; + if((this._width < 1) || (this._height < 1)) return false; } const graphic = new Graphics(); @@ -655,7 +655,7 @@ export class RoomPlane implements IRoomPlane this._bitmapData = graphic; - if (!this._bitmapData) return false; + if(!this._bitmapData) return false; } else { @@ -667,7 +667,7 @@ export class RoomPlane implements IRoomPlane const texture = this.getTexture(geometry, timeSinceStartMs); - if (texture) + if(texture) { this.renderTexture(geometry, texture); } @@ -723,7 +723,7 @@ export class RoomPlane implements IRoomPlane private renderTexture(k: IRoomGeometry, _arg_2: Graphics): void { - if (((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null))) + if(((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null))) { return; } @@ -731,21 +731,21 @@ export class RoomPlane implements IRoomPlane let _local_4: number = (this._cornerD.y - this._cornerC.y); let _local_5: number = (this._cornerB.x - this._cornerC.x); let _local_6: number = (this._cornerB.y - this._cornerC.y); - if (((this._type == RoomPlane.TYPE_WALL) || (this._type == RoomPlane.TYPE_LANDSCAPE))) + if(((this._type == RoomPlane.TYPE_WALL) || (this._type == RoomPlane.TYPE_LANDSCAPE))) { - if (Math.abs((_local_5 - _arg_2.width)) <= 1) + if(Math.abs((_local_5 - _arg_2.width)) <= 1) { _local_5 = _arg_2.width; } - if (Math.abs((_local_6 - _arg_2.width)) <= 1) + if(Math.abs((_local_6 - _arg_2.width)) <= 1) { _local_6 = _arg_2.width; } - if (Math.abs((_local_3 - _arg_2.height)) <= 1) + if(Math.abs((_local_3 - _arg_2.height)) <= 1) { _local_3 = _arg_2.height; } - if (Math.abs((_local_4 - _arg_2.height)) <= 1) + if(Math.abs((_local_4 - _arg_2.height)) <= 1) { _local_4 = _arg_2.height; } @@ -775,7 +775,7 @@ export class RoomPlane implements IRoomPlane public resetBitmapMasks(): void { - if (this._disposed || !this._useMask || !this._bitmapMasks.length) return; + if(this._disposed || !this._useMask || !this._bitmapMasks.length) return; this._maskChanged = true; this._bitmapMasks = []; @@ -783,17 +783,17 @@ export class RoomPlane implements IRoomPlane public addBitmapMask(k: string, _arg_2: number, _arg_3: number): boolean { - if (!this._useMask) return false; + if(!this._useMask) return false; let _local_5 = 0; - while (_local_5 < this._bitmapMasks.length) + while(_local_5 < this._bitmapMasks.length) { const mask = this._bitmapMasks[_local_5]; - if (mask) + if(mask) { - if ((((mask.type === k) && (mask.leftSideLoc === _arg_2)) && (mask.rightSideLoc === _arg_3))) return false; + if((((mask.type === k) && (mask.leftSideLoc === _arg_2)) && (mask.rightSideLoc === _arg_3))) return false; } _local_5++; @@ -809,7 +809,7 @@ export class RoomPlane implements IRoomPlane public resetRectangleMasks(): void { - if (!this._useMask || !this._rectangleMasks.length) return; + if(!this._useMask || !this._rectangleMasks.length) return; this._maskChanged = true; this._rectangleMasks = []; @@ -817,13 +817,13 @@ export class RoomPlane implements IRoomPlane public addRectangleMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean { - if (this._useMask) + if(this._useMask) { - for (const mask of this._rectangleMasks) + for(const mask of this._rectangleMasks) { - if (!mask) continue; + if(!mask) continue; - if ((((mask.leftSideLoc === k) && (mask.rightSideLoc === _arg_2)) && (mask.leftSideLength === _arg_3)) && (mask.rightSideLength === _arg_4)) return false; + if((((mask.leftSideLoc === k) && (mask.rightSideLoc === _arg_2)) && (mask.leftSideLength === _arg_3)) && (mask.rightSideLength === _arg_4)) return false; } const _local_5 = new RoomPlaneRectangleMask(k, _arg_2, _arg_3, _arg_4); @@ -839,24 +839,24 @@ export class RoomPlane implements IRoomPlane private updateMaskChangeStatus(): void { - if (!this._maskChanged) return; + if(!this._maskChanged) return; let _local_3 = true; let _local_6: boolean; - if (this._bitmapMasks.length === this._bitmapMasksOld.length) + if(this._bitmapMasks.length === this._bitmapMasksOld.length) { - for (const mask of this._bitmapMasks) + for(const mask of this._bitmapMasks) { - if (!mask) continue; + if(!mask) continue; _local_6 = false; - for (const plane of this._bitmapMasksOld) + for(const plane of this._bitmapMasksOld) { - if (!plane) continue; + if(!plane) continue; - if (((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc)) + if(((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc)) { _local_6 = true; @@ -864,7 +864,7 @@ export class RoomPlane implements IRoomPlane } } - if (!_local_6) + if(!_local_6) { _local_3 = false; @@ -877,25 +877,25 @@ export class RoomPlane implements IRoomPlane _local_3 = false; } - if (this._rectangleMasks.length > this._rectangleMasksOld.length) _local_3 = false; + if(this._rectangleMasks.length > this._rectangleMasksOld.length) _local_3 = false; - if (_local_3) this._maskChanged = false; + if(_local_3) this._maskChanged = false; } private updateMask(texture: Graphics, geometry: IRoomGeometry): void { - if (!texture || !geometry) return; + if(!texture || !geometry) return; - if (((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return; + if(((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return; const width = texture.width; const height = texture.height; this.updateMaskChangeStatus(); - if (!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height)) + if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height)) { - if (this._maskBitmapData) + if(this._maskBitmapData) { this._maskBitmapData.destroy(); this._maskBitmapData = null; @@ -912,12 +912,12 @@ export class RoomPlane implements IRoomPlane this._maskChanged = true; } - if (this._maskChanged) + if(this._maskChanged) { this._bitmapMasksOld = []; this._rectangleMasksOld = []; - if (this._maskBitmapData) + if(this._maskBitmapData) { this._maskBitmapData .beginFill(0xFFFFFF, 0) @@ -934,11 +934,11 @@ export class RoomPlane implements IRoomPlane let posY = 0; let i = 0; - while (i < this._bitmapMasks.length) + while(i < this._bitmapMasks.length) { const mask = this._bitmapMasks[i]; - if (mask) + if(mask) { type = mask.type; posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * mask.leftSideLoc) / this._leftSide.length)); @@ -953,11 +953,11 @@ export class RoomPlane implements IRoomPlane i = 0; - while (i < this._rectangleMasks.length) + while(i < this._rectangleMasks.length) { const rectMask = this._rectangleMasks[i]; - if (rectMask) + if(rectMask) { posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * rectMask.leftSideLoc) / this._leftSide.length)); posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * rectMask.rightSideLoc) / this._rightSide.length)); @@ -984,7 +984,7 @@ export class RoomPlane implements IRoomPlane private combineTextureMask(texture: Graphics, mask: Graphics): void { - if (!texture || !mask) return; + if(!texture || !mask) return; const maskCanvas = TextureUtils.generateCanvas(mask); const textureCanvas = TextureUtils.generateCanvas(texture); @@ -995,21 +995,21 @@ export class RoomPlane implements IRoomPlane const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height); const data = textureImageData.data; - for (let i = 0; i < data.length; i += 4) + for(let i = 0; i < data.length; i += 4) { const red = data[i]; const green = data[i + 1]; const blue = data[i + 2]; const alpha = data[i + 3]; - if (!red && !green && !blue) data[i + 3] = 0; + if(!red && !green && !blue) data[i + 3] = 0; } textureCtx.putImageData(textureImageData, 0, 0); const newTexture = Texture.from(textureCanvas); - if (!newTexture) return; + if(!newTexture) return; texture .clear() diff --git a/src/nitro/room/object/visualization/room/RoomVisualization.ts b/src/nitro/room/object/visualization/room/RoomVisualization.ts index 11457d07..51d7d497 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualization.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualization.ts @@ -107,18 +107,18 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { const existing = RoomVisualization.RENDER_TEXTURE_CACHE.get(RoomVisualization.LAST_VISUALIZATION); - if (!existing) return null; + if(!existing) return null; return existing.getValue(key); } public static addTextureCache(key: any, value: RenderTexture): void { - if (!RoomVisualization.LAST_VISUALIZATION) return; + if(!RoomVisualization.LAST_VISUALIZATION) return; let existing = RoomVisualization.RENDER_TEXTURE_CACHE.get(RoomVisualization.LAST_VISUALIZATION); - if (!existing) + if(!existing) { existing = new AdvancedMap(); @@ -130,7 +130,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements public initialize(data: IObjectVisualizationData): boolean { - if (!(data instanceof RoomVisualizationData)) return false; + if(!(data instanceof RoomVisualizationData)) return false; this._data = data; @@ -151,21 +151,21 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements this._visiblePlanes = null; this._visiblePlaneSpriteNumbers = null; - if (this._roomPlaneParser) + if(this._roomPlaneParser) { this._roomPlaneParser.dispose(); this._roomPlaneParser = null; } - if (this._roomPlaneBitmapMaskParser) + if(this._roomPlaneBitmapMaskParser) { this._roomPlaneBitmapMaskParser.dispose(); this._roomPlaneBitmapMaskParser = null; } - if (this._data) + if(this._data) { this._data.clearCache(); @@ -174,9 +174,9 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const existingTextureCache = RoomVisualization.RENDER_TEXTURE_CACHE.get(this); - if (existingTextureCache) + if(existingTextureCache) { - for (const texture of existingTextureCache.getValues()) + for(const texture of existingTextureCache.getValues()) { texture.destroy(true); } @@ -201,7 +201,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void { - if (!this.object || !geometry) return; + if(!this.object || !geometry) return; RoomVisualization.LAST_VISUALIZATION = this; @@ -209,28 +209,28 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const existing = RoomVisualization.RENDER_TEXTURE_CACHE.get(RoomVisualization.LAST_VISUALIZATION); - if (existing) removeCount = existing.length; + if(existing) removeCount = existing.length; const geometryUpdate = this.updateGeometry(geometry); const objectModel = this.object.model; let needsUpdate = false; - if (this.updateThickness(objectModel)) needsUpdate = true; + if(this.updateThickness(objectModel)) needsUpdate = true; - if (this.updateHole(objectModel)) needsUpdate = true; + if(this.updateHole(objectModel)) needsUpdate = true; - if (this.initializeRoomPlanes()) + if(this.initializeRoomPlanes()) { - if (existing && removeCount) + if(existing && removeCount) { setTimeout(() => { - while (removeCount) + while(removeCount) { const texture = existing.getWithIndex(0); - if (texture) + if(texture) { texture.destroy(true); @@ -245,25 +245,25 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements needsUpdate = this.updateMasks(objectModel); - if (((time < (this._lastUpdateTime + this._updateIntervalTime)) && (!geometryUpdate)) && (!needsUpdate)) return; + if(((time < (this._lastUpdateTime + this._updateIntervalTime)) && (!geometryUpdate)) && (!needsUpdate)) return; - if (this.updatePlaneTexturesAndVisibilities(objectModel)) needsUpdate = true; + if(this.updatePlaneTexturesAndVisibilities(objectModel)) needsUpdate = true; - if (this.updatePlanes(geometry, geometryUpdate, time)) needsUpdate = true; + if(this.updatePlanes(geometry, geometryUpdate, time)) needsUpdate = true; - if (needsUpdate) + if(needsUpdate) { let index = 0; - while (index < this._visiblePlanes.length) + while(index < this._visiblePlanes.length) { const spriteIndex = this._visiblePlaneSpriteNumbers[index]; const sprite = this.getSprite(spriteIndex); const plane = this._visiblePlanes[index]; - if (sprite && plane && (plane.type !== RoomPlane.TYPE_LANDSCAPE)) + if(sprite && plane && (plane.type !== RoomPlane.TYPE_LANDSCAPE)) { - if (this._colorBackgroundOnly) + if(this._colorBackgroundOnly) { let _local_14 = plane.color; @@ -294,16 +294,16 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updateGeometry(k: IRoomGeometry): boolean { - if (!k) return false; + if(!k) return false; - if (this._geometryUpdateId === k.updateId) return false; + if(this._geometryUpdateId === k.updateId) return false; this._geometryUpdateId = k.updateId; this._boundingRectangle = null; const direction = k.direction; - if (direction && ((direction.x !== this._directionX) || (direction.y !== this._directionY) || (direction.z !== this._directionZ) || (k.scale !== this._roomScale))) + if(direction && ((direction.x !== this._directionX) || (direction.y !== this._directionY) || (direction.z !== this._directionZ) || (k.scale !== this._roomScale))) { this._directionX = direction.x; this._directionY = direction.y; @@ -318,12 +318,12 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updateThickness(k: IRoomObjectModel): boolean { - if (this.updateModelCounter === k.updateCounter) return false; + if(this.updateModelCounter === k.updateCounter) return false; const floorThickness = k.getValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS); const wallThickness = k.getValue(RoomObjectVariable.ROOM_WALL_THICKNESS); - if ((!isNaN(floorThickness) && !isNaN(wallThickness)) && ((floorThickness !== this._floorThickness) || (wallThickness !== this._wallThickness))) + if((!isNaN(floorThickness) && !isNaN(wallThickness)) && ((floorThickness !== this._floorThickness) || (wallThickness !== this._wallThickness))) { this._floorThickness = floorThickness; this._wallThickness = wallThickness; @@ -338,11 +338,11 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updateHole(k: IRoomObjectModel): boolean { - if (this.updateModelCounter === k.updateCounter) return false; + if(this.updateModelCounter === k.updateCounter) return false; const holeUpdate = k.getValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME); - if (!isNaN(holeUpdate) && (holeUpdate !== this._holeUpdateTime)) + if(!isNaN(holeUpdate) && (holeUpdate !== this._holeUpdateTime)) { this._holeUpdateTime = holeUpdate; @@ -356,13 +356,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updateMasks(k: IRoomObjectModel): boolean { - if (this.updateModelCounter === k.updateCounter) return false; + if(this.updateModelCounter === k.updateCounter) return false; let didUpdate = false; const planeMask = k.getValue(RoomObjectVariable.ROOM_PLANE_MASK_XML); - if (planeMask !== this._maskData) + if(planeMask !== this._maskData) { this.updatePlaneMasks(planeMask); @@ -373,7 +373,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const backgroundColor = k.getValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR); - if (backgroundColor !== this._color) + if(backgroundColor !== this._color) { this._color = backgroundColor; this._redColor = (this._color & 0xFF); @@ -385,7 +385,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const backgroundOnly = (k.getValue(RoomObjectVariable.ROOM_COLORIZE_BG_ONLY) || false); - if (backgroundOnly !== this._colorBackgroundOnly) + if(backgroundOnly !== this._colorBackgroundOnly) { this._colorBackgroundOnly = backgroundOnly; @@ -397,7 +397,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updatePlaneTexturesAndVisibilities(model: IRoomObjectModel): boolean { - if (this.updateModelCounter === model.updateCounter) return false; + if(this.updateModelCounter === model.updateCounter) return false; const floorType = model.getValue(RoomObjectVariable.ROOM_FLOOR_TYPE); const wallType = model.getValue(RoomObjectVariable.ROOM_WALL_TYPE); @@ -416,13 +416,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private clearPlanes(): void { - if (this._planes) + if(this._planes) { - while (this._planes.length) + while(this._planes.length) { const plane = this._planes[0]; - if (plane) plane.dispose(); + if(plane) plane.dispose(); this._planes.pop(); } @@ -439,14 +439,14 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements protected initializeRoomPlanes(): boolean { - if (!this.object || this._isPlaneSet) return false; + if(!this.object || this._isPlaneSet) return false; - if (!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness; - if (!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness; + if(!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness; + if(!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness; const mapData = this.object.model.getValue(RoomObjectVariable.ROOM_MAP_DATA); - if (!this._roomPlaneParser.initializeFromMapData(mapData)) return; + if(!this._roomPlaneParser.initializeFromMapData(mapData)) return; const _local_3 = this.getLandscapeWidth(); const _local_4 = this.getLandscapeHeight(); @@ -455,7 +455,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let randomSeed = this.object.model.getValue(RoomObjectVariable.ROOM_RANDOM_SEED); let index = 0; - while (index < this._roomPlaneParser.planeCount) + while(index < this._roomPlaneParser.planeCount) { const location = this._roomPlaneParser.getPlaneLocation(index); const leftSide = this._roomPlaneParser.getPlaneLeftSide(index); @@ -465,14 +465,14 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let plane: RoomPlane = null; - if (location && leftSide && rightSide) + if(location && leftSide && rightSide) { const _local_14 = Vector3d.crossProduct(leftSide, rightSide); randomSeed = ((randomSeed * 7613) + 517); plane = null; - if (planeType === RoomPlaneData.PLANE_FLOOR) + if(planeType === RoomPlaneData.PLANE_FLOOR) { const _local_15 = ((location.x + leftSide.x) + 0.5); const _local_16 = ((location.y + rightSide.y) + 0.5); @@ -481,7 +481,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements plane = new RoomPlane(this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_FLOOR, true, secondaryNormals, randomSeed, -(textureOffsetX), -(textureOffsetY)); - if (_local_14.z !== 0) + if(_local_14.z !== 0) { plane.color = RoomVisualization.FLOOR_COLOR; } @@ -490,31 +490,31 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements plane.color = ((_local_14.x !== 0) ? RoomVisualization.FLOOR_COLOR_RIGHT : RoomVisualization.FLOOR_COLOR_LEFT); } - if (this._data) plane.rasterizer = this._data.floorRasterizer; + if(this._data) plane.rasterizer = this._data.floorRasterizer; } - else if (planeType === RoomPlaneData.PLANE_WALL) + else if(planeType === RoomPlaneData.PLANE_WALL) { plane = new RoomPlane(this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_WALL, true, secondaryNormals, randomSeed); - if ((leftSide.length < 1) || (rightSide.length < 1)) + if((leftSide.length < 1) || (rightSide.length < 1)) { plane.hasTexture = false; } - if ((_local_14.x === 0) && (_local_14.y === 0)) + if((_local_14.x === 0) && (_local_14.y === 0)) { plane.color = RoomVisualization.WALL_COLOR_BORDER; } else { - if (_local_14.y > 0) + if(_local_14.y > 0) { plane.color = RoomVisualization.WALL_COLOR_TOP; } else { - if (_local_14.y === 0) + if(_local_14.y === 0) { plane.color = RoomVisualization.WALL_COLOR_SIDE; } @@ -525,20 +525,20 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } } - if (this._data) plane.rasterizer = this._data.wallRasterizer; + if(this._data) plane.rasterizer = this._data.wallRasterizer; } - else if (planeType === RoomPlaneData.PLANE_LANDSCAPE) + else if(planeType === RoomPlaneData.PLANE_LANDSCAPE) { plane = new RoomPlane(this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_LANDSCAPE, true, secondaryNormals, randomSeed, _local_5, 0, _local_3, _local_4); - if (_local_14.y > 0) + if(_local_14.y > 0) { plane.color = RoomVisualization.LANDSCAPE_COLOR_TOP; } else { - if (_local_14.y == 0) + if(_local_14.y == 0) { plane.color = RoomVisualization.LANDSCAPE_COLOR_SIDE; } @@ -548,31 +548,31 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } } - if (this._data) plane.rasterizer = this._data.landscapeRasterizer; + if(this._data) plane.rasterizer = this._data.landscapeRasterizer; _local_5 = (_local_5 + leftSide.length); } - else if (planeType == RoomPlaneData.PLANE_BILLBOARD) + else if(planeType == RoomPlaneData.PLANE_BILLBOARD) { plane = new RoomPlane(this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_WALL, true, secondaryNormals, randomSeed); - if (((leftSide.length < 1) || (rightSide.length < 1))) + if(((leftSide.length < 1) || (rightSide.length < 1))) { plane.hasTexture = false; } - if (((_local_14.x == 0) && (_local_14.y == 0))) + if(((_local_14.x == 0) && (_local_14.y == 0))) { plane.color = RoomVisualization.WALL_COLOR_BORDER; } else { - if (_local_14.y > 0) + if(_local_14.y > 0) { plane.color = RoomVisualization.WALL_COLOR_TOP; } else { - if (_local_14.y == 0) + if(_local_14.y == 0) { plane.color = RoomVisualization.WALL_COLOR_SIDE; } @@ -589,13 +589,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } - if (plane) + if(plane) { plane.maskManager = this._data.maskManager; let _local_19 = 0; - while (_local_19 < this._roomPlaneParser.getPlaneMaskCount(index)) + while(_local_19 < this._roomPlaneParser.getPlaneMaskCount(index)) { const _local_20 = this._roomPlaneParser.getPlaneMaskLeftSideLoc(index, _local_19); const _local_21 = this._roomPlaneParser.getPlaneMaskRightSideLoc(index, _local_19); @@ -630,14 +630,14 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let planeIndex = 0; - while (planeIndex < this._planes.length) + while(planeIndex < this._planes.length) { const plane = this._planes[planeIndex]; const sprite = this.getSprite(planeIndex); - if (plane && sprite && plane.leftSide && plane.rightSide) + if(plane && sprite && plane.leftSide && plane.rightSide) { - if ((plane.type === RoomPlane.TYPE_WALL) && ((plane.leftSide.length < 1) || (plane.rightSide.length < 1))) + if((plane.type === RoomPlane.TYPE_WALL) && ((plane.leftSide.length < 1) || (plane.rightSide.length < 1))) { sprite.alphaTolerance = AlphaTolerance.MATCH_NOTHING; } @@ -646,12 +646,12 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements sprite.alphaTolerance = AlphaTolerance.MATCH_OPAQUE_PIXELS; } - if (plane.type === RoomPlane.TYPE_WALL) + if(plane.type === RoomPlane.TYPE_WALL) { sprite.tag = 'plane.wall@' + (planeIndex + 1); } - else if (plane.type === RoomPlane.TYPE_FLOOR) + else if(plane.type === RoomPlane.TYPE_FLOOR) { sprite.tag = 'plane.floor@' + (planeIndex + 1); } @@ -673,11 +673,11 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let length = 0; let index = 0; - while (index < this._roomPlaneParser.planeCount) + while(index < this._roomPlaneParser.planeCount) { const type = this._roomPlaneParser.getPlaneType(index); - if (type === RoomPlaneData.PLANE_LANDSCAPE) + if(type === RoomPlaneData.PLANE_LANDSCAPE) { const vector = this._roomPlaneParser.getPlaneLeftSide(index); @@ -695,57 +695,57 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let length = 0; let index = 0; - while (index < this._roomPlaneParser.planeCount) + while(index < this._roomPlaneParser.planeCount) { const type = this._roomPlaneParser.getPlaneType(index); - if (type === RoomPlaneData.PLANE_LANDSCAPE) + if(type === RoomPlaneData.PLANE_LANDSCAPE) { const vector = this._roomPlaneParser.getPlaneRightSide(index); - if (vector.length > length) length = vector.length; + if(vector.length > length) length = vector.length; } index++; } - if (length > 5) length = 5; + if(length > 5) length = 5; return length; } protected updatePlaneTypes(floorType: string, wallType: string, landscapeType: string): boolean { - if (floorType !== this._floorType) this._floorType = floorType; + if(floorType !== this._floorType) this._floorType = floorType; else floorType = null; - if (wallType !== this._wallType) this._wallType = wallType; + if(wallType !== this._wallType) this._wallType = wallType; else wallType = null; - if (landscapeType !== this._landscapeType) this._landscapeType = landscapeType; + if(landscapeType !== this._landscapeType) this._landscapeType = landscapeType; else landscapeType = null; - if (!floorType && !wallType && !landscapeType) return false; + if(!floorType && !wallType && !landscapeType) return false; let index = 0; - while (index < this._planes.length) + while(index < this._planes.length) { const plane = this._planes[index]; - if (plane) + if(plane) { - if ((plane.type === RoomPlane.TYPE_FLOOR) && floorType) + if((plane.type === RoomPlane.TYPE_FLOOR) && floorType) { plane.id = floorType; } - else if ((plane.type === RoomPlane.TYPE_WALL) && wallType) + else if((plane.type === RoomPlane.TYPE_WALL) && wallType) { plane.id = wallType; } - else if ((plane.type === RoomPlane.TYPE_LANDSCAPE) && landscapeType) + else if((plane.type === RoomPlane.TYPE_LANDSCAPE) && landscapeType) { plane.id = landscapeType; } @@ -759,7 +759,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private updatePlaneVisibility(k: boolean, _arg_2: boolean, _arg_3: boolean): void { - if ((k === this._typeVisibility[RoomPlane.TYPE_FLOOR]) && (_arg_2 === this._typeVisibility[RoomPlane.TYPE_WALL]) && (_arg_3 === this._typeVisibility[RoomPlane.TYPE_LANDSCAPE])) return; + if((k === this._typeVisibility[RoomPlane.TYPE_FLOOR]) && (_arg_2 === this._typeVisibility[RoomPlane.TYPE_WALL]) && (_arg_3 === this._typeVisibility[RoomPlane.TYPE_LANDSCAPE])) return; this._typeVisibility[RoomPlane.TYPE_FLOOR] = k; this._typeVisibility[RoomPlane.TYPE_WALL] = _arg_2; @@ -771,11 +771,11 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements protected updatePlanes(k: IRoomGeometry, _arg_2: boolean, _arg_3: number): boolean { - if (!k || !this.object) return; + if(!k || !this.object) return; this._assetUpdateCounter++; - if (_arg_2) + if(_arg_2) { this._visiblePlanes = []; this._visiblePlaneSpriteNumbers = []; @@ -785,39 +785,39 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let _local_6 = this._visiblePlanes; - if (!this._visiblePlanes.length) _local_6 = this._planes; + if(!this._visiblePlanes.length) _local_6 = this._planes; let depth = 0; let updated = false; let index = 0; - while (index < _local_6.length) + while(index < _local_6.length) { let _local_10 = index; - if (_local_8) _local_10 = this._visiblePlaneSpriteNumbers[index]; + if(_local_8) _local_10 = this._visiblePlaneSpriteNumbers[index]; const _local_11 = this.getSprite(_local_10); - if (_local_11) + if(_local_11) { const _local_12 = _local_6[index]; - if (_local_12) + if(_local_12) { _local_11.id = _local_12.uniqueId; - if (_local_12.update(k, _arg_3)) + if(_local_12.update(k, _arg_3)) { - if (_local_12.visible) + if(_local_12.visible) { depth = ((_local_12.relativeDepth + this.floorRelativeDepth) + (_local_10 / 1000)); - if (_local_12.type !== RoomPlane.TYPE_FLOOR) + if(_local_12.type !== RoomPlane.TYPE_FLOOR) { depth = ((_local_12.relativeDepth + this.wallRelativeDepth) + (_local_10 / 1000)); - if ((_local_12.leftSide.length < 1) || (_local_12.rightSide.length < 1)) + if((_local_12.leftSide.length < 1) || (_local_12.rightSide.length < 1)) { depth = (depth + (RoomVisualization.ROOM_DEPTH_OFFSET * 0.5)); } @@ -829,14 +829,14 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } updated = true; } - if (_local_11.visible != ((_local_12.visible) && (this._typeVisibility[_local_12.type]))) + if(_local_11.visible != ((_local_12.visible) && (this._typeVisibility[_local_12.type]))) { _local_11.visible = (!(_local_11.visible)); updated = true; } - if (_local_11.visible) + if(_local_11.visible) { - if (!_local_8) + if(!_local_8) { this._visiblePlanes.push(_local_12); this._visiblePlaneSpriteNumbers.push(index); @@ -846,7 +846,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements else { _local_11.id = 0; - if (_local_11.visible) + if(_local_11.visible) { _local_11.visible = false; updated = true; @@ -861,7 +861,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements protected updatePlaneMasks(k: RoomMapMaskData): void { - if (!k) return; + if(!k) return; this._roomPlaneBitmapMaskParser.initialize(k); @@ -871,57 +871,57 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements let _local_6 = false; let index = 0; - while (index < this._planes.length) + while(index < this._planes.length) { const plane = this._planes[index]; - if (plane) + if(plane) { plane.resetBitmapMasks(); - if (plane.type === RoomPlane.TYPE_LANDSCAPE) _local_4.push(index); + if(plane.type === RoomPlane.TYPE_LANDSCAPE) _local_4.push(index); } index++; } - for (const mask of this._roomPlaneBitmapMaskParser.masks.values()) + for(const mask of this._roomPlaneBitmapMaskParser.masks.values()) { const maskType = this._roomPlaneBitmapMaskParser.getMaskType(mask); const maskLocation = this._roomPlaneBitmapMaskParser.getMaskLocation(mask); const maskCategory = this._roomPlaneBitmapMaskParser.getMaskCategory(mask); - if (maskLocation) + if(maskLocation) { let i = 0; - while (i < this._planes.length) + while(i < this._planes.length) { const plane = this._planes[i]; - if ((plane.type === RoomPlane.TYPE_WALL) || (plane.type === RoomPlane.TYPE_LANDSCAPE)) + if((plane.type === RoomPlane.TYPE_WALL) || (plane.type === RoomPlane.TYPE_LANDSCAPE)) { - if (plane && plane.location && plane.normal) + if(plane && plane.location && plane.normal) { const _local_14 = Vector3d.dif(maskLocation, plane.location); const _local_15 = Math.abs(Vector3d.scalarProjection(_local_14, plane.normal)); - if (_local_15 < 0.01) + if(_local_15 < 0.01) { - if (plane.leftSide && plane.rightSide) + if(plane.leftSide && plane.rightSide) { const _local_16 = Vector3d.scalarProjection(_local_14, plane.leftSide); const _local_17 = Vector3d.scalarProjection(_local_14, plane.rightSide); - if ((plane.type === RoomPlane.TYPE_WALL) || ((plane.type === RoomPlane.TYPE_LANDSCAPE) && (maskCategory === RoomPlaneBitmapMaskData.HOLE))) + if((plane.type === RoomPlane.TYPE_WALL) || ((plane.type === RoomPlane.TYPE_LANDSCAPE) && (maskCategory === RoomPlaneBitmapMaskData.HOLE))) { plane.addBitmapMask(maskType, _local_16, _local_17); } else { - if (plane.type === RoomPlane.TYPE_LANDSCAPE) + if(plane.type === RoomPlane.TYPE_LANDSCAPE) { - if (!plane.canBeVisible) _local_6 = true; + if(!plane.canBeVisible) _local_6 = true; plane.canBeVisible = true; @@ -940,11 +940,11 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements index = 0; - while (index < _local_4.length) + while(index < _local_4.length) { const planeIndex = _local_4[index]; - if (_local_5.indexOf(planeIndex) < 0) + if(_local_5.indexOf(planeIndex) < 0) { const plane = this._planes[planeIndex]; @@ -955,7 +955,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements index++; } - if (_local_6) + if(_local_6) { this._visiblePlanes = []; this._visiblePlaneSpriteNumbers = []; @@ -981,7 +981,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements public getBoundingRectangle(): Rectangle { - if (!this._boundingRectangle) this._boundingRectangle = super.getBoundingRectangle(); + if(!this._boundingRectangle) this._boundingRectangle = super.getBoundingRectangle(); return new Rectangle(this._boundingRectangle.x, this._boundingRectangle.y, this._boundingRectangle.width, this._boundingRectangle.height); } @@ -990,7 +990,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { const planes: IRoomPlane[] = []; - for (const plane of this._visiblePlanes) planes.push(plane); + for(const plane of this._visiblePlanes) planes.push(plane); return planes; } diff --git a/src/nitro/room/object/visualization/room/RoomVisualizationData.ts b/src/nitro/room/object/visualization/room/RoomVisualizationData.ts index 1dd28e8b..4c138479 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualizationData.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualizationData.ts @@ -27,50 +27,50 @@ export class RoomVisualizationData extends Disposable implements IObjectVisualiz //@ts-ignore const wallData = asset.wallData; - if (wallData) this._wallRasterizer.initialize(wallData); + if(wallData) this._wallRasterizer.initialize(wallData); //@ts-ignore const floorData = asset.floorData; - if (floorData) this._floorRasterizer.initialize(floorData); + if(floorData) this._floorRasterizer.initialize(floorData); //@ts-ignore const landscapeData = asset.landscapeData; - if (landscapeData) this._landscapeRasterizer.initialize(landscapeData); + if(landscapeData) this._landscapeRasterizer.initialize(landscapeData); //@ts-ignore const maskData = asset.maskData; - if (maskData) this._maskManager.initialize(maskData); + if(maskData) this._maskManager.initialize(maskData); return true; } protected onDispose(): void { - if (this._wallRasterizer) + if(this._wallRasterizer) { this._wallRasterizer.dispose(); this._wallRasterizer = null; } - if (this._floorRasterizer) + if(this._floorRasterizer) { this._floorRasterizer.dispose(); this._floorRasterizer = null; } - if (this._landscapeRasterizer) + if(this._landscapeRasterizer) { this._landscapeRasterizer.dispose(); this._landscapeRasterizer = null; } - if (this._maskManager) + if(this._maskManager) { this._maskManager.dispose(); @@ -82,7 +82,7 @@ export class RoomVisualizationData extends Disposable implements IObjectVisualiz public setGraphicAssetCollection(collection: IGraphicAssetCollection): void { - if (this._initialized) return; + if(this._initialized) return; this._wallRasterizer.initializeAssetCollection(collection); this._floorRasterizer.initializeAssetCollection(collection); @@ -94,11 +94,11 @@ export class RoomVisualizationData extends Disposable implements IObjectVisualiz public clearCache(): void { - if (this._wallRasterizer) this._wallRasterizer.clearCache(); + if(this._wallRasterizer) this._wallRasterizer.clearCache(); - if (this._floorRasterizer) this._floorRasterizer.clearCache(); + if(this._floorRasterizer) this._floorRasterizer.clearCache(); - if (this._landscapeRasterizer) this._landscapeRasterizer.clearCache(); + if(this._landscapeRasterizer) this._landscapeRasterizer.clearCache(); } public get wallRasterizer(): WallRasterizer diff --git a/src/nitro/room/object/visualization/room/TileCursorVisualization.ts b/src/nitro/room/object/visualization/room/TileCursorVisualization.ts index b732980d..899d5457 100644 --- a/src/nitro/room/object/visualization/room/TileCursorVisualization.ts +++ b/src/nitro/room/object/visualization/room/TileCursorVisualization.ts @@ -14,7 +14,7 @@ export class TileCursorVisualization extends FurnitureAnimatedVisualization protected getLayerYOffset(scale: number, direction: number, layerId: number): number { - if (layerId === 1) + if(layerId === 1) { this._tileHeight = this.object.model.getValue(RoomObjectVariable.TILE_CURSOR_HEIGHT); diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMask.ts b/src/nitro/room/object/visualization/room/mask/PlaneMask.ts index fa441f2c..e7d42b97 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMask.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMask.ts @@ -20,11 +20,11 @@ export class PlaneMask public dispose(): void { - if (this._maskVisualizations) + if(this._maskVisualizations) { - for (const mask of this._maskVisualizations.values()) + for(const mask of this._maskVisualizations.values()) { - if (!mask) continue; + if(!mask) continue; mask.dispose(); } @@ -40,7 +40,7 @@ export class PlaneMask { const existing = this._maskVisualizations.get(size); - if (existing) return null; + if(existing) return null; const visualization = new PlaneMaskVisualization(); @@ -57,11 +57,11 @@ export class PlaneMask let sizeIndex = 0; const index = 1; - while (index < this._sizes.length) + while(index < this._sizes.length) { - if (this._sizes[index] > k) + if(this._sizes[index] > k) { - if ((this._sizes[index] - k) < (k - this._sizes[(index - 1)])) sizeIndex = index; + if((this._sizes[index] - k) < (k - this._sizes[(index - 1)])) sizeIndex = index; break; } @@ -74,11 +74,11 @@ export class PlaneMask protected getMaskVisualization(k: number): PlaneMaskVisualization { - if (k === this._lastSize) return this._lastMaskVisualization; + if(k === this._lastSize) return this._lastMaskVisualization; const sizeIndex = this.getSizeIndex(k); - if (sizeIndex < this._sizes.length) + if(sizeIndex < this._sizes.length) { this._lastMaskVisualization = (this._maskVisualizations.get(this._sizes[sizeIndex])); } @@ -96,21 +96,21 @@ export class PlaneMask { const visualization = this.getMaskVisualization(k); - if (!visualization) return null; + if(!visualization) return null; return visualization.getAsset(_arg_2); } public getAssetName(k: number): string { - if (!this._assetNames) return null; + if(!this._assetNames) return null; return this._assetNames.get(k) || null; } public setAssetName(k: number, _arg_2: string): void { - if (!this._assetNames) return; + if(!this._assetNames) return; this._assetNames.set(k, _arg_2); } diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts index 776718b1..9e43ef1b 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts @@ -27,11 +27,11 @@ export class PlaneMaskManager this._assetCollection = null; this._data = null; - if (this._masks && this._masks.size) + if(this._masks && this._masks.size) { - for (const mask of this._masks.values()) + for(const mask of this._masks.values()) { - if (!mask) continue; + if(!mask) continue; mask.dispose(); } @@ -47,7 +47,7 @@ export class PlaneMaskManager public initializeAssetCollection(k: IGraphicAssetCollection): void { - if (!this.data) return; + if(!this.data) return; this._assetCollection = k; @@ -56,39 +56,39 @@ export class PlaneMaskManager private parseMasks(k: any, _arg_2: IGraphicAssetCollection): void { - if (!k || !_arg_2) return; + if(!k || !_arg_2) return; - if (k.masks && k.masks.length) + if(k.masks && k.masks.length) { let index = 0; - while (index < k.masks.length) + while(index < k.masks.length) { const mask = k.masks[index]; - if (mask) + if(mask) { const id = mask.id; const existing = this._masks.get(id); - if (existing) continue; + if(existing) continue; const newMask = new PlaneMask(); - if (mask.visualizations && mask.visualizations.length) + if(mask.visualizations && mask.visualizations.length) { let visualIndex = 0; - while (visualIndex < mask.visualizations.length) + while(visualIndex < mask.visualizations.length) { const visualization = mask.visualizations[visualIndex]; - if (visualization) + if(visualization) { const size = visualization.size as number; const maskVisualization = newMask.createMaskVisualization(size); - if (maskVisualization) + if(maskVisualization) { const assetName = this.parseMaskBitmaps(visualization.bitmaps, maskVisualization, _arg_2); @@ -110,30 +110,30 @@ export class PlaneMaskManager private parseMaskBitmaps(k: any, _arg_2: PlaneMaskVisualization, _arg_3: IGraphicAssetCollection): string { - if (!k || !k.length) return null; + if(!k || !k.length) return null; let graphicName: string = null; - for (const bitmap of k) + for(const bitmap of k) { - if (!bitmap) continue; + if(!bitmap) continue; const assetName = bitmap.assetName; const asset = _arg_3.getAsset(assetName); - if (!asset) continue; + if(!asset) continue; let normalMinX = PlaneMaskVisualization.MIN_NORMAL_COORDINATE_VALUE; let normalMaxX = PlaneMaskVisualization.MAX_NORMAL_COORDINATE_VALUE; let normalMinY = PlaneMaskVisualization.MIN_NORMAL_COORDINATE_VALUE; let normalMaxY = PlaneMaskVisualization.MAX_NORMAL_COORDINATE_VALUE; - if (bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; - if (bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; - if (bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; - if (bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; + if(bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; + if(bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; + if(bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; + if(bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; - if (!asset.flipH) graphicName = assetName; + if(!asset.flipH) graphicName = assetName; _arg_2.addBitmap(asset, normalMinX, normalMaxX, normalMinY, normalMaxY); } @@ -145,15 +145,15 @@ export class PlaneMaskManager { const mask = this._masks.get(_arg_2); - if (!mask) return true; + if(!mask) return true; const asset = mask.getGraphicAsset(_arg_3, _arg_4); - if (!asset) return true; + if(!asset) return true; const texture = asset.texture; - if (!texture) return true; + if(!texture) return true; const point = new Point((_arg_5 + asset.offsetX), (_arg_6 + asset.offsetY)); @@ -164,13 +164,13 @@ export class PlaneMaskManager let c = 0; let d = 0; - if (asset.flipH) + if(asset.flipH) { a = -1; c = -(texture.width); } - if (asset.flipV) + if(asset.flipV) { b = -1; d = -(texture.height); @@ -189,7 +189,7 @@ export class PlaneMaskManager public getMask(k: string): PlaneMask { - if (!this._masks || !this._masks.size) return null; + if(!this._masks || !this._masks.size) return null; return this._masks.get(k) || null; } diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts b/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts index 0afdc244..19a6d22f 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts @@ -15,9 +15,9 @@ export class PlaneMaskVisualization public dispose(): void { - for (const mask of this._bitmaps) + for(const mask of this._bitmaps) { - if (!mask) continue; + if(!mask) continue; mask.dispose(); } @@ -32,13 +32,13 @@ export class PlaneMaskVisualization public getAsset(k: IVector3D): IGraphicAsset { - if (!k) return null; + if(!k) return null; - for (const mask of this._bitmaps) + for(const mask of this._bitmaps) { - if (!mask) continue; + if(!mask) continue; - if ((((k.x >= mask.normalMinX) && (k.x <= mask.normalMaxX)) && (k.y >= mask.normalMinY)) && (k.y <= mask.normalMaxY)) + if((((k.x >= mask.normalMinX) && (k.x <= mask.normalMaxX)) && (k.y >= mask.normalMinY)) && (k.y <= mask.normalMaxY)) { return mask.asset; } diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts index a58f3f1a..51e5df1f 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts @@ -17,13 +17,13 @@ export class AnimationItem this._speedY = _arg_4; this._bitmapData = _arg_5; - if (isNaN(this._x)) this._x = 0; + if(isNaN(this._x)) this._x = 0; - if (isNaN(this._y)) this._y = 0; + if(isNaN(this._y)) this._y = 0; - if (isNaN(this._speedX)) this._speedX = 0; + if(isNaN(this._speedX)) this._speedX = 0; - if (isNaN(this._speedY)) this._speedY = 0; + if(isNaN(this._speedY)) this._speedY = 0; } public get bitmapData(): IGraphicAsset @@ -41,9 +41,9 @@ export class AnimationItem let _local_6 = this._x; let _local_7 = this._y; - if (_arg_3 > 0) _local_6 = (_local_6 + (((this._speedX / _arg_3) * _arg_5) / 1000)); + if(_arg_3 > 0) _local_6 = (_local_6 + (((this._speedX / _arg_3) * _arg_5) / 1000)); - if (_arg_4 > 0) _local_7 = (_local_7 + (((this._speedY / _arg_4) * _arg_5) / 1000)); + if(_arg_4 > 0) _local_7 = (_local_7 + (((this._speedY / _arg_4) * _arg_5) / 1000)); const _local_8 = ((_local_6 % 1) * k); const _local_9 = ((_local_7 % 1) * _arg_2); diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts index e255650f..ce958842 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts @@ -15,18 +15,18 @@ export class LandscapePlane extends Plane { const _local_2 = this.getPlaneVisualization(k); - if (_local_2) return !(_local_2.hasAnimationLayers); + if(_local_2) return !(_local_2.hasAnimationLayers); return super.isStatic(k); } public initializeDimensions(k: number, _arg_2: number): void { - if (k < 0) k = 0; + if(k < 0) k = 0; - if (_arg_2 < 0) _arg_2 = 0; + if(_arg_2 < 0) _arg_2 = 0; - if ((k !== this._width) || (_arg_2 !== this._height)) + if((k !== this._width) || (_arg_2 !== this._height)) { this._width = k; this._height = _arg_2; @@ -37,13 +37,13 @@ export class LandscapePlane extends Plane { const visualization = this.getPlaneVisualization(_arg_4); - if (!visualization || !visualization.geometry) return null; + if(!visualization || !visualization.geometry) return null; const _local_13 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_14 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 1)); const _local_15 = visualization.geometry.getScreenPoint(new Vector3d(0, 1, 0)); - if (_local_13 && _local_14 && _local_15) + if(_local_13 && _local_14 && _local_15) { _arg_2 = Math.round(Math.abs((((_local_13.x - _local_15.x) * _arg_2) / visualization.geometry.scale))); _arg_3 = Math.round(Math.abs((((_local_13.y - _local_14.y) * _arg_3) / visualization.geometry.scale))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts index f46b3b87..077f3c44 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts @@ -14,9 +14,9 @@ export class LandscapeRasterizer extends PlaneRasterizer public initializeDimensions(k: number, _arg_2: number): boolean { - if (k < 0) k = 0; + if(k < 0) k = 0; - if (_arg_2 < 0) _arg_2 = 0; + if(_arg_2 < 0) _arg_2 = 0; this._landscapeWidth = k; this._landscapeHeight = _arg_2; @@ -26,41 +26,41 @@ export class LandscapeRasterizer extends PlaneRasterizer protected initializePlanes(): void { - if (!this.data) return; + if(!this.data) return; const landscapes = this.data.landscapes; - if (landscapes && landscapes.length) this.parseLandscapes(landscapes); + if(landscapes && landscapes.length) this.parseLandscapes(landscapes); } private parseLandscapes(k: any): void { - if (!k) return; + if(!k) return; const randomNumber = Math.trunc((Math.random() * 654321)); - for (const landscapeIndex in k) + for(const landscapeIndex in k) { const landscape = k[landscapeIndex]; - if (!landscape) continue; + if(!landscape) continue; const id = landscape.id; const visualizations = landscape.animatedVisualizations; const plane = new LandscapePlane(); - for (const visualization of visualizations) + for(const visualization of visualizations) { - if (!visualization) continue; + if(!visualization) continue; const size = visualization.size; let horizontalAngle = LandscapePlane.HORIZONTAL_ANGLE_DEFAULT; let verticalAngle = LandscapePlane.VERTICAL_ANGLE_DEFAULT; - if (visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; - if (visualization.verticalAngle) verticalAngle = visualization.verticalAngle; + if(visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; + if(visualization.verticalAngle) verticalAngle = visualization.verticalAngle; const basicLayers = visualization.layers; const animatedLayers = visualization.animationLayers; @@ -70,39 +70,39 @@ export class LandscapeRasterizer extends PlaneRasterizer const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this.getGeometry(size, horizontalAngle, verticalAngle)); - if (planeVisualization) + if(planeVisualization) { Randomizer.setSeed(randomNumber); let layerId = 0; - if (totalBasicLayers) + if(totalBasicLayers) { - while (layerId < basicLayers.length) + while(layerId < basicLayers.length) { const layer = basicLayers[layerId]; - if (layer) + if(layer) { let material: PlaneMaterial = null; let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT; let color: number = LandscapePlane.DEFAULT_COLOR; let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET; - if (layer.materialId) material = this.getMaterial(layer.materialId); + if(layer.materialId) material = this.getMaterial(layer.materialId); - if (layer.color) color = layer.color; + if(layer.color) color = layer.color; - if (layer.offset) offset = layer.offset; + if(layer.offset) offset = layer.offset; - if (layer.align) + if(layer.align) { - if (layer.align === 'bottom') + if(layer.align === 'bottom') { align = PlaneVisualizationLayer.ALIGN_BOTTOM; } - else if (layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP; + else if(layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP; } planeVisualization.setLayer(layerId, material, color, align, offset); @@ -114,23 +114,23 @@ export class LandscapeRasterizer extends PlaneRasterizer layerId = 0; - if (totalAnimatedLayers) + if(totalAnimatedLayers) { const animationItems: {}[] = []; - while (layerId < animatedLayers.length) + while(layerId < animatedLayers.length) { const layer = animatedLayers[layerId]; - if (layer) + if(layer) { const items = layer.animationItems; - if (items && items.length) + if(items && items.length) { - for (const item of items) + for(const item of items) { - if (item) + if(item) { const id = item.id; const assetId = item.assetId; @@ -159,7 +159,7 @@ export class LandscapeRasterizer extends PlaneRasterizer } } - if (!this.addPlane(id, plane)) plane.dispose(); + if(!this.addPlane(id, plane)) plane.dispose(); } } @@ -167,9 +167,9 @@ export class LandscapeRasterizer extends PlaneRasterizer { let _local_3 = 0; - if ((k.length > 0)) + if((k.length > 0)) { - if (k.charAt((k.length - 1)) === '%') + if(k.charAt((k.length - 1)) === '%') { k = k.substr(0, (k.length - 1)); @@ -177,13 +177,13 @@ export class LandscapeRasterizer extends PlaneRasterizer } } - if ((_arg_2.length > 0)) + if((_arg_2.length > 0)) { const _local_4 = 10000; const _local_5 = Randomizer.getValues(1, 0, _local_4); const _local_6 = (_local_5[0] / _local_4); - if (_arg_2.charAt((_arg_2.length - 1)) === '%') + if(_arg_2.charAt((_arg_2.length - 1)) === '%') { _arg_2 = _arg_2.substr(0, (_arg_2.length - 1)); @@ -198,27 +198,27 @@ export class LandscapeRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as LandscapePlane; - if (!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane; + if(!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane; - if (!plane) return null; + if(!plane) return null; - if (canvas) + if(canvas) { canvas.clear(); } let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY, maxX, maxY, timeSinceStartMs); - if (graphic && (graphic !== canvas)) + if(graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if (!graphic) return null; + if(!graphic) return null; } let planeBitmapData: PlaneBitmapData = null; - if (!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0)) + if(!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0)) { planeBitmapData = new PlaneBitmapData(graphic, ((Math.round((timeSinceStartMs / LandscapeRasterizer.UPDATE_INTERVAL)) * LandscapeRasterizer.UPDATE_INTERVAL) + LandscapeRasterizer.UPDATE_INTERVAL)); } @@ -232,9 +232,9 @@ export class LandscapeRasterizer extends PlaneRasterizer public getTextureIdentifier(k: number, _arg_2: IVector3D): string { - if (_arg_2) + if(_arg_2) { - if (_arg_2.x < 0) return (k + '_0'); + if(_arg_2.x < 0) return (k + '_0'); return (k + '_1'); } diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts index b79e3ac4..e93ea29f 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts @@ -17,19 +17,19 @@ export class PlaneVisualizationAnimationLayer implements IDisposable this._isDisposed = false; this._items = []; - if (k && _arg_2) + if(k && _arg_2) { - for (const item of k) + for(const item of k) { - if (!item) continue; + if(!item) continue; const assetName = item.asset; - if (assetName) + if(assetName) { const asset = _arg_2.getAsset(assetName); - if (asset) this._items.push(new AnimationItem(item.x, item.y, item.speedX, item.speedY, asset)); + if(asset) this._items.push(new AnimationItem(item.x, item.y, item.speedX, item.speedY, asset)); } } } @@ -44,16 +44,16 @@ export class PlaneVisualizationAnimationLayer implements IDisposable { this._isDisposed = true; - if (this._bitmapData) + if(this._bitmapData) { this._bitmapData.destroy(); this._bitmapData = null; } - if (this._items) + if(this._items) { - for (const item of this._items) item && item.dispose(); + for(const item of this._items) item && item.dispose(); this._items = []; } @@ -61,7 +61,7 @@ export class PlaneVisualizationAnimationLayer implements IDisposable public clearCache(): void { - if (this._bitmapData) + if(this._bitmapData) { this._bitmapData.destroy(); @@ -71,11 +71,11 @@ export class PlaneVisualizationAnimationLayer implements IDisposable public render(canvas: Graphics, width: number, height: number, normal: IVector3D, offsetX: number, offsetY: number, maxX: number, maxY: number, dimensionX: number, dimensionY: number, timeSinceStartMs: number): Graphics { - if ((((canvas == null) || (!(canvas.width == width))) || (!(canvas.height == height)))) + if((((canvas == null) || (!(canvas.width == width))) || (!(canvas.height == height)))) { - if ((((this._bitmapData == null) || (!(this._bitmapData.width == width))) || (!(this._bitmapData.height == height)))) + if((((this._bitmapData == null) || (!(this._bitmapData.width == width))) || (!(this._bitmapData.height == height)))) { - if (this._bitmapData != null) + if(this._bitmapData != null) { this._bitmapData.destroy(); } @@ -95,23 +95,23 @@ export class PlaneVisualizationAnimationLayer implements IDisposable canvas = this._bitmapData; } - if (((maxX > 0) && (maxY > 0))) + if(((maxX > 0) && (maxY > 0))) { let _local_12 = 0; - while (_local_12 < this._items.length) + while(_local_12 < this._items.length) { const _local_13 = (this._items[_local_12] as AnimationItem); - if (_local_13 != null) + if(_local_13 != null) { const _local_14 = _local_13.getPosition(maxX, maxY, dimensionX, dimensionY, timeSinceStartMs); _local_14.x = (_local_14.x - offsetX); _local_14.y = (_local_14.y - offsetY); - if (_local_13.bitmapData) + if(_local_13.bitmapData) { - if (_local_14.x > 0 && (_local_14.x + _local_13.bitmapData.width < canvas.width)) + if(_local_14.x > 0 && (_local_14.x + _local_13.bitmapData.width < canvas.width)) { canvas .beginFill(0x00FF00) @@ -119,7 +119,7 @@ export class PlaneVisualizationAnimationLayer implements IDisposable .drawRect(_local_14.x, _local_14.y, _local_13.bitmapData.width, _local_13.bitmapData.height) .endFill(); } - else if (_local_14.x > 0) + else if(_local_14.x > 0) { const difference = canvas.width - _local_14.x; canvas diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts index 94ca347e..511d6482 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts @@ -12,7 +12,7 @@ export class FloorPlane extends Plane { const visualization = this.getPlaneVisualization(scale); - if (!visualization || !visualization.geometry) return null; + if(!visualization || !visualization.geometry) return null; const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (height / visualization.geometry.scale), 0)); @@ -21,7 +21,7 @@ export class FloorPlane extends Plane let x = 0; let y = 0; - if (_local_10 && _local_11 && _local_12) + if(_local_10 && _local_11 && _local_12) { width = Math.round(Math.abs((_local_10.x - _local_12.x))); height = Math.round(Math.abs((_local_10.x - _local_11.x))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts index bc0f520d..21fe9b4f 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts @@ -8,22 +8,22 @@ export class FloorRasterizer extends PlaneRasterizer { protected initializePlanes(): void { - if (!this.data) return; + if(!this.data) return; const floors = this.data.floors; - if (floors && floors.length) this.parseFloors(floors); + if(floors && floors.length) this.parseFloors(floors); } private parseFloors(k: any): void { - if (!k) return; + if(!k) return; - for (const floorIndex in k) + for(const floorIndex in k) { const floor = k[floorIndex]; - if (!floor) continue; + if(!floor) continue; const id = floor.id; const visualization = floor.visualizations; @@ -31,7 +31,7 @@ export class FloorRasterizer extends PlaneRasterizer this.parseVisualizations(plane, visualization); - if (!this.addPlane(id, plane)) plane.dispose(); + if(!this.addPlane(id, plane)) plane.dispose(); } } @@ -39,19 +39,19 @@ export class FloorRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as FloorPlane; - if (!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane; + if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane; - if (!plane) return null; + if(!plane) return null; - if (canvas) canvas.clear(); + if(canvas) canvas.clear(); let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY); - if (graphic && (graphic !== canvas)) + if(graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if (!graphic) return null; + if(!graphic) return null; } return new PlaneBitmapData(graphic, -1); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts index f366af3a..b177505b 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts @@ -24,9 +24,9 @@ export class Plane public dispose(): void { - for (const visualization of this._planeVisualizations.values()) + for(const visualization of this._planeVisualizations.values()) { - if (!visualization) continue; + if(!visualization) continue; visualization.dispose(); } @@ -39,9 +39,9 @@ export class Plane public clearCache(): void { - for (const visualization of this._planeVisualizations.values()) + for(const visualization of this._planeVisualizations.values()) { - if (!visualization) continue; + if(!visualization) continue; visualization.clearCache(); } @@ -51,7 +51,7 @@ export class Plane { const existing = this._planeVisualizations.get(size.toString()); - if (existing) return null; + if(existing) return null; const plane = new PlaneVisualization(size, totalLayers, geometry); @@ -68,11 +68,11 @@ export class Plane let sizeIndex = 0; let i = 1; - while (i < this._sizes.length) + while(i < this._sizes.length) { - if (this._sizes[i] > size) + if(this._sizes[i] > size) { - if ((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i; + if((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i; break; } @@ -87,11 +87,11 @@ export class Plane protected getPlaneVisualization(size: number): PlaneVisualization { - if (size === this._lastSize) return this._lastPlaneVisualization; + if(size === this._lastSize) return this._lastPlaneVisualization; const sizeIndex = this.getSizeIndex(size); - if (sizeIndex < this._sizes.length) + if(sizeIndex < this._sizes.length) { this._lastPlaneVisualization = this._planeVisualizations.get(this._sizes[sizeIndex].toString()); } diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts index f0b22396..d82731f8 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts @@ -18,11 +18,11 @@ export class PlaneMaterial public dispose(): void { - if (this._planeMaterialItems && this._planeMaterialItems.length) + if(this._planeMaterialItems && this._planeMaterialItems.length) { - for (const item of this._planeMaterialItems) + for(const item of this._planeMaterialItems) { - if (!item) continue; + if(!item) continue; item.dispose(); } @@ -35,13 +35,13 @@ export class PlaneMaterial public clearCache(): void { - if (!this._isCached) return; + if(!this._isCached) return; - if (this._planeMaterialItems && this._planeMaterialItems.length) + if(this._planeMaterialItems && this._planeMaterialItems.length) { - for (const item of this._planeMaterialItems) + for(const item of this._planeMaterialItems) { - if (!item) continue; + if(!item) continue; item.clearCache(); } @@ -61,15 +61,15 @@ export class PlaneMaterial public getMaterialCellMatrix(normal: IVector3D): PlaneMaterialCellMatrix { - if (!normal) return null; + if(!normal) return null; - if (this._planeMaterialItems && this._planeMaterialItems.length) + if(this._planeMaterialItems && this._planeMaterialItems.length) { - for (const item of this._planeMaterialItems) + for(const item of this._planeMaterialItems) { - if (!item) continue; + if(!item) continue; - if ((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item; + if((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item; } } @@ -78,13 +78,13 @@ export class PlaneMaterial public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): Graphics { - if (width < 1) width = 1; + if(width < 1) width = 1; - if (height < 1) height = 1; + if(height < 1) height = 1; const cellMatrix = this.getMaterialCellMatrix(normal); - if (!cellMatrix) return null; + if(!cellMatrix) return null; this._isCached = true; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts index 6be502d3..3b04492c 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts @@ -20,30 +20,30 @@ export class PlaneMaterialCell this._extraItemAssets = []; this._extraItemCount = 0; - if (assets && assets.length && (limit > 0)) + if(assets && assets.length && (limit > 0)) { let assetIndex = 0; - while (assetIndex < assets.length) + while(assetIndex < assets.length) { const graphic = assets[assetIndex]; - if (graphic) this._extraItemAssets.push(graphic); + if(graphic) this._extraItemAssets.push(graphic); assetIndex++; } - if (this._extraItemAssets.length) + if(this._extraItemAssets.length) { - if (offsetPoints) + if(offsetPoints) { let pointIndex = 0; - while (pointIndex < offsetPoints.length) + while(pointIndex < offsetPoints.length) { const point = offsetPoints[pointIndex]; - if (point) this._extraItemOffsets.push(new Point(point.x, point.y)); + if(point) this._extraItemOffsets.push(new Point(point.x, point.y)); pointIndex++; } @@ -61,14 +61,14 @@ export class PlaneMaterialCell public dispose(): void { - if (this._texture) + if(this._texture) { this._texture.dispose(); this._texture = null; } - if (this._cachedSprite) + if(this._cachedSprite) { this._cachedSprite.destroy(); @@ -82,7 +82,7 @@ export class PlaneMaterialCell public clearCache(): void { - if (this._cachedSprite) + if(this._cachedSprite) { this._cachedSprite.destroy(); @@ -92,11 +92,11 @@ export class PlaneMaterialCell public getHeight(normal: IVector3D): number { - if (this._texture) + if(this._texture) { const texture = this._texture.getBitmap(normal); - if (texture) return texture.height; + if(texture) return texture.height; } return 0; @@ -104,43 +104,43 @@ export class PlaneMaterialCell public render(normal: IVector3D, textureOffsetX: number, textureOffsetY: number): NitroSprite { - if (!this._texture) return null; + if(!this._texture) return null; const texture = this._texture.getBitmap(normal); - if (!texture) return null; + if(!texture) return null; const bitmap = new NitroSprite(texture); - if ((textureOffsetX !== 0) || (textureOffsetY !== 0)) + if((textureOffsetX !== 0) || (textureOffsetY !== 0)) { - while (textureOffsetX < 0) textureOffsetX += texture.width; + while(textureOffsetX < 0) textureOffsetX += texture.width; - while (textureOffsetY < 0) textureOffsetY += texture.height; + while(textureOffsetY < 0) textureOffsetY += texture.height; bitmap.x = (textureOffsetX % texture.width); bitmap.y = (textureOffsetY % texture.height); - if (textureOffsetX) + if(textureOffsetX) { bitmap.anchor.x = 1; bitmap.scale.x = -1; } - if (textureOffsetY) + if(textureOffsetY) { bitmap.anchor.y = 1; bitmap.scale.y = -1; } } - if (bitmap) + if(bitmap) { - if (!this.isStatic) + if(!this.isStatic) { - if (this._cachedSprite) + if(this._cachedSprite) { - if ((this._cachedSprite.width !== bitmap.width) || (this._cachedSprite.height !== bitmap.height)) + if((this._cachedSprite.width !== bitmap.width) || (this._cachedSprite.height !== bitmap.height)) { this._cachedSprite.destroy(); @@ -148,7 +148,7 @@ export class PlaneMaterialCell } } - if (!this._cachedSprite) + if(!this._cachedSprite) { this._cachedSprite = new NitroSprite(texture); } @@ -159,16 +159,16 @@ export class PlaneMaterialCell let i = 0; - while (i < limitMin) + while(i < limitMin) { const offset = this._extraItemOffsets[offsetIndexes[i]]; const item = this._extraItemAssets[(i % this._extraItemAssets.length)]; - if (offset && item) + if(offset && item) { const assetTexture = item.texture; - if (assetTexture) + if(assetTexture) { const offsetFinal = new Point((offset.x + item.offsetX), (offset.y + item.offsetY)); const flipMatrix = new Matrix(); @@ -178,13 +178,13 @@ export class PlaneMaterialCell let translateX = 0; let translateY = 0; - if (item.flipH) + if(item.flipH) { x = -1; translateX = assetTexture.width; } - if (item.flipV) + if(item.flipV) { y = -1; translateY = assetTexture.height; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts index 59e0737c..f54b4b02 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts @@ -35,19 +35,19 @@ export class PlaneMaterialCellColumn this._isCached = false; this._isStatic = true; - if (cells && cells.length) + if(cells && cells.length) { let cellIndex = 0; - while (cellIndex < cells.length) + while(cellIndex < cells.length) { const cell = cells[cellIndex]; - if (cell) + if(cell) { this._cells.push(cell); - if (!cell.isStatic) this._isStatic = false; + if(!cell.isStatic) this._isStatic = false; } cellIndex++; @@ -72,11 +72,11 @@ export class PlaneMaterialCellColumn public dispose(): void { - if (this._cells && this._cells.length) + if(this._cells && this._cells.length) { - for (const cell of this._cells) + for(const cell of this._cells) { - if (!cell) continue; + if(!cell) continue; cell.dispose(); } @@ -84,39 +84,39 @@ export class PlaneMaterialCellColumn this._cells = null; } - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) this._cachedBitmapNormal = null; + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; } public clearCache(): void { - if (!this._isCached) return; + if(!this._isCached) return; - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) + if(this._cachedBitmapNormal) { this._cachedBitmapNormal.x = 0; this._cachedBitmapNormal.y = 0; this._cachedBitmapNormal.z = 0; } - if (this._cells && this._cells.length) + if(this._cells && this._cells.length) { - for (const cell of this._cells) + for(const cell of this._cells) { - if (!cell) continue; + if(!cell) continue; cell.clearCache(); } @@ -129,19 +129,19 @@ export class PlaneMaterialCellColumn { let ht = 0; - if (this._repeatMode == PlaneMaterialCellColumn.REPEAT_MODE_NONE) + if(this._repeatMode == PlaneMaterialCellColumn.REPEAT_MODE_NONE) { ht = this.getCellsHeight(this._cells, normal); height = ht; } - if (!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); + if(!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); - if (this.isStatic) + if(this.isStatic) { - if (this._cachedBitmapData) + if(this._cachedBitmapData) { - if ((this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal) && (this._cachedBitmapDataOffsetX === offsetX) && (this._cachedBitmapDataOffsetY === offsetY)) + if((this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal) && (this._cachedBitmapDataOffsetX === offsetX) && (this._cachedBitmapDataOffsetY === offsetY)) { return this._cachedBitmapData; } @@ -153,9 +153,9 @@ export class PlaneMaterialCellColumn } else { - if (this._cachedBitmapData) + if(this._cachedBitmapData) { - if (this._cachedBitmapData.height === height) + if(this._cachedBitmapData.height === height) { this._cachedBitmapData .beginFill(0xFFFFFF) @@ -173,7 +173,7 @@ export class PlaneMaterialCellColumn this._isCached = true; - if (!this._cachedBitmapData) + if(!this._cachedBitmapData) { this._cachedBitmapData = new Graphics() .beginFill(0xFFFFFF) @@ -185,9 +185,9 @@ export class PlaneMaterialCellColumn this._cachedBitmapDataOffsetX = offsetX; this._cachedBitmapDataOffsetY = offsetY; - if (!this._cells.length) return this._cachedBitmapData; + if(!this._cells.length) return this._cachedBitmapData; - switch (this._repeatMode) + switch(this._repeatMode) { case PlaneMaterialCellColumn.REPEAT_MODE_NONE: this.renderRepeatNone(normal); @@ -218,16 +218,16 @@ export class PlaneMaterialCellColumn private getCellsHeight(cells: PlaneMaterialCell[], normal: IVector3D): number { - if (!cells || !cells.length) return 0; + if(!cells || !cells.length) return 0; let height = 0; let cellIterator = 0; - while (cellIterator < cells.length) + while(cellIterator < cells.length) { const cell = cells[cellIterator]; - if (cell) height += cell.getHeight(normal); + if(cell) height += cell.getHeight(normal); cellIterator++; } @@ -237,15 +237,15 @@ export class PlaneMaterialCellColumn private renderCells(cells: PlaneMaterialCell[], index: number, flag: boolean, normal: IVector3D, offsetX: number = 0, offsetY: number = 0): number { - if (((!cells || !cells.length) || !this._cachedBitmapData)) return index; + if(((!cells || !cells.length) || !this._cachedBitmapData)) return index; let cellIndex = 0; - while (cellIndex < cells.length) + while(cellIndex < cells.length) { let cell: PlaneMaterialCell = null; - if (flag) + if(flag) { cell = cells[cellIndex]; } @@ -254,21 +254,21 @@ export class PlaneMaterialCellColumn cell = cells[((cells.length - 1) - cellIndex)]; } - if (cell) + if(cell) { const graphic = cell.render(normal, offsetX, offsetY); - if (graphic) + if(graphic) { - if (!flag) index -= graphic.height; + if(!flag) index -= graphic.height; graphic.y = index; this._cachedBitmapData.addChild(graphic); - if (flag) index = (index + graphic.height); + if(flag) index = (index + graphic.height); - if (((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index; + if(((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index; } } @@ -280,22 +280,22 @@ export class PlaneMaterialCellColumn private renderRepeatNone(normal: IVector3D): void { - if (!this._cells.length || !this._cachedBitmapData) return; + if(!this._cells.length || !this._cachedBitmapData) return; this.renderCells(this._cells, 0, true, normal); } private renderRepeatAll(normal: IVector3D, offsetX: number, offsetY: number): void { - if (!this._cells.length || !this._cachedBitmapData) return; + if(!this._cells.length || !this._cachedBitmapData) return; let index = 0; - while (index < this._cachedBitmapData.height) + while(index < this._cachedBitmapData.height) { index = this.renderCells(this._cells, index, true, normal, offsetX, offsetY); - if (!index) return; + if(!index) return; } } diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts index 6b9930f7..d5210d8e 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts @@ -38,12 +38,12 @@ export class PlaneMaterialCellMatrix constructor(totalColumns: number, repeatMode: number = 1, align: number = 1, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1) { this._columns = []; - if (totalColumns < 1) + if(totalColumns < 1) { totalColumns = 1; } let _local_8 = 0; - while (_local_8 < totalColumns) + while(_local_8 < totalColumns) { this._columns.push(null); _local_8++; @@ -54,7 +54,7 @@ export class PlaneMaterialCellMatrix this._normalMaxX = normalMaxX; this._normalMinY = normalMinY; this._normalMaxY = normalMaxY; - if (this._repeatMode == PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) + if(this._repeatMode == PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) { this._isStatic = false; } @@ -97,39 +97,39 @@ export class PlaneMaterialCellMatrix public dispose(): void { - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) this._cachedBitmapNormal = null; + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; } public clearCache(): void { - if (!this._isCached) return; + if(!this._isCached) return; - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) + if(this._cachedBitmapNormal) { this._cachedBitmapNormal.x = 0; this._cachedBitmapNormal.y = 0; this._cachedBitmapNormal.z = 0; } - if (this._columns && this._columns.length) + if(this._columns && this._columns.length) { - for (const column of this._columns) + for(const column of this._columns) { - if (!column) continue; + if(!column) continue; column.clearCache(); } @@ -140,37 +140,37 @@ export class PlaneMaterialCellMatrix public createColumn(index: number, width: number, cells: PlaneMaterialCell[], repeatMode: number = 1): boolean { - if ((index < 0) || (index >= this._columns.length)) return false; + if((index < 0) || (index >= this._columns.length)) return false; const newColumn = new PlaneMaterialCellColumn(width, cells, repeatMode); const oldColumn = this._columns[index]; - if (oldColumn) oldColumn.dispose(); + if(oldColumn) oldColumn.dispose(); this._columns[index] = newColumn; - if (newColumn && !newColumn.isStatic) this._isStatic = false; + if(newColumn && !newColumn.isStatic) this._isStatic = false; return true; } public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): Graphics { - if (width < 1) width = 1; + if(width < 1) width = 1; - if (height < 1) height = 1; + if(height < 1) height = 1; - if (!canvas || (canvas.width !== width) || (canvas.height !== height)) canvas = null; + if(!canvas || (canvas.width !== width) || (canvas.height !== height)) canvas = null; - if (!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); + if(!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); - if (this.isStatic) + if(this.isStatic) { - if (this._cachedBitmapData) + if(this._cachedBitmapData) { - if (((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height == height)) && Vector3d.isEqual(this._cachedBitmapNormal, normal)) + if(((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height == height)) && Vector3d.isEqual(this._cachedBitmapNormal, normal)) { - if (canvas) + if(canvas) { this.copyCachedBitmapOnCanvas(canvas, this._cachedBitmapHeight, offsetY, topAlign); @@ -187,9 +187,9 @@ export class PlaneMaterialCellMatrix } else { - if (this._cachedBitmapData) + if(this._cachedBitmapData) { - if ((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height)) + if((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height)) { this._cachedBitmapData .beginFill(0xFFFFFF) @@ -208,11 +208,11 @@ export class PlaneMaterialCellMatrix this._isCached = true; this._cachedBitmapNormal.assign(normal); - if (!useTexture) + if(!useTexture) { this._cachedBitmapHeight = height; - if (!this._cachedBitmapData) + if(!this._cachedBitmapData) { const graphic = new Graphics() .beginFill(0xFFFFFF) @@ -229,7 +229,7 @@ export class PlaneMaterialCellMatrix .endFill(); } - if (canvas) + if(canvas) { this.copyCachedBitmapOnCanvas(canvas, height, offsetY, topAlign); @@ -239,7 +239,7 @@ export class PlaneMaterialCellMatrix return this._cachedBitmapData; } - if (!this._cachedBitmapData) + if(!this._cachedBitmapData) { this._cachedBitmapHeight = height; @@ -255,30 +255,30 @@ export class PlaneMaterialCellMatrix let columnIndex = 0; - while (columnIndex < this._columns.length) + while(columnIndex < this._columns.length) { const column = this._columns[columnIndex]; - if (column) + if(column) { const columnBitmapData = column.render(height, normal, offsetX, offsetY); - if (columnBitmapData) columns.push(columnBitmapData); + if(columnBitmapData) columns.push(columnBitmapData); } columnIndex++; } - if (!columns.length) + if(!columns.length) { - if (canvas) return canvas; + if(canvas) return canvas; return this._cachedBitmapData; } let maxColumnHeight = 0; - switch (this._repeatMode) + switch(this._repeatMode) { case PlaneMaterialCellMatrix.REPEAT_MODE_BORDERS: // maxColumnHeight = this.renderRepeatBorders(this._cachedBitmapData, columns); @@ -302,7 +302,7 @@ export class PlaneMaterialCellMatrix this._cachedBitmapHeight = maxColumnHeight; - if (canvas) + if(canvas) { this.copyCachedBitmapOnCanvas(canvas, maxColumnHeight, offsetY, topAlign); @@ -314,13 +314,13 @@ export class PlaneMaterialCellMatrix private copyCachedBitmapOnCanvas(canvas: Graphics, height: number, offsetY: number, topAlign: boolean): void { - if (!canvas || !this._cachedBitmapData || (canvas === this._cachedBitmapData)) return; + if(!canvas || !this._cachedBitmapData || (canvas === this._cachedBitmapData)) return; - if (!topAlign) offsetY = ((canvas.height - height) - offsetY); + if(!topAlign) offsetY = ((canvas.height - height) - offsetY); let _local_5: Rectangle; - if (this._align == PlaneMaterialCellMatrix.ALIGN_TOP) + if(this._align == PlaneMaterialCellMatrix.ALIGN_TOP) { _local_5 = new Rectangle(0, 0, this._cachedBitmapData.width, this._cachedBitmapHeight); } @@ -331,7 +331,7 @@ export class PlaneMaterialCellMatrix const texture = TextureUtils.generateTexture(this._cachedBitmapData, _local_5); - if (texture) + if(texture) { canvas .beginTextureFill({ texture }) @@ -342,13 +342,13 @@ export class PlaneMaterialCellMatrix private getColumnsWidth(columns: Graphics[]): number { - if (!columns || !columns.length) return 0; + if(!columns || !columns.length) return 0; let width = 0; - for (const graphic of columns) + for(const graphic of columns) { - if (!graphic) continue; + if(!graphic) continue; width += graphic.width; } @@ -358,26 +358,26 @@ export class PlaneMaterialCellMatrix private renderColumns(canvas: Graphics, columns: Graphics[], x: number, flag: boolean): Point { - if (!canvas || !columns || !columns.length) return new Point(x, 0); + if(!canvas || !columns || !columns.length) return new Point(x, 0); let height = 0; let i = 0; - while (i < columns.length) + while(i < columns.length) { const column = flag ? columns[i] : columns[((columns.length - 1) - i)]; - if (column) + if(column) { - if (!flag) x = (x - column.width); + if(!flag) x = (x - column.width); let y = 0; - if (this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM) y = (canvas.height - column.height); + if(this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM) y = (canvas.height - column.height); let texture = RoomVisualization.getTextureCache(column); - if (!texture) + if(!texture) { texture = TextureUtils.generateTexture(column, new Rectangle(0, 0, column.width, column.height)); @@ -388,11 +388,11 @@ export class PlaneMaterialCellMatrix canvas.drawRect(x, y, texture.width, texture.height); canvas.endFill(); - if (column.height > height) height = column.height; + if(column.height > height) height = column.height; - if (flag) x = (x + column.width); + if(flag) x = (x + column.width); - if ((flag && (x >= canvas.width)) || (!flag && (x <= 0))) return new Point(x, height); + if((flag && (x >= canvas.width)) || (!flag && (x <= 0))) return new Point(x, height); } i++; @@ -403,22 +403,22 @@ export class PlaneMaterialCellMatrix private renderRepeatAll(canvas: Graphics, columns: Graphics[]): number { - if (!canvas || !columns || !columns.length) return 0; + if(!canvas || !columns || !columns.length) return 0; const totalWidth: number = this.getColumnsWidth(columns); let x = 0; let y = 0; - while (x < canvas.width) + while(x < canvas.width) { const point = this.renderColumns(canvas, columns, x, true); x = point.x; - if (point.y > y) y = point.y; + if(point.y > y) y = point.y; - if (!point.x) return y; + if(!point.x) return y; } return y; @@ -680,21 +680,21 @@ export class PlaneMaterialCellMatrix public getColumns(width: number): PlaneMaterialCellColumn[] { - if (this._repeatMode === PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) + if(this._repeatMode === PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) { const columns: PlaneMaterialCellColumn[] = []; let columnIndex = 0; - while (columnIndex < width) + while(columnIndex < width) { const column = this._columns[PlaneMaterialCellMatrix.nextRandomColumnIndex(this._columns.length)]; - if (column) + if(column) { columns.push(column); - if (column.width > 1) columnIndex += column.width; + if(column.width > 1) columnIndex += column.width; else break; } } diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts index 66053adf..c104fd62 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts @@ -52,11 +52,11 @@ export class PlaneRasterizer implements IPlaneRasterizer public dispose(): void { - if (this._planes) + if(this._planes) { - for (const plane of this._planes.values()) + for(const plane of this._planes.values()) { - if (!plane) continue; + if(!plane) continue; plane.dispose(); } @@ -64,25 +64,25 @@ export class PlaneRasterizer implements IPlaneRasterizer this._planes = null; } - if (this._materials) + if(this._materials) { this.resetMaterials(); this._materials = null; } - if (this._textures) + if(this._textures) { this.resetTextures(); this._textures = null; } - if (this._geometries) + if(this._geometries) { - for (const geometry of this._geometries.values()) + for(const geometry of this._geometries.values()) { - if (!geometry) continue; + if(!geometry) continue; geometry.dispose(); } @@ -96,16 +96,16 @@ export class PlaneRasterizer implements IPlaneRasterizer public clearCache(): void { - for (const plane of this._planes.values()) + for(const plane of this._planes.values()) { - if (!plane) continue; + if(!plane) continue; plane.clearCache(); } - for (const material of this._materials.values()) + for(const material of this._materials.values()) { - if (!material) continue; + if(!material) continue; material.clearCache(); } @@ -125,9 +125,9 @@ export class PlaneRasterizer implements IPlaneRasterizer private resetMaterials(): void { - for (const material of this._materials.values()) + for(const material of this._materials.values()) { - if (!material) continue; + if(!material) continue; material.dispose(); } @@ -137,9 +137,9 @@ export class PlaneRasterizer implements IPlaneRasterizer private resetTextures(): void { - for (const texture of this._textures.values()) + for(const texture of this._textures.values()) { - if (!texture) continue; + if(!texture) continue; texture.dispose(); } @@ -164,11 +164,11 @@ export class PlaneRasterizer implements IPlaneRasterizer protected addPlane(id: string, plane: Plane): boolean { - if (!plane) return false; + if(!plane) return false; const existing = this._planes.get(id); - if (!existing) + if(!existing) { this._planes.set(id, plane); @@ -180,7 +180,7 @@ export class PlaneRasterizer implements IPlaneRasterizer public initializeAssetCollection(collection: IGraphicAssetCollection): void { - if (!this._data) return; + if(!this._data) return; this._assetCollection = collection; @@ -189,7 +189,7 @@ export class PlaneRasterizer implements IPlaneRasterizer private initializeAll(): void { - if (!this._data) return; + if(!this._data) return; this.initializeTexturesAndMaterials(); @@ -198,9 +198,9 @@ export class PlaneRasterizer implements IPlaneRasterizer private initializeTexturesAndMaterials(): void { - if (this._data.textures && this._data.textures.length) this.parseTextures(this._data.textures, this.assetCollection); + if(this._data.textures && this._data.textures.length) this.parseTextures(this._data.textures, this.assetCollection); - if (this._data.materials && this._data.materials.length) this.parsePlaneMaterials(this._data.materials); + if(this._data.materials && this._data.materials.length) this.parsePlaneMaterials(this._data.materials); } protected initializePlanes(): void @@ -209,25 +209,25 @@ export class PlaneRasterizer implements IPlaneRasterizer private parseTextures(textures: any, collection: IGraphicAssetCollection): void { - if (!textures || !collection) return; + if(!textures || !collection) return; - if (textures.length) + if(textures.length) { - for (const texture of textures) + for(const texture of textures) { - if (!texture) continue; + if(!texture) continue; const id = texture.id; - if (!this._textures.get(id)) + if(!this._textures.get(id)) { const plane = new PlaneTexture(); - if (texture.bitmaps && texture.bitmaps.length) + if(texture.bitmaps && texture.bitmaps.length) { - for (const bitmap of texture.bitmaps) + for(const bitmap of texture.bitmaps) { - if (!bitmap) continue; + if(!bitmap) continue; const assetName = bitmap.assetName; @@ -236,22 +236,22 @@ export class PlaneRasterizer implements IPlaneRasterizer let normalMinY = PlaneTexture.MIN_NORMAL_COORDINATE_VALUE; let normalMaxY = PlaneTexture.MAX_NORMAL_COORDINATE_VALUE; - if (bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; - if (bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; - if (bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; - if (bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; + if(bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; + if(bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; + if(bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; + if(bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; const asset = collection.getAsset(assetName); - if (asset) + if(asset) { const texture = asset.texture; - if (texture) + if(texture) { let newTexture: Texture = texture; - if (asset.flipH) + if(asset.flipH) { newTexture = Rasterizer.getFlipHBitmapData(texture); } @@ -270,20 +270,20 @@ export class PlaneRasterizer implements IPlaneRasterizer private parsePlaneMaterials(materials: any): void { - if (!materials || !materials.length) return; + if(!materials || !materials.length) return; - for (const material of materials) + for(const material of materials) { - if (!material) continue; + if(!material) continue; const id = material.id; const newMaterial = new PlaneMaterial(); - if (material.matrices && material.matrices.length) + if(material.matrices && material.matrices.length) { - for (const matrix of material.matrices) + for(const matrix of material.matrices) { - if (!matrix) continue; + if(!matrix) continue; let repeatMode = matrix.repeatMode; let align = matrix.align; @@ -292,7 +292,7 @@ export class PlaneRasterizer implements IPlaneRasterizer const normalMinY = PlaneMaterialCellMatrix.MIN_NORMAL_COORDINATE_VALUE; const normalMaxY = PlaneMaterialCellMatrix.MAX_NORMAL_COORDINATE_VALUE; - switch (repeatMode) + switch(repeatMode) { case 'borders': repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_BORDERS; @@ -314,7 +314,7 @@ export class PlaneRasterizer implements IPlaneRasterizer break; } - switch (align) + switch(align) { case 'top': align = PlaneMaterialCellMatrix.ALIGN_TOP; @@ -327,17 +327,17 @@ export class PlaneRasterizer implements IPlaneRasterizer break; } - if (matrix.columns && matrix.columns.length) + if(matrix.columns && matrix.columns.length) { const cellMatrix = newMaterial.addMaterialCellMatrix(matrix.columns.length, repeatMode, align, normalMinX, normalMaxX, normalMinY, normalMaxY); let index = 0; - while (index < matrix.columns.length) + while(index < matrix.columns.length) { const column = matrix.columns[index]; - if (column) this.parsePlaneMaterialCellColumn(column, cellMatrix, index); + if(column) this.parsePlaneMaterialCellColumn(column, cellMatrix, index); index++; } @@ -351,7 +351,7 @@ export class PlaneRasterizer implements IPlaneRasterizer private parsePlaneMaterialCellColumn(column: { repeatMode: string, width: number }, cellMatrix: PlaneMaterialCellMatrix, index: number): void { - if (!column || !cellMatrix) return; + if(!column || !cellMatrix) return; let repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_ALL; @@ -359,7 +359,7 @@ export class PlaneRasterizer implements IPlaneRasterizer const cells = this.parsePlaneMaterialCells(column); - switch (column.repeatMode) + switch(column.repeatMode) { case 'borders': repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_BORDERS; @@ -386,17 +386,17 @@ export class PlaneRasterizer implements IPlaneRasterizer private parsePlaneMaterialCells(column: any): PlaneMaterialCell[] { - if (!column || !column.cells || !column.cells.length) return null; + if(!column || !column.cells || !column.cells.length) return null; const cells: PlaneMaterialCell[] = []; let index = 0; - while (index < column.cells.length) + while(index < column.cells.length) { const cell = column.cells[index]; - if (cell) + if(cell) { const textureId = cell.textureId; @@ -405,15 +405,15 @@ export class PlaneRasterizer implements IPlaneRasterizer let graphics: IGraphicAsset[] = null; let limit = 0; - if (cell.extras && cell.extras.length) + if(cell.extras && cell.extras.length) { const extra = cell.extras[0]; const types = extra.types; const offsets = extra.offsets; - if (types && offsets) + if(types && offsets) { - if (types.length && offsets.length) + if(types.length && offsets.length) { const type = types[0]; const offset = offsets[0]; @@ -422,22 +422,22 @@ export class PlaneRasterizer implements IPlaneRasterizer offsetPoints = this.parseExtraItemOffsets(offset); limit = offsetPoints.length; - if (extra.limitMax) limit = extra.limitMax; + if(extra.limitMax) limit = extra.limitMax; } } } - if (assetNames && assetNames.length) + if(assetNames && assetNames.length) { graphics = []; - for (const assetName of assetNames) + for(const assetName of assetNames) { - if (!assetName) continue; + if(!assetName) continue; const asset = this._assetCollection.getAsset(assetName); - if (!asset) continue; + if(!asset) continue; graphics.push(asset); } @@ -452,7 +452,7 @@ export class PlaneRasterizer implements IPlaneRasterizer index++; } - if (!cells || !cells.length) return null; + if(!cells || !cells.length) return null; return cells; } @@ -461,17 +461,17 @@ export class PlaneRasterizer implements IPlaneRasterizer { const assetNames: string[] = []; - if (k && k.types && k.types.length) + if(k && k.types && k.types.length) { let index = 0; - while (index < k.types.length) + while(index < k.types.length) { const type = k.types[index]; const assetName = type.assetName; - if (assetName) assetNames.push(assetName); + if(assetName) assetNames.push(assetName); index++; } @@ -484,11 +484,11 @@ export class PlaneRasterizer implements IPlaneRasterizer { const offsets: Point[] = []; - if (k && k.offsets && k.offsets.length) + if(k && k.offsets && k.offsets.length) { let index = 0; - while (index < k.offsets.length) + while(index < k.offsets.length) { const offset = k.offsets[index]; @@ -507,16 +507,16 @@ export class PlaneRasterizer implements IPlaneRasterizer protected getGeometry(size: number, horizontalAngle: number, verticalAngle: number): IRoomGeometry { horizontalAngle = Math.abs(horizontalAngle); - if (horizontalAngle > 90) horizontalAngle = 90; + if(horizontalAngle > 90) horizontalAngle = 90; verticalAngle = Math.abs(verticalAngle); - if (verticalAngle > 90) verticalAngle = 90; + if(verticalAngle > 90) verticalAngle = 90; const identifier = `${size}_${Math.round(horizontalAngle)}_${Math.round(verticalAngle)}`; let geometry = this._geometries.get(identifier); - if (geometry) return geometry; + if(geometry) return geometry; geometry = new RoomGeometry(size, new Vector3d(horizontalAngle, verticalAngle), new Vector3d(-10, 0, 0)); @@ -527,52 +527,52 @@ export class PlaneRasterizer implements IPlaneRasterizer protected parseVisualizations(plane: Plane, visualizations: any): void { - if (!plane || !visualizations) return; + if(!plane || !visualizations) return; - if (visualizations && visualizations.length) + if(visualizations && visualizations.length) { - for (const visualization of visualizations) + for(const visualization of visualizations) { - if (!visualization) continue; + if(!visualization) continue; const size = visualization.size; let horizontalAngle = FloorPlane.HORIZONTAL_ANGLE_DEFAULT; let verticalAngle = FloorPlane.VERTICAL_ANGLE_DEFAULT; - if (visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; - if (visualization.verticalAngle) verticalAngle = visualization.verticalAngle; + if(visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; + if(visualization.verticalAngle) verticalAngle = visualization.verticalAngle; const layers = visualization.layers; const planeVisualization = plane.createPlaneVisualization(size, ((layers && layers.length) || 0), this.getGeometry(size, horizontalAngle, verticalAngle)); - if (planeVisualization && (layers && layers.length)) + if(planeVisualization && (layers && layers.length)) { let layerId = 0; - while (layerId < layers.length) + while(layerId < layers.length) { const layer = layers[layerId]; - if (layer) + if(layer) { let material: PlaneMaterial = null; let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT; let color: number = FloorPlane.DEFAULT_COLOR; let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET; - if (layer.materialId) material = this.getMaterial(layer.materialId); + if(layer.materialId) material = this.getMaterial(layer.materialId); - if (layer.color) color = layer.color; + if(layer.color) color = layer.color; - if (layer.offset) offset = layer.offset; + if(layer.offset) offset = layer.offset; - if (layer.align) + if(layer.align) { - if (layer.align === 'bottom') align = PlaneVisualizationLayer.ALIGN_BOTTOM; + if(layer.align === 'bottom') align = PlaneVisualizationLayer.ALIGN_BOTTOM; - else if (layer.align == 'top') align = PlaneVisualizationLayer.ALIGN_TOP; + else if(layer.align == 'top') align = PlaneVisualizationLayer.ALIGN_TOP; } planeVisualization.setLayer(layerId, material, color, align, offset); @@ -599,7 +599,7 @@ export class PlaneRasterizer implements IPlaneRasterizer { let planes = this.getPlane(id); - if (!planes) planes = this.getPlane(PlaneRasterizer.DEFAULT); + if(!planes) planes = this.getPlane(PlaneRasterizer.DEFAULT); return planes.getLayers(); } diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts index 2f06f190..5ff8c4eb 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts @@ -16,11 +16,11 @@ export class PlaneTexture public dispose(): void { - if (this._bitmaps) + if(this._bitmaps) { - for (const bitmap of this._bitmaps) + for(const bitmap of this._bitmaps) { - if (!bitmap) continue; + if(!bitmap) continue; bitmap.dispose(); } @@ -38,20 +38,20 @@ export class PlaneTexture { const _local_2 = this.getPlaneTextureBitmap(k); - if (!_local_2) return null; + if(!_local_2) return null; return _local_2.bitmap; } public getPlaneTextureBitmap(k: IVector3D): PlaneTextureBitmap { - if (!k) return null; + if(!k) return null; - for (const bitmap of this._bitmaps) + for(const bitmap of this._bitmaps) { - if (!bitmap) continue; + if(!bitmap) continue; - if ((((k.x >= bitmap.normalMinX) && (k.x <= bitmap.normalMaxX)) && (k.y >= bitmap.normalMinY)) && (k.y <= bitmap.normalMaxY)) return bitmap; + if((((k.x >= bitmap.normalMinX) && (k.x <= bitmap.normalMaxX)) && (k.y >= bitmap.normalMinY)) && (k.y <= bitmap.normalMaxY)) return bitmap; } return null; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts index 1267fef2..4c40c495 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts @@ -22,11 +22,11 @@ export class PlaneVisualization this._isCached = false; this._hasAnimationLayers = false; - if (totalLayers < 0) totalLayers = 0; + if(totalLayers < 0) totalLayers = 0; let index = 0; - while (index < totalLayers) + while(index < totalLayers) { this._layers.push(null); @@ -46,11 +46,11 @@ export class PlaneVisualization public dispose(): void { - if (this._layers && this._layers.length) + if(this._layers && this._layers.length) { - for (const layer of this._layers) + for(const layer of this._layers) { - if (!layer) continue; + if(!layer) continue; layer.dispose(); } @@ -60,37 +60,37 @@ export class PlaneVisualization this._geometry = null; - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) this._cachedBitmapNormal = null; + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; } public clearCache(): void { - if (!this._isCached) return; + if(!this._isCached) return; - if (this._cachedBitmapData) + if(this._cachedBitmapData) { this._cachedBitmapData.destroy(); this._cachedBitmapData = null; } - if (this._cachedBitmapNormal) + if(this._cachedBitmapNormal) { this._cachedBitmapNormal.assign(new Vector3d()); } - if (this._layers && this._layers.length) + if(this._layers && this._layers.length) { - for (const layer of this._layers) + for(const layer of this._layers) { - if (!layer) continue; + if(!layer) continue; const planeLayer = layer as PlaneVisualizationLayer; @@ -103,11 +103,11 @@ export class PlaneVisualization public setLayer(layerId: number, material: PlaneMaterial, color: number, align: number, offset: number = 0): boolean { - if ((layerId < 0) || (layerId > this._layers.length)) return false; + if((layerId < 0) || (layerId > this._layers.length)) return false; let layer = this._layers[layerId]; - if (layer) layer.dispose(); + if(layer) layer.dispose(); layer = new PlaneVisualizationLayer(material, color, align, offset); @@ -118,11 +118,11 @@ export class PlaneVisualization public setAnimationLayer(layerId: number, animationItems: any, collection: IGraphicAssetCollection): boolean { - if ((layerId < 0) || (layerId > this._layers.length)) return false; + if((layerId < 0) || (layerId > this._layers.length)) return false; let layer = this._layers[layerId] as IDisposable; - if (layer) layer.dispose(); + if(layer) layer.dispose(); layer = new PlaneVisualizationAnimationLayer(animationItems, collection); @@ -139,19 +139,19 @@ export class PlaneVisualization public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, dimensionX: number = 0, dimensionY: number = 0, timeSinceStartMs: number = 0): Graphics { - if (width < 1) width = 1; + if(width < 1) width = 1; - if (height < 1) height = 1; + if(height < 1) height = 1; - if ((!canvas || (canvas.width !== width)) || (canvas.height !== height)) canvas = null; + if((!canvas || (canvas.width !== width)) || (canvas.height !== height)) canvas = null; - if (this._cachedBitmapData) + if(this._cachedBitmapData) { - if (((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height)) && (Vector3d.isEqual(this._cachedBitmapNormal, normal))) + if(((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height)) && (Vector3d.isEqual(this._cachedBitmapNormal, normal))) { - if (!this.hasAnimationLayers) + if(!this.hasAnimationLayers) { - if (canvas) + if(canvas) { canvas.addChild(this._cachedBitmapData); @@ -182,7 +182,7 @@ export class PlaneVisualization this._isCached = true; - if (!this._cachedBitmapData) + if(!this._cachedBitmapData) { this._cachedBitmapData = new Graphics() .beginFill(0xFFFFFF) @@ -197,29 +197,29 @@ export class PlaneVisualization .endFill(); } - if (!canvas) canvas = this._cachedBitmapData; + if(!canvas) canvas = this._cachedBitmapData; this._cachedBitmapNormal.assign(normal); - if (this._layers && this._layers.length) + if(this._layers && this._layers.length) { - for (const layer of this._layers) + for(const layer of this._layers) { - if (!layer) continue; + if(!layer) continue; - if (layer instanceof PlaneVisualizationLayer) + if(layer instanceof PlaneVisualizationLayer) { layer.render(canvas, width, height, normal, useTexture, offsetX, offsetY); } - else if (layer instanceof PlaneVisualizationAnimationLayer) + else if(layer instanceof PlaneVisualizationAnimationLayer) { layer.render(canvas, width, height, normal, offsetX, offsetY, maxX, maxY, dimensionX, dimensionY, timeSinceStartMs); } } } - if (canvas && (canvas !== this._cachedBitmapData)) + if(canvas && (canvas !== this._cachedBitmapData)) { this._cachedBitmapData.addChild(canvas.clone()); // const texture = TextureUtils.generateTexture(canvas, new Rectangle(0, 0, canvas.width, canvas.height)); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts index 46c8eab3..b97e5dff 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts @@ -54,7 +54,7 @@ export class PlaneVisualizationLayer public clearCache(): void { - if (this._bitmapData) + if(this._bitmapData) { this._bitmapData.destroy(); @@ -64,17 +64,17 @@ export class PlaneVisualizationLayer public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number): Graphics { - if (!canvas || (canvas.width !== width) || (canvas.height !== height)) canvas = null; + if(!canvas || (canvas.width !== width) || (canvas.height !== height)) canvas = null; let bitmapData: Graphics = null; - if (this._material) + if(this._material) { bitmapData = this._material.render(null, width, height, normal, useTexture, offsetX, (offsetY + this.offset), (this.align === PlaneVisualizationLayer.ALIGN_TOP)); - if (bitmapData && (bitmapData !== canvas)) + if(bitmapData && (bitmapData !== canvas)) { - if (this._bitmapData) this._bitmapData.destroy(); + if(this._bitmapData) this._bitmapData.destroy(); this._bitmapData = bitmapData.clone(); @@ -83,11 +83,11 @@ export class PlaneVisualizationLayer } else { - if (!canvas) + if(!canvas) { - if (this._bitmapData && (this._bitmapData.width === width) && (this._bitmapData.height === height)) return this._bitmapData; + if(this._bitmapData && (this._bitmapData.width === width) && (this._bitmapData.height === height)) return this._bitmapData; - if (this._bitmapData) this._bitmapData.destroy(); + if(this._bitmapData) this._bitmapData.destroy(); const graphic = new Graphics() .beginFill(0xFFFFFF) @@ -109,15 +109,15 @@ export class PlaneVisualizationLayer } } - if (bitmapData) + if(bitmapData) { bitmapData.tint = this._color; - if (canvas && (bitmapData !== canvas)) + if(canvas && (bitmapData !== canvas)) { let texture = RoomVisualization.getTextureCache(bitmapData); - if (!texture) + if(!texture) { texture = TextureUtils.generateTexture(bitmapData, new Rectangle(0, 0, width, height)); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts index a1d053e5..2f1a1ea3 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts @@ -12,13 +12,13 @@ export class WallPlane extends Plane { const visualization = this.getPlaneVisualization(size); - if (!visualization || !visualization.geometry) return null; + if(!visualization || !visualization.geometry) return null; const _local_8 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_9 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, (height / visualization.geometry.scale))); const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, (width / visualization.geometry.scale), 0)); - if (_local_8 && _local_9 && _local_10) + if(_local_8 && _local_9 && _local_10) { width = Math.round(Math.abs((_local_8.x - _local_10.x))); height = Math.round(Math.abs((_local_8.y - _local_9.y))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts index d1c7b807..5eff8cfa 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts @@ -8,22 +8,22 @@ export class WallRasterizer extends PlaneRasterizer { protected initializePlanes(): void { - if (!this.data) return; + if(!this.data) return; const walls = this.data.walls; - if (walls && walls.length) this.parseWalls(walls); + if(walls && walls.length) this.parseWalls(walls); } private parseWalls(k: any): void { - if (!k) return; + if(!k) return; - for (const wallIndex in k) + for(const wallIndex in k) { const wall = k[wallIndex]; - if (!wall) continue; + if(!wall) continue; const id = wall.id; const visualization = wall.visualizations; @@ -31,7 +31,7 @@ export class WallRasterizer extends PlaneRasterizer this.parseVisualizations(plane, visualization); - if (!this.addPlane(id, plane)) plane.dispose(); + if(!this.addPlane(id, plane)) plane.dispose(); } } @@ -39,11 +39,11 @@ export class WallRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as WallPlane; - if (!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane; + if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane; - if (!plane) return null; + if(!plane) return null; - if (canvas) + if(canvas) { const rectangle = canvas.getBounds(); @@ -54,11 +54,11 @@ export class WallRasterizer extends PlaneRasterizer let graphic = plane.render(canvas, width, height, scale, normal, useTexture); - if (graphic && (graphic !== canvas)) + if(graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if (!graphic) return null; + if(!graphic) return null; } return new PlaneBitmapData(graphic, -1); @@ -66,7 +66,7 @@ export class WallRasterizer extends PlaneRasterizer public getTextureIdentifier(k: number, normal: IVector3D): string { - if (normal) + if(normal) { return `${k}_${normal.x}_${normal.y}_${normal.z}`; } diff --git a/src/nitro/room/preview/RoomPreviewer.ts b/src/nitro/room/preview/RoomPreviewer.ts index 04127656..b0af1d2a 100644 --- a/src/nitro/room/preview/RoomPreviewer.ts +++ b/src/nitro/room/preview/RoomPreviewer.ts @@ -55,7 +55,7 @@ export class RoomPreviewer this.onRoomObjectAdded = this.onRoomObjectAdded.bind(this); this.onRoomInitializedonRoomInitialized = this.onRoomInitializedonRoomInitialized.bind(this); - if (this.isRoomEngineReady && this._roomEngine.events) + if(this.isRoomEngineReady && this._roomEngine.events) { this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); this._roomEngine.events.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); @@ -69,21 +69,21 @@ export class RoomPreviewer { this.reset(true); - if (this.isRoomEngineReady && this._roomEngine.events) + if(this.isRoomEngineReady && this._roomEngine.events) { 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); } - if (this._backgroundSprite) + if(this._backgroundSprite) { this._backgroundSprite.destroy(); this._backgroundSprite = null; } - if (this._planeParser) + if(this._planeParser) { this._planeParser.dispose(); @@ -93,7 +93,7 @@ export class RoomPreviewer private createRoomForPreview(): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const size = 7; @@ -103,11 +103,11 @@ export class RoomPreviewer let y = 1; - while (y < (1 + size)) + while(y < (1 + size)) { let x = 1; - while (x < (1 + size)) + while(x < (1 + size)) { planeParser.setTileHeight(x, y, 0); @@ -127,13 +127,13 @@ export class RoomPreviewer public reset(k: boolean): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this._roomEngine.removeRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); this._roomEngine.removeRoomObjectWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); this._roomEngine.removeRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); - if (!k) this.updatePreviewRoomView(); + if(!k) this.updatePreviewRoomView(); } this._currentPreviewObjectCategory = RoomObjectCategory.MINIMUM; @@ -149,7 +149,7 @@ export class RoomPreviewer //@ts-ignore const wallGeometry = (this._roomEngine as IRoomCreator).getLegacyWallGeometry(this._previewRoomId); - if (!wallGeometry) return; + if(!wallGeometry) return; this._planeParser.reset(); @@ -167,17 +167,17 @@ export class RoomPreviewer let y = 0; - while (y < height) + while(y < height) { let x = 0; - while (x < width) + while(x < width) { const tileHeight = parser.getHeight(x, y); - if (((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) + if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) { - if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) { doorX = (x + 0.5); doorY = y; @@ -185,7 +185,7 @@ export class RoomPreviewer doorDirection = 90; } - if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) { doorX = x; doorY = (y + 0.5); @@ -211,11 +211,11 @@ export class RoomPreviewer let heightIterator = (parser.height - 1); - while (heightIterator >= 0) + while(heightIterator >= 0) { let widthIterator = (parser.width - 1); - while (widthIterator >= 0) + while(widthIterator >= 0) { wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator)); widthIterator--; @@ -235,14 +235,14 @@ export class RoomPreviewer const roomObject = this.getRoomPreviewOwnRoomObject(); - if (roomObject) roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap)); + if(roomObject) roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap)); } public addFurnitureIntoRoom(classId: number, direction: IVector3D, objectData: IObjectData = null, extra: string = null): number { - if (!objectData) objectData = new LegacyDataType(); + if(!objectData) objectData = new LegacyDataType(); - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this.reset(false); @@ -250,14 +250,14 @@ export class RoomPreviewer this._currentPreviewObjectCategory = RoomObjectCategory.FLOOR; this._currentPreviewObjectData = ''; - if (this._roomEngine.addFurnitureFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), direction, 0, objectData, NaN, -1, 0, -1, '', true, false)) + if(this._roomEngine.addFurnitureFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), direction, 0, objectData, NaN, -1, 0, -1, '', true, false)) { this._previousAutomaticStateChangeTime = Nitro.instance.time; this._automaticStateChange = true; const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); - if (roomObject && extra) roomObject.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extra); + if(roomObject && extra) roomObject.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extra); this.updatePreviewRoomView(); @@ -270,9 +270,9 @@ export class RoomPreviewer public addWallItemIntoRoom(classId: number, direction: IVector3D, objectData: string): number { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { - if ((this._currentPreviewObjectCategory === RoomObjectCategory.WALL) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === objectData)) return RoomPreviewer.PREVIEW_OBJECT_ID; + if((this._currentPreviewObjectCategory === RoomObjectCategory.WALL) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === objectData)) return RoomPreviewer.PREVIEW_OBJECT_ID; this.reset(false); @@ -280,7 +280,7 @@ export class RoomPreviewer this._currentPreviewObjectCategory = RoomObjectCategory.WALL; this._currentPreviewObjectData = objectData; - if (this._roomEngine.addFurnitureWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(0.5, 2.3, 1.8), direction, 0, objectData, 0, 0, -1, '', false)) + if(this._roomEngine.addFurnitureWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(0.5, 2.3, 1.8), direction, 0, objectData, 0, 0, -1, '', false)) { this._previousAutomaticStateChangeTime = Nitro.instance.time; this._automaticStateChange = true; @@ -296,7 +296,7 @@ export class RoomPreviewer public addAvatarIntoRoom(figure: string, effect: number): number { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this.reset(false); @@ -304,7 +304,7 @@ export class RoomPreviewer this._currentPreviewObjectCategory = RoomObjectCategory.UNIT; this._currentPreviewObjectData = figure; - if (this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 135, RoomObjectUserType.getTypeNumber(RoomObjectUserType.USER), figure)) + if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 135, RoomObjectUserType.getTypeNumber(RoomObjectUserType.USER), figure)) { this._previousAutomaticStateChangeTime = Nitro.instance.time; this._automaticStateChange = true; @@ -324,7 +324,7 @@ export class RoomPreviewer public addPetIntoRoom(figure: string): number { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this.reset(false); @@ -332,7 +332,7 @@ export class RoomPreviewer this._currentPreviewObjectCategory = RoomObjectCategory.UNIT; this._currentPreviewObjectData = figure; - if (this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 90, RoomObjectUserType.getTypeNumber(RoomObjectUserType.PET), figure)) + if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 90, RoomObjectUserType.getTypeNumber(RoomObjectUserType.PET), figure)) { this._previousAutomaticStateChangeTime = Nitro.instance.time; this._automaticStateChange = false; @@ -351,57 +351,57 @@ export class RoomPreviewer public updateUserPosture(type: string, parameter: string = ''): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserPosture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, type, parameter); + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserPosture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, type, parameter); } public updateUserGesture(gestureId: number): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserGesture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, gestureId); + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserGesture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, gestureId); } public updateUserEffect(effectId: number): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserEffect(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, effectId); + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserEffect(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, effectId); } public updateObjectUserFigure(figure: string, gender: string = null, subType: string = null, isRiding: boolean = false): boolean { - if (this.isRoomEngineReady) return this._roomEngine.updateRoomObjectUserFigure(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, figure, gender, subType, isRiding); + if(this.isRoomEngineReady) return this._roomEngine.updateRoomObjectUserFigure(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, figure, gender, subType, isRiding); return false; } public updateObjectUserAction(action: string, value: number, parameter: string = null): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter); + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter); } public updateObjectStuffData(stuffData: IObjectData): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData); + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData); } public changeRoomObjectState(): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this._automaticStateChange = false; - if (this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); } } public changeRoomObjectDirection(): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); - if (!roomObject) return; + if(!roomObject) return; const direction = this._roomEngine.objectEventHandler.getValidRoomObjectDirection(roomObject, true); - switch (this._currentPreviewObjectCategory) + switch(this._currentPreviewObjectCategory) { case RoomObjectCategory.FLOOR: { const floorLocation = new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y); @@ -419,30 +419,30 @@ export class RoomPreviewer private checkAutomaticRoomObjectStateChange(): void { - if (this._automaticStateChange) + if(this._automaticStateChange) { const time = Nitro.instance.time; - if (time > (this._previousAutomaticStateChangeTime + RoomPreviewer.AUTOMATIC_STATE_CHANGE_INTERVAL)) + if(time > (this._previousAutomaticStateChangeTime + RoomPreviewer.AUTOMATIC_STATE_CHANGE_INTERVAL)) { this._previousAutomaticStateChangeTime = time; - if (this.isRoomEngineReady) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + if(this.isRoomEngineReady) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); } } } public getRoomCanvas(width: number, height: number): DisplayObject { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const displayObject = (this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale) as Container); - if (displayObject && (this._backgroundColor !== null)) + if(displayObject && (this._backgroundColor !== null)) { let backgroundSprite = this._backgroundSprite; - if (!backgroundSprite) + if(!backgroundSprite) { backgroundSprite = new NitroSprite(Texture.WHITE); @@ -458,7 +458,7 @@ export class RoomPreviewer const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); - if (geometry) geometry.adjustLocation(new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), 30); + if(geometry) geometry.adjustLocation(new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), 30); this._currentPreviewCanvasWidth = width; this._currentPreviewCanvasHeight = height; @@ -471,12 +471,12 @@ export class RoomPreviewer public modifyRoomCanvas(width: number, height: number): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this._currentPreviewCanvasWidth = width; this._currentPreviewCanvasHeight = height; - if (this._backgroundSprite) + if(this._backgroundSprite) { this._backgroundSprite.width = width; this._backgroundSprite.height = height; @@ -500,7 +500,7 @@ export class RoomPreviewer { const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID); - if (objectBounds && point) + if(objectBounds && point) { objectBounds.x += -(this._currentPreviewCanvasWidth >> 1); objectBounds.y += -(this._currentPreviewCanvasHeight >> 1); @@ -508,7 +508,7 @@ export class RoomPreviewer objectBounds.x += -(point.x); objectBounds.y += -(point.y); - if (!this._currentPreviewRectangle) + if(!this._currentPreviewRectangle) { this._currentPreviewRectangle = objectBounds; } @@ -516,27 +516,27 @@ export class RoomPreviewer { const bounds = this._currentPreviewRectangle.clone().enlarge(objectBounds); - if (((((bounds.width - this._currentPreviewRectangle.width) > ((this._currentPreviewCanvasWidth - this._currentPreviewRectangle.width) >> 1)) || ((bounds.height - this._currentPreviewRectangle.height) > ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1))) || (this._currentPreviewRectangle.width < 1)) || (this._currentPreviewRectangle.height < 1)) this._currentPreviewRectangle = bounds; + if(((((bounds.width - this._currentPreviewRectangle.width) > ((this._currentPreviewCanvasWidth - this._currentPreviewRectangle.width) >> 1)) || ((bounds.height - this._currentPreviewRectangle.height) > ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1))) || (this._currentPreviewRectangle.width < 1)) || (this._currentPreviewRectangle.height < 1)) this._currentPreviewRectangle = bounds; } } } private validatePreviewSize(point: Point): Point { - if (((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) + if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) { return point; } - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); - if ((this._currentPreviewRectangle.width > (this._currentPreviewCanvasWidth * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))) || (this._currentPreviewRectangle.height > (this._currentPreviewCanvasHeight * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT)))) + if((this._currentPreviewRectangle.width > (this._currentPreviewCanvasWidth * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))) || (this._currentPreviewRectangle.height > (this._currentPreviewCanvasHeight * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT)))) { - if (RoomPreviewer.ZOOM_ENABLED) + if(RoomPreviewer.ZOOM_ENABLED) { - if (this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 0.5) + if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 0.5) { this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5, null, null); @@ -554,7 +554,7 @@ export class RoomPreviewer } else { - if (geometry.isZoomedIn()) + if(geometry.isZoomedIn()) { geometry.performZoomOut(); @@ -564,11 +564,11 @@ export class RoomPreviewer } } - else if (!this._currentPreviewNeedsZoomOut) + else if(!this._currentPreviewNeedsZoomOut) { - if (RoomPreviewer.ZOOM_ENABLED) + if(RoomPreviewer.ZOOM_ENABLED) { - if (this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 1) + if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 1) { this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1, null, null); @@ -577,7 +577,7 @@ export class RoomPreviewer } else { - if (!geometry.isZoomedIn()) + if(!geometry.isZoomedIn()) { geometry.performZoomIn(); @@ -592,9 +592,9 @@ export class RoomPreviewer public zoomIn(): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { - if (RoomPreviewer.ZOOM_ENABLED) + if(RoomPreviewer.ZOOM_ENABLED) { this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1); } @@ -611,9 +611,9 @@ export class RoomPreviewer public zoomOut(): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { - if (RoomPreviewer.ZOOM_ENABLED) + if(RoomPreviewer.ZOOM_ENABLED) { this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5); } @@ -630,7 +630,7 @@ export class RoomPreviewer public updateAvatarDirection(direction: number, headDirection: number): void { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { this._roomEngine.updateRoomObjectUserLocation(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), false, 0, new Vector3d((direction * 45), 0, 0), (headDirection * 45)); } @@ -638,31 +638,31 @@ export class RoomPreviewer public updateObjectRoom(floorType: string = null, wallType: string = null, landscapeType: string = null, _arg_4: boolean = false): boolean { - if (this.isRoomEngineReady) return this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, floorType, wallType, landscapeType, _arg_4); + if(this.isRoomEngineReady) return this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, floorType, wallType, landscapeType, _arg_4); return false; } public updateRoomWallsAndFloorVisibility(wallsVisible: boolean, floorsVisible: boolean = true): void { - if (this.isRoomEngineReady) this._roomEngine.updateRoomInstancePlaneVisibility(this._previewRoomId, wallsVisible, floorsVisible); + if(this.isRoomEngineReady) this._roomEngine.updateRoomInstancePlaneVisibility(this._previewRoomId, wallsVisible, floorsVisible); } private getCanvasOffset(point: Point): Point { - if (((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) return point; + if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) return point; let x = (-(this._currentPreviewRectangle.left + this._currentPreviewRectangle.right) >> 1); let y = (-(this._currentPreviewRectangle.top + this._currentPreviewRectangle.bottom) >> 1); const height = ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1); - if (height > 10) + if(height > 10) { y = (y + Math.min(15, (height - 10))); } else { - if (this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) + if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) { y = (y + (5 - Math.max(0, (height / 2)))); } @@ -678,11 +678,11 @@ export class RoomPreviewer const offsetX = (x - point.x); const offsetY = (y - point.y); - if ((offsetX !== 0) || (offsetY !== 0)) + if((offsetX !== 0) || (offsetY !== 0)) { const _local_7 = Math.sqrt(((offsetX * offsetX) + (offsetY * offsetY))); - if (_local_7 > 10) + if(_local_7 > 10) { x = (point.x + ((offsetX * 10) / _local_7)); y = (point.y + ((offsetY * 10) / _local_7)); @@ -696,19 +696,19 @@ export class RoomPreviewer public updatePreviewRoomView(k: boolean = false): void { - if (this._disableUpdate && !k) return; + if(this._disableUpdate && !k) return; this.checkAutomaticRoomObjectStateChange(); - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { let offset = this._roomEngine.getRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); - if (offset) + if(offset) { this.updatePreviewObjectBoundingRectangle(offset); - if (this._currentPreviewRectangle) + if(this._currentPreviewRectangle) { const scale = this._currentPreviewScale; @@ -716,12 +716,12 @@ export class RoomPreviewer const canvasOffset = this.getCanvasOffset(offset); - if (canvasOffset) + if(canvasOffset) { this._roomEngine.setRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, canvasOffset); } - if (this._currentPreviewScale !== scale) this._currentPreviewRectangle = null; + if(this._currentPreviewScale !== scale) this._currentPreviewRectangle = null; } } } @@ -734,17 +734,17 @@ export class RoomPreviewer public set disableRoomEngineUpdate(flag: boolean) { - if (this.isRoomEngineReady) this._roomEngine.disableUpdate(flag); + if(this.isRoomEngineReady) this._roomEngine.disableUpdate(flag); } private onRoomInitializedonRoomInitialized(event: RoomEngineEvent): void { - if (!event) return; + if(!event) return; - switch (event.type) + switch(event.type) { case RoomEngineEvent.INITIALIZED: - if ((event.roomId === this._previewRoomId) && this.isRoomEngineReady) + if((event.roomId === this._previewRoomId) && this.isRoomEngineReady) { this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, '110', '99999'); } @@ -754,19 +754,19 @@ export class RoomPreviewer private onRoomObjectAdded(event: RoomEngineObjectEvent): void { - if ((event.roomId === this._previewRoomId) && (event.objectId === RoomPreviewer.PREVIEW_OBJECT_ID) && (event.category === this._currentPreviewObjectCategory)) + if((event.roomId === this._previewRoomId) && (event.objectId === RoomPreviewer.PREVIEW_OBJECT_ID) && (event.category === this._currentPreviewObjectCategory)) { this._currentPreviewRectangle = null; this._currentPreviewNeedsZoomOut = false; const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category); - if (roomObject && roomObject.model && (event.category === RoomObjectCategory.WALL)) + if(roomObject && roomObject.model && (event.category === RoomObjectCategory.WALL)) { const sizeZ = roomObject.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); const centerZ = roomObject.model.getValue(RoomObjectVariable.FURNITURE_CENTER_Z); - if ((sizeZ !== null) || (centerZ !== null)) + if((sizeZ !== null) || (centerZ !== null)) { this._roomEngine.updateRoomObjectWallLocation(event.roomId, event.objectId, new Vector3d(0.5, 2.3, (((3.6 - sizeZ) / 2) + centerZ))); } @@ -776,21 +776,21 @@ export class RoomPreviewer public updateRoomEngine(): void { - if (this.isRoomEngineReady) this._roomEngine.runUpdate(); + if(this.isRoomEngineReady) this._roomEngine.runUpdate(); } public getRenderingCanvas(): IRoomRenderingCanvas { const renderingCanvas = this._roomEngine.getRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); - if (!renderingCanvas) return null; + if(!renderingCanvas) return null; return renderingCanvas; } public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frame: number = -1, posture: string = null): IImageResult { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { return this._roomEngine.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, extras, objectData, state, frame, posture); } @@ -800,7 +800,7 @@ export class RoomPreviewer public getRoomObjectImage(direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): IImageResult { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { return this._roomEngine.getRoomObjectImage(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, direction, scale, listener, bgColor); } @@ -810,11 +810,11 @@ export class RoomPreviewer public getRoomObjectCurrentImage(): RenderTexture { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); - if (roomObject && roomObject.visualization) return roomObject.visualization.getImage(0xFFFFFF, -1); + if(roomObject && roomObject.visualization) return roomObject.visualization.getImage(0xFFFFFF, -1); } return null; @@ -822,11 +822,11 @@ export class RoomPreviewer public getRoomPreviewObject(): IRoomObjectController { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); - if (roomObject) return roomObject; + if(roomObject) return roomObject; } return null; @@ -834,11 +834,11 @@ export class RoomPreviewer public getRoomPreviewOwnRoomObject(): IRoomObjectController { - if (this.isRoomEngineReady) + if(this.isRoomEngineReady) { const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); - if (roomObject) return roomObject; + if(roomObject) return roomObject; } return null; diff --git a/src/nitro/room/utils/FurnitureStackingHeightMap.ts b/src/nitro/room/utils/FurnitureStackingHeightMap.ts index f0cccaf9..f567eb82 100644 --- a/src/nitro/room/utils/FurnitureStackingHeightMap.ts +++ b/src/nitro/room/utils/FurnitureStackingHeightMap.ts @@ -18,7 +18,7 @@ export class FurnitureStackingHeightMap implements IFurnitureStackingHeightMap let total = (width * height); - while (total > 0) + while(total > 0) { this._heights.push(0); this._isNotStackable.push(false); @@ -49,17 +49,17 @@ export class FurnitureStackingHeightMap implements IFurnitureStackingHeightMap public setTileHeight(x: number, y: number, height: number): void { - if (this.validPosition(x, y)) this._heights[((y * this._width) + x)] = height; + if(this.validPosition(x, y)) this._heights[((y * this._width) + x)] = height; } public setStackingBlocked(x: number, y: number, isNotStackable: boolean): void { - if (this.validPosition(x, y)) this._isNotStackable[((y * this._width) + x)] = isNotStackable; + if(this.validPosition(x, y)) this._isNotStackable[((y * this._width) + x)] = isNotStackable; } public setIsRoomTile(x: number, y: number, isRoomTile: boolean): void { - if (this.validPosition(x, y)) this._isRoomTile[((y * this._width) + x)] = isRoomTile; + if(this.validPosition(x, y)) this._isRoomTile[((y * this._width) + x)] = isRoomTile; } public validateLocation(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: number, _arg_7: number, _arg_8: number, _arg_9: boolean, _arg_10: number = -1): boolean @@ -67,36 +67,36 @@ export class FurnitureStackingHeightMap implements IFurnitureStackingHeightMap let _local_12 = 0; let _local_13 = 0; - if (!this.validPosition(k, _arg_2) || !this.validPosition(((k + _arg_3) - 1), ((_arg_2 + _arg_4) - 1))) return false; + if(!this.validPosition(k, _arg_2) || !this.validPosition(((k + _arg_3) - 1), ((_arg_2 + _arg_4) - 1))) return false; - if (((_arg_5 < 0) || (_arg_5 >= this._width))) _arg_5 = 0; + if(((_arg_5 < 0) || (_arg_5 >= this._width))) _arg_5 = 0; - if (((_arg_6 < 0) || (_arg_6 >= this._height))) _arg_6 = 0; + if(((_arg_6 < 0) || (_arg_6 >= this._height))) _arg_6 = 0; _arg_7 = Math.min(_arg_7, (this._width - _arg_5)); _arg_8 = Math.min(_arg_8, (this._height - _arg_6)); - if (_arg_10 === -1) _arg_10 = this.getTileHeight(k, _arg_2); + if(_arg_10 === -1) _arg_10 = this.getTileHeight(k, _arg_2); let _local_11 = _arg_2; - while (_local_11 < (_arg_2 + _arg_4)) + while(_local_11 < (_arg_2 + _arg_4)) { _local_12 = k; - while (_local_12 < (k + _arg_3)) + while(_local_12 < (k + _arg_3)) { - if (((((_local_12 < _arg_5) || (_local_12 >= (_arg_5 + _arg_7))) || (_local_11 < _arg_6)) || (_local_11 >= (_arg_6 + _arg_8)))) + if(((((_local_12 < _arg_5) || (_local_12 >= (_arg_5 + _arg_7))) || (_local_11 < _arg_6)) || (_local_11 >= (_arg_6 + _arg_8)))) { _local_13 = ((_local_11 * this._width) + _local_12); - if (_arg_9) + if(_arg_9) { - if (!this._isRoomTile[_local_13]) return false; + if(!this._isRoomTile[_local_13]) return false; } else { - if (((this._isNotStackable[_local_13]) || (!(this._isRoomTile[_local_13]))) || (Math.abs((this._heights[_local_13] - _arg_10)) > 0.01)) return false; + if(((this._isNotStackable[_local_13]) || (!(this._isRoomTile[_local_13]))) || (Math.abs((this._heights[_local_13] - _arg_10)) > 0.01)) return false; } } diff --git a/src/nitro/room/utils/LegacyWallGeometry.ts b/src/nitro/room/utils/LegacyWallGeometry.ts index 625265de..308eda51 100644 --- a/src/nitro/room/utils/LegacyWallGeometry.ts +++ b/src/nitro/room/utils/LegacyWallGeometry.ts @@ -47,7 +47,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public initialize(width: number, height: number, floorHeight: number): void { - if ((width <= this._width) && (height <= this._height)) + if((width <= this._width) && (height <= this._height)) { this._width = width; this._height = height; @@ -60,7 +60,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let y = 0; - while (y < height) + while(y < height) { const heights: number[] = []; @@ -68,7 +68,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let x = 0; - while (x < width) + while(x < width) { heights.push(0); @@ -90,11 +90,11 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public setHeight(x: number, y: number, height: number): boolean { - if ((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return false; + if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return false; const heightMap = this._heightMap[y]; - if (!heightMap) return false; + if(!heightMap) return false; heightMap[x] = height; @@ -103,11 +103,11 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public getHeight(x: number, y: number): number { - if ((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return 0; + if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return 0; const heightMap = this._heightMap[y]; - if (!heightMap) return 0; + if(!heightMap) return 0; return heightMap[x]; } @@ -117,22 +117,22 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let _local_12: number; let _local_6: number; let _local_7: number; - if (((k == 0) && (_arg_2 == 0))) + if(((k == 0) && (_arg_2 == 0))) { k = this._width; _arg_2 = this._height; _local_12 = Math.round((this.scale / 10)); - if (_arg_5 == LegacyWallGeometry.R) + if(_arg_5 == LegacyWallGeometry.R) { _local_7 = (this._width - 1); - while (_local_7 >= 0) + while(_local_7 >= 0) { _local_6 = 1; - while (_local_6 < this._height) + while(_local_6 < this._height) { - if (this.getHeight(_local_7, _local_6) <= this._floorHeight) + if(this.getHeight(_local_7, _local_6) <= this._floorHeight) { - if ((_local_6 - 1) < _arg_2) + if((_local_6 - 1) < _arg_2) { k = _local_7; _arg_2 = (_local_6 - 1); @@ -149,14 +149,14 @@ export class LegacyWallGeometry implements ILegacyWallGeometry else { _local_6 = (this._height - 1); - while (_local_6 >= 0) + while(_local_6 >= 0) { _local_7 = 1; - while (_local_7 < this._width) + while(_local_7 < this._width) { - if (this.getHeight(_local_7, _local_6) <= this._floorHeight) + if(this.getHeight(_local_7, _local_6) <= this._floorHeight) { - if ((_local_7 - 1) < k) + if((_local_7 - 1) < k) { k = (_local_7 - 1); _arg_2 = _local_6; @@ -174,7 +174,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let _local_8: number = k; let _local_9: number = _arg_2; let _local_10: number = this.getHeight(k, _arg_2); - if (_arg_5 == LegacyWallGeometry.R) + if(_arg_5 == LegacyWallGeometry.R) { _local_8 = (_local_8 + ((_arg_3 / (this._scale / 2)) - 0.5)); _local_9 = (_local_9 + 0.5); @@ -203,11 +203,11 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let _local_11: number; let _local_12 = 0; _local_4 = 0; - while (_local_4 < this._width) + while(_local_4 < this._width) { - if (((_local_5 >= 0) && (_local_5 < this._height))) + if(((_local_5 >= 0) && (_local_5 < this._height))) { - if (this.getHeight(_local_4, _local_5) <= this._floorHeight) + if(this.getHeight(_local_4, _local_5) <= this._floorHeight) { _local_8 = (_local_4 - 1); _local_9 = _local_5; @@ -215,7 +215,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry _arg_3 = LegacyWallGeometry.L; break; } - if (this.getHeight(_local_4, (_local_5 + 1)) <= this._floorHeight) + if(this.getHeight(_local_4, (_local_5 + 1)) <= this._floorHeight) { _local_8 = _local_4; _local_9 = _local_5; @@ -232,7 +232,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry _local_13 = (_local_13 + ((((-(_arg_2) * 18) / 32) * this.scale) / 2)); _local_12 = this.getHeight(_local_8, _local_9); _local_11 = (((_local_12 * this.scale) / 2) + _local_13); - if (_arg_3 == LegacyWallGeometry.R) + if(_arg_3 == LegacyWallGeometry.R) { _local_11 = (_local_11 + ((_local_6 * this.scale) / 4)); } @@ -245,7 +245,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public getOldLocation(k: IVector3D, _arg_2: number): [number, number, number, number, string] { - if (k == null) + if(k == null) { return null; } @@ -255,7 +255,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry let _local_6 = 0; let _local_7 = ''; let _local_8 = 0; - if (_arg_2 == 90) + if(_arg_2 == 90) { _local_3 = Math.floor((k.x - 0.5)); _local_4 = Math.floor((k.y + 0.5)); @@ -266,7 +266,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry } else { - if (_arg_2 == 180) + if(_arg_2 == 180) { _local_3 = Math.floor((k.x + 0.5)); _local_4 = Math.floor((k.y - 0.5)); @@ -286,7 +286,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public getOldLocationString(k: IVector3D, _arg_2: number): string { const _local_3 = this.getOldLocation(k, _arg_2); - if (_local_3 == null) + if(_local_3 == null) { return null; } @@ -301,7 +301,7 @@ export class LegacyWallGeometry implements ILegacyWallGeometry public getDirection(k: string): number { - if (k == LegacyWallGeometry.R) + if(k == LegacyWallGeometry.R) { return 180; } diff --git a/src/nitro/room/utils/RoomCamera.ts b/src/nitro/room/utils/RoomCamera.ts index b8d80fd7..0ead8274 100644 --- a/src/nitro/room/utils/RoomCamera.ts +++ b/src/nitro/room/utils/RoomCamera.ts @@ -132,7 +132,7 @@ export class RoomCamera public set scale(k: number) { - if (this._scale != k) + if(this._scale != k) { this._scale = k; this._scaleChanged = true; @@ -171,7 +171,7 @@ export class RoomCamera public get isMoving(): boolean { - if (((!(this._targetLoc == null)) && (!(this._currentLoc == null)))) + if(((!(this._targetLoc == null)) && (!(this._currentLoc == null)))) { return true; } @@ -181,11 +181,11 @@ export class RoomCamera public set target(k: IVector3D) { let _local_2: Vector3d; - if (this._targetLoc == null) + if(this._targetLoc == null) { this._targetLoc = new Vector3d(); } - if ((((!(this._targetLoc.x == k.x)) || (!(this._targetLoc.y == k.y))) || (!(this._targetLoc.z == k.z)))) + if((((!(this._targetLoc.x == k.x)) || (!(this._targetLoc.y == k.y))) || (!(this._targetLoc.z == k.z)))) { this._targetLoc.assign(k); _local_2 = Vector3d.dif(this._targetLoc, this._currentLoc); @@ -202,7 +202,7 @@ export class RoomCamera public initializeLocation(k: IVector3D): void { - if (this._currentLoc != null) + if(this._currentLoc != null) { return; } @@ -212,7 +212,7 @@ export class RoomCamera public resetLocation(k: IVector3D): void { - if (this._currentLoc == null) + if(this._currentLoc == null) { this._currentLoc = new Vector3d(); } @@ -226,9 +226,9 @@ export class RoomCamera let _local_5: number; let _local_6: number; let _local_7: number; - if ((((this._followDuration > 0) && (!(this._targetLoc == null))) && (!(this._currentLoc == null)))) + if((((this._followDuration > 0) && (!(this._targetLoc == null))) && (!(this._currentLoc == null)))) { - if (this._scaleChanged) + if(this._scaleChanged) { this._scaleChanged = false; this._currentLoc = this._targetLoc; @@ -236,11 +236,11 @@ export class RoomCamera return; } _local_3 = Vector3d.dif(this._targetLoc, this._currentLoc); - if (_local_3.length > this._moveDistance) + if(_local_3.length > this._moveDistance) { this._moveDistance = _local_3.length; } - if (_local_3.length <= _arg_2) + if(_local_3.length <= _arg_2) { this._currentLoc = this._targetLoc; this._targetLoc = null; @@ -252,12 +252,12 @@ export class RoomCamera _local_5 = (_arg_2 * 0.5); _local_6 = (this._moveDistance / RoomCamera.MOVE_SPEED_DENOMINATOR); _local_7 = (_local_5 + ((_local_6 - _local_5) * _local_4)); - if (this._maintainPreviousMoveSpeed) + if(this._maintainPreviousMoveSpeed) { - if (_local_7 < this._previousMoveSpeed) + if(_local_7 < this._previousMoveSpeed) { _local_7 = this._previousMoveSpeed; - if (_local_7 > _local_3.length) + if(_local_7 > _local_3.length) { _local_7 = _local_3.length; } diff --git a/src/nitro/room/utils/RoomInstanceData.ts b/src/nitro/room/utils/RoomInstanceData.ts index 974d1f0c..5d7aa42b 100644 --- a/src/nitro/room/utils/RoomInstanceData.ts +++ b/src/nitro/room/utils/RoomInstanceData.ts @@ -49,7 +49,7 @@ export class RoomInstanceData public setSelectedObject(data: ISelectedRoomObjectData): void { - if (this._selectedObject) + if(this._selectedObject) { this._selectedObject.dispose(); } @@ -59,7 +59,7 @@ export class RoomInstanceData public setPlacedObject(data: ISelectedRoomObjectData): void { - if (this._placedObject) + if(this._placedObject) { this._placedObject.dispose(); } @@ -69,13 +69,13 @@ export class RoomInstanceData public setFurnitureStackingHeightMap(heightMap: IFurnitureStackingHeightMap): void { - if (this._furnitureStackingHeightMap) this._furnitureStackingHeightMap.dispose(); + if(this._furnitureStackingHeightMap) this._furnitureStackingHeightMap.dispose(); this._furnitureStackingHeightMap = heightMap; - if (this._tileObjectMap) this._tileObjectMap.dispose(); + if(this._tileObjectMap) this._tileObjectMap.dispose(); - if (this._furnitureStackingHeightMap) + if(this._furnitureStackingHeightMap) { this._tileObjectMap = new TileObjectMap(this._furnitureStackingHeightMap.width, this._furnitureStackingHeightMap.height); } @@ -83,7 +83,7 @@ export class RoomInstanceData public addPendingFurnitureFloor(data: RoomFurnitureData): void { - if (!data) return; + if(!data) return; this._floorStack.delete(data.id); this._floorStack.set(data.id, data); @@ -93,7 +93,7 @@ export class RoomInstanceData { const existing = this._floorStack.get(id); - if (!existing) return null; + if(!existing) return null; this._floorStack.delete(id); @@ -104,7 +104,7 @@ export class RoomInstanceData { const existing = this._floorStack.get(id); - if (!existing) return null; + if(!existing) return null; this._floorStack.delete(id); @@ -113,7 +113,7 @@ export class RoomInstanceData public getNextPendingFurnitureFloor(): RoomFurnitureData { - if (!this._floorStack.size) return null; + if(!this._floorStack.size) return null; const keys = this._floorStack.keys(); @@ -122,7 +122,7 @@ export class RoomInstanceData public addPendingFurnitureWall(data: RoomFurnitureData): void { - if (!data) return; + if(!data) return; this._wallStack.delete(data.id); this._wallStack.set(data.id, data); @@ -132,7 +132,7 @@ export class RoomInstanceData { const existing = this._wallStack.get(id); - if (!existing) return null; + if(!existing) return null; this._wallStack.delete(id); @@ -143,7 +143,7 @@ export class RoomInstanceData { const existing = this._wallStack.get(id); - if (!existing) return null; + if(!existing) return null; this._wallStack.delete(id); @@ -152,7 +152,7 @@ export class RoomInstanceData public getNextPendingFurnitureWall(): RoomFurnitureData { - if (!this._wallStack.size) return null; + if(!this._wallStack.size) return null; const keys = this._wallStack.keys(); @@ -163,7 +163,7 @@ export class RoomInstanceData { const _local_2 = this._mouseButtonCursorOwners.indexOf(k); - if (_local_2 === -1) + if(_local_2 === -1) { this._mouseButtonCursorOwners.push(k); @@ -177,7 +177,7 @@ export class RoomInstanceData { const _local_2 = this._mouseButtonCursorOwners.indexOf(k); - if (_local_2 > -1) + if(_local_2 > -1) { this._mouseButtonCursorOwners.splice(_local_2, 1); diff --git a/src/nitro/room/utils/SpriteDataCollector.ts b/src/nitro/room/utils/SpriteDataCollector.ts index 1c668649..bb844b8a 100644 --- a/src/nitro/room/utils/SpriteDataCollector.ts +++ b/src/nitro/room/utils/SpriteDataCollector.ts @@ -19,21 +19,21 @@ export class SpriteDataCollector { const datas: RoomObjectSpriteData[] = []; - for (const data of k) + for(const data of k) { - if (!data) continue; + if(!data) continue; - if ((data.type === 'boutique_mannequin1') && (data.name.indexOf('mannequin_') === 0)) + if((data.type === 'boutique_mannequin1') && (data.name.indexOf('mannequin_') === 0)) { const roomObject = _arg_2.getRoomObject(_arg_2.activeRoomId, data.objectId, RoomObjectCategory.FLOOR); - if (roomObject) + if(roomObject) { const spriteList = (roomObject.visualization as IRoomObjectSpriteVisualization).getSpriteList(); - if (spriteList) + if(spriteList) { - for (const sprite of spriteList) + for(const sprite of spriteList) { sprite.x = (sprite.x + ((data.x + (data.width / 2)) + SpriteDataCollector.MANNEQUIN_MAGIC_X_OFFSET)); sprite.y = (sprite.y + ((data.y + data.height) + SpriteDataCollector.MANNEQUIN_MAGIC_Y_OFFSET)); @@ -54,9 +54,9 @@ export class SpriteDataCollector private static sortSpriteDataObjects(k: RoomObjectSpriteData, _arg_2: RoomObjectSpriteData): number { - if (k.z < _arg_2.z) return 1; + if(k.z < _arg_2.z) return 1; - if (k.z > _arg_2.z) return -1; + if(k.z > _arg_2.z) return -1; return -1; } @@ -73,19 +73,19 @@ export class SpriteDataCollector { const points: Point[] = []; - if (k.x == _arg_2.x) + if(k.x == _arg_2.x) { points.push(k, _arg_3, _arg_2, _arg_4); } else { - if (k.x == _arg_3.x) + if(k.x == _arg_3.x) { points.push(k, _arg_2, _arg_3, _arg_4); } else { - if ((((_arg_2.x < k.x) && (_arg_2.y > k.y)) || ((_arg_2.x > k.x) && (_arg_2.y < k.y)))) + if((((_arg_2.x < k.x) && (_arg_2.y > k.y)) || ((_arg_2.x > k.x) && (_arg_2.y < k.y)))) { points.push(k, _arg_3, _arg_2, _arg_4); } @@ -96,7 +96,7 @@ export class SpriteDataCollector } } - if (points[0].x < points[1].x) + if(points[0].x < points[1].x) { let _local_6 = points[0]; @@ -109,7 +109,7 @@ export class SpriteDataCollector points[3] = _local_6; } - if (points[0].y < points[2].y) + if(points[0].y < points[2].y) { let _local_6 = points[0]; @@ -133,20 +133,20 @@ export class SpriteDataCollector const _local_7 = _arg_3.getRoomObjects(_arg_3.activeRoomId, RoomObjectCategory.UNIT); - for (const _local_8 of _local_7) + for(const _local_8 of _local_7) { - if (_local_8.id !== _arg_4) + if(_local_8.id !== _arg_4) { const _local_11 = (_local_8.visualization as IRoomObjectSpriteVisualization).getSpriteList(); - if (_local_11) + if(_local_11) { let _local_12 = 0; let _local_13 = 0; - for (const _local_14 of _local_6) + for(const _local_14 of _local_6) { - if (_local_14.name === ('avatar_' + _local_8.id)) + if(_local_14.name === ('avatar_' + _local_8.id)) { _local_12 = _local_14.z; _local_13 = ((_local_14.y + _local_14.height) - (_arg_2.geometry.scale / 4)); @@ -157,17 +157,17 @@ export class SpriteDataCollector const _local_15 = _arg_3.getRoomObjectScreenLocation(_arg_3.activeRoomId, _local_8.id, RoomObjectCategory.UNIT, _arg_2.id); - if (_local_15) + if(_local_15) { - if (_local_13 === 0) _local_13 = _local_15.y; + if(_local_13 === 0) _local_13 = _local_15.y; - for (const _local_16 of _local_11) + for(const _local_16 of _local_11) { _local_16.x = (_local_16.x + (_local_15.x - _arg_2.screenOffsetX)); _local_16.y = (_local_16.y + _local_13); _local_16.z = (_local_16.z + _local_12); - if (((_local_16.name.indexOf('h_std_fx29_') === 0) || (_local_16.name.indexOf('h_std_fx185_') === 0))) + if(((_local_16.name.indexOf('h_std_fx29_') === 0) || (_local_16.name.indexOf('h_std_fx185_') === 0))) { _local_16.y = (_local_16.y + SpriteDataCollector.AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET); } @@ -182,13 +182,13 @@ export class SpriteDataCollector _local_6 = SpriteDataCollector.addMannequinSprites(_local_6, _arg_3); _local_6.sort(SpriteDataCollector.sortSpriteDataObjects); - for (const _local_9 of _local_6) + for(const _local_9 of _local_6) { - if ((((((!(_local_9.name === null)) && (_local_9.name.length > 0)) && (!(_local_9.name.indexOf('tile_cursor_') === 0))) && (SpriteDataCollector.isSpriteInViewPort(_local_9, k, _arg_2))) && ((_arg_4 < 0) || (!(_local_9.objectId == _arg_4))))) + if((((((!(_local_9.name === null)) && (_local_9.name.length > 0)) && (!(_local_9.name.indexOf('tile_cursor_') === 0))) && (SpriteDataCollector.isSpriteInViewPort(_local_9, k, _arg_2))) && ((_arg_4 < 0) || (!(_local_9.objectId == _arg_4))))) { _local_5.push(this.getSpriteDataObject(_local_9, k, _arg_2, _arg_3)); - if (!this.maxZ) this.maxZ = _local_9.z; + if(!this.maxZ) this.maxZ = _local_9.z; this.spriteCount++; } @@ -225,7 +225,7 @@ export class SpriteDataCollector let _local_6 = k.name; - if (k.name.indexOf('@') !== -1) + if(k.name.indexOf('@') !== -1) { _local_9 = k.name.split('@'); _local_6 = _local_9[0]; @@ -264,29 +264,29 @@ export class SpriteDataCollector _local_5.y = (_local_5.y + _arg_3.screenOffsetY); _local_5.z = k.z; - if (k.alpha && (k.alpha.toString() !== '255')) _local_5.alpha = k.alpha; + if(k.alpha && (k.alpha.toString() !== '255')) _local_5.alpha = k.alpha; - if (k.flipH) _local_5.flipH = k.flipH; + if(k.flipH) _local_5.flipH = k.flipH; - if (k.skew) _local_5.skew = k.skew; + if(k.skew) _local_5.skew = k.skew; - if (k.frame) _local_5.frame = k.frame; + if(k.frame) _local_5.frame = k.frame; - if (k.color && (k.color.length > 0)) _local_5.color = parseInt(k.color); + if(k.color && (k.color.length > 0)) _local_5.color = parseInt(k.color); - if (k.blendMode && (k.blendMode !== 'normal')) _local_5.blendMode = k.blendMode; + if(k.blendMode && (k.blendMode !== 'normal')) _local_5.blendMode = k.blendMode; - if (_local_6.indexOf('http') === 0) + if(_local_6.indexOf('http') === 0) { _local_5.width = k.width; _local_5.height = k.height; this.externalImageCount++; - if (this.externalImageCount > SpriteDataCollector.MAX_EXTERNAL_IMAGE_COUNT) _local_5.name = 'box'; + if(this.externalImageCount > SpriteDataCollector.MAX_EXTERNAL_IMAGE_COUNT) _local_5.name = 'box'; } - if (k.posture) _local_5.posture = k.posture; + if(k.posture) _local_5.posture = k.posture; return _local_5; } @@ -301,11 +301,11 @@ export class SpriteDataCollector let _local_9 = 0; - if (_arg_3.length > 0) + if(_arg_3.length > 0) { _local_9 = _arg_3[0].z; - if (this.maxZ) _local_9 = Math.max(this.maxZ, _local_9); + if(this.maxZ) _local_9 = Math.max(this.maxZ, _local_9); } else { @@ -328,12 +328,12 @@ export class SpriteDataCollector let _local_5 = 1; - if (this.maxZ) + if(this.maxZ) { _local_5 = (_local_5 + this.maxZ); } - for (const _local_6 of k) + for(const _local_6 of k) { const _local_10 = { plane: _local_6, @@ -354,15 +354,15 @@ export class SpriteDataCollector let _local_8: { plane: IRoomPlane, z: number }[] = []; - for (const sprite of sprites) + for(const sprite of sprites) { const objectSprite = sprite.sprite; - if (objectSprite) + if(objectSprite) { const _local_10 = _local_4.get(objectSprite.id); - if (_local_10) + if(_local_10) { _local_4.delete(objectSprite.id); @@ -385,13 +385,13 @@ export class SpriteDataCollector const roomObject = _arg_3.getRoomObject(_arg_3.activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); const visualization = (roomObject.visualization as unknown as IPlaneVisualization); - if (visualization) + if(visualization) { const _local_8 = _arg_2.geometry; const _local_9 = this.sortRoomPlanes(visualization.planes, _arg_2, _arg_3); const _local_10 = PixiApplicationProxy.instance.stage; - for (const _local_11 of _local_9) + for(const _local_11 of _local_9) { const _local_12 = _local_11.plane; const _local_13: Point[] = []; @@ -407,7 +407,7 @@ export class SpriteDataCollector let _local_19 = 0; let _local_20 = 0; - for (const _local_21 of _local_13) + for(const _local_21 of _local_13) { _local_21.x += (_local_10.width / 2); _local_21.y += (_local_10.height / 2); @@ -418,16 +418,16 @@ export class SpriteDataCollector _local_21.x += -(k.x); _local_21.y += -(k.y); - if (_local_21.x < 0) _local_19--; + if(_local_21.x < 0) _local_19--; - else if (_local_21.x >= k.width) _local_19++; + else if(_local_21.x >= k.width) _local_19++; - if (_local_21.y < 0) _local_20--; + if(_local_21.y < 0) _local_20--; - else if (_local_21.y >= k.height) _local_20++; + else if(_local_21.y >= k.height) _local_20++; } - if (((Math.abs(_local_19) === 4) || (Math.abs(_local_20) === 4))) + if(((Math.abs(_local_19) === 4) || (Math.abs(_local_20) === 4))) { // } @@ -435,7 +435,7 @@ export class SpriteDataCollector { const _local_22 = SpriteDataCollector.sortQuadPoints(_local_15, _local_16, _local_17, _local_18); - for (const _local_23 of _local_12.getDrawingDatas(_local_8)) + for(const _local_23 of _local_12.getDrawingDatas(_local_8)) { _local_23.cornerPoints = _local_22; _local_23.z = _local_11.z; diff --git a/src/nitro/room/utils/TileObjectMap.ts b/src/nitro/room/utils/TileObjectMap.ts index 2afa9b07..4a7f2a7e 100644 --- a/src/nitro/room/utils/TileObjectMap.ts +++ b/src/nitro/room/utils/TileObjectMap.ts @@ -13,7 +13,7 @@ export class TileObjectMap implements ITileObjectMap let index = 0; - while (index < _arg_2) + while(index < _arg_2) { this._tileObjectMap.set(index, new Map()); @@ -26,9 +26,9 @@ export class TileObjectMap implements ITileObjectMap public clear(): void { - for (const k of this._tileObjectMap.values()) + for(const k of this._tileObjectMap.values()) { - if (!k) continue; + if(!k) continue; k.clear(); } @@ -40,7 +40,7 @@ export class TileObjectMap implements ITileObjectMap { this.clear(); - for (const _local_2 of k) this.addRoomObject(_local_2); + for(const _local_2 of k) this.addRoomObject(_local_2); } public dispose(): void @@ -52,11 +52,11 @@ export class TileObjectMap implements ITileObjectMap public getObjectIntTile(k: number, _arg_2: number): IRoomObject { - if ((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) + if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) { const existing = this._tileObjectMap.get(_arg_2); - if (existing) return existing.get(k); + if(existing) return existing.get(k); } return null; @@ -64,51 +64,51 @@ export class TileObjectMap implements ITileObjectMap public setObjectInTile(k: number, _arg_2: number, _arg_3: IRoomObject): void { - if (!_arg_3.isReady) + if(!_arg_3.isReady) { NitroLogger.log('Assigning non initialized object to tile object map!'); return; } - if ((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) + if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) { const existing = this._tileObjectMap.get(_arg_2); - if (existing) existing.set(k, _arg_3); + if(existing) existing.set(k, _arg_3); } } public addRoomObject(k: IRoomObject): void { - if (!k || !k.model || !k.isReady) return; + if(!k || !k.model || !k.isReady) return; const location = k.getLocation(); const direction = k.getDirection(); - if (!location || !direction) return; + if(!location || !direction) return; let sizeX = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); let sizeY = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); - if (sizeX < 1) sizeX = 1; - if (sizeY < 1) sizeY = 1; + if(sizeX < 1) sizeX = 1; + if(sizeY < 1) sizeY = 1; const directionNumber = ((Math.trunc((direction.x + 45)) % 360) / 90); - if ((directionNumber === 1) || (directionNumber === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + if((directionNumber === 1) || (directionNumber === 3)) [sizeX, sizeY] = [sizeY, sizeX]; let y = location.y; - while (y < (location.y + sizeY)) + while(y < (location.y + sizeY)) { let x = location.x; - while (x < (location.x + sizeX)) + while(x < (location.x + sizeX)) { const roomObject = this.getObjectIntTile(x, y); - if ((!(roomObject)) || ((!(roomObject === k)) && (roomObject.getLocation().z <= location.z))) + if((!(roomObject)) || ((!(roomObject === k)) && (roomObject.getLocation().z <= location.z))) { this.setObjectInTile(x, y, k); } diff --git a/src/nitro/session/GroupInformationManager.ts b/src/nitro/session/GroupInformationManager.ts index 8ac06a2f..6dbb2490 100644 --- a/src/nitro/session/GroupInformationManager.ts +++ b/src/nitro/session/GroupInformationManager.ts @@ -17,24 +17,24 @@ export class GroupInformationManager implements IDisposable, IGroupInformationMa public init(): void { - if (this._sessionDataManager && this._sessionDataManager.communication) + if(this._sessionDataManager && this._sessionDataManager.communication) { this._messages = [ new RoomReadyMessageEvent(this.onRoomReadyMessageEvent.bind(this)), new HabboGroupBadgesMessageEvent(this.onGroupBadgesEvent.bind(this)) ]; - for (const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); } } public dispose(): void { - if (this.disposed) return; + if(this.disposed) return; - if (this._messages && this._messages.length) + if(this._messages && this._messages.length) { - for (const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); this._messages = null; } @@ -52,7 +52,7 @@ export class GroupInformationManager implements IDisposable, IGroupInformationMa { const parser = event.getParser(); - for (const [groupId, badgeId] of parser.badges.entries()) this._groupBadges.set(groupId, badgeId); + for(const [groupId, badgeId] of parser.badges.entries()) this._groupBadges.set(groupId, badgeId); } public getGroupBadge(groupId: number): string diff --git a/src/nitro/session/IgnoredUsersManager.ts b/src/nitro/session/IgnoredUsersManager.ts index 65aa8f66..2dfcffe7 100644 --- a/src/nitro/session/IgnoredUsersManager.ts +++ b/src/nitro/session/IgnoredUsersManager.ts @@ -17,24 +17,24 @@ export class IgnoredUsersManager implements IDisposable, IIgnoredUsersManager public init(): void { - if (this._sessionDataManager && this._sessionDataManager.communication) + if(this._sessionDataManager && this._sessionDataManager.communication) { this._messages = [ new IgnoredUsersEvent(this.onIgnoredUsersEvent.bind(this)), new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this)) ]; - for (const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); } } public dispose(): void { - if (this.disposed) return; + if(this.disposed) return; - if (this._messages && this._messages.length) + if(this._messages && this._messages.length) { - for (const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); this._messages = null; } @@ -49,26 +49,26 @@ export class IgnoredUsersManager implements IDisposable, IIgnoredUsersManager private onIgnoredUsersEvent(event: IgnoredUsersEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._ignoredUsers = parser.ignoredUsers; } private onIgnoreResultEvent(event: IgnoreResultEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const name = parser.name; - switch (parser.result) + switch(parser.result) { case 0: return; @@ -87,14 +87,14 @@ export class IgnoredUsersManager implements IDisposable, IIgnoredUsersManager private addUserToIgnoreList(name: string): void { - if (this._ignoredUsers.indexOf(name) < 0) this._ignoredUsers.push(name); + if(this._ignoredUsers.indexOf(name) < 0) this._ignoredUsers.push(name); } private removeUserFromIgnoreList(name: string): void { const index = this._ignoredUsers.indexOf(name); - if (index >= 0) this._ignoredUsers.splice(index, 1); + if(index >= 0) this._ignoredUsers.splice(index, 1); } public ignoreUserId(id: number): void diff --git a/src/nitro/session/RoomSession.ts b/src/nitro/session/RoomSession.ts index 2bbf44c0..71b95bca 100644 --- a/src/nitro/session/RoomSession.ts +++ b/src/nitro/session/RoomSession.ts @@ -48,7 +48,7 @@ export class RoomSession extends Disposable implements IRoomSession protected onDispose(): void { - if (this._userData) + if(this._userData) { this._userData.dispose(); @@ -60,16 +60,16 @@ export class RoomSession extends Disposable implements IRoomSession public setConnection(connection: IConnection): void { - if (this._connection || !connection) return; + if(this._connection || !connection) return; this._connection = connection; - if (this._userData) this._userData.setConnection(connection); + if(this._userData) this._userData.setConnection(connection); } public setControllerLevel(level: number): void { - if ((level >= RoomControllerLevel.NONE) && (level <= RoomControllerLevel.MODERATOR)) + if((level >= RoomControllerLevel.NONE) && (level <= RoomControllerLevel.MODERATOR)) { this._controllerLevel = level; @@ -91,7 +91,7 @@ export class RoomSession extends Disposable implements IRoomSession public start(): boolean { - if (this._state !== RoomSessionEvent.CREATED || !this._connection) return false; + if(this._state !== RoomSessionEvent.CREATED || !this._connection) return false; this._state = RoomSessionEvent.STARTED; @@ -100,7 +100,7 @@ export class RoomSession extends Disposable implements IRoomSession private enterRoom(): boolean { - if (!this._connection) return false; + if(!this._connection) return false; this._connection.send(new RoomEnterComposer(this._roomId, this._password)); @@ -109,7 +109,7 @@ export class RoomSession extends Disposable implements IRoomSession public reset(roomId: number): void { - if (roomId === this._roomId) return; + if(roomId === this._roomId) return; this._roomId = roomId; } @@ -131,7 +131,7 @@ export class RoomSession extends Disposable implements IRoomSession public sendChatTypingMessage(isTyping: boolean): void { - if (isTyping) this._connection.send(new RoomUnitTypingStartComposer()); + if(isTyping) this._connection.send(new RoomUnitTypingStartComposer()); else this._connection.send(new RoomUnitTypingStopComposer()); } @@ -152,7 +152,7 @@ export class RoomSession extends Disposable implements IRoomSession public sendSignMessage(sign: number): void { - if ((sign < 0) || (sign > 17)) return; + if((sign < 0) || (sign > 17)) return; this._connection.send(new RoomUnitSignComposer(sign)); } @@ -227,21 +227,21 @@ export class RoomSession extends Disposable implements IRoomSession public pickupPet(id: number): void { - if (!this._connection) return; + if(!this._connection) return; this._connection.send(new PetRemoveComposer(id)); } public pickupBot(id: number): void { - if (!this._connection) return; + if(!this._connection) return; this._connection.send(new BotRemoveComposer(id)); } public requestMoodlightSettings(): void { - if (!this._connection) return; + if(!this._connection) return; this._connection.send(new MoodlightSettingsComposer()); } diff --git a/src/nitro/session/RoomSessionManager.ts b/src/nitro/session/RoomSessionManager.ts index 473d7b1c..b141b1a7 100644 --- a/src/nitro/session/RoomSessionManager.ts +++ b/src/nitro/session/RoomSessionManager.ts @@ -54,7 +54,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana { const connection = this._communication && this._communication.connection; - if (!connection) return; + if(!connection) return; this._handlers.push( new RoomChatHandler(connection, this), @@ -72,11 +72,11 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana private setHandlers(session: IRoomSession): void { - if (!this._handlers || !this._handlers.length) return; + if(!this._handlers || !this._handlers.length) return; - for (const handler of this._handlers) + for(const handler of this._handlers) { - if (!handler) continue; + if(!handler) continue; handler.setRoomId(session.roomId); } @@ -89,7 +89,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana private processPendingSession(): void { - if (!this._pendingSession || !this._roomEngine.ready) return; + if(!this._pendingSession || !this._roomEngine.ready) return; this.addSession(this._pendingSession); @@ -100,7 +100,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana { const existing = this._sessions.get(this.getRoomId(id)); - if (!existing) return null; + if(!existing) return null; return existing; } @@ -117,7 +117,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana private addSession(roomSession: IRoomSession): boolean { - if (!this._roomEngine.ready) + if(!this._roomEngine.ready) { this._pendingSession = roomSession; @@ -126,7 +126,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana this._sessionStarting = true; - if (this._sessions.get(this.getRoomId(roomSession.roomId))) + if(this._sessions.get(this.getRoomId(roomSession.roomId))) { this.removeSession(roomSession.roomId, false); } @@ -146,11 +146,11 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana public startSession(session: IRoomSession): boolean { - if (session.state === RoomSessionEvent.STARTED) return false; + if(session.state === RoomSessionEvent.STARTED) return false; this._sessionStarting = false; - if (!session.start()) + if(!session.start()) { this.removeSession(session.roomId); @@ -168,7 +168,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana { const session = this.getSession(id); - if (!session) return; + if(!session) return; this._sessions.delete(this.getRoomId(id)); @@ -181,9 +181,9 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana { const session = this.getSession(id); - if (!session) return; + if(!session) return; - switch (type) + switch(type) { case RoomSessionHandler.RS_CONNECTED: return; @@ -199,7 +199,7 @@ export class RoomSessionManager extends NitroManager implements IRoomSessionMana { const existing = this.getSession(fromRoomId); - if (!existing) return; + if(!existing) return; this._sessions.delete(this.getRoomId(fromRoomId)); diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index bc252bdb..82a98a35 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -121,14 +121,14 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { this.destroyFurnitureData(); - if (this._ignoredUsersManager) + if(this._ignoredUsersManager) { this._ignoredUsersManager.dispose(); this._ignoredUsersManager = null; } - if (this._groupInformationManager) + if(this._groupInformationManager) { this._groupInformationManager.dispose(); @@ -174,7 +174,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private loadBadgeImageManager(): void { - if (this._badgeImageManager) return; + if(this._badgeImageManager) return; this._badgeImageManager = new BadgeImageManager(Nitro.instance.core.asset, this); this._badgeImageManager.init(); @@ -182,34 +182,34 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public hasProductData(listener: IProductDataListener): boolean { - if (this._productsReady) return true; + if(this._productsReady) return true; - if (listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); + if(listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); return false; } public getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] { - if (!this._furnitureReady) + if(!this._furnitureReady) { - if (this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); + if(this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); return null; } const furnitureData: IFurnitureData[] = []; - for (const data of this._floorItems.values()) + for(const data of this._floorItems.values()) { - if (!data) continue; + if(!data) continue; furnitureData.push(data); } - for (const data of this._wallItems.values()) + for(const data of this._wallItems.values()) { - if (!data) continue; + if(!data) continue; furnitureData.push(data); } @@ -219,18 +219,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public removePendingFurniDataListener(listener: IFurnitureDataListener): void { - if (!this._pendingFurnitureListeners) return; + if(!this._pendingFurnitureListeners) return; const index = this._pendingFurnitureListeners.indexOf(listener); - if (index === -1) return; + if(index === -1) return; this._pendingFurnitureListeners.splice(index, 1); } private onUserFigureEvent(event: FigureUpdateEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; this._figure = event.getParser().figure; this._gender = event.getParser().gender; @@ -240,13 +240,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserInfoEvent(event: UserInfoEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; this.resetUserInfo(); const userInfo = event.getParser().userInfo; - if (!userInfo) return; + if(!userInfo) return; this._userId = userInfo.userId; this._name = userInfo.username; @@ -263,7 +263,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserPermissionsEvent(event: UserPermissionsEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; this._clubLevel = event.getParser().clubLevel; this._securityLevel = event.getParser().securityLevel; @@ -272,11 +272,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this._systemOpen = parser.isOpen; this._systemShutdown = parser.onShutdown; @@ -285,13 +285,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; - if (parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; + if(parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; this._canChangeName = false; @@ -300,13 +300,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void { - if (!event || !event.connection) return; + if(!event || !event.connection) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; - if (parser.webId !== this.userId) return; + if(parser.webId !== this.userId) return; this._name = parser.newName; this._canChangeName = false; @@ -316,11 +316,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private onRoomModelNameEvent(event: RoomReadyMessageEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; HabboWebTools.roomVisited(parser.roomId); } @@ -331,13 +331,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._furnitureReady = true; - if (!this._furnitureListenersNotified) + if(!this._furnitureListenersNotified) { this._furnitureListenersNotified = true; - if (this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) + if(this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) { - for (const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); + for(const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); } } @@ -350,29 +350,29 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._productsReady = true; - for (const listener of this._pendingProductListeners) listener && listener.loadProductData(); + for(const listener of this._pendingProductListeners) listener && listener.loadProductData(); this._pendingProductListeners = []; } private onInClientLinkEvent(event: InClientLinkEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; Nitro.instance.createLinkEvent(parser.link); } private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); } @@ -381,7 +381,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { this._noobnessLevel = event.getParser().noobnessLevel; - if (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) + if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) { Nitro.instance.core.configuration.setValue('new.identity', 1); } @@ -397,7 +397,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private destroyFurnitureData(): void { - if (!this._furnitureData) return; + if(!this._furnitureData) return; this._furnitureData.dispose(); @@ -406,7 +406,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana private destroyProductData(): void { - if (!this._productData) return; + if(!this._productData) return; this._productData.dispose(); @@ -417,18 +417,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { const existing = this._floorItems.get(id); - if (!existing) return null; + if(!existing) return null; return existing; } public getFloorItemDataByName(name: string): IFurnitureData { - if (!name || !this._floorItems || !this._floorItems.size) return null; + if(!name || !this._floorItems || !this._floorItems.size) return null; - for (const item of this._floorItems.values()) + for(const item of this._floorItems.values()) { - if (!item || (item.className !== name)) continue; + if(!item || (item.className !== name)) continue; return item; } @@ -438,18 +438,18 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { const existing = this._wallItems.get(id); - if (!existing) return null; + if(!existing) return null; return existing; } public getWallItemDataByName(name: string): IFurnitureData { - if (!name || !this._wallItems || !this._wallItems.size) return null; + if(!name || !this._wallItems || !this._wallItems.size) return null; - for (const item of this._wallItems.values()) + for(const item of this._wallItems.values()) { - if (!item || (item.className !== name)) continue; + if(!item || (item.className !== name)) continue; return item; } @@ -457,7 +457,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public getProductData(type: string): IProductData { - if (!this._productsReady) this.loadProductData(); + if(!this._productsReady) this.loadProductData(); return this._products.get(type); } @@ -499,7 +499,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public giveRespect(userId: number): void { - if ((userId < 0) || (this._respectsLeft <= 0)) return; + if((userId < 0) || (this._respectsLeft <= 0)) return; this.send(new UserRespectComposer(userId)); @@ -508,7 +508,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana public givePetRespect(petId: number): void { - if ((petId < 0) || (this._respectsPetLeft <= 0)) return; + if((petId < 0) || (this._respectsPetLeft <= 0)) return; this.send(new PetRespectComposer(petId)); diff --git a/src/nitro/session/UserDataManager.ts b/src/nitro/session/UserDataManager.ts index f8f76993..1e5843bb 100644 --- a/src/nitro/session/UserDataManager.ts +++ b/src/nitro/session/UserDataManager.ts @@ -60,11 +60,11 @@ export class UserDataManager extends Disposable { const existing = this._userDataByType.get(type); - if (!existing) return null; + if(!existing) return null; const userData = existing.get(webID); - if (!userData) return null; + if(!userData) return null; return userData; } @@ -73,16 +73,16 @@ export class UserDataManager extends Disposable { const existing = this._userDataByRoomIndex.get(roomIndex); - if (!existing) return null; + if(!existing) return null; return existing; } public getUserDataByName(name: string): IRoomUserData { - for (const userData of this._userDataByRoomIndex.values()) + for(const userData of this._userDataByRoomIndex.values()) { - if (!userData || (userData.name !== name)) continue; + if(!userData || (userData.name !== name)) continue; return userData; } @@ -92,13 +92,13 @@ export class UserDataManager extends Disposable public updateUserData(data: IRoomUserData): void { - if (!data) return; + if(!data) return; this.removeUserData(data.roomIndex); let existingType = this._userDataByType.get(data.type); - if (!existingType) + if(!existingType) { existingType = new Map(); @@ -114,25 +114,25 @@ export class UserDataManager extends Disposable { const existing = this.getUserDataByIndex(roomIndex); - if (!existing) return; + if(!existing) return; this._userDataByRoomIndex.delete(roomIndex); const existingType = this._userDataByType.get(existing.type); - if (existingType) existingType.delete(existing.webID); + if(existingType) existingType.delete(existing.webID); } public getUserBadges(userId: number): string[] { - if (this._connection) + if(this._connection) { this._connection.send(new UserCurrentBadgesComposer(userId)); } const badges = this._userBadges.get(userId); - if (!badges) return []; + if(!badges) return []; return badges; } @@ -146,7 +146,7 @@ export class UserDataManager extends Disposable { const userData = this.getUserDataByIndex(roomIndex); - if (!userData) return; + if(!userData) return; userData.figure = figure; userData.sex = sex; @@ -158,7 +158,7 @@ export class UserDataManager extends Disposable { const userData = this.getUserDataByIndex(roomIndex); - if (!userData) return; + if(!userData) return; userData.name = name; } @@ -167,7 +167,7 @@ export class UserDataManager extends Disposable { const userData = this.getUserDataByIndex(roomIndex); - if (!userData) return; + if(!userData) return; userData.custom = custom; } @@ -176,7 +176,7 @@ export class UserDataManager extends Disposable { const userData = this.getUserDataByIndex(roomIndex); - if (!userData) return; + if(!userData) return; userData.activityPoints = score; } @@ -185,14 +185,14 @@ export class UserDataManager extends Disposable { const userData = this.getUserDataByIndex(roomIndex); - if (userData) userData.petLevel = level; + if(userData) userData.petLevel = level; } public updatePetBreedingStatus(roomIndex: number, canBreed: boolean, canHarvest: boolean, canRevive: boolean, hasBreedingPermission: boolean): void { const userData = this.getUserDataByIndex(roomIndex); - if (!userData) return; + if(!userData) return; userData.canBreed = canBreed; userData.canHarvest = canHarvest; @@ -202,11 +202,11 @@ export class UserDataManager extends Disposable public requestPetInfo(id: number): void { - if (!this._connection) return; + if(!this._connection) return; const petData = this.getPetData(id); - if (!petData) return; + if(!petData) return; this._connection.send(new RequestPetInfoComposer(id)); } diff --git a/src/nitro/session/badge/BadgeImageManager.ts b/src/nitro/session/badge/BadgeImageManager.ts index 1da27a3f..b2d965c3 100644 --- a/src/nitro/session/badge/BadgeImageManager.ts +++ b/src/nitro/session/badge/BadgeImageManager.ts @@ -44,21 +44,21 @@ export class BadgeImageManager implements IDisposable public init(): void { - if (this._sessionDataManager && this._sessionDataManager.communication) + if(this._sessionDataManager && this._sessionDataManager.communication) { this._messages = [ new GroupBadgePartsEvent(this.onGroupBadgePartsEvent.bind(this)) ]; - for (const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); } } public dispose(): void { - if (this._messages && this._messages.length) + if(this._messages && this._messages.length) { - for (const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); this._messages = null; } @@ -70,7 +70,7 @@ export class BadgeImageManager implements IDisposable { let badge = this.getBadgeTexture(badgeName, type); - if (!badge && load) badge = this.getBadgePlaceholder(); + if(!badge && load) badge = this.getBadgePlaceholder(); return badge; } @@ -84,7 +84,7 @@ export class BadgeImageManager implements IDisposable public loadBadgeImage(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE): string { - if (this._assets.getTexture(this.getBadgeUrl(badgeName, type))) return badgeName; + if(this._assets.getTexture(this.getBadgeUrl(badgeName, type))) return badgeName; this.getBadgeTexture(badgeName, type); @@ -95,38 +95,38 @@ export class BadgeImageManager implements IDisposable { const url = this.getBadgeUrl(badgeName, type); - if (!url || !url.length) return null; + if(!url || !url.length) return null; const existing = this._assets.getTexture(url); - if (existing) return existing.clone(); + if(existing) return existing.clone(); - if (type === BadgeImageManager.NORMAL_BADGE) + if(type === BadgeImageManager.NORMAL_BADGE) { - if (this._requestedBadges.get(badgeName)) return null; + if(this._requestedBadges.get(badgeName)) return null; this._requestedBadges.set(badgeName, true); this._assets.downloadAsset(url, (flag: boolean) => { - if (flag) + if(flag) { this._requestedBadges.delete(badgeName); const texture = this._assets.getTexture(url); - if (texture && this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone())); + if(texture && this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone())); } }); } - else if (type === BadgeImageManager.GROUP_BADGE) + else if(type === BadgeImageManager.GROUP_BADGE) { - if (this._groupBadgesQueue.get(badgeName)) return; + if(this._groupBadgesQueue.get(badgeName)) return; this._groupBadgesQueue.set(badgeName, true); - if (this._readyToGenerateGroupBadges) this.loadGroupBadge(badgeName); + if(this._readyToGenerateGroupBadges) this.loadGroupBadge(badgeName); } return null; @@ -137,7 +137,7 @@ export class BadgeImageManager implements IDisposable const url = (Nitro.instance.getConfiguration('images.url') + '/loading_icon.png'); const existing = this._assets.getTexture(url); - if (!existing) return null; + if(!existing) return null; return existing.clone(); } @@ -146,7 +146,7 @@ export class BadgeImageManager implements IDisposable { let url = null; - switch (type) + switch(type) { case BadgeImageManager.NORMAL_BADGE: url = (Nitro.instance.getConfiguration('badge.asset.url')).replace('%badgename%', badge); @@ -164,7 +164,7 @@ export class BadgeImageManager implements IDisposable const groupBadge = new GroupBadge(badgeCode); const partMatches = [...badgeCode.matchAll(/[b|s][0-9]{4,6}/g)]; - for (const partMatch of partMatches) + for(const partMatch of partMatches) { const partCode = partMatch[0]; const shortMethod = (partCode.length === 6); @@ -190,28 +190,28 @@ export class BadgeImageManager implements IDisposable container.addChild(tempSprite); - for (const part of groupBadge.parts) + for(const part of groupBadge.parts) { let isFirst = true; const partNames = ((part.type === 'b') ? this._groupBases.get(part.key) : this._groupSymbols.get(part.key)); - if (partNames) + if(partNames) { - for (const partName of partNames) + for(const partName of partNames) { - if (!partName || !partName.length) continue; + if(!partName || !partName.length) continue; const texture = this._assets.getTexture(`badgepart_${partName}`); - if (!texture) continue; + if(!texture) continue; const { x, y } = part.calculatePosition(texture); const sprite = new NitroSprite(texture); sprite.position.set(x, y); - if (isFirst) sprite.tint = parseInt(this._groupPartColors.get(part.color), 16); + if(isFirst) sprite.tint = parseInt(this._groupPartColors.get(part.color), 16); isFirst = false; @@ -226,16 +226,16 @@ 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) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(groupBadge.code, texture)); } private onGroupBadgePartsEvent(event: GroupBadgePartsEvent): void { - if (!event) return; + if(!event) return; const data = event.getParser(); - if (!data) return; + if(!data) return; data.bases.forEach((names, id) => this._groupBases.set(id, names.map(val => val.replace('.png', '').replace('.gif', '')))); @@ -244,7 +244,7 @@ export class BadgeImageManager implements IDisposable this._groupPartColors = data.partColors; this._readyToGenerateGroupBadges = true; - for (const badgeCode of this._groupBadgesQueue.keys()) this.loadGroupBadge(badgeCode); + for(const badgeCode of this._groupBadgesQueue.keys()) this.loadGroupBadge(badgeCode); } public get disposed(): boolean diff --git a/src/nitro/session/badge/GroupBadgePart.ts b/src/nitro/session/badge/GroupBadgePart.ts index 0bf12af7..4e676517 100644 --- a/src/nitro/session/badge/GroupBadgePart.ts +++ b/src/nitro/session/badge/GroupBadgePart.ts @@ -27,7 +27,7 @@ export class GroupBadgePart public get code(): string { - if (this.key === 0) return null; + if(this.key === 0) return null; return GroupBadgePart.getCode(this.type, this.key, this.color, this.position); } @@ -44,13 +44,13 @@ export class GroupBadgePart let x: number = (((GroupBadgePart.CELL_WIDTH * gridPos.x) + (GroupBadgePart.CELL_WIDTH / 2)) - (asset.width / 2)); let y: number = (((GroupBadgePart.CELL_HEIGHT * gridPos.y) + (GroupBadgePart.CELL_HEIGHT / 2)) - (asset.height / 2)); - if (x < 0) x = 0; + if(x < 0) x = 0; - if ((x + asset.width) > GroupBadgePart.IMAGE_WIDTH) x = (GroupBadgePart.IMAGE_WIDTH - asset.width); + if((x + asset.width) > GroupBadgePart.IMAGE_WIDTH) x = (GroupBadgePart.IMAGE_WIDTH - asset.width); - if (y < 0) y = 0; + if(y < 0) y = 0; - if ((y + asset.height) > GroupBadgePart.IMAGE_HEIGHT) y = (GroupBadgePart.IMAGE_HEIGHT - asset.height); + if((y + asset.height) > GroupBadgePart.IMAGE_HEIGHT) y = (GroupBadgePart.IMAGE_HEIGHT - asset.height); return new NitroPoint(Math.floor(x), Math.floor(y)); } diff --git a/src/nitro/session/events/RoomSessionDimmerPresetsEvent.ts b/src/nitro/session/events/RoomSessionDimmerPresetsEvent.ts index fc91bfd3..0136aeb6 100644 --- a/src/nitro/session/events/RoomSessionDimmerPresetsEvent.ts +++ b/src/nitro/session/events/RoomSessionDimmerPresetsEvent.ts @@ -23,7 +23,7 @@ export class RoomSessionDimmerPresetsEvent extends RoomSessionEvent public getPreset(id: number): RoomSessionDimmerPresetsEventPresetItem { - if ((id < 0) || (id >= this._presets.length)) return null; + if((id < 0) || (id >= this._presets.length)) return null; return this._presets[id]; } diff --git a/src/nitro/session/events/RoomSessionVoteEvent.ts b/src/nitro/session/events/RoomSessionVoteEvent.ts index 478bb276..c7135474 100644 --- a/src/nitro/session/events/RoomSessionVoteEvent.ts +++ b/src/nitro/session/events/RoomSessionVoteEvent.ts @@ -21,7 +21,7 @@ export class RoomSessionVoteEvent extends RoomSessionEvent this._question = _arg_3; this._choices = _arg_4; this._SafeStr_7651 = _arg_5; - if (this._SafeStr_7651 == null) + if(this._SafeStr_7651 == null) { this._SafeStr_7651 = []; } diff --git a/src/nitro/session/furniture/FurnitureDataLoader.ts b/src/nitro/session/furniture/FurnitureDataLoader.ts index 1cfa1a52..5837c435 100644 --- a/src/nitro/session/furniture/FurnitureDataLoader.ts +++ b/src/nitro/session/furniture/FurnitureDataLoader.ts @@ -24,7 +24,7 @@ export class FurnitureDataLoader extends EventDispatcher public loadFurnitureData(url: string): void { - if (!url) return; + if(!url) return; fetch(url) .then(response => response.json()) @@ -34,20 +34,20 @@ export class FurnitureDataLoader extends EventDispatcher private onFurnitureDataLoaded(data: { [index: string]: any }): void { - if (!data) return; + if(!data) return; - if ((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) this._nitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.'); + if((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) this._nitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.'); - if (data.roomitemtypes) this.parseFloorItems(data.roomitemtypes); + if(data.roomitemtypes) this.parseFloorItems(data.roomitemtypes); - if (data.wallitemtypes) this.parseWallItems(data.wallitemtypes); + if(data.wallitemtypes) this.parseWallItems(data.wallitemtypes); this.dispatchEvent(new NitroEvent(FurnitureDataLoader.FURNITURE_DATA_READY)); } private onFurnitureDataError(error: Error): void { - if (!error) return; + if(!error) return; console.error(error); @@ -56,21 +56,21 @@ export class FurnitureDataLoader extends EventDispatcher private parseFloorItems(data: any): void { - if (!data || !data.furnitype) return; + if(!data || !data.furnitype) return; - for (const furniture of data.furnitype) + for(const furniture of data.furnitype) { - if (!furniture) continue; + if(!furniture) continue; const colors: number[] = []; - if (furniture.partcolors) + if(furniture.partcolors) { - for (const color of furniture.partcolors.color) + for(const color of furniture.partcolors.color) { let colorCode = (color as string); - if (colorCode.charAt(0) === '#') + if(colorCode.charAt(0) === '#') { colorCode = colorCode.replace('#', ''); @@ -98,11 +98,11 @@ export class FurnitureDataLoader extends EventDispatcher private parseWallItems(data: any): void { - if (!data || !data.furnitype) return; + if(!data || !data.furnitype) return; - for (const furniture of data.furnitype) + for(const furniture of data.furnitype) { - if (!furniture) continue; + if(!furniture) continue; const furnitureData = new FurnitureData(FurnitureType.WALL, furniture.id, furniture.classname, furniture.classname, furniture.category, furniture.name, furniture.description, furniture.revision, 0, 0, 0, null, false, 0, furniture.adurl, furniture.offerid, furniture.buyout, furniture.rentofferid, furniture.rentbuyout, furniture.bc, null, furniture.specialtype, false, false, false, furniture.excludeddynamic, furniture.furniline, furniture.environment, furniture.rare); @@ -114,9 +114,9 @@ export class FurnitureDataLoader extends EventDispatcher private updateLocalizations(furniture: FurnitureData): void { - if (!this._localization) return; + if(!this._localization) return; - switch (furniture.type) + switch(furniture.type) { case FurnitureType.FLOOR: this._localization.setValue(('roomItem.name.' + furniture.id), furniture.name); diff --git a/src/nitro/session/handler/GenericErrorHandler.ts b/src/nitro/session/handler/GenericErrorHandler.ts index aa4c6d83..1f3310ae 100644 --- a/src/nitro/session/handler/GenericErrorHandler.ts +++ b/src/nitro/session/handler/GenericErrorHandler.ts @@ -14,19 +14,19 @@ export class GenericErrorHandler extends BaseHandler private onRoomGenericError(event: GenericErrorEvent): void { - if (!(event instanceof GenericErrorEvent)) return; + if(!(event instanceof GenericErrorEvent)) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const roomSession = this.listener.getSession(this.roomId); - if (!roomSession) return; + if(!roomSession) return; let type: string = null; - switch (parser.errorCode) + switch(parser.errorCode) { case GenericErrorEnum.KICKED_OUT_OF_ROOM: type = RoomSessionErrorMessageEvent.RSEME_KICKED; @@ -35,7 +35,7 @@ export class GenericErrorHandler extends BaseHandler return; } - if (!type || type.length == 0) return; + if(!type || type.length == 0) return; this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, roomSession)); } diff --git a/src/nitro/session/handler/PollHandler.ts b/src/nitro/session/handler/PollHandler.ts index 8ecff7f7..0501b418 100644 --- a/src/nitro/session/handler/PollHandler.ts +++ b/src/nitro/session/handler/PollHandler.ts @@ -16,15 +16,15 @@ export class PollHandler extends BaseHandler private onPollContentsEvent(event: PollContentsEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.CONTENT, session, parser.id); @@ -39,15 +39,15 @@ export class PollHandler extends BaseHandler private onPollOfferEvent(event: PollOfferEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.OFFER, session, parser.id); @@ -59,15 +59,15 @@ export class PollHandler extends BaseHandler private onPollErrorEvent(event: PollErrorEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.ERROR, session, -1); pollEvent.headline = '???'; diff --git a/src/nitro/session/handler/RoomChatHandler.ts b/src/nitro/session/handler/RoomChatHandler.ts index 0cca74b0..091543a5 100644 --- a/src/nitro/session/handler/RoomChatHandler.ts +++ b/src/nitro/session/handler/RoomChatHandler.ts @@ -23,20 +23,20 @@ export class RoomChatHandler extends BaseHandler private onRoomUnitChatEvent(event: RoomUnitChatEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; let chatType: number = RoomSessionChatEvent.CHAT_TYPE_SPEAK; - if (event instanceof RoomUnitChatShoutEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_SHOUT; - else if (event instanceof RoomUnitChatWhisperEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_WHISPER; + if(event instanceof RoomUnitChatShoutEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_SHOUT; + else if(event instanceof RoomUnitChatWhisperEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_WHISPER; const chatEvent = new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.roomIndex, parser.message, chatType, parser.bubble); @@ -45,86 +45,86 @@ export class RoomChatHandler extends BaseHandler private onRoomUnitHandItemReceivedEvent(event: RoomUnitHandItemReceivedEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + 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)); } private onRespectReceivedEvent(event: RespectReceivedEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const userData = session.userDataManager.getUserData(parser.userId); - if (!userData) return; + if(!userData) return; this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, userData.roomIndex, '', RoomSessionChatEvent.CHAT_TYPE_RESPECT, SystemChatStyleEnum.GENERIC)); } private onPetRespectNoficationEvent(event: PetRespectNoficationEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const petData = session.userDataManager.getPetData(parser.petData.id); - if (!petData) return; + if(!petData) return; let chatType = RoomSessionChatEvent.CHAT_TYPE_PETRESPECT; - if (parser.isTreat) chatType = RoomSessionChatEvent.CHAT_TYPE_PETTREAT; + if(parser.isTreat) chatType = RoomSessionChatEvent.CHAT_TYPE_PETTREAT; this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC)); } private onPetSupplementedNotificationEvent(event: PetSupplementedNotificationEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const petData = session.userDataManager.getPetData(parser.petId); - if (!petData) return; + if(!petData) return; let userRoomIndex = -1; const userData = session.userDataManager.getUserData(parser.userId); - if (userData) userRoomIndex = userData.roomIndex; + if(userData) userRoomIndex = userData.roomIndex; let chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE; - switch (parser.supplementType) + switch(parser.supplementType) { case PetSupplementTypeEnum.REVIVE: chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE; @@ -142,15 +142,15 @@ export class RoomChatHandler extends BaseHandler private onFloodControlEvent(event: FloodControlEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const seconds = parser.seconds; @@ -159,15 +159,15 @@ export class RoomChatHandler extends BaseHandler private onRemainingMuteEvent(event: RemainingMuteEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + 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)); } diff --git a/src/nitro/session/handler/RoomDataHandler.ts b/src/nitro/session/handler/RoomDataHandler.ts index 34d4a4c2..9543ef6e 100644 --- a/src/nitro/session/handler/RoomDataHandler.ts +++ b/src/nitro/session/handler/RoomDataHandler.ts @@ -14,17 +14,17 @@ export class RoomDataHandler extends BaseHandler private onGetGuestRoomResultEvent(event: GetGuestRoomResultEvent): void { - if (!(event instanceof GetGuestRoomResultEvent)) return; + if(!(event instanceof GetGuestRoomResultEvent)) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; - if (parser.roomForward) return; + if(parser.roomForward) return; const roomSession = this.listener.getSession(this.roomId); - if (!roomSession) return; + if(!roomSession) return; const roomData = parser.data; diff --git a/src/nitro/session/handler/RoomDimmerPresetsHandler.ts b/src/nitro/session/handler/RoomDimmerPresetsHandler.ts index 4a9c28b7..58bde132 100644 --- a/src/nitro/session/handler/RoomDimmerPresetsHandler.ts +++ b/src/nitro/session/handler/RoomDimmerPresetsHandler.ts @@ -14,15 +14,15 @@ export class RoomDimmerPresetsHandler extends BaseHandler private onRoomDimmerPresets(event: RoomDimmerPresetsEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const presetEvent = new RoomSessionDimmerPresetsEvent(RoomSessionDimmerPresetsEvent.ROOM_DIMMER_PRESETS, session); @@ -30,11 +30,11 @@ export class RoomDimmerPresetsHandler extends BaseHandler let i = 0; - while (i < parser.presetCount) + while(i < parser.presetCount) { const preset = parser.getPreset(i); - if (preset) presetEvent.storePreset(preset.id, preset.type, preset.color, preset.brightness); + if(preset) presetEvent.storePreset(preset.id, preset.type, preset.color, preset.brightness); i++; } diff --git a/src/nitro/session/handler/RoomPermissionsHandler.ts b/src/nitro/session/handler/RoomPermissionsHandler.ts index 99f7aa09..bafbd8f5 100644 --- a/src/nitro/session/handler/RoomPermissionsHandler.ts +++ b/src/nitro/session/handler/RoomPermissionsHandler.ts @@ -15,33 +15,33 @@ export class RoomPermissionsHandler extends BaseHandler private onRoomRightsEvent(event: RoomRightsEvent): void { - if (!(event instanceof RoomRightsEvent)) return; + if(!(event instanceof RoomRightsEvent)) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.setControllerLevel(event.getParser().controllerLevel); } private onRoomRightsClearEvent(event: RoomRightsClearEvent): void { - if (!(event instanceof RoomRightsClearEvent)) return; + if(!(event instanceof RoomRightsClearEvent)) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.setControllerLevel(RoomControllerLevel.NONE); } private onRoomRightsOwnerEvent(event: RoomRightsOwnerEvent): void { - if (!(event instanceof RoomRightsOwnerEvent)) return; + if(!(event instanceof RoomRightsOwnerEvent)) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.setRoomOwner(); } diff --git a/src/nitro/session/handler/RoomPresentHandler.ts b/src/nitro/session/handler/RoomPresentHandler.ts index 5762dbce..e7ae7f5a 100644 --- a/src/nitro/session/handler/RoomPresentHandler.ts +++ b/src/nitro/session/handler/RoomPresentHandler.ts @@ -9,24 +9,24 @@ export class RoomPresentHandler extends BaseHandler { super(connection, listener); - if (!connection) return; + if(!connection) return; connection.addMessageEvent(new PresentOpenedMessageEvent(this.onFurnitureGiftOpenedEvent.bind(this))); } private onFurnitureGiftOpenedEvent(event: PresentOpenedMessageEvent): void { - if (!event) return; + if(!event) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; - if (this.listener && this.listener.events) this.listener.events.dispatchEvent( + 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)); diff --git a/src/nitro/session/handler/RoomSessionHandler.ts b/src/nitro/session/handler/RoomSessionHandler.ts index f7874f14..c7fd76a4 100644 --- a/src/nitro/session/handler/RoomSessionHandler.ts +++ b/src/nitro/session/handler/RoomSessionHandler.ts @@ -24,19 +24,19 @@ export class RoomSessionHandler extends BaseHandler private onRoomEnterEvent(event: RoomEnterEvent): void { - if (!(event instanceof RoomEnterEvent)) return; + if(!(event instanceof RoomEnterEvent)) return; - if (this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_CONNECTED); + if(this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_CONNECTED); } private onRoomReadyMessageEvent(event: RoomReadyMessageEvent): void { - if (!(event instanceof RoomReadyMessageEvent)) return; + if(!(event instanceof RoomReadyMessageEvent)) return; const fromRoomId = this.roomId; const toRoomId = event.getParser().roomId; - if (this.listener) + if(this.listener) { this.listener.sessionReinitialize(fromRoomId, toRoomId); this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_READY); @@ -45,32 +45,32 @@ export class RoomSessionHandler extends BaseHandler private onDesktopViewEvent(event: DesktopViewEvent): void { - if (!(event instanceof DesktopViewEvent)) return; + if(!(event instanceof DesktopViewEvent)) return; - if (this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_DISCONNECTED); + if(this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_DISCONNECTED); } private onRoomDoorbellAcceptedEvent(event: RoomDoorbellAcceptedEvent): void { - if (!(event instanceof RoomDoorbellAcceptedEvent) || !this.listener) return; + if(!(event instanceof RoomDoorbellAcceptedEvent) || !this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const username = parser.userName; - if (!username || !username.length) + if(!username || !username.length) { this.connection.send(new GoToFlatMessageComposer(this.roomId)); } else { - if (this.listener.events) + if(this.listener.events) { const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, session, username)); } @@ -79,25 +79,25 @@ export class RoomSessionHandler extends BaseHandler private onRoomDoorbellRejectedEvent(event: FlatAccessDeniedMessageEvent): void { - if (!(event instanceof FlatAccessDeniedMessageEvent) || !this.listener) return; + if(!(event instanceof FlatAccessDeniedMessageEvent) || !this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const username = parser.userName; - if (!username || !username.length) + if(!username || !username.length) { this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_DISCONNECTED); } else { - if (this.listener.events) + if(this.listener.events) { const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, session, username)); } @@ -106,11 +106,11 @@ export class RoomSessionHandler extends BaseHandler private onYouAreSpectatorMessageEvent(event: YouAreSpectatorMessageEvent): void { - if (this.listener) + if(this.listener) { const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.isSpectator = true; this.listener.events.dispatchEvent(new RoomSessionSpectatorModeEvent(RoomSessionSpectatorModeEvent.SPECTATOR_MODE, session)); diff --git a/src/nitro/session/handler/RoomUsersHandler.ts b/src/nitro/session/handler/RoomUsersHandler.ts index 6b54e19b..c5a9ff62 100644 --- a/src/nitro/session/handler/RoomUsersHandler.ts +++ b/src/nitro/session/handler/RoomUsersHandler.ts @@ -29,21 +29,21 @@ export class RoomUsersHandler extends BaseHandler private onRoomUnitEvent(event: RoomUnitEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const users = event.getParser().users; const usersToAdd: IRoomUserData[] = []; - if (users && users.length) + if(users && users.length) { - for (const user of users) + for(const user of users) { - if (!user) continue; + if(!user) continue; const userData = new RoomUserData(user.roomIndex); @@ -70,7 +70,7 @@ export class RoomUsersHandler extends BaseHandler userData.botSkills = user.botSkills; userData.isModerator = user.isModerator; - if (!session.userDataManager.getUserData(user.roomIndex)) usersToAdd.push(userData); + if(!session.userDataManager.getUserData(user.roomIndex)) usersToAdd.push(userData); session.userDataManager.updateUserData(userData); } @@ -81,15 +81,15 @@ export class RoomUsersHandler extends BaseHandler private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; session.userDataManager.updateFigure(parser.unitId, parser.figure, parser.gender, false, false); session.userDataManager.updateMotto(parser.unitId, parser.motto); @@ -101,41 +101,41 @@ export class RoomUsersHandler extends BaseHandler private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.userDataManager.removeUserData(event.getParser().unitId); } private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; this.listener.events.dispatchEvent(new RoomSessionDanceEvent(session, parser.unitId, parser.danceId)); } private onUserCurrentBadgesEvent(event: UserCurrentBadgesEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.userDataManager.setUserBadges(parser.userId, parser.badges); @@ -144,49 +144,49 @@ export class RoomUsersHandler extends BaseHandler private onRoomDoorbellEvent(event: DoorbellMessageEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const username = parser.userName; - if (!username || !username.length) return; + if(!username || !username.length) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.DOORBELL, session, username)); } private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.userDataManager.updateName(parser.id, parser.newName); } private onNewFriendRequestEvent(event: NewFriendRequestEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const request = parser.request; @@ -195,15 +195,15 @@ export class RoomUsersHandler extends BaseHandler private onPetInfoEvent(event: PetInfoEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const petData = new RoomPetData(); @@ -239,15 +239,15 @@ export class RoomUsersHandler extends BaseHandler private onPetStatusUpdateEvent(event: PetStatusUpdateEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; session.userDataManager.updatePetBreedingStatus(parser.roomIndex, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission); @@ -256,15 +256,15 @@ export class RoomUsersHandler extends BaseHandler private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const figure = parser.figureData.figuredata; @@ -275,21 +275,21 @@ export class RoomUsersHandler extends BaseHandler private onPetPlacingError(event: PetPlacingErrorEvent): void { - if (!event) return; + if(!event) return; - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; let type: string = null; - switch (parser.errorCode) + switch(parser.errorCode) { case 0: type = RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL; @@ -311,28 +311,28 @@ export class RoomUsersHandler extends BaseHandler break; } - if (!type || type.length == 0) return; + if(!type || type.length == 0) return; this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); } private onBotError(event: BotErrorEvent): void { - if (!event) return; + if(!event) return; - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; let type: string = null; - switch (parser.errorCode) + switch(parser.errorCode) { case 0: type = RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL; @@ -351,23 +351,23 @@ export class RoomUsersHandler extends BaseHandler break; } - if (!type || type.length == 0) return; + if(!type || type.length == 0) return; this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); } private onFavoriteMembershipUpdateMessageEvent(event: FavoriteMembershipUpdateMessageEvent): void { - if (!this.listener) return; + if(!this.listener) return; const parser = event.getParser(); const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const userData = session.userDataManager.getUserDataByIndex(parser.roomIndex); - if (!userData) return; + if(!userData) return; userData.groupId = parser.groupId; userData.groupName = parser.groupName; diff --git a/src/nitro/session/handler/WordQuizHandler.ts b/src/nitro/session/handler/WordQuizHandler.ts index b66dac7d..9bcacd3e 100644 --- a/src/nitro/session/handler/WordQuizHandler.ts +++ b/src/nitro/session/handler/WordQuizHandler.ts @@ -16,15 +16,15 @@ export class WordQuizHandler extends BaseHandler private onQuestionEvent(event: QuestionEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.QUESTION, session, parser.pollId); @@ -39,15 +39,15 @@ export class WordQuizHandler extends BaseHandler private onQuestionAnsweredEvent(event: QuestionAnsweredEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.ANSWERED, session, parser.userId); @@ -60,15 +60,15 @@ export class WordQuizHandler extends BaseHandler private onQuestionFinishedEvent(event: QuestionFinishedEvent): void { - if (!this.listener) return; + if(!this.listener) return; const session = this.listener.getSession(this.roomId); - if (!session) return; + if(!session) return; const parser = event.getParser(); - if (!parser) return; + if(!parser) return; const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.FINISHED, session); quizEvent.questionId = parser.questionId; diff --git a/src/nitro/session/product/ProductDataLoader.ts b/src/nitro/session/product/ProductDataLoader.ts index c78d97f4..d0cd07f8 100644 --- a/src/nitro/session/product/ProductDataLoader.ts +++ b/src/nitro/session/product/ProductDataLoader.ts @@ -23,7 +23,7 @@ export class ProductDataLoader extends EventDispatcher public loadProductData(url: string): void { - if (!url) return; + if(!url) return; fetch(url) .then(response => response.json()) @@ -33,7 +33,7 @@ export class ProductDataLoader extends EventDispatcher private onProductDataLoadedEvent(data: { [index: string]: any }): void { - if (!data) return; + if(!data) return; this.parseProducts(data.productdata); @@ -42,15 +42,15 @@ export class ProductDataLoader extends EventDispatcher private onProductDataError(error: Error): void { - if (!error) return; + if(!error) return; this.dispatchEvent(new NitroEvent(ProductDataLoader.PDP_PRODUCT_DATA_FAILED)); } private parseProducts(data: { [index: string]: any }): void { - if (!data) return; + if(!data) return; - for (const product of data.product) (product && this._products.set(product.code, new ProductData(product.code, product.name, product.description))); + for(const product of data.product) (product && this._products.set(product.code, new ProductData(product.code, product.name, product.description))); } } diff --git a/src/nitro/sound/SoundManager.ts b/src/nitro/sound/SoundManager.ts index 51902ec3..4c46a460 100644 --- a/src/nitro/sound/SoundManager.ts +++ b/src/nitro/sound/SoundManager.ts @@ -48,7 +48,7 @@ export class SoundManager extends NitroManager implements ISoundManager public onDispose(): void { - if (this._musicManager) + if(this._musicManager) { this._musicManager.dispose(); this._musicManager = null; @@ -63,7 +63,7 @@ export class SoundManager extends NitroManager implements ISoundManager private onEvent(event: NitroEvent) { - switch (event.type) + switch(event.type) { case RoomEngineSamplePlaybackEvent.PLAY_SAMPLE: { const castedEvent = (event as RoomEngineSamplePlaybackEvent); @@ -93,7 +93,7 @@ export class SoundManager extends NitroManager implements ISoundManager this._volumeFurni = (castedEvent.volumeFurni / 100); this._volumeTrax = (castedEvent.volumeTrax / 100); - if (volumeFurniUpdated) this.updateFurniSamplesVolume(this._volumeFurni); + if(volumeFurniUpdated) this.updateFurniSamplesVolume(this._volumeFurni); return; } case NitroSoundEvent.PLAY_SOUND: { @@ -124,7 +124,7 @@ export class SoundManager extends NitroManager implements ISoundManager { let sample = this._internalSamples.getValue(code); - if (!sample) + if(!sample) { const sampleUrl = Nitro.instance.getConfiguration('sounds.url'); @@ -139,7 +139,7 @@ export class SoundManager extends NitroManager implements ISoundManager { let sample = this._furniSamples.getValue(code); - if (!sample) + if(!sample) { const sampleUrl = Nitro.instance.getConfiguration('external.samples.url'); @@ -147,7 +147,7 @@ export class SoundManager extends NitroManager implements ISoundManager this._furniSamples.add(code, sample); } - if (!this._furnitureBeingPlayed.hasKey(objectId)) this._furnitureBeingPlayed.add(objectId, code); + if(!this._furnitureBeingPlayed.hasKey(objectId)) this._furnitureBeingPlayed.add(objectId, code); sample.onended = (event) => { @@ -171,7 +171,7 @@ export class SoundManager extends NitroManager implements ISoundManager { const sample = this._internalSamples.getValue(code); - if (!sample) return; + if(!sample) return; try { @@ -187,13 +187,13 @@ export class SoundManager extends NitroManager implements ISoundManager { const furnitureBeingPlayed = this._furnitureBeingPlayed.getValue(objectId); - if (!furnitureBeingPlayed) return; + if(!furnitureBeingPlayed) return; const sample = this._furniSamples.getValue(furnitureBeingPlayed); this._furnitureBeingPlayed.remove(objectId); - if (!sample) return; + if(!sample) return; try { diff --git a/src/nitro/sound/common/TraxSample.ts b/src/nitro/sound/common/TraxSample.ts index b6dad30f..a093d8d4 100644 --- a/src/nitro/sound/common/TraxSample.ts +++ b/src/nitro/sound/common/TraxSample.ts @@ -29,7 +29,7 @@ export class TraxSample let local5 = 65536; - switch (sampleFrequency) + switch(sampleFrequency) { case TraxSample.SAMPLE_FREQUENCY_22KHZ: this._sampleRepeats = 2; @@ -41,7 +41,7 @@ export class TraxSample this._sampleRepeats = 1; } - if (sampleScale === TraxSample.SAMPLE_SCALE_8BIT) + if(sampleScale === TraxSample.SAMPLE_SCALE_8BIT) { this._samplesPerValue = 4; local5 = 0x0100; @@ -63,12 +63,12 @@ export class TraxSample let local12: number; let local15: number; - for (let i = 0; i < local10; i++) + for(let i = 0; i < local10; i++) { local12 = reader.readFloat(); reader.readFloat(); - for (let j = 2; j <= this._sampleRepeats; j++) + for(let j = 2; j <= this._sampleRepeats; j++) { local15 = reader.readFloat(); reader.readFloat(); @@ -76,22 +76,22 @@ export class TraxSample local12 = (((j * (j - 1)) / j) + (local15 / j)); } - if (i >= ((local10 - 1) - TraxSample._Str_14308)) local12 = (local12 * (((local10 - 1) - 1) / TraxSample._Str_14308)); + if(i >= ((local10 - 1) - TraxSample._Str_14308)) local12 = (local12 * (((local10 - 1) - 1) / TraxSample._Str_14308)); let local14 = ((local12 + 1) / local8); - if (local14 < 0) + if(local14 < 0) { local14 = 0; } - else if (local14 >= local5) + else if(local14 >= local5) { local14 = local5 - 1; } local9 = (local9 * local5) + local14; - if ((i % this._samplesPerValue) === this._samplesPerValue - 1) + if((i % this._samplesPerValue) === this._samplesPerValue - 1) { this._sampleData[Math.trunc(i / this._samplesPerValue)] = local9; } @@ -104,31 +104,31 @@ export class TraxSample let local9: number; let local10: number; - if (k === null || this._sampleData === null) return arg4; + if(k === null || this._sampleData === null) return arg4; const local5 = this._samplesPerValue * this._sampleRepeats; arg4 = arg4 / local5; - if (arg2 < 0) arg3 = arg3 + arg2; + if(arg2 < 0) arg3 = arg3 + arg2; - if (arg3 > k.length - arg2) arg3 = k.length - arg2; + if(arg3 > k.length - arg2) arg3 = k.length - arg2; let local6 = arg3 / local5; let local7: number; - if (local6 > this._sampleData.length - arg4) + if(local6 > this._sampleData.length - arg4) { local7 = (local6 - this._sampleData.length - arg4) * local5; local6 = this._sampleData.length - arg4; - if (local7 > (k.length - arg2)) local7 = k.length - arg2; + if(local7 > (k.length - arg2)) local7 = k.length - arg2; } - if (this._sampleRepeats === 1) + if(this._sampleRepeats === 1) { - if (this._samplesPerValue === 2) + if(this._samplesPerValue === 2) { - while (local6-- > 0) + while(local6-- > 0) { local8 = this._sampleData[arg4++]; @@ -136,9 +136,9 @@ export class TraxSample k[arg2++] = ((local8 & TraxSample.MASK_16BIT) - TraxSample.OFFSET_16BIT); } } - else if (this._samplesPerValue === 4) + else if(this._samplesPerValue === 4) { - while (local6-- > 0) + while(local6-- > 0) { local8 = this._sampleData[arg4++]; @@ -149,20 +149,20 @@ export class TraxSample } } } - else if (this._sampleRepeats >= 2) + else if(this._sampleRepeats >= 2) { local9 = 0; local10 = 0; - if (this._samplesPerValue === 2) + if(this._samplesPerValue === 2) { - while (local6-- > 0) + while(local6-- > 0) { local8 = this._sampleData[arg4++]; local10 = (((local8 >> 16) & TraxSample.MASK_16BIT) - TraxSample.OFFSET_16BIT); local9 = this._sampleRepeats; - while (local9 > 0) + while(local9 > 0) // eslint-disable-next-line no-empty { diff --git a/src/nitro/sound/music/MusicManager.ts b/src/nitro/sound/music/MusicManager.ts index ecbf48c0..de19160f 100644 --- a/src/nitro/sound/music/MusicManager.ts +++ b/src/nitro/sound/music/MusicManager.ts @@ -57,7 +57,7 @@ export class MusicManager extends NitroManager implements IMusicManager public onDispose(): void { - if (this._timerInstance) + if(this._timerInstance) { clearInterval(this._timerInstance); this._timerInstance = null; @@ -84,14 +84,14 @@ export class MusicManager extends NitroManager implements IMusicManager { const parser = event.getParser(); - for (const song of parser.songs) + for(const song of parser.songs) { const songAvailable: boolean = (this._availableSongs.get(song.id) !== null); const areSamplesRequested: boolean = (this._requestedSongs.get(song.id) !== null); - if (!songAvailable) + if(!songAvailable) { - if (areSamplesRequested) + if(areSamplesRequested) { //LoadTraxSong } @@ -113,7 +113,7 @@ export class MusicManager extends NitroManager implements IMusicManager this._isPlaying = (parser.currentSongId !== -1); - if (parser.currentSongId >= 0) + if(parser.currentSongId >= 0) { this.playSong(parser.currentSongId, MusicPriorities.PRIORITY_ROOM_PLAYLIST, (parser.syncCount / 1000), 0, 1, 1); } @@ -122,7 +122,7 @@ export class MusicManager extends NitroManager implements IMusicManager this.stopPlaying(); } - if (parser.nextSongId >= 0) this.requestSong(parser.nextSongId, true); + if(parser.nextSongId >= 0) this.requestSong(parser.nextSongId, true); this._playPosition = parser.currentPosition; //Dispatch local event NowPlayingEvent @@ -130,7 +130,7 @@ export class MusicManager extends NitroManager implements IMusicManager private onTick(): void { - if (this._songRequestList.length === 0) return; + if(this._songRequestList.length === 0) return; Nitro.instance.communication.connection.send(new GetSongInfoMessageComposer(...this._songRequestList)); this._songRequestList = []; @@ -138,7 +138,7 @@ export class MusicManager extends NitroManager implements IMusicManager private requestSong(songId: number, arg2: boolean): void { - if (this._requestedSongs.get(songId) === null) + if(this._requestedSongs.get(songId) === null) { this._requestedSongs.set(songId, arg2); this._songRequestList.push(songId); @@ -164,9 +164,9 @@ export class MusicManager extends NitroManager implements IMusicManager private getSongIdRequestedAtPriority(priorityIndex: number): number { - if (priorityIndex < 0 || priorityIndex >= MusicPriorities.PRIORITY_COUNT) return -1; + if(priorityIndex < 0 || priorityIndex >= MusicPriorities.PRIORITY_COUNT) return -1; - if (!this._songRequestsPerPriority[priorityIndex]) return -1; + if(!this._songRequestsPerPriority[priorityIndex]) return -1; return this._songRequestsPerPriority[priorityIndex].songId; } diff --git a/src/nitro/utils/HabboWebTools.ts b/src/nitro/utils/HabboWebTools.ts index 699f80ff..a352b6c5 100644 --- a/src/nitro/utils/HabboWebTools.ts +++ b/src/nitro/utils/HabboWebTools.ts @@ -11,7 +11,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('logEventLog', data); } @@ -27,7 +27,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openPage', pageUrl); } @@ -52,7 +52,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('heartBeat'); } @@ -68,7 +68,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { HabboWebTools.openPage(pageUrl); } @@ -84,7 +84,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('closeWebPageAndRestoreClient'); } @@ -100,7 +100,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openHabblet', name, param); } @@ -116,7 +116,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('closeHabblet', name, param); } @@ -132,7 +132,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('disconnect', reasonCode, reasonString); } @@ -148,7 +148,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.callGame('showGame', gameUrl); } @@ -164,7 +164,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.callGame('hideGame'); } @@ -180,7 +180,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openExternalLink', escape(url)); } @@ -200,7 +200,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('roomVisited', roomId); } @@ -220,7 +220,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openMinimail', target); } @@ -240,7 +240,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openNews'); } @@ -260,7 +260,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('closeNews'); } @@ -280,7 +280,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openAvatars'); } @@ -300,7 +300,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('openRoomEnterAd'); } @@ -320,7 +320,7 @@ export class HabboWebTools { try { - if (LegacyExternalInterface.available) + if(LegacyExternalInterface.available) { LegacyExternalInterface.call('updateFigure', figure); } diff --git a/src/pixi-proxy/PaletteMapFilter.ts b/src/pixi-proxy/PaletteMapFilter.ts index 451072f4..b7b2ff2a 100644 --- a/src/pixi-proxy/PaletteMapFilter.ts +++ b/src/pixi-proxy/PaletteMapFilter.ts @@ -67,7 +67,7 @@ export class PaletteMapFilter extends NitroFilter { const lut = []; - for (let i = 0; i < data.length; i++) + for(let i = 0; i < data.length; i++) { // R lut[(i * 4) + PaletteMapFilter.CHANNEL_RED] = ((data[i] >> 16) & 0xFF); diff --git a/src/pixi-proxy/PixiApplicationProxy.ts b/src/pixi-proxy/PixiApplicationProxy.ts index fe8c0833..f0265303 100644 --- a/src/pixi-proxy/PixiApplicationProxy.ts +++ b/src/pixi-proxy/PixiApplicationProxy.ts @@ -8,7 +8,7 @@ export class PixiApplicationProxy extends Application { super(options); - if (!PixiApplicationProxy.INSTANCE) PixiApplicationProxy.INSTANCE = this; + if(!PixiApplicationProxy.INSTANCE) PixiApplicationProxy.INSTANCE = this; } public static get instance(): Application diff --git a/src/pixi-proxy/TextureUtils.ts b/src/pixi-proxy/TextureUtils.ts index 20eaff35..311118df 100644 --- a/src/pixi-proxy/TextureUtils.ts +++ b/src/pixi-proxy/TextureUtils.ts @@ -9,7 +9,7 @@ export class TextureUtils { public static generateTexture(displayObject: DisplayObject, region: Rectangle = null, scaleMode: number = SCALE_MODES.NEAREST, resolution: number = 1): RenderTexture { - if (!displayObject) return null; + if(!displayObject) return null; return this.getRenderer().generateTexture(displayObject, { scaleMode, @@ -20,28 +20,28 @@ export class TextureUtils public static generateTextureFromImage(image: HTMLImageElement): Texture { - if (!image) return null; + if(!image) return null; return Texture.from(image); } public static generateImage(target: DisplayObject | RenderTexture): HTMLImageElement { - if (!target) return null; + if(!target) return null; return this.getExtractor().image(target); } public static generateImageUrl(target: DisplayObject | RenderTexture): string { - if (!target) return null; + if(!target) return null; return this.getExtractor().base64(target); } public static generateCanvas(target: DisplayObject | RenderTexture): HTMLCanvasElement { - if (!target) return null; + if(!target) return null; return this.getExtractor().canvas(target); } diff --git a/src/room/RoomInstance.ts b/src/room/RoomInstance.ts index 3508150f..6621c097 100644 --- a/src/room/RoomInstance.ts +++ b/src/room/RoomInstance.ts @@ -36,29 +36,29 @@ export class RoomInstance extends Disposable implements IRoomInstance public setRenderer(renderer: IRoomRendererBase): void { - if (renderer === this._renderer) return; + if(renderer === this._renderer) return; - if (this._renderer) this.destroyRenderer(); + if(this._renderer) this.destroyRenderer(); this._renderer = renderer; - if (!this._renderer) return; + if(!this._renderer) return; this._renderer.reset(); - if (this._managers.size) + if(this._managers.size) { - for (const manager of this._managers.values()) + for(const manager of this._managers.values()) { - if (!manager) continue; + if(!manager) continue; const objects = manager.objects; - if (!objects.length) continue; + if(!objects.length) continue; - for (const object of objects.getValues()) + for(const object of objects.getValues()) { - if (!object) continue; + if(!object) continue; this._renderer.addObject(object); } @@ -68,7 +68,7 @@ export class RoomInstance extends Disposable implements IRoomInstance private destroyRenderer(): void { - if (!this._renderer) return; + if(!this._renderer) return; this._renderer.dispose(); @@ -79,7 +79,7 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this._managers.get(category); - if (!manager) return null; + if(!manager) return null; return manager; } @@ -88,11 +88,11 @@ export class RoomInstance extends Disposable implements IRoomInstance { let manager = this.getManager(category); - if (manager) return manager; + if(manager) return manager; manager = this._container.createRoomObjectManager(category); - if (!manager) return null; + if(!manager) return null; this._managers.set(category, manager); @@ -103,7 +103,7 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this.getManager(category); - if (!manager) return 0; + if(!manager) return 0; return manager.totalObjects; } @@ -112,11 +112,11 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this.getManager(category); - if (!manager) return null; + if(!manager) return null; const object = manager.getObject(id); - if (!object) return null; + if(!object) return null; return object; } @@ -132,11 +132,11 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this.getManager(category); - if (!manager) return null; + if(!manager) return null; const object = manager.getObjectByIndex(index); - if (!object) return null; + if(!object) return null; return object; } @@ -145,20 +145,20 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this.getManagerOrCreate(category); - if (!manager) return null; + if(!manager) return null; const object = manager.createObject(id, stateCount, type); - if (!object) return null; + if(!object) return null; - if (this._renderer) this._renderer.addObject(object); + if(this._renderer) this._renderer.addObject(object); return object; } public createRoomObjectAndInitalize(objectId: number, type: string, category: number): IRoomObject { - if (!this._container) return null; + if(!this._container) return null; return this._container.createRoomObjectAndInitalize(this._id, objectId, type, category); } @@ -167,34 +167,34 @@ export class RoomInstance extends Disposable implements IRoomInstance { const manager = this.getManager(category); - if (!manager) return; + if(!manager) return; const object = manager.getObject(id); - if (!object) return; + if(!object) return; object.tearDown(); - if (this._renderer) this._renderer.removeObject(object); + if(this._renderer) this._renderer.removeObject(object); manager.removeObject(id); } public removeAllManagers(): void { - for (const manager of this._managers.values()) + for(const manager of this._managers.values()) { - if (!manager) continue; + if(!manager) continue; - if (this._renderer) + if(this._renderer) { const objects = manager.objects; - if (objects.length) + if(objects.length) { - for (const object of objects.getValues()) + for(const object of objects.getValues()) { - if (!object) continue; + if(!object) continue; this._renderer.removeObject(object); } @@ -211,7 +211,7 @@ export class RoomInstance extends Disposable implements IRoomInstance { const index = this._updateCategories.indexOf(category); - if (index >= 0) return; + if(index >= 0) return; this._updateCategories.push(category); } @@ -220,26 +220,26 @@ export class RoomInstance extends Disposable implements IRoomInstance { const index = this._updateCategories.indexOf(category); - if (index === -1) return; + if(index === -1) return; this._updateCategories.splice(index, 1); } public update(time: number, update: boolean = false): void { - for (const category of this._updateCategories) + for(const category of this._updateCategories) { const manager = this.getManager(category); - if (!manager) continue; + if(!manager) continue; const objects = manager.objects; - if (!objects.length) continue; + if(!objects.length) continue; - for (const object of objects.getValues()) + for(const object of objects.getValues()) { - if (!object) continue; + if(!object) continue; const logic = object.logic; @@ -252,15 +252,15 @@ export class RoomInstance extends Disposable implements IRoomInstance public hasUninitializedObjects(): boolean { - for (const manager of this._managers.values()) + for(const manager of this._managers.values()) { - if (!manager) continue; + if(!manager) continue; - for (const object of manager.objects.getValues()) + for(const object of manager.objects.getValues()) { - if (!object) continue; + if(!object) continue; - if (!object.isReady) return true; + if(!object.isReady) return true; } } diff --git a/src/room/RoomManager.ts b/src/room/RoomManager.ts index 870e20d8..cb2b37bf 100644 --- a/src/room/RoomManager.ts +++ b/src/room/RoomManager.ts @@ -57,15 +57,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst public onInit(): void { - if (this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return; + if(this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return; const mandatoryLibraries = RoomContentLoader.MANDATORY_LIBRARIES; - for (const library of mandatoryLibraries) + for(const library of mandatoryLibraries) { - if (!library) continue; + if(!library) continue; - if (this._initialLoadList.indexOf(library) === -1) + if(this._initialLoadList.indexOf(library) === -1) { this._contentLoader.downloadAsset(library, this.events); @@ -80,22 +80,22 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { const existing = this._rooms.get(roomId); - if (!existing) return null; + if(!existing) return null; return existing; } public createRoomInstance(roomId: string): IRoomInstance { - if (this._rooms.get(roomId)) return null; + if(this._rooms.get(roomId)) return null; const instance = new RoomInstance(roomId, this); this._rooms.set(instance.id, instance); - if (this._updateCategories.length) + if(this._updateCategories.length) { - for (const category of this._updateCategories) + for(const category of this._updateCategories) { instance.addUpdateCategory(category); } @@ -108,7 +108,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { const existing = this._rooms.get(roomId); - if (!existing) return false; + if(!existing) return false; this._rooms.delete(roomId); @@ -121,7 +121,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { const instance = this.getRoomInstance(roomId); - if (!instance) return null; + if(!instance) return null; let visualization = type; let logic = type; @@ -129,11 +129,11 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst let asset: IGraphicAssetCollection = null; let isLoading = false; - if (this._contentLoader.isLoaderType(type)) + if(this._contentLoader.isLoaderType(type)) { asset = this._contentLoader.getCollection(type); - if (!asset) + if(!asset) { isLoading = true; @@ -142,7 +142,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst assetName = this._contentLoader.getPlaceholderName(type); asset = this._contentLoader.getCollection(assetName); - if (!asset) return null; + if(!asset) return null; } visualization = asset.data.visualizationType; @@ -151,13 +151,13 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst const object = (instance.createRoomObject(objectId, 1, type, category) as IRoomObjectController); - if (!object) return null; + if(!object) return null; - if (this._visualizationFactory) + if(this._visualizationFactory) { const visualizationInstance = this._visualizationFactory.getVisualization(visualization); - if (!visualizationInstance) + if(!visualizationInstance) { instance.removeRoomObject(objectId, category); @@ -168,7 +168,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst const visualizationData = this._visualizationFactory.getVisualizationData(assetName, visualization, ((asset && asset.data) || null)); - if (!visualizationData || !visualizationInstance.initialize(visualizationData)) + if(!visualizationData || !visualizationInstance.initialize(visualizationData)) { instance.removeRoomObject(objectId, category); @@ -178,19 +178,19 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst object.setVisualization(visualizationInstance); } - if (this._logicFactory) + if(this._logicFactory) { const logicInstance = this._logicFactory.getLogic(logic); object.setLogic(logicInstance); - if (logicInstance) + if(logicInstance) { logicInstance.initialize((asset && asset.data) || null); } } - if (!isLoading) object.isReady = true; + if(!isLoading) object.isReady = true; this._contentLoader.setRoomObjectRoomId(object, roomId); @@ -199,35 +199,35 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst private reinitializeRoomObjectsByType(type: string): void { - if (!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return; + if(!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return; const asset = this._contentLoader.getCollection(type); - if (!asset) return; + if(!asset) return; const visualization = asset.data.visualizationType; const logic = asset.data.logicType; const visualizationData = this._visualizationFactory.getVisualizationData(type, visualization, asset.data); - for (const room of this._rooms.values()) + for(const room of this._rooms.values()) { - if (!room) continue; + if(!room) continue; - for (const [category, manager] of room.managers.entries()) + for(const [category, manager] of room.managers.entries()) { - if (!manager) continue; + if(!manager) continue; - for (const object of manager.objects.getValues()) + for(const object of manager.objects.getValues()) { - if (!object || object.type !== type) continue; + if(!object || object.type !== type) continue; const visualizationInstance = this._visualizationFactory.getVisualization(visualization); - if (visualizationInstance) + if(visualizationInstance) { visualizationInstance.asset = asset; - if (!visualizationData || !visualizationInstance.initialize(visualizationData)) + if(!visualizationData || !visualizationInstance.initialize(visualizationData)) { manager.removeObject(object.id); } @@ -239,14 +239,14 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst object.setLogic(logicInstance); - if (logicInstance) + if(logicInstance) { logicInstance.initialize(asset.data); } object.isReady = true; - if (this._listener) this._listener.objectInitialized(room.id, object.id, category); + if(this._listener) this._listener.objectInitialized(room.id, object.id, category); } } else @@ -262,15 +262,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { const index = this._updateCategories.indexOf(category); - if (index >= 0) return; + if(index >= 0) return; this._updateCategories.push(category); - if (!this._rooms.size) return; + if(!this._rooms.size) return; - for (const room of this._rooms.values()) + for(const room of this._rooms.values()) { - if (!room) continue; + if(!room) continue; room.addUpdateCategory(category); } @@ -280,15 +280,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { const index = this._updateCategories.indexOf(category); - if (index === -1) return; + if(index === -1) return; this._updateCategories.splice(index, 1); - if (!this._rooms.size) return; + if(!this._rooms.size) return; - for (const room of this._rooms.values()) + for(const room of this._rooms.values()) { - if (!room) continue; + if(!room) continue; room.removeUpdateCategory(category); } @@ -296,29 +296,29 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst public setContentLoader(loader: IRoomContentLoader): void { - if (this._contentLoader) this._contentLoader.dispose(); + if(this._contentLoader) this._contentLoader.dispose(); this._contentLoader = loader; } private processPendingContentTypes(time: number): void { - if (this._skipContentProcessing) + if(this._skipContentProcessing) { this._skipContentProcessing = false; return; } - while (this._pendingContentTypes.length) + while(this._pendingContentTypes.length) { const type = this._pendingContentTypes.shift(); const collection = this._contentLoader.getCollection(type); - if (!collection) + if(!collection) { - if (this._listener) + if(this._listener) { this._listener.initalizeTemporaryObjectsByType(type, false); } @@ -330,29 +330,29 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst this.reinitializeRoomObjectsByType(type); - if (this._listener) this._listener.initalizeTemporaryObjectsByType(type, true); + if(this._listener) this._listener.initalizeTemporaryObjectsByType(type, true); - if (this._initialLoadList.length > 0) this.removeFromInitialLoad(type); + if(this._initialLoadList.length > 0) this.removeFromInitialLoad(type); } } private removeFromInitialLoad(type: string): void { - if (!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return; + if(!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return; - if (!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR; + if(!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR; - if (this._contentLoader.getCollection(type)) + if(this._contentLoader.getCollection(type)) { const i = this._initialLoadList.indexOf(type); - if (i >= 0) this._initialLoadList.splice(i, 1); + if(i >= 0) this._initialLoadList.splice(i, 1); - if (!this._initialLoadList.length) + if(!this._initialLoadList.length) { this._state = RoomManager.ROOM_MANAGER_INITIALIZED; - if (this._listener) + if(this._listener) { this._listener.onRoomEngineInitalized(true); } @@ -362,17 +362,17 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { this._state = RoomManager.ROOM_MANAGER_ERROR; - if (this._listener) this._listener.onRoomEngineInitalized(false); + if(this._listener) this._listener.onRoomEngineInitalized(false); } } private onRoomContentLoadedEvent(event: RoomContentLoadedEvent): void { - if (!this._contentLoader) return; + if(!this._contentLoader) return; const contentType = event.contentType; - if (this._pendingContentTypes.indexOf(contentType) >= 0) return; + if(this._pendingContentTypes.indexOf(contentType) >= 0) return; this._pendingContentTypes.push(contentType); } @@ -381,9 +381,9 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst { this.processPendingContentTypes(time); - if (!this._rooms.size) return; + if(!this._rooms.size) return; - for (const room of this._rooms.values()) room && room.update(time, update); + for(const room of this._rooms.values()) room && room.update(time, update); } public createRoomObjectManager(category: number): IRoomObjectManager diff --git a/src/room/RoomObjectManager.ts b/src/room/RoomObjectManager.ts index 3771d902..56136995 100644 --- a/src/room/RoomObjectManager.ts +++ b/src/room/RoomObjectManager.ts @@ -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++; } @@ -108,7 +108,7 @@ export class RoomObjectManager implements IRoomObjectManager { let existing = this._objectsPerType.getValue(k); - if (!existing && _arg_2) + if(!existing && _arg_2) { existing = new AdvancedMap(); diff --git a/src/room/events/RoomObjectEvent.ts b/src/room/events/RoomObjectEvent.ts index 34d84998..8f6de867 100644 --- a/src/room/events/RoomObjectEvent.ts +++ b/src/room/events/RoomObjectEvent.ts @@ -19,14 +19,14 @@ export class RoomObjectEvent extends NitroEvent public get objectId(): number { - if (!this._object) return -1; + if(!this._object) return -1; return this._object.id; } public get objectType(): string { - if (!this._object) return null; + if(!this._object) return null; return this._object.type; } diff --git a/src/room/object/RoomObject.ts b/src/room/object/RoomObject.ts index 618737c5..f9008394 100644 --- a/src/room/object/RoomObject.ts +++ b/src/room/object/RoomObject.ts @@ -44,7 +44,7 @@ export class RoomObject extends Disposable implements IRoomObjectController let i = (stateCount - 1); - while (i >= 0) + while(i >= 0) { this._states[i] = 0; @@ -59,7 +59,7 @@ export class RoomObject extends Disposable implements IRoomObjectController this.setVisualization(null); this.setLogic(null); - if (this._model) this._model.dispose(); + if(this._model) this._model.dispose(); super.onDispose(); } @@ -71,9 +71,9 @@ export class RoomObject extends Disposable implements IRoomObjectController public setLocation(vector: IVector3D): void { - if (!vector) return; + if(!vector) return; - if ((vector.x === this._location.x) && (vector.y === this._location.y) && (vector.z === this._location.z)) return; + if((vector.x === this._location.x) && (vector.y === this._location.y) && (vector.z === this._location.z)) return; this._location.x = vector.x; this._location.y = vector.y; @@ -89,9 +89,9 @@ export class RoomObject extends Disposable implements IRoomObjectController public setDirection(vector: IVector3D): void { - if (!vector) return; + if(!vector) return; - if ((vector.x === this._direction.x) && (vector.y === this._direction.y) && (vector.z === this._direction.z)) return; + if((vector.x === this._direction.x) && (vector.y === this._direction.y) && (vector.z === this._direction.z)) return; this._direction.x = (((vector.x % 360) + 360) % 360); this._direction.y = (((vector.y % 360) + 360) % 360); @@ -102,7 +102,7 @@ export class RoomObject extends Disposable implements IRoomObjectController public getState(index: number = 0): number { - if ((index >= 0) && (index < this._states.length)) + if((index >= 0) && (index < this._states.length)) { return this._states[index]; } @@ -112,9 +112,9 @@ export class RoomObject extends Disposable implements IRoomObjectController public setState(state: number, index: number = 0): boolean { - if ((index >= 0) && (index < this._states.length)) + if((index >= 0) && (index < this._states.length)) { - if (this._states[index] !== state) + if(this._states[index] !== state) { this._states[index] = state; @@ -129,22 +129,22 @@ export class RoomObject extends Disposable implements IRoomObjectController public setVisualization(visualization: IRoomObjectVisualization): void { - if (this._visualization === visualization) return; + if(this._visualization === visualization) return; - if (this._visualization) this._visualization.dispose(); + if(this._visualization) this._visualization.dispose(); this._visualization = visualization; - if (this._visualization) this._visualization.object = this; + if(this._visualization) this._visualization.object = this; } public setLogic(logic: IRoomObjectEventHandler): void { - if (this._logic === logic) return; + if(this._logic === logic) return; const eventHandler = this._logic; - if (eventHandler) + if(eventHandler) { this._logic = null; @@ -153,11 +153,11 @@ export class RoomObject extends Disposable implements IRoomObjectController this._logic = logic; - if (this._logic) + if(this._logic) { this._logic.setObject(this); - while (this._pendingLogicMessages.length) + while(this._pendingLogicMessages.length) { const message = this._pendingLogicMessages.shift(); @@ -168,14 +168,14 @@ export class RoomObject extends Disposable implements IRoomObjectController public processUpdateMessage(message: IRoomObjectUpdateMessage): void { - if (this._logic) return this._logic.processUpdateMessage(message); + if(this._logic) return this._logic.processUpdateMessage(message); this._pendingLogicMessages.push(message); } public tearDown(): void { - if (this._logic) this._logic.tearDown(); + if(this._logic) this._logic.tearDown(); } public get id(): number diff --git a/src/room/object/RoomObjectModel.ts b/src/room/object/RoomObjectModel.ts index 9696bbff..9d7b05d5 100644 --- a/src/room/object/RoomObjectModel.ts +++ b/src/room/object/RoomObjectModel.ts @@ -27,9 +27,9 @@ export class RoomObjectModel implements IRoomObjectModel public setValue(key: string, value: T): void { - if (this._map.has(key)) + if(this._map.has(key)) { - if (this._map.get(key) === value) return; + if(this._map.get(key) === value) return; } this._map.set(key, (value as T)); @@ -39,7 +39,7 @@ export class RoomObjectModel implements IRoomObjectModel public removeKey(key: string): void { - if (!key) return; + if(!key) return; this._map.delete(key); diff --git a/src/room/object/logic/RoomObjectLogicBase.ts b/src/room/object/logic/RoomObjectLogicBase.ts index 34610cc9..5872d7d3 100644 --- a/src/room/object/logic/RoomObjectLogicBase.ts +++ b/src/room/object/logic/RoomObjectLogicBase.ts @@ -38,7 +38,7 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH public processUpdateMessage(message: IRoomObjectUpdateMessage): void { - if (!message || !this._object) return; + if(!message || !this._object) return; this._object.setLocation(message.location); this._object.setDirection(message.direction); @@ -53,9 +53,9 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH { const types = k.concat(); - for (const type of _arg_2) + for(const type of _arg_2) { - if (!type || (types.indexOf(type) >= 0)) continue; + if(!type || (types.indexOf(type) >= 0)) continue; types.push(type); } @@ -75,14 +75,14 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH public setObject(object: IRoomObjectController): void { - if (this._object === object) return; + if(this._object === object) return; - if (this._object) + if(this._object) { this._object.setLogic(null); } - if (!object) + if(!object) { this.dispose(); diff --git a/src/room/object/visualization/RoomObjectSprite.ts b/src/room/object/visualization/RoomObjectSprite.ts index 609b322e..15616e6b 100644 --- a/src/room/object/visualization/RoomObjectSprite.ts +++ b/src/room/object/visualization/RoomObjectSprite.ts @@ -96,7 +96,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set name(name: string) { - if (this._name === name) return; + if(this._name === name) return; this._name = name; @@ -130,9 +130,9 @@ export class RoomObjectSprite implements IRoomObjectSprite public set texture(texture: Texture) { - if (this._texture === texture) return; + if(this._texture === texture) return; - if (texture) + if(texture) { this._width = texture.width; this._height = texture.height; @@ -150,11 +150,11 @@ export class RoomObjectSprite implements IRoomObjectSprite public set container(container: Container) { - if (this._container === container) return; + if(this._container === container) return; this.texture = Texture.EMPTY; - if (container) + if(container) { this._width = container.width; this._height = container.height; @@ -184,7 +184,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set offsetX(x: number) { - if (this._offsetX === x) return; + if(this._offsetX === x) return; this._offsetX = x; @@ -198,7 +198,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set offsetY(y: number) { - if (this._offsetY === y) return; + if(this._offsetY === y) return; this._offsetY = y; @@ -212,7 +212,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set flipH(flip: boolean) { - if (this._flipH === flip) return; + if(this._flipH === flip) return; this._flipH = flip; @@ -226,7 +226,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set flipV(flip: boolean) { - if (this._flipV === flip) return; + if(this._flipV === flip) return; this._flipV = flip; @@ -252,7 +252,7 @@ export class RoomObjectSprite implements IRoomObjectSprite { alpha = (alpha & 0xFF); - if (this._alpha === alpha) return; + if(this._alpha === alpha) return; this._alpha = alpha; @@ -266,7 +266,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set blendMode(blend: number) { - if (this._blendMode === blend) return; + if(this._blendMode === blend) return; this._blendMode = blend; @@ -282,7 +282,7 @@ export class RoomObjectSprite implements IRoomObjectSprite { color = (color & 0xFFFFFF); - if (this._color === color) return; + if(this._color === color) return; this._color = color; @@ -296,7 +296,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set relativeDepth(depth: number) { - if (this._relativeDepth === depth) return; + if(this._relativeDepth === depth) return; this._relativeDepth = depth; @@ -310,7 +310,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set varyingDepth(flag: boolean) { - if (flag === this._varyingDepth) return; + if(flag === this._varyingDepth) return; this._varyingDepth = flag; @@ -344,7 +344,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set visible(visible: boolean) { - if (this._visible === visible) return; + if(this._visible === visible) return; this._visible = visible; @@ -358,7 +358,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set tag(tag: string) { - if (this._tag === tag) return; + if(this._tag === tag) return; this._tag = tag; @@ -372,7 +372,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set posture(posture: string) { - if (this._posture === posture) return; + if(this._posture === posture) return; this._posture = posture; @@ -386,7 +386,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set alphaTolerance(tolerance: number) { - if (this._alphaTolerance === tolerance) return; + if(this._alphaTolerance === tolerance) return; this._alphaTolerance = tolerance; diff --git a/src/room/object/visualization/RoomObjectSpriteVisualization.ts b/src/room/object/visualization/RoomObjectSpriteVisualization.ts index 0bed86f9..d753b32e 100644 --- a/src/room/object/visualization/RoomObjectSpriteVisualization.ts +++ b/src/room/object/visualization/RoomObjectSpriteVisualization.ts @@ -50,13 +50,13 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza public dispose(): void { - if (this._sprites) + if(this._sprites) { - while (this._sprites.length) + while(this._sprites.length) { const sprite = (this._sprites[0] as RoomObjectSprite); - if (sprite) sprite.dispose(); + if(sprite) sprite.dispose(); this._sprites.pop(); } @@ -70,7 +70,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza public getSprite(index: number): IRoomObjectSprite { - if ((index >= 0) && (index < this._sprites.length)) return this._sprites[index]; + if((index >= 0) && (index < this._sprites.length)) return this._sprites[index]; return null; } @@ -89,7 +89,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza { const sprite = new RoomObjectSprite(); - if (index >= this._sprites.length) + if(index >= this._sprites.length) { this._sprites.push(sprite); } @@ -103,16 +103,16 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza protected createSprites(count: number): void { - while (this._sprites.length > count) + while(this._sprites.length > count) { const sprite = this._sprites[(this._sprites.length - 1)] as RoomObjectSprite; - if (sprite) sprite.dispose(); + if(sprite) sprite.dispose(); this._sprites.pop(); } - while (this._sprites.length < count) + while(this._sprites.length < count) { this._sprites.push(new RoomObjectSprite()); } @@ -127,18 +127,18 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza { const boundingRectangle = this.getBoundingRectangle(); - if ((boundingRectangle.width * boundingRectangle.height) === 0) return null; + if((boundingRectangle.width * boundingRectangle.height) === 0) return null; const spriteCount = this.totalSprites; const spriteList: IRoomObjectSprite[] = []; let index = 0; - while (index < spriteCount) + while(index < spriteCount) { const objectSprite = this.getSprite(index); - if (objectSprite && objectSprite.visible && objectSprite.texture) spriteList.push(objectSprite); + if(objectSprite && objectSprite.visible && objectSprite.texture) spriteList.push(objectSprite); index++; } @@ -152,12 +152,12 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza index = 0; - while (index < spriteList.length) + while(index < spriteList.length) { const objectSprite = spriteList[index]; const texture = objectSprite.texture; - if (texture) + if(texture) { const sprite = new NitroSprite(texture); @@ -168,9 +168,9 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza sprite.blendMode = objectSprite.blendMode; sprite.filters = objectSprite.filters; - if (objectSprite.flipH) sprite.scale.x = -1; + if(objectSprite.flipH) sprite.scale.x = -1; - if (objectSprite.flipV) sprite.scale.y = -1; + if(objectSprite.flipV) sprite.scale.y = -1; container.addChild(sprite); } @@ -180,7 +180,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza const texture = TextureUtils.generateTexture(container); - if (!texture) return null; + if(!texture) return null; return texture; } @@ -192,18 +192,18 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza let iterator = 0; - while (iterator < totalSprites) + while(iterator < totalSprites) { const sprite = this.getSprite(iterator); - if (sprite && sprite.texture && sprite.visible) + if(sprite && sprite.texture && sprite.visible) { const offsetX = ((sprite.flipH) ? (-(sprite.width) + sprite.offsetX) : sprite.offsetX); const offsetY = ((sprite.flipV) ? (-(sprite.height) + sprite.offsetY) : sprite.offsetY); const point = new Point(offsetX, offsetY); - if (iterator === 0) + if(iterator === 0) { rectangle.x = point.x; rectangle.y = point.y; @@ -212,13 +212,13 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza } else { - if (point.x < rectangle.x) rectangle.x = point.x; + if(point.x < rectangle.x) rectangle.x = point.x; - if (point.y < rectangle.y) rectangle.y = point.y; + if(point.y < rectangle.y) rectangle.y = point.y; - if ((point.x + sprite.width) > rectangle.right) rectangle.width = ((point.x + sprite.width) - rectangle.x); + if((point.x + sprite.width) > rectangle.right) rectangle.width = ((point.x + sprite.width) - rectangle.x); - if ((point.y + sprite.height) > rectangle.bottom) rectangle.height = ((point.y + sprite.height) - rectangle.y); + if((point.y + sprite.height) > rectangle.bottom) rectangle.height = ((point.y + sprite.height) - rectangle.y); } } @@ -250,11 +250,11 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza public set asset(asset: IGraphicAssetCollection) { - if (this._asset) this._asset.removeReference(); + if(this._asset) this._asset.removeReference(); this._asset = asset; - if (this._asset) this._asset.addReference(); + if(this._asset) this._asset.addReference(); } public get sprites(): IRoomObjectSprite[] diff --git a/src/room/renderer/RoomRenderer.ts b/src/room/renderer/RoomRenderer.ts index ed86a212..db1ef57c 100644 --- a/src/room/renderer/RoomRenderer.ts +++ b/src/room/renderer/RoomRenderer.ts @@ -20,15 +20,15 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public dispose(): void { - if (this._disposed) return; + if(this._disposed) return; - if (this._canvases) + if(this._canvases) { - for (const [key, canvas] of this._canvases.entries()) + for(const [key, canvas] of this._canvases.entries()) { this._canvases.delete(key); - if (!canvas) continue; + if(!canvas) continue; canvas.dispose(); } @@ -36,7 +36,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer this._canvases = null; } - if (this._objects) + if(this._objects) { this._objects = null; } @@ -51,7 +51,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public getInstanceId(object: IRoomObject): number { - if (!object) return -1; + if(!object) return -1; return object.instanceId; } @@ -63,7 +63,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public addObject(object: IRoomObject): void { - if (!object) return; + if(!object) return; this._objects.set(this.getInstanceId(object), object); } @@ -74,9 +74,9 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer this._objects.delete(instanceId); - for (const canvas of this._canvases.values()) + for(const canvas of this._canvases.values()) { - if (!canvas) continue; + if(!canvas) continue; const spriteCanvas = canvas as RoomSpriteCanvas; @@ -86,25 +86,25 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public render(time: number, update: boolean = false): void { - if (!this._canvases || !this._canvases.size) return; + if(!this._canvases || !this._canvases.size) return; - for (const canvas of this._canvases.values()) canvas && canvas.render(time, update); + for(const canvas of this._canvases.values()) canvas && canvas.render(time, update); } public update(time: number, update: boolean = false): void { - if (!this._canvases || !this._canvases.size) return; + if(!this._canvases || !this._canvases.size) return; this.render(time, update); - for (const canvas of this._canvases.values()) canvas && canvas.update(); + for(const canvas of this._canvases.values()) canvas && canvas.update(); } public getCanvas(id: number): IRoomRenderingCanvas { const existing = this._canvases.get(id); - if (!existing) return null; + if(!existing) return null; return existing; } @@ -113,18 +113,18 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer { const existing = this._canvases.get(id) as IRoomRenderingCanvas; - if (existing) + if(existing) { existing.initialize(width, height); - if (existing.geometry) existing.geometry.scale = scale; + if(existing.geometry) existing.geometry.scale = scale; return existing; } const canvas = this.createSpriteCanvas(id, width, height, scale); - if (!canvas) return; + if(!canvas) return; this._canvases.set(id, canvas); @@ -140,7 +140,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer { const existing = this._canvases.get(id); - if (!existing) return; + if(!existing) return; this._canvases.delete(id); diff --git a/src/room/renderer/RoomSpriteCanvas.ts b/src/room/renderer/RoomSpriteCanvas.ts index 74e17908..d4ba35e2 100644 --- a/src/room/renderer/RoomSpriteCanvas.ts +++ b/src/room/renderer/RoomSpriteCanvas.ts @@ -122,14 +122,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private setupCanvas(): void { - if (!this._master) + if(!this._master) { this._master = new NitroSprite(); this._master.interactiveChildren = false; } - if (!this._display) + if(!this._display) { const display = new NitroContainer(); @@ -143,32 +143,32 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { this.cleanSprites(0, true); - if (this._geometry) + if(this._geometry) { this._geometry.dispose(); this._geometry = null; } - if (this._mask) this._mask = null; + if(this._mask) this._mask = null; - if (this._objectCache) + if(this._objectCache) { this._objectCache.dispose(); this._objectCache = null; } - if (this._master) + if(this._master) { - while (this._master.children.length) + while(this._master.children.length) { const child = this._master.removeChildAt(0); child.destroy(); } - if (this._master.parent) this._master.parent.removeChild(this._master); + if(this._master.parent) this._master.parent.removeChild(this._master); this._master.destroy(); @@ -178,16 +178,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._display = null; this._sortableSprites = []; - if (this._mouseActiveObjects) + if(this._mouseActiveObjects) { this._mouseActiveObjects.clear(); this._mouseActiveObjects = null; } - if (this._spritePool) + if(this._spritePool) { - for (const sprite of this._spritePool) + for(const sprite of this._spritePool) { this.cleanSprite(sprite, true); } @@ -195,7 +195,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._spritePool = []; } - if (this._eventCache) + if(this._eventCache) { this._eventCache.clear(); @@ -210,20 +210,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas width = width < 1 ? 1 : width; height = height < 1 ? 1 : height; - if (this._usesMask) + if(this._usesMask) { - if (!this._mask) + if(!this._mask) { this._mask = new Graphics() .beginFill(0xFF0000) .drawRect(0, 0, width, height) .endFill(); - if (this._master) + if(this._master) { this._master.addChild(this._mask); - if (this._display) this._display.mask = this._mask; + if(this._display) this._display.mask = this._mask; } } else @@ -236,9 +236,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas } } - if (this._master) + if(this._master) { - if (this._master.hitArea) + if(this._master.hitArea) { const hitArea = (this._master.hitArea as Rectangle); @@ -250,7 +250,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._master.hitArea = new Rectangle(0, 0, width, height); } - if (this._master.filterArea) + if(this._master.filterArea) { const filterArea = this._master.filterArea; @@ -269,11 +269,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public setMask(flag: boolean): void { - if (flag && !this._usesMask) + if(flag && !this._usesMask) { this._usesMask = true; - if (this._mask && (this._mask.parent !== this._master)) + if(this._mask && (this._mask.parent !== this._master)) { this._master.addChild(this._mask); @@ -281,11 +281,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas } } - else if (!flag && this._usesMask) + else if(!flag && this._usesMask) { this._usesMask = false; - if (this._mask && (this._mask.parent === this._master)) + if(this._mask && (this._mask.parent === this._master)) { this._master.removeChild(this._mask); @@ -296,17 +296,17 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public setScale(scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void { - if (!this._master || !this._display) return; + if(!this._master || !this._display) return; - if (this._restrictsScaling && !override) return; + if(this._restrictsScaling && !override) return; - if (!point) point = new Point((this._width / 2), (this._height / 2)); + if(!point) point = new Point((this._width / 2), (this._height / 2)); - if (!offsetPoint) offsetPoint = point; + if(!offsetPoint) offsetPoint = point; point = this._display.toLocal(point); - if (asDelta) + if(asDelta) { this._scale *= scale; } @@ -325,15 +325,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._totalTimeRunning += PixiApplicationProxy.instance.ticker.deltaTime; - if (this._totalTimeRunning === this._renderTimestamp) return; + if(this._totalTimeRunning === this._renderTimestamp) return; - if (time === -1) time = (this._renderTimestamp + 1); + if(time === -1) time = (this._renderTimestamp + 1); - if (!this._container || !this._geometry) return; + if(!this._container || !this._geometry) return; - if ((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true; + if((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true; - if ((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY)) + if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY)) { this._display.x = this._screenOffsetX; this._display.y = this._screenOffsetY; @@ -341,7 +341,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas update = true; } - if (this._display.scale.x !== this._scale) + if(this._display.scale.x !== this._scale) { this._display.scale.set(this._scale); @@ -354,7 +354,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas let updateVisuals = false; - if (frame !== this._lastFrame) + if(frame !== this._lastFrame) { this._lastFrame = frame; @@ -365,11 +365,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const objects = this._container.objects; - if (objects.size) + if(objects.size) { - for (const object of objects.values()) + for(const object of objects.values()) { - if (!object) continue; + if(!object) continue; spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount)); } @@ -380,25 +380,25 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas return b.z - a.z; }); - if (spriteCount < this._sortableSprites.length) + if(spriteCount < this._sortableSprites.length) { this._sortableSprites.splice(spriteCount); } let iterator = 0; - while (iterator < spriteCount) + while(iterator < spriteCount) { const sprite = this._sortableSprites[iterator]; - if (sprite && sprite.sprite) this.renderSprite(iterator, sprite); + if(sprite && sprite.sprite) this.renderSprite(iterator, sprite); iterator++; } this.cleanSprites(spriteCount); - if (update || updateVisuals) this._canvasUpdated = true; + if(update || updateVisuals) this._canvasUpdated = true; this._renderTimestamp = this._totalTimeRunning; this._renderedWidth = this._width; @@ -434,11 +434,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number { - if (!object) return 0; + if(!object) return 0; const visualization = object.visualization as IRoomObjectSpriteVisualization; - if (!visualization) + if(!visualization) { this.removeFromCache(identifier); @@ -453,18 +453,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const vector = locationCache.updateLocation(object, this._geometry); - if (!vector) + if(!vector) { this.removeFromCache(identifier); return 0; } - if (updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow)); + if(updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow)); - if (locationCache.locationChanged) update = true; + if(locationCache.locationChanged) update = true; - if (!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update) + if(!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update) { return sortableCache.spriteCount; } @@ -473,7 +473,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas let y = vector.y; let z = vector.z; - if (x > 0) z = (z + (x * 1.2E-7)); + if(x > 0) z = (z + (x * 1.2E-7)); else z = (z + (-(x) * 1.2E-7)); x = (x + Math.trunc(this._width / 2)); @@ -481,40 +481,40 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas let spriteCount = 0; - for (const sprite of visualization.sprites.values()) + for(const sprite of visualization.sprites.values()) { - if (!sprite || !sprite.visible) continue; + if(!sprite || !sprite.visible) continue; const texture = sprite.texture; const baseTexture = texture && texture.baseTexture; - if (!texture || !baseTexture) continue; + if(!texture || !baseTexture) continue; const spriteX = ((x + sprite.offsetX) + this._screenOffsetX); const spriteY = ((y + sprite.offsetY) + this._screenOffsetY); - if (sprite.flipH) + if(sprite.flipH) { const checkX = ((x + (-(texture.width + (-(sprite.offsetX))))) + this._screenOffsetX); - if (!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue; + if(!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue; } - else if (sprite.flipV) + else if(sprite.flipV) { const checkY = ((y + (-(texture.height + (-(sprite.offsetY))))) + this._screenOffsetY); - if (!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue; + if(!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue; } else { - if (!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue; + if(!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue; } let sortableSprite = sortableCache.getSprite(spriteCount); - if (!sortableSprite) + if(!sortableSprite) { sortableSprite = new SortableSprite(); @@ -527,7 +527,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas sortableSprite.sprite = sprite; - if ((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN)) + if((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN)) { sortableSprite.sprite.libraryAssetName = 'avatar_' + object.id; } @@ -549,41 +549,41 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private getExtendedSprite(index: number): ExtendedSprite { - if ((index < 0) || (index >= this._spriteCount)) return null; + if((index < 0) || (index >= this._spriteCount)) return null; const sprite = (this._display.getChildAt(index) as ExtendedSprite); - if (!sprite) return null; + if(!sprite) return null; return sprite; } protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string { - if (!sprite) return ''; + if(!sprite) return ''; return sprite.name; } private renderSprite(index: number, sprite: SortableSprite): boolean { - if (index >= this._spriteCount) + if(index >= this._spriteCount) { this.createAndAddSprite(sprite); return true; } - if (!sprite) return false; + if(!sprite) return false; const objectSprite = sprite.sprite; const extendedSprite = this.getExtendedSprite(index); - if (!objectSprite || !extendedSprite) return false; + if(!objectSprite || !extendedSprite) return false; - if (extendedSprite.varyingDepth !== objectSprite.varyingDepth) + if(extendedSprite.varyingDepth !== objectSprite.varyingDepth) { - if (extendedSprite.varyingDepth && !objectSprite.varyingDepth) + if(extendedSprite.varyingDepth && !objectSprite.varyingDepth) { this._display.removeChildAt(index); @@ -597,7 +597,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas return true; } - if (extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn()) + if(extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn()) { extendedSprite.tag = objectSprite.tag; extendedSprite.alphaTolerance = objectSprite.alphaTolerance; @@ -608,48 +608,48 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const alpha = (objectSprite.alpha / 255); - if (extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha; + if(extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha; - if (extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color; + if(extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color; - if (extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode; + if(extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode; - if (extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture); + if(extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture); - if (objectSprite.updateContainer) + if(objectSprite.updateContainer) { const length = extendedSprite.children.length; - if (length === 1) extendedSprite.removeChildAt(0); + if(length === 1) extendedSprite.removeChildAt(0); extendedSprite.addChild(objectSprite.container); objectSprite.updateContainer = false; } - if (objectSprite.flipH) + if(objectSprite.flipH) { - if (extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1; + if(extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1; } else { - if (extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1; + if(extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1; } - if (objectSprite.flipV) + if(objectSprite.flipV) { - if (extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1; + if(extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1; } else { - if (extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1; + if(extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1; } this.updateEnterRoomEffect(extendedSprite, objectSprite); } - if (extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x; - if (extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y; + if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x; + if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y; extendedSprite.offsetX = objectSprite.offsetX; extendedSprite.offsetY = objectSprite.offsetY; @@ -661,15 +661,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { const sprite = sortableSprite.sprite; - if (!sprite) return; + if(!sprite) return; let extendedSprite: ExtendedSprite = null; - if (this._spritePool.length > 0) extendedSprite = this._spritePool.pop(); + if(this._spritePool.length > 0) extendedSprite = this._spritePool.pop(); - if (!extendedSprite) extendedSprite = new ExtendedSprite(); + if(!extendedSprite) extendedSprite = new ExtendedSprite(); - if (extendedSprite.children.length) extendedSprite.removeChildren(); + if(extendedSprite.children.length) extendedSprite.removeChildren(); extendedSprite.tag = sprite.tag; extendedSprite.alphaTolerance = sprite.alphaTolerance; @@ -687,20 +687,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas extendedSprite.setTexture(sprite.texture); - if (sprite.updateContainer) + if(sprite.updateContainer) { extendedSprite.addChild(sprite.container); sprite.updateContainer = false; } - if (sprite.flipH) extendedSprite.scale.x = -1; + if(sprite.flipH) extendedSprite.scale.x = -1; - if (sprite.flipV) extendedSprite.scale.y = -1; + if(sprite.flipV) extendedSprite.scale.y = -1; this.updateEnterRoomEffect(extendedSprite, sprite); - if ((index < 0) || (index >= this._spriteCount)) + if((index < 0) || (index >= this._spriteCount)) { this._display.addChild(extendedSprite); @@ -716,15 +716,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private cleanSprites(spriteCount: number, _arg_2: boolean = false): void { - if (!this._display) return; + if(!this._display) return; - if (spriteCount < 0) spriteCount = 0; + if(spriteCount < 0) spriteCount = 0; - if ((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount) + if((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount) { let iterator = (this._spriteCount - 1); - while (iterator >= spriteCount) + while(iterator >= spriteCount) { this.cleanSprite(this.getExtendedSprite(iterator), _arg_2); @@ -737,9 +737,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private updateEnterRoomEffect(sprite: ExtendedSprite, _arg_2: IRoomObjectSprite): void { - if (!RoomEnterEffect.isVisualizationOn() || !_arg_2) return; + if(!RoomEnterEffect.isVisualizationOn() || !_arg_2) return; - switch (_arg_2.spriteType) + switch(_arg_2.spriteType) { case RoomObjectSpriteType.AVATAR_OWN: return; @@ -756,15 +756,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void { - if (!sprite) return; + if(!sprite) return; - if (!_arg_2) + if(!_arg_2) { sprite.setTexture(null); } else { - if (sprite.parent) sprite.parent.removeChild(sprite); + if(sprite.parent) sprite.parent.removeChild(sprite); sprite.destroy({ children: true @@ -774,7 +774,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public update(): void { - if (!this._mouseCheckCount) + if(!this._mouseCheckCount) { //this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE); } @@ -796,16 +796,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private isSpriteVisible(x: number, y: number, width: number, height: number): boolean { - if (this._noSpriteVisibilityChecking) return true; + if(this._noSpriteVisibilityChecking) return true; x = (((x - this._screenOffsetX) * this._scale) + this._screenOffsetX); y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY); width = (width * this._scale); height = (height * this._scale); - if (((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0))) + if(((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0))) { - if (!this._usesExclusionRectangles) return true; + if(!this._usesExclusionRectangles) return true; } return false; @@ -819,7 +819,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._mouseLocation.x = (x / this._scale); this._mouseLocation.y = (y / this._scale); - if ((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit; + if((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit; this._mouseSpriteWasHit = this.checkMouseHits(Math.trunc(x / this._scale), Math.trunc(y / this._scale), type, altKey, ctrlKey, shiftKey, buttonDown); @@ -836,13 +836,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas let mouseEvent: IRoomSpriteMouseEvent = null; let spriteId = (this._activeSpriteCount - 1); - while (spriteId >= 0) + while(spriteId >= 0) { const extendedSprite = this.getExtendedSprite(spriteId); - if (extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y)))) + if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y)))) { - if (extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))) + if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))) { // } @@ -850,15 +850,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { const identifier = this.getExtendedSpriteIdentifier(extendedSprite); - if (checkedSprites.indexOf(identifier) === -1) + if(checkedSprites.indexOf(identifier) === -1) { const tag = extendedSprite.tag; let mouseData = this._mouseActiveObjects.get(identifier); - if (mouseData) + if(mouseData) { - if (mouseData.spriteTag !== tag) + if(mouseData.spriteTag !== tag) { mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); @@ -866,7 +866,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas } } - if ((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag))) + if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag))) { mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown); } @@ -878,7 +878,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas mouseEvent.spriteOffsetY = extendedSprite.offsetY; } - if (!mouseData) + if(!mouseData) { mouseData = new ObjectMouseData(); @@ -888,7 +888,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas mouseData.spriteTag = tag; - if (((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY)) + if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY)) { this.bufferMouseEvent(mouseEvent, identifier); } @@ -905,30 +905,30 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const keys: string[] = []; - for (const key of this._mouseActiveObjects.keys()) key && keys.push(key); + for(const key of this._mouseActiveObjects.keys()) key && keys.push(key); let index = 0; - while (index < keys.length) + while(index < keys.length) { const key = keys[index]; - if (checkedSprites.indexOf(key) >= 0) keys[index] = null; + if(checkedSprites.indexOf(key) >= 0) keys[index] = null; index++; } index = 0; - while (index < keys.length) + while(index < keys.length) { const key = keys[index]; - if (key !== null) + if(key !== null) { const existing = this._mouseActiveObjects.get(key); - if (existing) this._mouseActiveObjects.delete(key); + if(existing) this._mouseActiveObjects.delete(key); const mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, existing.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); @@ -956,7 +956,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas protected bufferMouseEvent(k: IRoomSpriteMouseEvent, _arg_2: string): void { - if (!k || !this._eventCache) return; + if(!k || !this._eventCache) return; this._eventCache.delete(_arg_2); this._eventCache.set(_arg_2, k); @@ -964,19 +964,19 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas protected processMouseEvents(): void { - if (!this._container || !this._eventCache) return; + if(!this._container || !this._eventCache) return; - for (const [key, event] of this._eventCache.entries()) + for(const [key, event] of this._eventCache.entries()) { - if (!this._eventCache) return; + if(!this._eventCache) return; - if (!event) continue; + if(!event) continue; const roomObject = this._container.getRoomObject(parseInt(key)); - if (!roomObject) continue; + if(!roomObject) continue; - if (this._mouseListener) + if(this._mouseListener) { this._mouseListener.processRoomCanvasMouseEvent(event, roomObject, this._geometry); } @@ -984,14 +984,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { const logic = roomObject.mouseHandler; - if (logic) + if(logic) { logic.mouseEvent(event, this._geometry); } } } - if (this._eventCache) this._eventCache.clear(); + if(this._eventCache) this._eventCache.clear(); } public getDisplayAsTexture(): RenderTexture @@ -1034,7 +1034,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { const geometry = (this.geometry as RoomGeometry); - if (this._rotation !== 0) + if(this._rotation !== 0) { let direction = this._effectDirection; @@ -1060,18 +1060,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas this._effectDirection.assign(geometry.direction); } - if (RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507) + if(RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507) { this.changeShaking(); } else { - if (!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking(); + if(!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking(); } - if (RoomRotatingEffect.isVisualizationOn()) this.changeRotation(); + if(RoomRotatingEffect.isVisualizationOn()) this.changeRotation(); - if (this._SafeStr_4507) + if(this._SafeStr_4507) { this._SafeStr_795++; @@ -1092,7 +1092,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { this._SafeStr_4507 = !this._SafeStr_4507; - if (this._SafeStr_4507) + if(this._SafeStr_4507) { const direction = this.geometry.direction; @@ -1102,13 +1102,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private changeRotation(): void { - if (this._SafeStr_4507) return; + if(this._SafeStr_4507) return; const geometry = (this.geometry as RoomGeometry); - if (!geometry) return; + if(!geometry) return; - if (this._rotation === 0) + if(this._rotation === 0) { const location = geometry.location; const directionAxis = geometry.directionAxis; @@ -1120,7 +1120,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const intersection = RoomGeometry.getIntersectionVector(location, directionAxis, new Vector3d(0, 0, 0), new Vector3d(0, 0, 1)); - if (intersection !== null) + if(intersection !== null) { this._rotationOrigin = new Vector3d(intersection.x, intersection.y, intersection.z); this._rotationRodLength = Vector3d.dif(intersection, location).length; @@ -1139,9 +1139,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public moveLeft(): void { - if (this._rotation !== 0) + if(this._rotation !== 0) { - if (this._rotation === 1) + if(this._rotation === 1) { this._rotation = -1; } @@ -1161,9 +1161,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public moveRight(): void { - if (this._rotation !== 0) + if(this._rotation !== 0) { - if (this._rotation === -1) + if(this._rotation === -1) { this._rotation = 1; } @@ -1183,7 +1183,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public moveUp(): void { - if (this._rotation !== 0) return; + if(this._rotation !== 0) return; const geometry = (this.geometry as RoomGeometry); const direction = ((geometry.direction.x / 180) * 3.14159265358979); @@ -1193,7 +1193,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas public moveDown(): void { - if (this._rotation !== 0) return; + if(this._rotation !== 0) return; const geometry = (this.geometry as RoomGeometry); const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979); diff --git a/src/room/renderer/cache/RoomObjectCache.ts b/src/room/renderer/cache/RoomObjectCache.ts index f65aeca2..fe2f3773 100644 --- a/src/room/renderer/cache/RoomObjectCache.ts +++ b/src/room/renderer/cache/RoomObjectCache.ts @@ -17,11 +17,11 @@ export class RoomObjectCache public dispose(): void { - if (this._data) + if(this._data) { - for (const [key, item] of this._data.entries()) + for(const [key, item] of this._data.entries()) { - if (!item) continue; + if(!item) continue; this._data.delete(key); @@ -36,7 +36,7 @@ export class RoomObjectCache { let existing = this._data.get(k); - if (!existing) + if(!existing) { existing = new RoomObjectCacheItem(this._roomObjectVariableAccurateZ); @@ -50,7 +50,7 @@ export class RoomObjectCache { const existing = this._data.get(k); - if (!existing) return; + if(!existing) return; this._data.delete(k); @@ -61,19 +61,19 @@ export class RoomObjectCache { const spriteData: RoomObjectSpriteData[] = []; - for (const item of this._data.values()) + for(const item of this._data.values()) { - if (!item) continue; + if(!item) continue; const sprites = item.sprites && item.sprites.sprites; - if (!sprites || !sprites.length) continue; + if(!sprites || !sprites.length) continue; - for (const sprite of sprites) + for(const sprite of sprites) { - if (!sprite) continue; + if(!sprite) continue; - if ((sprite.sprite.spriteType !== RoomObjectSpriteType.ROOM_PLANE) && (sprite.sprite.name !== '')) + if((sprite.sprite.spriteType !== RoomObjectSpriteType.ROOM_PLANE) && (sprite.sprite.name !== '')) { const data = new RoomObjectSpriteData(); @@ -93,16 +93,16 @@ export class RoomObjectCache const isSkewed = this.isSkewedSprite(sprite.sprite); - if (isSkewed) + if(isSkewed) { data.skew = (((sprite.sprite.direction % 4) === 0) ? -0.5 : 0.5); } - if (((((isSkewed || (sprite.name.indexOf('%image.library.url%') >= 0)) || (sprite.name.indexOf('%group.badge.url%') >= 0)) && (data.width <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR)) && (data.height <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR))) + if(((((isSkewed || (sprite.name.indexOf('%image.library.url%') >= 0)) || (sprite.name.indexOf('%group.badge.url%') >= 0)) && (data.width <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR)) && (data.height <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR))) { //data.color = Canvas._Str_23439(sprite.sprite.texture).toString(); - if (sprite.sprite.name.indexOf('external_image_wallitem') === 0) + if(sprite.sprite.name.indexOf('external_image_wallitem') === 0) { data.frame = true; } @@ -113,18 +113,18 @@ export class RoomObjectCache } } - if (!spriteData || !spriteData.length) return null; + if(!spriteData || !spriteData.length) return null; return spriteData; } private isSkewedSprite(k: IRoomObjectSprite): boolean { - if (!k.type) return false; + if(!k.type) return false; - if ((k.type.indexOf('external_image_wallitem') === 0) && (k.tag === 'THUMBNAIL')) return true; + if((k.type.indexOf('external_image_wallitem') === 0) && (k.tag === 'THUMBNAIL')) return true; - if ((k.type.indexOf('guild_forum') === 0) && (k.tag === 'THUMBNAIL')) return true; + if((k.type.indexOf('guild_forum') === 0) && (k.tag === 'THUMBNAIL')) return true; return false; } @@ -133,11 +133,11 @@ export class RoomObjectCache { const sprites: SortableSprite[] = []; - for (const item of this._data.values()) + for(const item of this._data.values()) { - for (const sprite of item.sprites.sprites) + for(const sprite of item.sprites.sprites) { - if (sprite.sprite.spriteType === RoomObjectSpriteType.ROOM_PLANE) sprites.push(sprite); + if(sprite.sprite.spriteType === RoomObjectSpriteType.ROOM_PLANE) sprites.push(sprite); } } diff --git a/src/room/renderer/cache/RoomObjectLocationCacheItem.ts b/src/room/renderer/cache/RoomObjectLocationCacheItem.ts index 80bbe8b4..1ebb46d6 100644 --- a/src/room/renderer/cache/RoomObjectLocationCacheItem.ts +++ b/src/room/renderer/cache/RoomObjectLocationCacheItem.ts @@ -30,17 +30,17 @@ export class RoomObjectLocationCacheItem public updateLocation(object: IRoomObject, geometry: IRoomGeometry): IVector3D { - if (!object || !geometry) return null; + if(!object || !geometry) return null; let locationChanged = false; const location = object.getLocation(); - if ((geometry.updateId !== this._geometryUpdateId) || (object.updateCounter !== this._objectUpdateId)) + if((geometry.updateId !== this._geometryUpdateId) || (object.updateCounter !== this._objectUpdateId)) { this._objectUpdateId = object.updateCounter; - if ((geometry.updateId !== this._geometryUpdateId) || (location.x !== this._location.x) || (location.y !== this._location.y) || (location.z !== this._location.z)) + if((geometry.updateId !== this._geometryUpdateId) || (location.x !== this._location.x) || (location.y !== this._location.y) || (location.z !== this._location.z)) { this._geometryUpdateId = geometry.updateId; this._location.assign(location); @@ -51,25 +51,25 @@ export class RoomObjectLocationCacheItem this._locationChanged = locationChanged; - if (this._locationChanged) + if(this._locationChanged) { const screenLocation = geometry.getScreenPosition(location); - if (!screenLocation) return null; + if(!screenLocation) return null; const accurateZ = object.model.getValue(this._roomObjectVariableAccurateZ); - if (isNaN(accurateZ) || (accurateZ === 0)) + if(isNaN(accurateZ) || (accurateZ === 0)) { const rounded = new Vector3d(Math.round(location.x), Math.round(location.y), location.z); - if ((rounded.x !== location.x) || (rounded.y !== location.y)) + if((rounded.x !== location.x) || (rounded.y !== location.y)) { const roundedScreen = geometry.getScreenPosition(rounded); this._screenLocation.assign(screenLocation); - if (roundedScreen) this._screenLocation.z = roundedScreen.z; + if(roundedScreen) this._screenLocation.z = roundedScreen.z; } else { diff --git a/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts b/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts index 64edf21d..cef1b4ed 100644 --- a/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts +++ b/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts @@ -47,7 +47,7 @@ export class RoomObjectSortableSpriteCacheItem public needsUpdate(k: number, _arg_2: number): boolean { - if ((k === this._updateId1) && (_arg_2 === this._updateId2)) return false; + if((k === this._updateId1) && (_arg_2 === this._updateId2)) return false; this._updateId1 = k; this._updateId2 = _arg_2; @@ -57,15 +57,15 @@ export class RoomObjectSortableSpriteCacheItem public setSpriteCount(k: number): void { - if (k < this._sprites.length) + if(k < this._sprites.length) { let iterator = k; - while (iterator < this._sprites.length) + while(iterator < this._sprites.length) { const sprite = this._sprites[iterator]; - if (sprite) sprite.dispose(); + if(sprite) sprite.dispose(); iterator++; } diff --git a/src/room/renderer/utils/ExtendedSprite.ts b/src/room/renderer/utils/ExtendedSprite.ts index 4803ae35..e86fcc4b 100644 --- a/src/room/renderer/utils/ExtendedSprite.ts +++ b/src/room/renderer/utils/ExtendedSprite.ts @@ -35,7 +35,7 @@ export class ExtendedSprite extends Sprite public needsUpdate(pairedSpriteId: number, pairedSpriteUpdateCounter: number): boolean { - if ((this._pairedSpriteId === pairedSpriteId) && (this._pairedSpriteUpdateCounter === pairedSpriteUpdateCounter)) return false; + if((this._pairedSpriteId === pairedSpriteId) && (this._pairedSpriteUpdateCounter === pairedSpriteUpdateCounter)) return false; this._pairedSpriteId = pairedSpriteId; this._pairedSpriteUpdateCounter = pairedSpriteUpdateCounter; @@ -45,18 +45,18 @@ export class ExtendedSprite extends Sprite public calculateVertices(): void { - if (!this.texture.orig) return; + if(!this.texture.orig) return; super.calculateVertices(); } public setTexture(texture: Texture): void { - if (!texture) texture = Texture.EMPTY; + if(!texture) texture = Texture.EMPTY; - if (texture === this.texture) return; + if(texture === this.texture) return; - if (texture === Texture.EMPTY) + if(texture === Texture.EMPTY) { this._pairedSpriteId = -1; this._pairedSpriteUpdateCounter = -1; @@ -72,31 +72,31 @@ export class ExtendedSprite extends Sprite public static containsPoint(sprite: ExtendedSprite, point: Point): boolean { - if (!sprite || !point || (sprite.alphaTolerance > 255)) return false; + if(!sprite || !point || (sprite.alphaTolerance > 255)) return false; - if (!(sprite instanceof Sprite)) return false; + if(!(sprite instanceof Sprite)) return false; - if ((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return; + if((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return; const texture = sprite.texture; const baseTexture = texture.baseTexture; - if (!texture || !baseTexture || !baseTexture.valid) return false; + if(!texture || !baseTexture || !baseTexture.valid) return false; const x = (point.x * sprite.scale.x); const y = (point.y * sprite.scale.y); - if (!sprite.getLocalBounds().contains(x, y)) return false; + if(!sprite.getLocalBounds().contains(x, y)) return false; //@ts-ignore - if (!baseTexture.hitMap) + if(!baseTexture.hitMap) { let canvas: HTMLCanvasElement = null; - if (!baseTexture.resource) + if(!baseTexture.resource) { //@ts-ignore - if (!texture.getLocalBounds) + if(!texture.getLocalBounds) { const tempSprite = new NitroSprite(texture); @@ -110,7 +110,7 @@ export class ExtendedSprite extends Sprite } } - if (!ExtendedSprite.generateHitMap(baseTexture, canvas)) return false; + if(!ExtendedSprite.generateHitMap(baseTexture, canvas)) return false; } //@ts-ignore @@ -119,7 +119,7 @@ export class ExtendedSprite extends Sprite let dx = (x + texture.frame.x); let dy = (y + texture.frame.y); - if (texture.trim) + if(texture.trim) { dx -= texture.trim.x; dy -= texture.trim.y; @@ -140,27 +140,27 @@ export class ExtendedSprite extends Sprite let canvas: HTMLCanvasElement = null; let context: CanvasRenderingContext2D = null; - if (tempCanvas) + if(tempCanvas) { canvas = tempCanvas; context = canvas.getContext('2d'); } else { - if (!baseTexture.resource) return false; + if(!baseTexture.resource) return false; //@ts-ignore const source = baseTexture.resource.source as HTMLCanvasElement; - if (!source) return false; + if(!source) return false; - if (source.getContext) + if(source.getContext) { canvas = source; context = canvas.getContext('2d'); } - else if (source instanceof Image) + else if(source instanceof Image) { canvas = document.createElement('canvas'); canvas.width = source.width; @@ -180,12 +180,12 @@ export class ExtendedSprite extends Sprite const hitmap = new Uint32Array(Math.ceil(width * height / 32)); const threshold = 128; - for (let i = 0; i < width * height; i++) + for(let i = 0; i < width * height; i++) { const ind1 = i % 32; const ind2 = i / 32 | 0; - if (imageData.data[i * 4 + 3] >= threshold) + if(imageData.data[i * 4 + 3] >= threshold) { hitmap[ind2] = hitmap[ind2] | (1 << ind1); } diff --git a/src/room/utils/ColorConverter.ts b/src/room/utils/ColorConverter.ts index bff18b18..839f167e 100644 --- a/src/room/utils/ColorConverter.ts +++ b/src/room/utils/ColorConverter.ts @@ -67,15 +67,15 @@ export class ColorConverter let _local_8 = 0; let _local_9 = 0; let _local_10 = 0; - if (_local_7 == 0) + if(_local_7 == 0) { _local_8 = 0; } else { - if (_local_5 == _local_2) + if(_local_5 == _local_2) { - if (_local_3 > _local_4) + if(_local_3 > _local_4) { _local_8 = ((60 * (_local_3 - _local_4)) / _local_7); } @@ -86,13 +86,13 @@ export class ColorConverter } else { - if (_local_5 == _local_3) + if(_local_5 == _local_3) { _local_8 = (((60 * (_local_4 - _local_2)) / _local_7) + 120); } else { - if (_local_5 == _local_4) + if(_local_5 == _local_4) { _local_8 = (((60 * (_local_2 - _local_3)) / _local_7) + 240); } @@ -100,13 +100,13 @@ export class ColorConverter } } _local_9 = (0.5 * (_local_5 + _local_6)); - if (_local_7 == 0) + if(_local_7 == 0) { _local_10 = 0; } else { - if (_local_9 <= 0.5) + if(_local_9 <= 0.5) { _local_10 = ((_local_7 / _local_9) * 0.5); } @@ -135,11 +135,11 @@ export class ColorConverter let _local_5 = 0; let _local_6 = 0; let _local_7 = 0; - if (_local_3 > 0) + if(_local_3 > 0) { _local_12 = 0; _local_13 = 0; - if (_local_4 < 0.5) + if(_local_4 < 0.5) { _local_12 = (_local_4 * (1 + _local_3)); } @@ -151,52 +151,52 @@ export class ColorConverter _local_14 = (_local_2 + (1 / 3)); _local_15 = _local_2; _local_16 = (_local_2 - (1 / 3)); - if (_local_14 < 0) + if(_local_14 < 0) { _local_14 = (_local_14 + 1); } else { - if (_local_14 > 1) + if(_local_14 > 1) { _local_14--; } } - if (_local_15 < 0) + if(_local_15 < 0) { _local_15 = (_local_15 + 1); } else { - if (_local_15 > 1) + if(_local_15 > 1) { _local_15--; } } - if (_local_16 < 0) + if(_local_16 < 0) { _local_16 = (_local_16 + 1); } else { - if (_local_16 > 1) + if(_local_16 > 1) { _local_16--; } } - if ((_local_14 * 6) < 1) + if((_local_14 * 6) < 1) { _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_14)); } else { - if ((_local_14 * 2) < 1) + if((_local_14 * 2) < 1) { _local_5 = _local_12; } else { - if ((_local_14 * 3) < 2) + if((_local_14 * 3) < 2) { _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_14))); } @@ -206,19 +206,19 @@ export class ColorConverter } } } - if ((_local_15 * 6) < 1) + if((_local_15 * 6) < 1) { _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_15)); } else { - if ((_local_15 * 2) < 1) + if((_local_15 * 2) < 1) { _local_6 = _local_12; } else { - if ((_local_15 * 3) < 2) + if((_local_15 * 3) < 2) { _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_15))); } @@ -228,19 +228,19 @@ export class ColorConverter } } } - if ((_local_16 * 6) < 1) + if((_local_16 * 6) < 1) { _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_16)); } else { - if ((_local_16 * 2) < 1) + if((_local_16 * 2) < 1) { _local_7 = _local_12; } else { - if ((_local_16 * 3) < 2) + if((_local_16 * 3) < 2) { _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_16))); } @@ -269,7 +269,7 @@ export class ColorConverter let _local_2: number = (((k >> 16) & 0xFF) / 0xFF); let _local_3: number = (((k >> 8) & 0xFF) / 0xFF); let _local_4: number = (((k >> 0) & 0xFF) / 0xFF); - if (_local_2 > 0.04045) + if(_local_2 > 0.04045) { _local_2 = Math.pow(((_local_2 + 0.055) / 1.055), 2.4); } @@ -277,7 +277,7 @@ export class ColorConverter { _local_2 = (_local_2 / 12.92); } - if (_local_3 > 0.04045) + if(_local_3 > 0.04045) { _local_3 = Math.pow(((_local_3 + 0.055) / 1.055), 2.4); } @@ -285,7 +285,7 @@ export class ColorConverter { _local_3 = (_local_3 / 12.92); } - if (_local_4 > 0.04045) + if(_local_4 > 0.04045) { _local_4 = Math.pow(((_local_4 + 0.055) / 1.055), 2.4); } @@ -304,7 +304,7 @@ export class ColorConverter let _local_2: number = (k.x / 95.047); let _local_3: number = (k.y / 100); let _local_4: number = (k.z / 108.883); - if (_local_2 > 0.008856) + if(_local_2 > 0.008856) { _local_2 = Math.pow(_local_2, (1 / 3)); } @@ -312,7 +312,7 @@ export class ColorConverter { _local_2 = ((7.787 * _local_2) + (16 / 116)); } - if (_local_3 > 0.008856) + if(_local_3 > 0.008856) { _local_3 = Math.pow(_local_3, (1 / 3)); } @@ -320,7 +320,7 @@ export class ColorConverter { _local_3 = ((7.787 * _local_3) + (16 / 116)); } - if (_local_4 > 0.008856) + if(_local_4 > 0.008856) { _local_4 = Math.pow(_local_4, (1 / 3)); } diff --git a/src/room/utils/Rasterizer.ts b/src/room/utils/Rasterizer.ts index 1a534fbd..2fc1420b 100644 --- a/src/room/utils/Rasterizer.ts +++ b/src/room/utils/Rasterizer.ts @@ -65,7 +65,7 @@ export class Rasterizer public static getFlipHBitmapData(k: Texture): Texture { - if (!k) return null; + if(!k) return null; const matrix = new Matrix(); @@ -87,7 +87,7 @@ export class Rasterizer public static getFlipVBitmapData(k: Texture): Texture { - if (!k) return null; + if(!k) return null; const matrix = new Matrix(); @@ -109,7 +109,7 @@ export class Rasterizer public static getFlipHVBitmapData(k: Texture): Texture { - if (!k) return null; + if(!k) return null; const matrix = new Matrix(); diff --git a/src/room/utils/RoomEnterEffect.ts b/src/room/utils/RoomEnterEffect.ts index 49d0d505..9e8fd201 100644 --- a/src/room/utils/RoomEnterEffect.ts +++ b/src/room/utils/RoomEnterEffect.ts @@ -25,11 +25,11 @@ export class RoomEnterEffect public static turnVisualizationOn(): void { - if ((RoomEnterEffect._state === RoomEnterEffect.STATE_NOT_INITIALIZED) || (RoomEnterEffect._state === RoomEnterEffect.STATE_OVER)) return; + if((RoomEnterEffect._state === RoomEnterEffect.STATE_NOT_INITIALIZED) || (RoomEnterEffect._state === RoomEnterEffect.STATE_OVER)) return; const k = (PixiApplicationProxy.instance.ticker.lastTime - RoomEnterEffect._initializationTimeMs); - if (k > (RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs)) + if(k > (RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs)) { RoomEnterEffect._state = RoomEnterEffect.STATE_OVER; @@ -38,7 +38,7 @@ export class RoomEnterEffect RoomEnterEffect._visualizationOn = true; - if (k < RoomEnterEffect._startDelayMs) + if(k < RoomEnterEffect._startDelayMs) { RoomEnterEffect._state = RoomEnterEffect.STATE_START_DELAY; @@ -61,7 +61,7 @@ export class RoomEnterEffect public static isRunning(): boolean { - if ((RoomEnterEffect._state === RoomEnterEffect.STATE_START_DELAY) || (RoomEnterEffect._state === RoomEnterEffect.STATE_RUNNING)) return true; + if((RoomEnterEffect._state === RoomEnterEffect.STATE_START_DELAY) || (RoomEnterEffect._state === RoomEnterEffect.STATE_RUNNING)) return true; return false; } diff --git a/src/room/utils/RoomGeometry.ts b/src/room/utils/RoomGeometry.ts index ec555b03..cfef44a0 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; } @@ -82,12 +82,12 @@ export class RoomGeometry implements IRoomGeometry public set scale(k: number) { - if (k <= 1) + if(k <= 1) { k = 1; } k = (k * Math.sqrt(0.5)); - if (k != this._scale) + if(k != this._scale) { this._scale = k; this._updateId++; @@ -110,11 +110,11 @@ export class RoomGeometry implements IRoomGeometry public set location(k: IVector3D) { - if (k == null) + if(k == null) { return; } - if (this._loc == null) + if(this._loc == null) { this._loc = new Vector3d(); } @@ -125,7 +125,7 @@ export class RoomGeometry implements IRoomGeometry 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++; } @@ -143,11 +143,11 @@ export class RoomGeometry implements IRoomGeometry let _local_23: IVector3D; let _local_24: IVector3D; let _local_25: IVector3D; - if (k == null) + if(k == null) { return; } - if (this._dir == null) + if(this._dir == null) { this._dir = new Vector3d(); } @@ -156,7 +156,7 @@ export class RoomGeometry implements IRoomGeometry 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)))) + if((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) { this._updateId++; } @@ -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); @@ -199,7 +199,7 @@ export class RoomGeometry implements IRoomGeometry public set x_scale(k: number) { - if (this._x_scale != (k * this._x_scale_internal)) + if(this._x_scale != (k * this._x_scale_internal)) { this._x_scale = (k * this._x_scale_internal); this._updateId++; @@ -208,7 +208,7 @@ export class RoomGeometry implements IRoomGeometry public set y_scale(k: number) { - if (this._y_scale != (k * this._y_scale_internal)) + if(this._y_scale != (k * this._y_scale_internal)) { this._y_scale = (k * this._y_scale_internal); this._updateId++; @@ -217,7 +217,7 @@ export class RoomGeometry implements IRoomGeometry public set z_scale(k: number) { - if (this._z_scale != (k * this._z_scale_internal)) + if(this._z_scale != (k * this._z_scale_internal)) { this._z_scale = (k * 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/RoomRotatingEffect.ts b/src/room/utils/RoomRotatingEffect.ts index ba844119..da60956f 100644 --- a/src/room/utils/RoomRotatingEffect.ts +++ b/src/room/utils/RoomRotatingEffect.ts @@ -26,13 +26,13 @@ export class RoomRotatingEffect public static turnVisualizationOn(): void { - if ((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; - if (!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); const _local_1 = (PixiApplicationProxy.instance.ticker.lastTime - this._SafeStr_4514); - if (_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) { this._SafeStr_448 = 3; @@ -41,7 +41,7 @@ export class RoomRotatingEffect this._SafeStr_4512 = true; - if (_local_1 < this._SafeStr_4515) + if(_local_1 < this._SafeStr_4515) { this._SafeStr_448 = 1; @@ -68,7 +68,7 @@ export class RoomRotatingEffect private static isRunning(): boolean { - if ((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; return false; } diff --git a/src/room/utils/RoomShakingEffect.ts b/src/room/utils/RoomShakingEffect.ts index e8b68f83..94f76aac 100644 --- a/src/room/utils/RoomShakingEffect.ts +++ b/src/room/utils/RoomShakingEffect.ts @@ -26,13 +26,13 @@ export class RoomShakingEffect public static turnVisualizationOn(): void { - if ((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; - if (!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); const _local_1 = (PixiApplicationProxy.instance.ticker.lastTime - this._SafeStr_4514); - if (_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) { this._SafeStr_448 = 3; @@ -41,7 +41,7 @@ export class RoomShakingEffect this._SafeStr_4512 = true; - if (_local_1 < this._SafeStr_4515) + if(_local_1 < this._SafeStr_4515) { this._SafeStr_448 = 1; @@ -68,7 +68,7 @@ export class RoomShakingEffect private static isRunning(): boolean { - if ((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; return false; }