Advertisement
kolton

Untitled

Jan 21st, 2015
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. function CDKeyMaker() {
  2. // edit
  3. var inputFile = "input.txt", // Input file name, must be in kolbot folder
  4. outputFile = "output.txt", // Name of the output file. Copy its contents to cdkeys.ini
  5. keyPrefix = "key-", // Name for the keys, numeration is automatic
  6. listName = "List 0", // Name of the list
  7.  
  8. // don't edit
  9. i = 0,
  10. obj = {"CDKeys": [], "name": listName, "east": 0, "west": 0, "euro": 0, "asia": 0},
  11. lines = Misc.fileAction(inputFile, 0).split("\n");
  12.  
  13. for (i = 0; i < lines.length; i += 1) {
  14. if (lines[i].length > 2) {
  15. if (lines[i].indexOf(".mpq") < 0) {
  16. obj.CDKeys.push({name: keyPrefix + i.toString(), classic: lines[i].split(" ")[0], expansion: lines[i].split(" ")[1]});
  17. } else {
  18. obj.CDKeys.push({name: lines[i], classic: null, expansion: null});
  19. }
  20. }
  21. }
  22.  
  23. Misc.fileAction(outputFile, 1, JSON.stringify(obj));
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement