Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // cdkey library by kolton
- // configure this
- var debug = false;
- var p1 = new cdKey("kol8-a", ["n2.mpq", "d3.mpq", "d1.mpq", "12.mpq", "s2.mpq", "u3.mpq", "5.mpq"]);
- var p2 = new cdKey("kol8-b", ["s10.mpq", "18.mpq", "u10.mpq", "d4.mpq", "s3.mpq", "u4.mpq", "u8.mpq"]);
- var p3 = new cdKey("kol8-c", ["u12.mpq", "d5.mpq", "g3.mpq", "g2.mpq", "s1.mpq", "u1.mpq", "1.mpq"]);
- var p4 = new cdKey("kol8-d", ["n4.mpq", "d6.mpq", "g14.mpq", "g12.mpq", "s11.mpq", "s6.mpq", "s15.mpq", "d10.mpq"]);
- var p5 = new cdKey("kol8-e", ["g7.mpq", "u5.mpq", "17.mpq", "g1.mpq", "s7.mpq", "d2.mpq", "g13.mpq"]);
- var p6 = new cdKey("kol8-i", ["d8.mpq", "u6.mpq", "s14.mpq", "g9.mpq", "s8.mpq", "g8.mpq", "g4.mpq"]);
- var p7 = new cdKey("kol8-j", ["14.mpq", "2.mpq", "u7.mpq", "d9.mpq", "u9.mpq", "3.mpq", "n5.mpq"]);
- var p8 = new cdKey("kol8-k", ["d7.mpq", "9.mpq", "13.mpq", "s12.mpq", "s13.mpq", "12.mpq", "u2.mpq"]);
- var accountArray = [p1, p2, p3, p4, p5, p6, p7, p8];
- // internal stuff
- function dPrint(text)
- {
- if(debug)
- sendEventToOOG(D2NT_MGR_PRINT_LOG, text, 0);
- }
- function cdKey(accName, keys) {
- this.accName = accName;
- this.keys = keys;
- }
- function getAccount(accName) {
- for (var i in accountArray) {
- if (accName === accountArray[i].accName) {
- return accountArray[i];
- }
- }
- }
- function getCurrentKey(accName) {
- var cKey = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[1], 10);
- if (cKey) {
- return cKey;
- } else {
- return 0;
- }
- }
- function getCurrentGame(accName) {
- var cGame = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[0], 10);
- if (cGame) {
- return cGame;
- } else {
- return 0;
- }
- }
- function increaseKey(accName) {
- var cGame = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[0], 10);
- var cKey = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[1], 10);
- cKey = cKey + 1;
- dPrint("ΓΏc1Increasing key count to " + cKey);
- NT_File("data/" + accName + ".txt", 1, cGame + "|" + cKey);
- }
- function increaseGame(accName) {
- var cGame = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[0], 10);
- var cKey = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[1], 10);
- cGame = cGame + 1;
- dPrint("ΓΏc1Increasing game count to " + cGame);
- NT_File("data/" + accName + ".txt", 1, cGame + "|" + cKey);
- }
- function setKey(accName, key) {
- var cGame = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[0], 10);
- NT_File("data/" + accName + ".txt", 1, cGame + "|" + key);
- }
- function setGame(accName, game) {
- var cKey = parseInt(NT_File("data/" + accName + ".txt", 0).split("|")[1], 10);
- NT_File("data/" + accName + ".txt", 1, game + "|" + cKey);
- }
- function NT_File(path, mode, msg, delay) {
- var _msg = "";
- var _line = "";
- var _fileHandle;
- var _isFileCheck = false;
- if (arguments.length < 3) msg = "";
- if (arguments.length < 4) delay = (mode > 0) ? 5 : 2;
- while (delay--) {
- if (mode == 2 && !_isFileCheck) {
- _fileHandle = FileOpen(path, 0);
- if (!_fileHandle)
- _fileHandle = FileOpen(path, 1);
- if (_fileHandle)
- _fileHandle.Close();
- _isFileCheck = true;
- }
- _fileHandle = FileOpen(path, mode);
- if (_fileHandle)
- break;
- if (delay)
- Delay(200);
- }
- if (_fileHandle) {
- if (mode == 0) {
- while (!_fileHandle.eof) {
- _line = _fileHandle.ReadLine();
- if (_line || !_fileHandle.eof)
- _msg += _line + msg;
- }
- }
- else if (msg)
- _fileHandle.WriteLine(msg);
- _fileHandle.Close();
- }
- return _msg;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement