Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CDKeyMaker() {
- // edit
- var inputFile = "input.txt", // Input file name, must be in kolbot folder
- outputFile = "output.txt", // Name of the output file. Copy its contents to cdkeys.ini
- keyPrefix = "key-", // Name for the keys, numeration is automatic
- listName = "List", // Name of the list
- // don't edit
- i = 0,
- obj = {"CDKeys": [], "name": listName, "east": 0, "west": 0, "euro": 0, "asia": 0},
- lines = Misc.fileAction(inputFile, 0).split("\n");
- for (i = 0; i < lines.length; i += 1) {
- if (lines[i].length > 2) {
- if (lines[i].indexOf(".mpq") < 0) {
- obj.CDKeys.push({name: keyPrefix + i.toString(), classic: lines[i].split(" ")[0], expansion: lines[i].split(" ")[1]});
- } else {
- obj.CDKeys.push({name: lines[i], classic: null, expansion: null});
- }
- }
- }
- Misc.fileAction(outputFile, 1, JSON.stringify(obj));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement