|
|
|
@ -86,7 +86,7 @@ function update(){ |
|
|
|
|
async(err,data)=>{ |
|
|
|
|
var fileContents = data.toString().split("\n"); |
|
|
|
|
if (fileContents.length>=387){ |
|
|
|
|
for (i=0;i<fileContents.length;i++){ |
|
|
|
|
for (var i=0;i<fileContents.length;i++){ |
|
|
|
|
line=fileContents[i] |
|
|
|
|
item=line.split(" ") |
|
|
|
|
if (i==385){ |
|
|
|
@ -100,7 +100,11 @@ function update(){ |
|
|
|
|
if (fileContents[387].split(" ")[0]!=0){ |
|
|
|
|
var tempLine=fileContents[387].split(" ")[0] |
|
|
|
|
var tempLineAmt=fileContents[386].split(" ")[0] |
|
|
|
|
var itemObj={id:Number(tempLine)} |
|
|
|
|
var itemID=Number(tempLine); |
|
|
|
|
if (itemID>1000000){ |
|
|
|
|
itemID-=1000000 |
|
|
|
|
} |
|
|
|
|
var itemObj={id:itemID} |
|
|
|
|
await getItemData(itemObj) |
|
|
|
|
var fileData=fs.readFileSync("goalamt.txt") |
|
|
|
|
if (fileData!=0){ |
|
|
|
@ -128,16 +132,18 @@ function update(){ |
|
|
|
|
itemHQ=hq==="0"?false:true |
|
|
|
|
newItem={"id":Number(itemID),"amt":Number(itemAmt),"hq":itemHQ} |
|
|
|
|
//console.log(itemID+" x"+itemAmt+" "+(itemHQ))
|
|
|
|
|
if(firstLoad){ |
|
|
|
|
await getItemData(newItem) |
|
|
|
|
finalData=[...finalData,newItem] |
|
|
|
|
}else |
|
|
|
|
if (finalData[i]!==undefined&&(Number.isInteger(finalData[i].id)^Number.isInteger(itemID))){ |
|
|
|
|
if (finalData[i].id!=Number(itemID)||finalData[i].amt!==Number(itemAmt)||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
|
if (i<=384){ |
|
|
|
|
if(firstLoad){ |
|
|
|
|
await getItemData(newItem) |
|
|
|
|
console.log(JSON.stringify(finalData[i])+" !== "+JSON.stringify(newItem)) |
|
|
|
|
finalData[i]=newItem |
|
|
|
|
changed=true; |
|
|
|
|
finalData=[...finalData,newItem] |
|
|
|
|
}else |
|
|
|
|
if (finalData[i]!==undefined&&(Number.isInteger(finalData[i].id)^Number.isInteger(itemID))){ |
|
|
|
|
if (finalData[i].id!=Number(itemID)||finalData[i].amt!==Number(itemAmt)||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
|
await getItemData(newItem) |
|
|
|
|
console.log(JSON.stringify(finalData[i])+" !== "+JSON.stringify(newItem)) |
|
|
|
|
finalData[i]=newItem |
|
|
|
|
changed=true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|