From b45890d589a2a84dfdcac278bd2ab79c2aa6f0f0 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 23 Feb 2021 13:58:56 -0500 Subject: [PATCH] Fix bugs --- src/Main.ts | 6 ------ src/configuration.json.example | 15 ++++++--------- src/converters/effect/EffectDownloader.ts | 4 ++++ src/converters/effectmap/EffectMapConverter.ts | 2 -- src/converters/figure/FigureDownloader.ts | 4 ++++ src/converters/figuremap/FigureMapConverter.ts | 2 -- src/converters/furniture/FurnitureDownloader.ts | 4 ++++ .../furnituredata/FurnitureDataConverter.ts | 2 -- src/mapping/xml/furnituredata/FurnitureDataXML.ts | 2 +- 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/Main.ts b/src/Main.ts index ed731fe..5984b86 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -3,12 +3,9 @@ import { container } from 'tsyringe'; import { Configuration } from './common/config/Configuration'; import { IConverter } from './common/converters/IConverter'; import { EffectConverter } from './converters/effect/EffectConverter'; -import { EffectMapConverter } from './converters/effectmap/EffectMapConverter'; import { ExternalTextsConverter } from './converters/externaltexts/ExternalTextsConverter'; import { FigureConverter } from './converters/figure/FigureConverter'; -import { FigureMapConverter } from './converters/figuremap/FigureMapConverter'; import { FurnitureConverter } from './converters/furniture/FurnitureConverter'; -import { FurnitureDataConverter } from './converters/furnituredata/FurnitureDataConverter'; import { PetConverter } from './converters/pet/PetConverter'; import { ProductDataConverter } from './converters/productdata/ProductDataConverter'; @@ -18,9 +15,6 @@ import { ProductDataConverter } from './converters/productdata/ProductDataConver await config.init(); const converters = [ - FigureMapConverter, - EffectMapConverter, - FurnitureDataConverter, ProductDataConverter, ExternalTextsConverter, FigureConverter, diff --git a/src/configuration.json.example b/src/configuration.json.example index 6348c8f..173be7c 100644 --- a/src/configuration.json.example +++ b/src/configuration.json.example @@ -12,13 +12,10 @@ "dynamic.download.furniture.url": "${flash.dynamic.download.url}%revision%/%className%.swf", "external.variables.url": "https://www.habbo.com/gamedata/external_variables/1", "external.texts.url": "${external.texts.txt}", - "convert.furnituredata": "1", - "convert.productdata": "1", - "convert.figuremap": "1", - "convert.effectmap": "1", - "convert.externaltexts": "1", - "convert.figure": "1", - "convert.effect": "1", - "convert.furniture": "1", - "convert.pet": "1" + "convert.productdata": "0", + "convert.externaltexts": "0", + "convert.figure": "0", + "convert.effect": "0", + "convert.furniture": "0", + "convert.pet": "0" } diff --git a/src/converters/effect/EffectDownloader.ts b/src/converters/effect/EffectDownloader.ts index 3e974a6..a524ae4 100644 --- a/src/converters/effect/EffectDownloader.ts +++ b/src/converters/effect/EffectDownloader.ts @@ -5,6 +5,7 @@ import { HabboAssetSWF } from '../../swf/HabboAssetSWF'; import File from '../../utils/File'; import { FileUtilities } from '../../utils/FileUtilities'; import { Logger } from '../../utils/Logger'; +import { EffectConverter } from './EffectConverter'; @singleton() export class EffectDownloader @@ -12,12 +13,15 @@ export class EffectDownloader public static EFFECT_TYPES: Map = new Map(); constructor( + private readonly _effectConverter: EffectConverter, private readonly _configuration: Configuration, private readonly _logger: Logger) {} public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise): Promise { + await this._effectConverter.convertAsync(); + const effectMap = await this.parseEffectMap(); const classNames: string[] = []; diff --git a/src/converters/effectmap/EffectMapConverter.ts b/src/converters/effectmap/EffectMapConverter.ts index 629fa79..1218419 100644 --- a/src/converters/effectmap/EffectMapConverter.ts +++ b/src/converters/effectmap/EffectMapConverter.ts @@ -23,8 +23,6 @@ export class EffectMapConverter extends Converter public async convertAsync(): Promise { - if(!this._configuration.getBoolean('convert.effectmap')) return; - const now = Date.now(); const spinner = ora('Preparing EffectMap').start(); diff --git a/src/converters/figure/FigureDownloader.ts b/src/converters/figure/FigureDownloader.ts index b790bcc..18bcb52 100644 --- a/src/converters/figure/FigureDownloader.ts +++ b/src/converters/figure/FigureDownloader.ts @@ -5,6 +5,7 @@ import { HabboAssetSWF } from '../../swf/HabboAssetSWF'; import File from '../../utils/File'; import { FileUtilities } from '../../utils/FileUtilities'; import { Logger } from '../../utils/Logger'; +import { FigureConverter } from './FigureConverter'; @singleton() export class FigureDownloader @@ -12,12 +13,15 @@ export class FigureDownloader public static FIGURE_TYPES: Map = new Map(); constructor( + private readonly _figureConverter: FigureConverter, private readonly _configuration: Configuration, private readonly _logger: Logger) {} public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise): Promise { + await this._figureConverter.convertAsync(); + const figureMap = await this.parseFigureMap(); const classNames: string[] = []; diff --git a/src/converters/figuremap/FigureMapConverter.ts b/src/converters/figuremap/FigureMapConverter.ts index 4234475..14a5fc2 100644 --- a/src/converters/figuremap/FigureMapConverter.ts +++ b/src/converters/figuremap/FigureMapConverter.ts @@ -23,8 +23,6 @@ export class FigureMapConverter extends Converter public async convertAsync(): Promise { - if(!this._configuration.getBoolean('convert.figuremap')) return; - const now = Date.now(); const spinner = ora('Preparing FigureMap').start(); diff --git a/src/converters/furniture/FurnitureDownloader.ts b/src/converters/furniture/FurnitureDownloader.ts index fa853fb..ad26879 100644 --- a/src/converters/furniture/FurnitureDownloader.ts +++ b/src/converters/furniture/FurnitureDownloader.ts @@ -5,17 +5,21 @@ import { HabboAssetSWF } from '../../swf/HabboAssetSWF'; import File from '../../utils/File'; import { FileUtilities } from '../../utils/FileUtilities'; import { Logger } from '../../utils/Logger'; +import { FurnitureDataConverter } from '../furnituredata/FurnitureDataConverter'; @singleton() export class FurnitureDownloader { constructor( + private readonly _furnitureDataConverter: FurnitureDataConverter, private readonly _configuration: Configuration, private readonly _logger: Logger) {} public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise): Promise { + this._furnitureDataConverter.convertAsync(); + const furniData = await this.parseFurniData(); if(!furniData) throw new Error('invalid_furnidata'); diff --git a/src/converters/furnituredata/FurnitureDataConverter.ts b/src/converters/furnituredata/FurnitureDataConverter.ts index d142134..178f352 100644 --- a/src/converters/furnituredata/FurnitureDataConverter.ts +++ b/src/converters/furnituredata/FurnitureDataConverter.ts @@ -23,8 +23,6 @@ export class FurnitureDataConverter extends Converter public async convertAsync(): Promise { - if(!this._configuration.getBoolean('convert.furnituredata')) return; - const now = Date.now(); const spinner = ora('Preparing FurnitureData').start(); diff --git a/src/mapping/xml/furnituredata/FurnitureDataXML.ts b/src/mapping/xml/furnituredata/FurnitureDataXML.ts index a0deb45..ea04085 100644 --- a/src/mapping/xml/furnituredata/FurnitureDataXML.ts +++ b/src/mapping/xml/furnituredata/FurnitureDataXML.ts @@ -34,7 +34,7 @@ export class FurnitureDataXML if(furniTypes !== undefined) { - if(Array.isArray(furniTypes)) for(const furniType in furniTypes) this._wallItems.push(new FurnitureTypeXML('wall', furniType)); + if(Array.isArray(furniTypes)) for(const furniType of furniTypes) this._wallItems.push(new FurnitureTypeXML('wall', furniType)); } } }