|
@@ -8,8 +8,9 @@ import defaultProcess from "./src/defaultProcess.js";
|
|
|
import npcInit from "./src/npcInit.js";
|
|
|
import skillDefinitions from "./src/skillDefinitions.js";
|
|
|
import wardrobeItems from "./src/wardrobeItems.js";
|
|
|
+import wardrobeItemsTypes from "./src/wardrobeItemsTypes.js";
|
|
|
|
|
|
-
|
|
|
+const thisFilesHash = md5(fs.readFileSync(__filename,{encoding: 'utf8'}));
|
|
|
|
|
|
//https://stackoverflow.com/a/25221100/7200161
|
|
|
function baseFileName(fullpath){
|
|
@@ -53,7 +54,7 @@ function convertFile(task){
|
|
|
const qsrc2twResult = JSON.parse(qsrc2twResultMatch[1]);
|
|
|
|
|
|
if((qsrc2twResult.code && codeHash == qsrc2twResult.code) &&
|
|
|
- (qsrc2twResult.version && VERSION == qsrc2twResult.version)){
|
|
|
+ (qsrc2twResult.version && thisFilesHash == qsrc2twResult.version)){
|
|
|
return [0,"EXISTS"];
|
|
|
}
|
|
|
}
|
|
@@ -91,6 +92,7 @@ function convertFile(task){
|
|
|
case "npcInit": convertFunction = (code,options) => npcInit(code); break;
|
|
|
case "stat_sklattrib_lvlset": convertFunction = (code,options) => skillDefinitions(code); break;
|
|
|
case "wardrobeItems": convertFunction = (code,options) => wardrobeItems(code,options); break;
|
|
|
+ case "wardrobeItemsTypes": convertFunction = (code,options) => wardrobeItemsTypes(code,options); break;
|
|
|
default:
|
|
|
console.warn("Unreckognized Convert Mode");
|
|
|
break;
|
|
@@ -119,7 +121,7 @@ function convertFile(task){
|
|
|
return [2,"Invalid convertFunction"];
|
|
|
}else{
|
|
|
twineCode = twineCodeRaw.split('\n')
|
|
|
- .toSpliced(1,0,`<!--qsrc2twResult={"version":${VERSION},"code":"${codeHash}","time":"${(new Date().toISOString())}"}-->`)
|
|
|
+ .toSpliced(1,0,`<!--qsrc2twResult={"version":"${thisFilesHash}","code":"${codeHash}","time":"${(new Date().toISOString())}"}-->`)
|
|
|
.join('\n');
|
|
|
fs.writeFile(outFilePath, twineCode, err => {
|
|
|
if (err) {
|
|
@@ -160,4 +162,4 @@ function convertFile(task){
|
|
|
|
|
|
parentPort.on('message', (task) => {
|
|
|
parentPort.postMessage(convertFile(task));
|
|
|
-});
|
|
|
+});
|