Advertisement
kolton

Untitled

Nov 30th, 2014
2,270
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.  
  3. // edit
  4. var inputFile = "input.txt", // Input file name, must be in kolbot folder
  5. outputFile = "output.txt", // Name of the output file. Copy its contents to cdkeys.ini
  6. keyPrefix = "key-", // Name for the keys, numeration is automatic
  7. listName = "List", // Name of the list
  8.  
  9. // don't edit
  10. i = 0,
  11. obj = {"CDKeys": [], "name": listName, "east": 0, "west": 0, "euro": 0, "asia": 0},
  12. lines = Misc.fileAction(inputFile, 0).split("\n");
  13.  
  14. for (i = 0; i < lines.length; i += 1) {
  15. if (lines[i].length > 2) {
  16. if (lines[i].indexOf(".mpq") < 0) {
  17. obj.CDKeys.push({name: keyPrefix + i.toString(), classic: lines[i].split(" ")[0], expansion: lines[i].split(" ")[1]});
  18. } else {
  19. obj.CDKeys.push({name: lines[i], classic: null, expansion: null});
  20. }
  21. }
  22. }
  23.  
  24. Misc.fileAction(outputFile, 1, JSON.stringify(obj));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement