-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixdialogues.js
More file actions
39 lines (30 loc) · 995 Bytes
/
Copy pathfixdialogues.js
File metadata and controls
39 lines (30 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";
function fixDialogues(path) {
let file = path + "dialogue.json";
let dialogues = json.parse(json.read(file));
let count = 0;
for (let id in dialogues) {
let dialogue = dialogues[id];
for (let m of dialogue.messages) {
if (m.hasOwnProperty("items")) {
for (let it in m.items.data) {
let item = m.items.data[it];
if (!item.hasOwnProperty("slotId")) {
item["parentId"] = m.items.stash;
item["slotId"] = "main";
count++;
}
}
}
}
}
json.write(file, dialogues);
console.log("Fixed " + count + " items");
}
/* show name in window */
process.stdout.setEncoding('utf8');
process.title = "Sort Loot";
global.json = require('./core/util/json.js');
global.fs = require("fs");
global.profilePath = "user/profiles/1/";
fixDialogues(profilePath);