mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-22 23:50:52 +01:00
More updates
This commit is contained in:
parent
4def01225f
commit
39dcab0600
@ -35,11 +35,20 @@ export class EffectConverter extends SWFConverter
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._effectDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
await this._effectDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
||||||
|
{
|
||||||
|
if(!habboAssetSwf)
|
||||||
|
{
|
||||||
|
spinner.text = 'Couldnt convert effect: ' + className;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
spinner.text = 'Parsing Effect: ' + habboAssetSwf.getDocumentClass();
|
spinner.text = 'Parsing Effect: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
}
|
||||||
|
|
||||||
spinner.render();
|
spinner.render();
|
||||||
|
|
||||||
|
if(!habboAssetSwf) return;
|
||||||
|
|
||||||
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
||||||
const assetData = await this.mapXML2JSON(habboAssetSwf, className);
|
const assetData = await this.mapXML2JSON(habboAssetSwf, className);
|
||||||
|
|
||||||
|
@ -35,11 +35,20 @@ export class FigureConverter extends SWFConverter
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._figureDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
await this._figureDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
||||||
|
{
|
||||||
|
if(!habboAssetSwf)
|
||||||
|
{
|
||||||
|
spinner.text = 'Couldnt convert figure: ' + className;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
spinner.text = 'Parsing Figure: ' + habboAssetSwf.getDocumentClass();
|
spinner.text = 'Parsing Figure: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
}
|
||||||
|
|
||||||
spinner.render();
|
spinner.render();
|
||||||
|
|
||||||
|
if(!habboAssetSwf) return;
|
||||||
|
|
||||||
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
||||||
const assetData = await this.mapXML2JSON(habboAssetSwf, className);
|
const assetData = await this.mapXML2JSON(habboAssetSwf, className);
|
||||||
|
|
||||||
|
@ -36,12 +36,21 @@ export class FurnitureConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._furniDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
|
await this._furniDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
||||||
|
{
|
||||||
|
if(!habboAssetSwf)
|
||||||
|
{
|
||||||
|
spinner.text = 'Couldnt convert furni: ' + className;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
spinner.text = (`Parsing Furniture: ${ habboAssetSwf.getDocumentClass() } (${ (this._furniDownloader.totalFinished + 1) } / ${ this._furniDownloader.totalItems })`);
|
spinner.text = (`Parsing Furniture: ${ habboAssetSwf.getDocumentClass() } (${ (this._furniDownloader.totalFinished + 1) } / ${ this._furniDownloader.totalItems })`);
|
||||||
|
}
|
||||||
|
|
||||||
spinner.render();
|
spinner.render();
|
||||||
|
|
||||||
|
if(!habboAssetSwf) return;
|
||||||
|
|
||||||
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
||||||
const assetData = await this.mapXML2JSON(habboAssetSwf, 'furniture');
|
const assetData = await this.mapXML2JSON(habboAssetSwf, 'furniture');
|
||||||
|
|
||||||
|
@ -34,12 +34,21 @@ export class PetConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._petDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
|
await this._petDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
|
||||||
|
{
|
||||||
|
if(!habboAssetSwf)
|
||||||
|
{
|
||||||
|
spinner.text = 'Couldnt convert pet: ' + className;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
spinner.text = 'Parsing Pet: ' + habboAssetSwf.getDocumentClass();
|
spinner.text = 'Parsing Pet: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
}
|
||||||
|
|
||||||
spinner.render();
|
spinner.render();
|
||||||
|
|
||||||
|
if(!habboAssetSwf) return;
|
||||||
|
|
||||||
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
const spriteBundle = await this._bundleProvider.generateSpriteSheet(habboAssetSwf);
|
||||||
const assetData = await this.mapXML2JSON(habboAssetSwf, 'pet');
|
const assetData = await this.mapXML2JSON(habboAssetSwf, 'pet');
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export class PetDownloader
|
|||||||
private readonly _logger: Logger)
|
private readonly _logger: Logger)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF) => Promise<void>): Promise<void>
|
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
|
||||||
{
|
{
|
||||||
const petTypes = await this.parsePetTypes();
|
const petTypes = await this.parsePetTypes();
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export class PetDownloader
|
|||||||
return petTypes;
|
return petTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async extractPet(className: string, callback: (habboAssetSwf: HabboAssetSWF) => Promise<void>): Promise<void>
|
public async extractPet(className: string, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
|
||||||
{
|
{
|
||||||
let url = this._configuration.getValue('dynamic.download.pet.url');
|
let url = this._configuration.getValue('dynamic.download.pet.url');
|
||||||
|
|
||||||
@ -78,6 +78,6 @@ export class PetDownloader
|
|||||||
|
|
||||||
await newHabboAssetSWF.setupAsync();
|
await newHabboAssetSWF.setupAsync();
|
||||||
|
|
||||||
await callback(newHabboAssetSWF);
|
await callback(newHabboAssetSWF, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,6 +294,8 @@ function readSWFTags(buff, swf)
|
|||||||
*/
|
*/
|
||||||
function readSWFBuff(buff, compressed_buff, next)
|
function readSWFBuff(buff, compressed_buff, next)
|
||||||
{
|
{
|
||||||
|
if(!buff) return next(null, null);
|
||||||
|
|
||||||
buff.seek(3);// start
|
buff.seek(3);// start
|
||||||
|
|
||||||
if(buff.length < 9)
|
if(buff.length < 9)
|
||||||
@ -359,28 +361,26 @@ function uncompress(swf, next)
|
|||||||
{
|
{
|
||||||
uncompressed_buff = concatSWFHeader(zlib.unzipSync(compressed_buff), swf);
|
uncompressed_buff = concatSWFHeader(zlib.unzipSync(compressed_buff), swf);
|
||||||
|
|
||||||
if(!Buffer.isBuffer(uncompressed_buff))
|
if(!Buffer.isBuffer(uncompressed_buff)) return null;
|
||||||
{
|
|
||||||
console.log('invalid_buffer');
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return readSWFBuff(new SWFBuffer(uncompressed_buff), swf);
|
return readSWFBuff(new SWFBuffer(uncompressed_buff), swf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Buffer.isBuffer(compressed_buff))
|
|
||||||
{
|
|
||||||
console.log('invalid_buffer');
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
zlib.inflate(compressed_buff, function(err, buf)
|
zlib.inflate(compressed_buff, function(err, buf)
|
||||||
|
{
|
||||||
|
if(!Buffer.isBuffer(compressed_buff))
|
||||||
|
{
|
||||||
|
readSWFBuff(null, swf, next);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
readSWFBuff(new SWFBuffer(buf), swf, next);
|
readSWFBuff(new SWFBuffer(buf), swf, next);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 0x46 : // uncompressed
|
case 0x46 : // uncompressed
|
||||||
|
if(!Buffer.isBuffer(swf)) return null;
|
||||||
|
|
||||||
return readSWFBuff(new SWFBuffer( swf ), swf, next);
|
return readSWFBuff(new SWFBuffer( swf ), swf, next);
|
||||||
case 0x5a : // LZMA compressed
|
case 0x5a : // LZMA compressed
|
||||||
var lzmaProperties = compressed_buff.slice(4, 9);
|
var lzmaProperties = compressed_buff.slice(4, 9);
|
||||||
@ -421,6 +421,8 @@ function uncompress(swf, next)
|
|||||||
lzma.decompress(lzmaProperties, input_stream, output_stream, -1);
|
lzma.decompress(lzmaProperties, input_stream, output_stream, -1);
|
||||||
uncompressed_buff = Buffer.concat([swf.slice(0, 8), output_stream.getBuffer()]);
|
uncompressed_buff = Buffer.concat([swf.slice(0, 8), output_stream.getBuffer()]);
|
||||||
|
|
||||||
|
if(!Buffer.isBuffer(uncompressed_buff)) return null;
|
||||||
|
|
||||||
return readSWFBuff(new SWFBuffer(uncompressed_buff), swf, next);
|
return readSWFBuff(new SWFBuffer(uncompressed_buff), swf, next);
|
||||||
default :
|
default :
|
||||||
e = new Error('Unknown SWF compressions');
|
e = new Error('Unknown SWF compressions');
|
||||||
|
@ -21,6 +21,9 @@ export class HabboAssetSWF
|
|||||||
async setupAsync()
|
async setupAsync()
|
||||||
{
|
{
|
||||||
const swf = await readSwfAsync(this._data);
|
const swf = await readSwfAsync(this._data);
|
||||||
|
|
||||||
|
if(!swf) return;
|
||||||
|
|
||||||
for(const tag of swf.tags)
|
for(const tag of swf.tags)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user