mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-22 23:50:52 +01:00
Further fixes
This commit is contained in:
parent
bc60a2b244
commit
7a7d913282
18
config.ini
18
config.ini
@ -1,18 +0,0 @@
|
||||
output.folder.furniture=/home/user/WebstormProjects/sites/assets.nitro.se/game/dcr/furniture-test/
|
||||
output.folder.figure=/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/figure-test/
|
||||
output.folder.effect=/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/effect-test/
|
||||
output.folder.pet=/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/pet-test/
|
||||
furnidata.url=http://assets.nitro.se/game/gamedata/furnidata-entry.xml
|
||||
figuremap.url=http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/figuremap.xml
|
||||
effectmap.url=http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/effectmap.xml
|
||||
external_vars.url=http://assets.nitro.se/game/gamedata/external_variables.txt
|
||||
dynamic.download.url.furniture=http://assets.nitro.se/game/dcr/endrit/hof_furni/%className%.swf
|
||||
dynamic.download.url.figure=http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf
|
||||
dynamic.download.url.effect=http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf
|
||||
dynamic.download.url.pet=http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf
|
||||
convert.furniture=0
|
||||
convert.figure=0
|
||||
convert.effect=1
|
||||
convert.pet=0
|
||||
figure.rotation.enabled=0
|
||||
figure.skip.non-existing.asset.images=0
|
@ -21,5 +21,6 @@
|
||||
"png-stream": "^1.0.5",
|
||||
"stream-to-array": "^2.3.0",
|
||||
"xml2js": "^0.4.23"
|
||||
}
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
20
src/config.json
Normal file
20
src/config.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"output.folder.furniture": "/home/user/WebstormProjects/sites/assets.nitro.se/game/dcr/furniture-test/",
|
||||
"output.folder.figure": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/figure-test/",
|
||||
"output.folder.effect": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/effect-test/",
|
||||
"output.folder.pet": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/pet-test/",
|
||||
"furnidata.url": "http://assets.nitro.se/game/gamedata/furnidata-entry.xml",
|
||||
"figuremap.url": "http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/figuremap.xml",
|
||||
"effectmap.url": "http://assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/effectmap.xml",
|
||||
"external_vars.url": "http://assets.nitro.se/game/gamedata/external_variables.txt",
|
||||
"dynamic.download.url.furniture": "/home/user/WebstormProjects/sites/assets.nitro.se/game/dcr/endrit/hof_furni/%className%.swf",
|
||||
"dynamic.download.url.figure": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf",
|
||||
"dynamic.download.url.effect": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf",
|
||||
"dynamic.download.url.pet": "/home/user/WebstormProjects/sites/assets.nitro.se/game/gordon/PRODUCTION-201701242205-837386173/%className%.swf",
|
||||
"convert.furniture": "1",
|
||||
"convert.figure": "0",
|
||||
"convert.effect": "0",
|
||||
"convert.pet": "0",
|
||||
"figure.rotation.enabled": "0",
|
||||
"figure.skip.non-existing.asset.images": "0"
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
const fs = require('fs/promises');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const config = require('../config.json');
|
||||
|
||||
export default class Configuration {
|
||||
|
||||
private readonly _config: Map<string, string>;
|
||||
@ -10,19 +12,8 @@ export default class Configuration {
|
||||
}
|
||||
|
||||
async init() {
|
||||
const content = await fs.readFile("/home/user/git/nitro-asset-converter-node/config.ini");
|
||||
|
||||
this.parseContent(content.toString("utf-8"));
|
||||
}
|
||||
|
||||
private parseContent(content: string) {
|
||||
const config: string[] = content.split("\n");
|
||||
for (const configEntry of config) {
|
||||
const configEntrySplit = configEntry.split("=");
|
||||
const configKey = configEntrySplit[0];
|
||||
const configValue = configEntrySplit[1];
|
||||
|
||||
this._config.set(configKey, configValue);
|
||||
for (const key of Object.keys(config)) {
|
||||
this._config.set(key, config[key]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +35,13 @@ export default class Configuration {
|
||||
const fetchData = await fetch(url);
|
||||
const textData = await fetchData.text();
|
||||
|
||||
this.parseContent(textData);
|
||||
const config: string[] = textData.split("\n");
|
||||
for (const configEntry of config) {
|
||||
const configEntrySplit = configEntry.split("=");
|
||||
const configKey = configEntrySplit[0];
|
||||
const configValue = configEntrySplit[1];
|
||||
|
||||
this._config.set(configKey, configValue);
|
||||
}
|
||||
}
|
||||
}
|
@ -69,7 +69,9 @@ export default class FurniJsonMapper {
|
||||
furniAsset.source = SpriteSheetConverter.imageSource.get(asset.name) as string;
|
||||
}
|
||||
|
||||
if (asset.x !== undefined)
|
||||
furniAsset.x = parseInt(asset.x.toString());
|
||||
if (asset.y !== undefined)
|
||||
furniAsset.y = parseInt(asset.y.toString());
|
||||
furniAsset.flipH = asset.flipH as any;
|
||||
assets[asset.name] = furniAsset;
|
||||
|
@ -67,8 +67,8 @@ export default class SpriteSheetConverter {
|
||||
async packImages(documentClass: string, outputFolder: string, images: Array<{ path: string, contents: Buffer }>): Promise<ArchiveType | null> {
|
||||
let options = {
|
||||
textureName: documentClass,
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
width: 3072,
|
||||
height: 2048,
|
||||
fixedSize: false,
|
||||
allowRotation: true,
|
||||
detectIdentical: true,
|
||||
|
@ -26,7 +26,7 @@ export default class FigureDownloader {
|
||||
for (const lib of map.lib) {
|
||||
const info = lib['$'];
|
||||
const className: string = info.id.split("\\*")[0];
|
||||
if (className === "hh_human_fx") {
|
||||
if (className === "hh_human_fx" || className === "hh_pets") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -39,6 +39,8 @@ export default class FigureDownloader {
|
||||
if (className !== "jacket_U_snowwar4_team1" &&
|
||||
className !== "jacket_U_snowwar4_team2") { //TODO: Figure out why snowstorm assets aren't converting...
|
||||
|
||||
if (className !== "hh_human_hats") continue;
|
||||
|
||||
const url = this._config.getValue("dynamic.download.url.figure").replace("%className%", className);
|
||||
let buffer: Buffer | null = null;
|
||||
|
||||
|
@ -104,9 +104,14 @@ export default class FurnitureDownloader {
|
||||
|
||||
async parseFurniData() {
|
||||
const furniDataFetch = this._config.getValue("furnidata.url");
|
||||
if (furniDataFetch.includes("http")) {
|
||||
const furniFetch = await fetch(furniDataFetch);
|
||||
const furniData = await furniFetch.text();
|
||||
|
||||
return await parser.parseStringPromise(furniData);
|
||||
} else {
|
||||
const content = await readFile(furniDataFetch);
|
||||
return await parser.parseStringPromise(content);
|
||||
}
|
||||
}
|
||||
}
|
@ -10,5 +10,9 @@
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/config.json",
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user