mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-29 18:50:51 +01:00
Merge branch 'master' of https://git.krews.org/nitro/nitro-converter
This commit is contained in:
commit
f37a028fc1
@ -36,7 +36,7 @@ export class FurnitureConverter extends SWFConverter
|
||||
{
|
||||
await this._furniDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
|
||||
{
|
||||
spinner.text = 'Parsing Furniture: ' + habboAssetSwf.getDocumentClass();
|
||||
spinner.text = (`Parsing Furniture: ${ habboAssetSwf.getDocumentClass() } (${ this._furniDownloader.totalFinished } / ${ this._furniDownloader.totalItems })`);
|
||||
|
||||
spinner.render();
|
||||
|
||||
|
@ -10,6 +10,9 @@ import { FurnitureDataConverter } from '../furnituredata/FurnitureDataConverter'
|
||||
@singleton()
|
||||
export class FurnitureDownloader
|
||||
{
|
||||
private _totalItems: number = 0;
|
||||
private _totalFinished: number = 0;
|
||||
|
||||
constructor(
|
||||
private readonly _furnitureDataConverter: FurnitureDataConverter,
|
||||
private readonly _configuration: Configuration,
|
||||
@ -25,6 +28,7 @@ export class FurnitureDownloader
|
||||
if(!furniData) throw new Error('invalid_furnidata');
|
||||
|
||||
const classNames: string[] = [];
|
||||
const revisions: number[] = [];
|
||||
|
||||
if(furniData.roomitemtypes !== undefined)
|
||||
{
|
||||
@ -42,17 +46,7 @@ export class FurnitureDownloader
|
||||
if(classNames.indexOf(className) >= 0) continue;
|
||||
|
||||
classNames.push(className);
|
||||
|
||||
try
|
||||
{
|
||||
await this.extractFurniture(revision, className, callback);
|
||||
}
|
||||
|
||||
catch (error)
|
||||
{
|
||||
console.log();
|
||||
console.error(`Error parsing ${ className }: ` + error.message);
|
||||
}
|
||||
revisions.push(revision);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,6 +67,19 @@ export class FurnitureDownloader
|
||||
if(classNames.indexOf(className) >= 0) continue;
|
||||
|
||||
classNames.push(className);
|
||||
revisions.push(revision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._totalItems = classNames.length;
|
||||
|
||||
this._totalFinished = 0;
|
||||
|
||||
while(this._totalFinished < this._totalItems)
|
||||
{
|
||||
const className = classNames[this._totalFinished];
|
||||
const revision = revisions[this._totalFinished];
|
||||
|
||||
try
|
||||
{
|
||||
@ -86,8 +93,8 @@ export class FurnitureDownloader
|
||||
|
||||
this._logger.logError(`Error parsing ${ className }: ` + error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._totalFinished++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,4 +130,14 @@ export class FurnitureDownloader
|
||||
|
||||
await callback(newHabboAssetSWF, className);
|
||||
}
|
||||
|
||||
public get totalItems(): number
|
||||
{
|
||||
return this._totalItems;
|
||||
}
|
||||
|
||||
public get totalFinished(): number
|
||||
{
|
||||
return this._totalFinished;
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ export class AssetMapper extends Mapper
|
||||
if(assetXML.y !== undefined) asset.y = assetXML.y;
|
||||
if(assetXML.flipH !== undefined) asset.flipH = assetXML.flipH;
|
||||
if(assetXML.flipV !== undefined) asset.flipV = assetXML.flipV;
|
||||
if(assetXML.usesPalette !== undefined) asset.usesPalette = assetXML.usesPalette;
|
||||
|
||||
output[assetXML.name] = asset;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ export class VisualizationMapper extends Mapper
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
|
||||
const i = 0;
|
||||
let i = 0;
|
||||
|
||||
for(const offsetXML of xml)
|
||||
{
|
||||
@ -316,6 +316,8 @@ export class VisualizationMapper extends Mapper
|
||||
if(offsetXML.y !== undefined) offset.y = offsetXML.y;
|
||||
|
||||
output[i.toString()] = offset;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ export class AssetXML
|
||||
private readonly _y: number;
|
||||
private readonly _flipH: boolean;
|
||||
private readonly _flipV: boolean;
|
||||
private readonly _usesPalette: number;
|
||||
private readonly _usesPalette: boolean;
|
||||
|
||||
constructor(asset: any)
|
||||
{
|
||||
@ -20,7 +20,7 @@ export class AssetXML
|
||||
if(attributes.x !== undefined) this._y = parseInt(attributes.y);
|
||||
if(attributes.flipH !== undefined) this._flipH = (attributes.flipH === '1');
|
||||
if(attributes.flipV !== undefined) this._flipV = (attributes.flipV === '1');
|
||||
if(attributes.usesPalette !== undefined) this._usesPalette = parseInt(attributes.usesPalette);
|
||||
if(attributes.usesPalette !== undefined) this._usesPalette = (attributes.usesPalette === '1');
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ export class AssetXML
|
||||
return this._flipV;
|
||||
}
|
||||
|
||||
public get usesPalette(): number
|
||||
public get usesPalette(): boolean
|
||||
{
|
||||
return this._usesPalette;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user